浏览代码

添加amz

lvhao 5 月之前
父节点
当前提交
efb63e3e1e
共有 1 个文件被更改,包括 54 次插入0 次删除
  1. 54 0
      core/CoreApp/models/Model_customeramz.php

+ 54 - 0
core/CoreApp/models/Model_customeramz.php

@@ -0,0 +1,54 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
+class Model_Customeramz extends Lin_Model 
+{
+	function __construct(){
+	parent::__construct();
+	$this->load->database();
+	$this->table = 'customeramz';
+    $this->load_table('customeramz');
+}
+    /** 通过名称查找 */
+	public function get_name($name)
+	{
+		return  $this->find("name = '$name'");
+	}
+	public function get_data($name,$email,$address)
+	{
+		return  $this->find("name = '$name' or email = '$email' or address = '$address'");
+	}
+	public function get_shopdata($name,$email,$address,$shop)
+	{
+		return  $this->find("shop = '$shop' and (name = '$name' or email = '$email' or address = '$address')");
+	}
+	public function get_shopdatatwo($name,$email,$address,$shop)
+	{
+		return  $this->find("shop = '$shop' and name = '$name' and email = '$email' and address = '$address'");
+	}
+	public function get_email($email,$shop)
+	{
+		return  $this->find("email = '$email' and shop = '$shop'");
+	}
+	public function get_khcx($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