Browse Source

分销成本*1.1

sunhao 5 years ago
parent
commit
7b41c3133a
1 changed files with 11 additions and 1 deletions
  1. 11 1
      app/Console/Commands/SyncMjOrderStatus.php

+ 11 - 1
app/Console/Commands/SyncMjOrderStatus.php

@@ -24,7 +24,7 @@ class SyncMjOrderStatus extends Command {
24 24
     }
25 25
     public function SyncMjOrderStatus(){
26 26
 
27
-        $orders = Order::select('id', 'outerCode')->where('orderCode','>',0)->where('status', '<', 3)->where('warehouse', 3)->where('is_del', 0)->orderBy('id', 'desc')->get();
27
+        $orders = Order::select('id', 'outerCode', 'admin_id')->where('orderCode','>',0)->where('status', '<', 3)->where('warehouse', 3)->where('is_del', 0)->orderBy('id', 'desc')->get();
28 28
         $orders = json_decode(json_encode($orders), true);
29 29
         foreach($orders as $k=>$order){
30 30
             $result = $this->getMjOrder($order['id'], $order['outerCode']);
@@ -33,6 +33,12 @@ class SyncMjOrderStatus extends Command {
33 33
                 if( isset($result['expressCode']) && !empty($result['expressCode']) ){
34 34
                     $data['is_cannot_del'] = 1;
35 35
                 }
36
+                //新加逻辑,查看是否分销团队订单
37
+                $is_fx = 0;
38
+                $self_role = DB::table('admin_role')->where('user_id', $order['admin_id'])->pluck('role_name');
39
+                if($self_role == '分销销售' || $self_role == '分销管理员'){
40
+                    $is_fx = 1;
41
+                }
36 42
                 $status = $result['status'];
37 43
                 if($status == '已发货' || $status == '已完成'){
38 44
                     $data['status'] = 3;
@@ -57,6 +63,10 @@ class SyncMjOrderStatus extends Command {
57 63
                         #更新order_sku
58 64
                         OrderGoodsSkus::where('order_id', $order['id'])->where('sku_id', $sku_id)->update(['send_num'=>$quantity]);
59 65
                     }
66
+
67
+                    if($is_fx == 1){
68
+                        $data['cost'] = round($data['cost'] * 1.1, 2);
69
+                    }
60 70
                 }
61 71
 
62 72
                 if(!empty($data)){