Bladeren bron

参数问题

shish 5 jaren geleden
bovenliggende
commit
87c86d79a0
2 gewijzigde bestanden met toevoegingen van 10 en 9 verwijderingen
  1. 4 5
      app-ghs/controllers/OrderController.php
  2. 6 4
      biz-hd/purchase/classes/PurchaseClass.php

+ 4 - 5
app-ghs/controllers/OrderController.php

@@ -76,12 +76,11 @@ class OrderController extends BaseController
         $shopId = $this->shopId;
         $customId = $post['customId'] ?? 0;
         $post['customId'] = $customId;
-
-        $custom = CustomClass::getCustom($customId);
-        if (empty($custom)) {
-            util::fail('客户无效');
+        //开单允许不选客户
+        if (!empty($customId)) {
+            $custom = CustomClass::getCustom($customId);
+            CustomClass::valid($custom, $this->shopId);
         }
-        CustomClass::valid($custom, $this->shopId);
         $post['customMobile'] = $custom['mobile'] ?? '';
         $customName = $custom['name'] ?? '';
         $post['customName'] = $customName;

+ 6 - 4
biz-hd/purchase/classes/PurchaseClass.php

@@ -54,10 +54,12 @@ class PurchaseClass extends BaseClass
         //传过滤的productId 是供货商的,需要转换为零售端(hd)的productId
         //补充了hdProductId
         //[{"productId":"113","bigNum":1,"smallNum":0,"classId":"-2","hdProductId":1}]
-        $productList = ProductClass::toggleProductList($productList,$hdShopId,$hdSjId);
+        $hdShopId = $data['shopId'] ?? 0;
+        $hdSjId = $data['merchantId'] ?? 0;
+        $productList = ProductClass::toggleProductList($productList, $hdShopId, $hdSjId);
 
-        $productData = self::getProductMapData($productList,"productId");
-        $hdProductData = self::getProductMapData($productList,"hdProductId");
+        $productData = self::getProductMapData($productList, "productId");
+        $hdProductData = self::getProductMapData($productList, "hdProductId");
 
         //计算价格= 各个productId的price*num(bigNum,smallNum) + sendCost(配送费)
         $bigNum = 0; //总共多少扎
@@ -102,7 +104,7 @@ class PurchaseClass extends BaseClass
             $prePrice = bcadd($prePrice, $sellPrice, 2);
 
             //加库存
-            ProductClass::addStockByItemNum($hdProductId,$itemNum);
+            ProductClass::addStockByItemNum($hdProductId, $itemNum);
 
         }
         $sendCost = $data['sendCost'] ?? 0.00;