Browse Source

Merge branch 'dev_wf' of wugg/phpstock into version1.5

wufeng 2 years ago
parent
commit
242b234333
2 changed files with 31 additions and 32 deletions
  1. 30 31
      app/admin/controller/Goodup.php
  2. 1 1
      app/admin/route/app.php

+ 30 - 31
app/admin/controller/Goodup.php

@@ -216,8 +216,7 @@ class Goodup extends Base
         if($unit==''){
             return error_show(1004,"商品单位不能为空");
         }
-        $good_type = isset($this->post['good_type'])&&$this->post['good_type']!==""? intval($this->post['good_type'])
-            :"";
+        $good_type = isset($this->post['good_type'])&&$this->post['good_type']!==""? intval($this->post['good_type']) :"";
         if($good_type===''){
             return error_show(1004,"参数good_type不能为空");
         }
@@ -246,7 +245,7 @@ class Goodup extends Base
             return error_show(1004,"参数supplierNo不能为空");
         }
         $supplier =Db::name("supplier")->where(["code"=>$supplierNo])->findOrEmpty();
-        if(empty($supplier)) return error_show(1004,"供应商信息找到");
+        if(empty($supplier)) return error_show(1004,"供应商信息找到");
         $good_size = isset($this->post['good_size'])&&$this->post['good_size']!=""? trim($this->post['good_size']):"";
         if($good_size==''){
             return error_show(1004,"参数good_size不能为空");
@@ -383,12 +382,12 @@ class Goodup extends Base
         if($token==''){
             return error_show(105,"参数token不能为空");
         }
-        $user =GetUserInfo($token);
-        if(empty($user)||$user['code']!=0){
-            return error_show(1002,"创建人数据不存在");
-        }
-        $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
-        $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
+//        $user =GetUserInfo($token);
+//        if(empty($user)||$user['code']!=0){
+//            return error_show(1002,"创建人数据不存在");
+//        }
+        $createrid= $this->uid;
+        $creater= $this->uname;
         $spucode=makeNo("SKU");
         Db::startTrans();
         try {
@@ -521,19 +520,19 @@ class Goodup extends Base
                 }
 
                 //修改状态,添加待办
-                ActionLog::logAdd($this->post['token'], [
+                ActionLog::logAdd(['id' => $createrid, 'nickname' => $creater], [
                     "order_code" =>$spucode,//咨询单详情编号
                     "status" => 0,//这里的status是之前的值
                     "action_remark" => '',//备注
                     "action_type" => "create"//新建create,编辑edit,更改状态status
                 ], "SPCB", 0,$data);
 
-                        ProcessOrder::AddProcess($this->post['token'], [
-                            "order_type" => 'SPCB',
-                            "order_code" => $spucode,//咨询单详情编号
-                            "order_id" => $in,
-                            "order_status" =>0,"before_status"=>0
-                        ]);
+                ProcessOrder::AddProcess(['id' => $createrid, 'nickname' => $creater], [
+                    "order_type" => 'SPCB',
+                    "order_code" => $spucode,//咨询单详情编号
+                    "order_id" => $in,
+                    "order_status" => 0, "before_status" => 0
+                ]);
                     Db::commit();
                     return app_show(0,"创建成功",["spuCode"=>$spucode]);
 
@@ -556,8 +555,7 @@ class Goodup extends Base
         if($data==false){
             return error_show(1004,"未找到商品数据");
         }
-        $is_down = Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->where("exam_status","<>",8)
-            ->find();
+        $is_down = Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->where("exam_status","<>",8)->find();
         if($is_down!=false){
             return error_show(1004,"存在未下线商品数据");
         }
@@ -577,8 +575,7 @@ class Goodup extends Base
         if($unit==''){
             return error_show(1004,"商品单位不能为空");
         }
-        $good_type = isset($this->post['good_type'])&&$this->post['good_type']!==""? intval($this->post['good_type'])
-            :"";
+        $good_type = isset($this->post['good_type'])&&$this->post['good_type']!==""? intval($this->post['good_type']) :"";
         if($good_type===''){
             return error_show(1004,"参数good_type不能为空");
         }
@@ -611,13 +608,14 @@ class Goodup extends Base
         if($supplierNo==''){
             return error_show(1004,"参数supplierNo不能为空");
         }
-        $good_size = isset($this->post['good_size'])&&$this->post['good_size']!=""? trim($this->post['good_size'])
-            :"";
+        $supplier =Db::name("supplier")->field('id,personid,person')->where(["code"=>$supplierNo])->findOrEmpty();
+        if(empty($supplier)) return error_show(1004,"供应商信息未找到");
+
+        $good_size = isset($this->post['good_size'])&&$this->post['good_size']!=""? trim($this->post['good_size']) :"";
         if($good_size==''){
             return error_show(1004,"参数good_size不能为空");
         }
-        $company_id = isset($this->post['company_id'])&&$this->post['company_id']!=""? trim($this->post['company_id'])
-            :"";
+        $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不能为空");
         }
@@ -680,8 +678,7 @@ class Goodup extends Base
         if($delivery_day===""){
             return error_show(1004,"参数delivery_day不能为空");
         }
-        $lead_time = isset($this->post['lead_time'])&&$this->post['lead_time']!==""? intval($this->post['lead_time'])
-            :"0";
+        $lead_time = isset($this->post['lead_time'])&&$this->post['lead_time']!==""? intval($this->post['lead_time']) :"0";
 //        if($lead_time===""){
 //            return error_show(1004,"参数lead_time不能为空");
 //        }
@@ -750,12 +747,14 @@ class Goodup extends Base
                 'is_stock'=>$is_stock,
                 "config"=>$config,
                 "other_config"=>$other_config,
-                "good_img"=>$good_img,
-                 "stock_moq"=>$stock_moq,
+                "good_img" => $good_img,
+                "stock_moq" => $stock_moq,
                 "good_thumb_img"=>$good_thumb_img,
                 "good_info_img"=>$good_info_img,
                 "status"=>$count>0?2:1,
-                "updatetime"=>date("Y-m-d H:i:s")
+                "updatetime" => date("Y-m-d H:i:s"),
+                'chargerid' => $supplier['personid'] ?? $this->uid,
+                'charger' => $supplier['person'] ?? $this->uname,//负责人跟创建人一致
             ];
             $field = array_diff_assoc($temp,$data);
             $temp['field_change'] =empty($field)?"":json_encode(array_keys($field));
@@ -783,14 +782,14 @@ class Goodup extends Base
                     }
                 }
                 //修改状态,添加待办
-                ActionLog::logAdd($this->post['token'], [
+                ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
                     "order_code" =>$supcode,//咨询单详情编号
                     "status" =>  $data['status'],//这里的status是之前的值
                     "action_remark" => '',//备注
                     "action_type" => "edit"//新建create,编辑edit,更改状态status
                 ], "SPCB",$temp['status'] ,$data);
 
-                ProcessOrder::AddProcess($this->post['token'], [
+                ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $data['id'],

+ 1 - 1
app/admin/route/app.php

@@ -371,7 +371,7 @@ Route::rule('unitstatus','admin/Unit/status');
 
 Route::rule('goodupcreate','admin/Goodup/create');//创建商品成本
 //Route::rule('gooduplist','admin/Goodup/list');
-Route::rule('goodupeditinfo','admin/Goodup/editinfo');
+Route::rule('goodupeditinfo','admin/Goodup/editinfo');//修改商品成本基础信息
 Route::rule('goodupinfo','admin/Goodup/info');
 Route::rule('goodupeditfee','admin/Goodup/editfee');
 Route::rule('goodupdelall','admin/Goodup/delall');