wugg hace 3 años
padre
commit
362fa7910a
Se han modificado 1 ficheros con 26 adiciones y 3 borrados
  1. 26 3
      app/admin/controller/Goodup.php

+ 26 - 3
app/admin/controller/Goodup.php

@@ -42,7 +42,20 @@ class Goodup extends BaseController
         $total = ceil($count / $size);
         $page = $page >= $total ? $total : $page;
         $list = Db::name('good_basic')->where($where)->page($page,$size)->order("addtime desc")->select();
-        return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
+        $data=[];
+        foreach ($list as $value){
+                $value["cat_info"]= made($value['cat_id'],[]);
+                $brand=Db::name("brand")->where(["id"=>$value['brand_id']])->find();
+                $value["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
+                $unit = Db::name("unit")->where(["id"=>$value['good_unit']])->find();
+                $value['unit'] =isset($unit['unit'])?$unit['unit']:"";
+                $company = Db::name("business")->where(["companyNo"=>$value['company_id']])->find();
+                $value['company'] = isset($company['company'])?$company['company']:"";
+                $supplier = Db::name("supplier")->where(['code'=>$value['supplierNo']])->find();
+                $value['supplier_name']=isset($supplier['name'])?$supplier['name']:"";
+                $data[]=$value;
+        }
+        return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
     }
 
 
@@ -96,7 +109,11 @@ class Goodup extends BaseController
         if($supplierNo==''){
             return error_show(1004,"参数supplierNo不能为空");
         }
-
+        $company_id = isset($this->post['company_id'])&&$this->post['company_id']!=""? trim($this->post['company_id'])
+            :"";
+        if($company_id==''){
+            return error_show(1004,"参数company_id不能为空");
+        }
         $is_auth = isset($this->post['is_auth'])&&$this->post['is_auth']!==""? intval($this->post['is_auth']):"";
         if($is_auth===''){
             return error_show(1004,"参数is_auth不能为空");
@@ -220,6 +237,7 @@ class Goodup extends BaseController
                 "moq"=>$moq,
                 "is_exclusive"=>$is_exclusive,
                 "customized"=>$customized,
+                "company_id"=>$company_id,
                 "tax"=>$tax,
                 "supplierNo"=>$supplierNo,
                 "is_auth"=>$is_auth,
@@ -375,7 +393,11 @@ class Goodup extends BaseController
         if($supplierNo==''){
             return error_show(1004,"参数supplierNo不能为空");
         }
-
+        $company_id = isset($this->post['company_id'])&&$this->post['company_id']!=""? trim($this->post['company_id'])
+            :"";
+        if($company_id==''){
+            return error_show(1004,"参数company_id不能为空");
+        }
         $is_auth = isset($this->post['is_auth'])&&$this->post['is_auth']!==""? intval($this->post['is_auth']):"";
         if($is_auth===''){
             return error_show(1004,"参数is_auth不能为空");
@@ -464,6 +486,7 @@ class Goodup extends BaseController
             'brand_id'=>$brandid,
             "good_unit"=>$unit,
             "good_type"=>$good_type,
+            "company_id"=>$company_id,
             "moq"=>$moq,
             "is_exclusive"=>$is_exclusive,
             "customized"=>$customized,