Browse Source

分销商上线

shensong 5 years ago
parent
commit
2269a4853f
2 changed files with 9 additions and 9 deletions
  1. 7 7
      app/Console/Commands/SyncGoods.php
  2. 2 2
      app/Console/Commands/SyncMjWarehouse.php

+ 7 - 7
app/Console/Commands/SyncGoods.php

@@ -41,7 +41,7 @@ class SyncGoods extends Command {
41 41
     public function handleGoodsList($list) {
42 42
         foreach($list as $key=>$goods){
43 43
             //查询现在商品表中是否有该商品
44
-            $info = DB::table('seafood_fx.goods')->where('productCode',$goods['productCode'])->first();
44
+            $info = DB::table(env('DB_DATABASE').'.goods')->where('productCode',$goods['productCode'])->first();
45 45
             if($info){
46 46
                 //有商品信息则更新店铺商品信息
47 47
                 //卖家云必要参数拼接转化
@@ -60,7 +60,7 @@ class SyncGoods extends Command {
60 60
                 $result = json_decode(json_encode($result),true);
61 61
                 foreach ($result as $sku){
62 62
                     //查询规格信息
63
-                    $skuInfo = DB::table('seafood_fx.goods_skus')->where('code',$sku['code'])->first();
63
+                    $skuInfo = DB::table(env('DB_DATABASE').'.goods_skus')->where('code',$sku['code'])->first();
64 64
                     if(!$skuInfo){
65 65
                         //增加shop sku
66 66
                         $shopArr = array();
@@ -79,7 +79,7 @@ class SyncGoods extends Command {
79 79
                         }
80 80
                         //更新商品信息以及添加库存
81 81
                         $sku['goodsCode'] = $info->id;
82
-                        $skus_ad = DB::table('seafood_fx.goods_skus')->insert($sku);
82
+                        $skus_ad = DB::table(env('DB_DATABASE').'.goods_skus')->insert($sku);
83 83
                     } else {
84 84
                         # eshop sku更新
85 85
                         $shopArr = array();
@@ -98,12 +98,12 @@ class SyncGoods extends Command {
98 98
                         unset($sku['id']);
99 99
                         unset($sku['code']);
100 100
                         unset($sku['goodsCode']);
101
-                        $sku_update = DB::table('seafood_fx.goods_skus')->where('code',$code)->update($sku);
101
+                        $sku_update = DB::table(env('DB_DATABASE').'.goods_skus')->where('code',$code)->update($sku);
102 102
                     }
103 103
                     $productCode = $info->productCode;
104 104
                     unset($goods['id']);
105 105
                     unset($goods['productCode']);
106
-                    $goods_up = DB::table('seafood_fx.goods')->where('productCode',$productCode)->update($goods);
106
+                    $goods_up = DB::table(env('DB_DATABASE').'.goods')->where('productCode',$productCode)->update($goods);
107 107
                 }
108 108
 
109 109
             } else {
@@ -138,11 +138,11 @@ class SyncGoods extends Command {
138 138
                 }
139 139
                 //数据表中插入商品信息以及规格信息
140 140
                 unset($goods['id']);
141
-                $goods_id = DB::table('seafood_fx.goods')->insertGetId($goods);
141
+                $goods_id = DB::table(env('DB_DATABASE').'.goods')->insertGetId($goods);
142 142
                 if($goods_id > 0 && count($result)>0 ){
143 143
                     foreach ($result as $skus){
144 144
                         $skus['goodsCode'] = $goods_id;
145
-                        $sku_ad = DB::table('seafood_fx.goods_skus')->insert($skus);
145
+                        $sku_ad = DB::table(env('DB_DATABASE').'.goods_skus')->insert($skus);
146 146
                     }
147 147
 
148 148
                 }

+ 2 - 2
app/Console/Commands/SyncMjWarehouse.php

@@ -75,8 +75,8 @@ class SyncMjWarehouse extends Command {
75 75
 //                    $up['realPrice'] = 0;
76 76
 //                    $up['outPrice'] = 0;
77 77
                 }
78
-                if(!$cost->outPrice){
79
-                    if(isset($up['realPrice'])){
78
+                if($cost->outPrice == 0){
79
+                    if($up['realPrice'] != 0){
80 80
                         $up['outPrice'] = ceil($up['realPrice']*1.15);
81 81
                     }
82 82
                 }