Model_customerxw.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Model_Customerxw extends Lin_Model
  3. {
  4. function __construct(){
  5. parent::__construct();
  6. $this->load->database();
  7. $this->table = 'customerxw';
  8. $this->load_table('customerxw');
  9. }
  10. /** 通过名称查找 */
  11. public function get_name($name)
  12. {
  13. return $this->find("name = '$name'");
  14. }
  15. public function get_data($name,$email,$address)
  16. {
  17. return $this->find("name = '$name' or email = '$email' or address = '$address'");
  18. }
  19. public function get_shopdata($name,$email,$address,$shop)
  20. {
  21. return $this->find("shop = '$shop' and (name = '$name' or email = '$email' or address = '$address')");
  22. }
  23. public function get_shopdatatwo($name,$email,$address,$shop)
  24. {
  25. return $this->find("shop = '$shop' and name = '$name' and email = '$email' and address = '$address'");
  26. }
  27. public function get_email($email,$shop)
  28. {
  29. return $this->find("email = '$email' and shop = '$shop'");
  30. }
  31. public function get_khcx($email,$shop)
  32. {
  33. return $this->find("email = '$email' and shop = '$shop'");
  34. }
  35. public function get_address($address)
  36. {
  37. return $this->find("address = '$address'");
  38. }
  39. public function get_excel($titledata,$filename)
  40. {
  41. require_once "./data/excel/PHPExcel/IOFactory.php";
  42. $objPHPExcel = new \PHPExcel();
  43. $objPHPExcel->setActiveSheetIndex(0);
  44. $dataArray = $titledata;
  45. $objPHPExcel->getActiveSheet()->fromArray($dataArray, null, 'A1');
  46. header('Content-Type: application/vnd.ms-excel');
  47. header('Content-Disposition: attachment;filename='.$filename);
  48. $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
  49. $objWriter->save('php://output');
  50. $objPHPExcel->disconnectWorksheets();
  51. }
  52. } //end class