|
@@ -0,0 +1,47 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\admin\controller;
|
|
|
+
|
|
|
+
|
|
|
+use app\BaseController;
|
|
|
+use think\App;
|
|
|
+use think\facade\Db;
|
|
|
+class Listcustomer extends BaseController
|
|
|
+{
|
|
|
+ public $post = "";
|
|
|
+ public function __construct(App $app)
|
|
|
+ {
|
|
|
+ parent::__construct($app);
|
|
|
+ $this->post = $this->request->post();
|
|
|
+ $token = isset($this->post['token']) ? trim($this->post['token']) : "";
|
|
|
+ if($token ==""){
|
|
|
+ return error_show(101,'token不能为空');
|
|
|
+ }
|
|
|
+ $effetc = VerifyTokens($token);
|
|
|
+ if(!empty($effetc) && $effetc['code']!=0){
|
|
|
+ return error_show($effetc['code'],$effetc['message']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function list(){
|
|
|
+ $page = isset($this->post['page'])&& $this->post['page'] !=="" ? intval($this->post['page']) :"1";
|
|
|
+ $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']) :"10";
|
|
|
+ $where []= ['is_del',"=",0];
|
|
|
+ $companyNo= isset($this->post['companyNo'])&&$this->post['companyNo']!=="" ? trim($this->post['companyNo']):"";
|
|
|
+ if($companyNo!="") {
|
|
|
+ $where[] = ["companyNo", "=", $companyNo];
|
|
|
+ }
|
|
|
+ $companyName= isset($this->post['companyName'])&&$this->post['companyName']!=="" ? trim($this->post['companyName']):"";
|
|
|
+ if($companyName!=""){
|
|
|
+ $where[]=["companyName","like","%$companyName%"];
|
|
|
+ }
|
|
|
+ $itemid = isset($this->post['itemid']) && $this->post['itemid'] !=="" ? intval($this->post['itemid']):"";
|
|
|
+ if($itemid!=""){
|
|
|
+ $where[]=["itemid","=",$itemid];
|
|
|
+ }
|
|
|
+ $count = Db::name('customer_info')->where($where)->count();
|
|
|
+ $total = ceil($count/$size);
|
|
|
+ $page = $page >= $total ? $total : $page;
|
|
|
+ $item = Db::name('customer_info')->where($where)->order("addtime desc")->page($page,$size)->select();
|
|
|
+ return app_show(0,"获取成功",['item'=>$item,'count'=>$count]);
|
|
|
+ }
|
|
|
+}
|