Browse Source

相关接口补充字段

wufeng 2 years ago
parent
commit
6cc64fe242

+ 10 - 0
app/admin/controller/Consult.php

@@ -1015,6 +1015,16 @@ class Consult extends Base
         $bargain =Db::name("bargain_order")->where(['bidsNo'=>$bidNo,"is_del"=>0])->find();
         $info['bargain'] =$bargain;
         $info['good_img'] = explode(',',$info['good_img']);
+
+        //添加商品创建人字段
+        $good_info = Db::name('good_basic')
+            ->field('id,createrid,creater')
+            ->where('is_del',0)
+            ->where('spuCode',$info['spuCode'])
+            ->findOrEmpty();
+        $info['good_createrid'] = $good_info['createrid']??0;
+        $info['good_creater'] = $good_info['creater']??'';
+
         return app_show(0,"获取成功",$info);
     }
 

+ 7 - 4
app/admin/controller/Good.php

@@ -398,12 +398,15 @@ class Good extends Base
         //成本表里的创建人,也是线上商品的采购人,为了防止混淆,给creater取个别名
         $temp_basic_info = Db::name('good_basic')
             ->field('id,createrid purchase_id,creater purchase')
-            ->where(['spuCode'=>$data['spuCode'],'is_del'=>0])
+            ->where(['spuCode' => $data['spuCode'], 'is_del' => 0])
             ->find();
-        $data['purchase_id'] = $temp_basic_info['purchase_id'];
-        $data['purchase'] = $temp_basic_info['purchase'];
+        $data['good_createrid'] = $data['purchase_id'] = $temp_basic_info['purchase_id'] ?? 0;
+        $data['good_creater'] = $data['purchase'] = $temp_basic_info['purchase'] ?? '';
 
-        return app_show(0,"获取成功",$data);
+        $data['cgderid'] = $supplier['personid'] ?? 0;
+        $data['cgder'] = $supplier['person'] ?? '';
+
+        return app_show(0, "获取成功", $data);
     }
 
 

+ 5 - 2
app/admin/controller/Goodup.php

@@ -1080,8 +1080,8 @@ class Goodup extends Base
         $data['unit'] = isset($unit['unit'])?$unit['unit']:'';
         $data['cat_info'] = made($data['cat_id'],[]);
         $spec = Db::name("good_spec")->where(["spuCode"=>$supcode,"is_del"=>0])->select()->toArray();
-        $supplier = Db::name("supplier")->where(["code"=>$data['supplierNo']])->find();
-        $data['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
+//        $supplier = Db::name("supplier")->where(["code"=>$data['supplierNo']])->find();
+//        $data['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
         $supplier = Db::name("supplier")->where(["code"=>$data['supplierNo']])->find();
         $data['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
         $company = Db::name("business")->where(["companyNo"=>$data['companyNo']])->find();
@@ -1132,6 +1132,9 @@ class Goodup extends Base
             }
         }
         $data["nakelist"]=$nakearry;
+
+        $data['cgderid'] = $supplier['personid'] ?? '';
+        $data['cgder'] = $supplier['person'] ?? '';
         return app_show(0,"获取成功",$data);
     }
 

+ 12 - 2
app/admin/controller/Purch.php

@@ -118,8 +118,14 @@ class Purch extends Base
 //        if(!empty($role['platform']) ){
 //            $where[]=["po.platform_id","in",$role['platform']];
 //        }
-        $count=Db::name("purchease_order")->alias('po')->leftJoin('order_num on','on.cgdNo=po.cgdNo')->where($where)
-            ->where(function($query) use ($where){$query->whereOr([['po.order_type', '<>', 1],['po.order_source', '=', 0]]);})->count();
+        $count = Db::name("purchease_order")
+            ->alias('po')
+            ->leftJoin('order_num on', 'on.cgdNo=po.cgdNo')
+            ->where($where)
+            ->where(function ($query) use ($where) {
+                $query->whereOr([['po.order_type', '<>', 1], ['po.order_source', '=', 0]]);
+            })
+            ->count();
         $total = ceil($count/$size);
         $page = $page >= $total ? $total : $page;
         $list = Db::name("purchease_order")
@@ -338,6 +344,10 @@ class Purch extends Base
 
         $data['has_account'] = (int)isset(checkHasAccountBySupplierNos([$data['supplierNo']])[$data['supplierNo']]);
 
+        //补充商品创建人字段
+        $data['good_createrid']=$goon['createrid']??'';
+        $data['good_creater']=$goon['creater']??'';
+
         return app_show(0, "获取成功", $data);
     }
 

+ 11 - 0
app/admin/controller/Sale.php

@@ -4136,6 +4136,17 @@ class Sale extends Base
 //        $order['platform_name']=isset($palt['platform_name']) ? $palt['platform_name']:"";
         $order["gold_price"] = isset($price['price']) ? $price['price'] : 0;
         $order["noble_weight"] = isset($order['weight']) ? $order['weight'] : 0;
+
+        $good_info = Db::name('good_basic')
+            ->field('id,createrid,creater')
+            ->where('is_del',0)
+            ->where('spuCode',$order['spuCode'])
+            ->findOrEmpty();
+
+        //补充商品创建人字段
+        $order['good_createrid']=$good_info['createrid']??'';
+        $order['good_creater']=$good_info['creater']??'';
+
         return app_show(0, "获取成功", $order);
     }