Browse Source

报备单优化

wufeng 2 years ago
parent
commit
953c271646
2 changed files with 17 additions and 13 deletions
  1. 16 12
      app/admin/controller/Filing.php
  2. 1 1
      app/admin/controller/Sale.php

+ 16 - 12
app/admin/controller/Filing.php

@@ -156,6 +156,8 @@ class Filing extends Base
                 'status' => 0,
                 'is_del' => 0,
                 'addtime' => date('Y-m-d H:i:s'),
+                'updaterid' => $this->uid,
+                'updater' => $this->uname,
                 'updatetime' => date('Y-m-d H:i:s'),
                 'gold_weight' => $param['gold_weight'] ?? 0,
                 'noble_metal' => $param['noble_metal'] ?? 0,
@@ -256,6 +258,8 @@ class Filing extends Base
 
         $update = array_merge($param, [
             'companyName' => $company['data']['companyName'],
+            'updaterid' => $this->uid,
+            'updater' => $this->uname,
             'updatetime' => date('Y-m-d H:i:s'),
         ]);
 
@@ -304,7 +308,7 @@ class Filing extends Base
 
         $res = Db::name('filing')
             ->where($where)
-            ->update(['status' => 5, 'updatetime' => date('Y-m-d H:i:s')]);
+            ->update(['status' => 5, 'updatetime' => date('Y-m-d H:i:s'), 'updaterid' => $this->uid, 'updater' => $this->uname,]);
         return $res ? json_show(0, '操作成功') : json_show(1004, '操作失败');
     }
 
@@ -390,8 +394,8 @@ class Filing extends Base
                     'good_thumb_img' => '',
                     'good_info_img' => '',
                     'status' => 1,
-                    'createrid' => $filing['apply_id'],
-                    'creater' => $filing['apply_name'],
+                    'createrid' => $filing['updaterid'],
+                    'creater' => $filing['updater'],
                     'is_del' => 0,
                     'addtime' => $date,
                     'updatetime' => $date,
@@ -418,8 +422,8 @@ class Filing extends Base
             //sale
             $sale_id = Db::name('sale')->insertGetId([
                 'orderCode' => $orderCode,
-                'apply_id' => $filing['apply_id'],
-                'apply_name' => $filing['apply_name'],
+                'apply_id' => $filing['updaterid'],
+                'apply_name' => $filing['updater'],
                 'order_type' => $order_type,//报备商品
                 'order_source' => $order_source,//报备转单
                 'platform_id' => $filing['platform_id'],
@@ -469,8 +473,8 @@ class Filing extends Base
                 'updatetime' => $date,
                 'cgderid' => $supplier['data']['personid'],
                 'cgder' => $supplier['data']['person'],
-                'good_createrid' => $filing['apply_id'],
-                'good_creater' => $filing['apply_name'],
+                'good_createrid' => $filing['updaterid'],
+                'good_creater' => $filing['updater'],
             ]);
 
 
@@ -541,8 +545,8 @@ class Filing extends Base
                 'good_type' => 1,
                 'addtime' => $date,
                 'updatetime' => $date,
-                'good_createrid' => $filing['apply_id'],
-                'good_creater' => $filing['apply_name'],
+                'good_createrid' => $filing['updaterid'],
+                'good_creater' => $filing['updater'],
             ]);
 
             //台账
@@ -586,8 +590,8 @@ class Filing extends Base
                 Db::name('order_out')->insert([
                     'orderCode' => $orderCode,
                     'outCode' => $outCode,
-                    'apply_id' => $this->uid,
-                    'apply_name' => $this->uname,
+                    'apply_id' => $filing['updaterid'],
+                    'apply_name' => $filing['updater'],
                     'addrid' => $addrid,
                     'post_name' => '',
                     'post_code' => '',
@@ -618,7 +622,7 @@ class Filing extends Base
             //更新报备单
             Db::name('filing')
                 ->where(['is_del' => 0, 'id' => $param['id'], 'status' => 2])
-                ->update(['status' => 3, 'updatetime' => $date, 'orderCode' => $orderCode, 'reason' => '']);
+                ->update(['status' => 3, 'updatetime' => $date, 'orderCode' => $orderCode, 'reason' => '', 'updaterid' => $this->uid, 'updater' => $this->uname]);
 
             //待办已办先不处理
 

+ 1 - 1
app/admin/controller/Sale.php

@@ -3685,7 +3685,7 @@ class Sale extends Base
                 }
                 $addr['addr_cn'] = GetAddr(json_encode($addinfo));
             }
-            if ($value['order_type'] == 3) {
+            if (in_array($value['order_type'], [3, 4])) {
                 $goon = Db::name("good_zixun")->field('id,cat_id')->where(["spuCode" => $value['good_code'], "is_del" => 0])->find();
             } else {
                 $goon = Db::name('good_platform')->field('a.id,b.cat_id')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')->where(['a.skuCode' => $value['skuCode']])->find();