wupengfei 2 年之前
父节点
当前提交
ea55551df4
共有 2 个文件被更改,包括 23 次插入16 次删除
  1. 4 3
      .idea/workspace.xml
  2. 19 13
      application/api/controller/Supplier.php

+ 4 - 3
.idea/workspace.xml

@@ -3,6 +3,7 @@
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Supplier.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Supplier.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -250,7 +251,7 @@
       <workItem from="1678063982310" duration="24531000" />
       <workItem from="1678149106133" duration="24129000" />
       <workItem from="1678236784872" duration="19064000" />
-      <workItem from="1678322422199" duration="2274000" />
+      <workItem from="1678322422199" duration="2717000" />
     </task>
     <servers />
   </component>
@@ -400,10 +401,10 @@
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
     <state x="737" y="480" key="RollbackChangesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1678066876854" />
-    <state width="498" height="446" key="SwitcherDM" timestamp="1677809229518">
+    <state width="498" height="446" key="SwitcherDM" timestamp="1678326332442">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state width="498" height="446" key="SwitcherDM/0.0.2560.1400@0.0.2560.1400" timestamp="1677809229518" />
+    <state width="498" height="446" key="SwitcherDM/0.0.2560.1400@0.0.2560.1400" timestamp="1678326332442" />
     <state x="533" y="290" key="com.intellij.ide.util.TipDialog" timestamp="1678236791603">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 19 - 13
application/api/controller/Supplier.php

@@ -88,7 +88,7 @@ class Supplier extends Base
         $contact = Db::name('contact')->where('tag','supplier')->field('qrcode contact_qrcode,phone contact_phone,email contact_email')->find();
         $contact['phone'] = $detail['phone'];
         $contact['email'] = $detail['email'];
-        $contact['qr_code'] = $detail['qr_code'];;
+        $contact['qr_code'] = $detail['qr_code'];
         $this->success('ok',$contact);
 
     }
@@ -153,8 +153,10 @@ class Supplier extends Base
             $v['label_name'] =$v['label'] ?  explode(',',trim($v['label'],',')):null;
             $v['business_arr'] = $v['business'] ? explode(',',trim($v['business'],',')) : null;
         }
-        $total_num  =\app\common\model\Supplier::where($sel_where)->count();
-        $this->success('ok',['list'=>$list,'total_num'=>numTransform($total_num)]);
+        $total_num  =\app\common\model\Supplier::where($sel_where)->when($title,function ($query)use($title){
+            if($title) $query->where('title|label','like','%'.$title.'%');
+        })->count();
+        $this->success('ok',['list'=>$list,'total_num'=>numTransform($total_num),'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
     /**
@@ -232,8 +234,9 @@ class Supplier extends Base
             $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null;
             $v['cover_arr'] = $v['cover']? explode('|',trim($v['cover'],'|')):null;
         });
-
-        $this->success('ok',['list'=>$list]);
+        $sql2 = "SELECT $field FROM " .$table . " a LEFT JOIN ( SELECT id,IF(id,1,1) is_recommend FROM $table b WHERE ( $where_str )) AS c ON c.id = a.id LEFT JOIN dd_supplier as k ON a.supplier_id = k.id  WHERE a.is_deleted = 0 AND a.status = 1 AND k.status =1 AND k.is_deleted = 0 ";
+        $total =  Db::query($sql2);
+        $this->success('ok',['list'=>$list,'total_count'=>$total[0]['num'],'page_num'=>$this->page_num]);
     }
 
 
@@ -285,8 +288,7 @@ class Supplier extends Base
         $sel_where[] = ['is_deleted','=',0];
         $sel_where[] = ['status','=',1];
         $sel_where[] = ['supplier_id','=',$supplier_id];
-        $list = SupplierGoods::where($sel_where)
-            ->order($order)->limit($this->off_set,$this->page_num)->select()->toArray();
+        $list = SupplierGoods::where($sel_where)->order($order)->limit($this->off_set,$this->page_num)->select()->toArray();
         $supplier_info = \app\common\model\Supplier::where('id',$supplier_id)->find()->toArray();
         foreach ($list as &$v) {
             $v['label_name'] =$v['label'] ?  explode(',',trim($v['label'],',')):null;
@@ -295,7 +297,7 @@ class Supplier extends Base
             $v['supplier_logo'] =$supplier_info['logo'];
         }
         $total_num = SupplierGoods::where($sel_where)->count();
-        $this->success('ok',['list'=>$list,'total_num'=>numTransform($total_num)]);
+        $this->success('ok',['list'=>$list,'total_num'=>numTransform($total_num),'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
     /**
@@ -424,7 +426,7 @@ class Supplier extends Base
         $total_num = SupplierGoods::where($sel_where)->alias('g')->leftJoin('Supplier s','g.supplier_id = s.id')->when($search_name,function ($query)use($search_name){
             if($search_name) $query->where('g.name|g.label','like','%'.$search_name.'%');
         })->count();
-        $this->success('ok',['list'=>$list,'total_num'=>numTransform($total_num)]);
+        $this->success('ok',['list'=>$list,'total_num'=>numTransform($total_num),'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
 
@@ -548,7 +550,8 @@ class Supplier extends Base
             $v['supplier_name'] = \app\common\model\Supplier::where('id',$v['supplier_id'])->value('title');
             $v['is_normal'] = CheckPower::checkModulesPower($v['goods_id'],0,$this->request->controller());
         }
-        $this->success('ok',['list'=>$list]);
+        $total_num =UserTrack::where($sel_where)->alias('t')->leftJoin('SupplierGoods i','t.first_id = i.id')->count();
+        $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
     /**
@@ -590,7 +593,8 @@ class Supplier extends Base
             $v['supplier_name'] = \app\common\model\Supplier::where('id',$v['supplier_id'])->value('title');
             $v['is_normal'] = CheckPower::checkModulesPower($v['goods_id'],0,$this->request->controller());
         }
-        $this->success('ok',['list'=>$list]);
+        $total_num =  PlatformLike::where($sel_where)->alias('t')->leftJoin('SupplierGoods i','t.like_id = i.id')->count();
+        $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
 
@@ -634,7 +638,8 @@ class Supplier extends Base
             $v['supplier_name'] = \app\common\model\Supplier::where('id',$v['supplier_id'])->value('title');
             $v['is_normal'] = CheckPower::checkModulesPower($v['goods_id'],0,$this->request->controller());
         }
-        $this->success('ok',['list'=>$list]);
+        $total_num= UserCollect::where($sel_where)->alias('t') ->leftJoin('SupplierGoods i','t.coll_id = i.id')->count();
+        $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }
 
 
@@ -679,7 +684,8 @@ class Supplier extends Base
             ->limit($this->off_set,$this->page_num)
             ->order('p.id desc')
             ->select()->toArray();
-        $this->success('ok',['list'=>$list]);
+        $total_num=  PlatformSwitch::where($sel_where)->alias('p')->leftJoin('Supplier a','p.switch_id = a.id')->count();
+        $this->success('ok',['list'=>$list,'total_count'=>$total_num,'page_num'=>$this->page_num]);
     }