shish 5 лет назад
Родитель
Сommit
a310283022

+ 2 - 1
app-ghs/controllers/OrderController.php

@@ -94,6 +94,7 @@ class OrderController extends BaseController
         $post['shopAdminId'] = $this->shopAdminId;
         $shopAdmin = $this->shopAdmin;
         $post['shopAdminName'] = $shopAdmin['name'] ?? '';
+        $post['merchantId'] = $this->sjId;
         $post['shopId'] = $shopId;
         $post['payWay'] = $this->isWx == true ? 0 : 1;
         $post['merchantId'] = $this->sjId;
@@ -115,7 +116,7 @@ class OrderController extends BaseController
             //判断花材有效性
             ProductClass::valid($productList, $this->shopId);
             $post['product'] = $productList;
-            $return = OrderService::createOrder($post);
+            $return = OrderService::createOrder($post, $custom);
             $transaction->commit();
             util::success($return);
         } catch (\Exception $e) {

+ 2 - 2
app-hd/controllers/PurchaseController.php

@@ -23,7 +23,7 @@ class PurchaseController extends BaseController
         $post = Yii::$app->request->post();
         $ghsId = $post['ghsId'] ?? 0;
         //供货商
-        $ghsInfo = GhsClass::getById($ghsId);
+        $ghsInfo = GhsClass::getGhsInfo($ghsId);
         if (empty($ghsInfo)) {
             util::fail('没有找到供货商');
         }
@@ -46,7 +46,7 @@ class PurchaseController extends BaseController
             ProductClass::valid($productList, $currentShopId);
             $post['product'] = $productList;
             $post['sendCost'] = isset($post['sendCost']) && is_numeric($post['sendCost']) ? $post['sendCost'] : 0;
-            $respond = PurchaseService::createPurchase($post);
+            $respond = PurchaseService::createPurchase($post,$ghsInfo);
             $orderSn = $respond['orderSn'] ?? '';
             $actPrice = $respond['actPrice'] ?? '';
             $transaction->commit();

+ 3 - 3
biz-ghs/order/services/OrderService.php

@@ -17,13 +17,13 @@ class OrderService extends BaseService
     public static $baseFile = '\bizGhs\order\classes\OrderClass';
 
     //添加订单
-    public static function createOrder($data)
+    public static function createOrder($data, $custom)
     {
         //供货商销售单
         $return = OrderClass::addOrder($data);
 
-        $customSjId = $data['sjId'] ?? 0;
-        $customShopId = $data['shopId'] ?? 0;
+        $customSjId = $custom['sjId'] ?? 0;
+        $customShopId = $custom['shopId'] ?? 0;
         $ghsShopAdminId = $data['shopAdminId'] ?? 0;
         $ghsShopAdminName = $data['shopAdminName'] ?? '';
         $customId = $data['customId'] ?? 0;

+ 1 - 5
biz-hd/purchase/services/PurchaseService.php

@@ -16,17 +16,13 @@ class PurchaseService extends BaseService
 
     public static $baseFile = '\bizHd\purchase\classes\PurchaseClass';
 
-    public static function createPurchase($data)
+    public static function createPurchase($data, $ghs)
     {
         //零售采购单
         $respond = PurchaseClass::addPurchase($data);
 
         //供货商销售单
         $ghsId = $data['ghsId'] ?? 0;
-        $ghs = GhsClass::getGhsInfo($ghsId);
-        if (empty($ghs)) {
-            util::fail('没有找到供货商');
-        }
         $currentShopId = $ghs['shopId'] ?? 0;
         $currentSjId = $ghs['sjId'] ?? 0;
         $product = $data['product'] ?? [];