panlumeng 3 years ago
parent
commit
72df73301f
2 changed files with 24 additions and 3 deletions
  1. 1 0
      app/admin/controller/Allot.php
  2. 23 3
      app/admin/controller/Customer.php

+ 1 - 0
app/admin/controller/Allot.php

@@ -73,6 +73,7 @@ class Allot extends BaseController
         if($status!==""){
             $where[]=['status',"=",$status];
         }
+
         $count = Db::name('allot_stock')->where($where)->count();
         $total = ceil($count/$size);
         $page = $page >= $total ? $total : $page;

+ 23 - 3
app/admin/controller/Customer.php

@@ -27,6 +27,8 @@ class Customer extends BaseController
         $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;
         $pid =  isset($this->post['pid']) &&$this->post['pid']!=="" ?intval($this->post['pid']): 0;
+        $where =[];
+        $where []= ['is_del',"=",0];
         $condition[] = ['is_del',"=",0];
         if($pid!==""){
             $condition[]=["pid","=",$pid];
@@ -35,10 +37,28 @@ class Customer extends BaseController
         if($name!=""){
             $condition[]=["name","like","%{$this->post['name']}%"];
         }
-        $count = Db::name('customer_org1')->where($condition)->count();
-        $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
+//        $count = Db::name('customer_org1')->where($condition)->count();
+//        $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
+        $pidlist = Db::name("customer_org1")->where($condition)->column("pid");
+        if(!empty($pidlist)){
+            $where[]=[["itemid","in",$pidlist]];
+
+        }else{
+            if($pid===""){
+                $where[]=['itemid','=',0];
+            }else{
+                $where[]=['itemid','=',$pid];
+            }
+        }
+        $itm = Db::name('customer_info')->where($where)->select();
         $list = Db::name('customer_org1')->where($condition)->page($page,$size)->column("id,pid,name,level,depart_link");
-        return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
+//        $data=[];
+//        foreach ($list as $item) {
+//            $cuost = Db::name('customer_info')->where(['itemid'=>$item['id'],'is_del'=>0])->find();
+//            $item['name']=$cuost['companyName'];
+//            $data[]=$item;
+//        }
+        return app_show(0,"获取成功",['list'=>$list,'itm'=>$itm]);
     }
     /*新建*/
     public function create()