Browse Source

修改同步商品库存成本脚本

shensong 5 years ago
parent
commit
b81860f273
1 changed files with 4 additions and 3 deletions
  1. 4 3
      app/Console/Commands/SyncMjWarehouse.php

+ 4 - 3
app/Console/Commands/SyncMjWarehouse.php

@@ -14,6 +14,7 @@ class SyncMjWarehouse extends Command {
14 14
      * @var string
15 15
      */
16 16
     protected $description = '同步库存';
17
+    protected $limit = 20;
17 18
 
18 19
 
19 20
     public function handle()
@@ -25,7 +26,7 @@ class SyncMjWarehouse extends Command {
25 26
         $params['eshopCode'] = config('constants.ESHOP_CODE');
26 27
         $params['warehouseCode'] = config('constants.WAREHOUSE_CODE'); //仓库编码
27 28
         $params['pageIndex'] = '1';
28
-        $params['pageSize'] = '10';
29
+        $params['pageSize'] = $this->limit;
29 30
         $mjRes = Order::mjWarehouseSkuGet($params);
30 31
         if($mjRes == false){
31 32
             exit('获取卖家云数据出错');
@@ -35,7 +36,7 @@ class SyncMjWarehouse extends Command {
35 36
         $this->insertData( $mjRes['resultSet']['skuList'] );
36 37
 
37 38
         $count = $mjRes['resultSet']['totalNum'];
38
-        $pages = ceil($count / 20);
39
+        $pages = ceil($count / $this->limit);
39 40
 
40 41
         //插入其他页面
41 42
         for($i=2; $i<=$pages; $i++){
@@ -65,7 +66,7 @@ class SyncMjWarehouse extends Command {
65 66
                 $up['totalCost'] = isset($sku['totalCost']) ? $sku['totalCost'] : 0;
66 67
                 if($up['quantity'] != 0 ){
67 68
                     $up['realPrice'] = $up['totalCost'] / $up['quantity'];
68
-                    $up['outPrice'] = ceil($up['realPrice'] * 1.1);
69
+                    $up['outPrice'] = ceil($up['realPrice'] * 1.1 * 100)/100;
69 70
                 } else {
70 71
                     $up['realPrice'] = 0;
71 72
                     $up['outPrice'] = 0;