12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Model_Customersmt2 extends Lin_Model
- {
- function __construct(){
- parent::__construct();
- $this->load->database();
- $this->table = 'customersmt2';
- $this->load_table('customersmt2');
- }
- /** 通过名称查找 */
- public function get_name($name)
- {
- return $this->find("name = '$name'");
- }
- public function get_fullname($fullname)
- {
- return $this->find("fullname = '$fullname'");
- }
- public function get_userid($userid)
- {
- return $this->find("userid = '$userid'");
- }
- public function get_us($userid,$shop)
- {
- return $this->find("userid = '$userid' and shop = '$shop'");
- }
- public function get_data($name,$email,$address)
- {
- return $this->find("name = '$name' or email = '$email' or address = '$address'");
- }
- public function get_shopdata($shop,$name,$address)
- {
- return $this->find("shop = '$shop' and (name = '$name' or address = '$address')");
- }
- public function get_email($email,$shop)
- {
- return $this->find("email = '$email' and shop = '$shop'");
- }
- public function get_address($address)
- {
- return $this->find("address = '$address'");
- }
- public function get_excel($titledata,$filename)
- {
- require_once "./data/excel/PHPExcel/IOFactory.php";
- $objPHPExcel = new \PHPExcel();
- $objPHPExcel->setActiveSheetIndex(0);
- $dataArray = $titledata;
- $objPHPExcel->getActiveSheet()->fromArray($dataArray, null, 'A1');
- header('Content-Type: application/vnd.ms-excel');
- header('Content-Disposition: attachment;filename='.$filename);
- $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
- $objWriter->save('php://output');
- $objPHPExcel->disconnectWorksheets();
-
- }
- } //end class
|