diff --git a/app/api/controller/Checkout.php b/app/api/controller/Checkout.php index d944860d..09c23e50 100644 --- a/app/api/controller/Checkout.php +++ b/app/api/controller/Checkout.php @@ -90,11 +90,12 @@ class Checkout extends Controller (string)$params['goodsSkuId'], (int)$params['goodsNum'] ); + $merchantId = 0; + foreach ($goodsList as $g) { + $merchantId = $g['merchant_id']; + } // 获取订单确认信息 $orderInfo = $Checkout->onCheckout($goodsList); - // echo "
";
-        // print_r($orderInfo);
-        // exit();
         if ($this->request->isGet()) {
             return $this->renderSuccess([
                 'order' => $orderInfo,
@@ -106,7 +107,9 @@ class Checkout extends Controller
         if ($Checkout->hasError()) {
             return $this->renderError($Checkout->getError(), ['isCreated' => false]);
         }
-        // 创建订单
+        // 创建订单 增加订单
+        $orderInfo['merchantId'] = $merchantId;
+        //print_r($orderInfo);die;
         if (!$Checkout->createOrder($orderInfo)) {
             return $this->renderError($Checkout->getError() ?: '订单创建失败', ['isCreated' => false]);
         }
diff --git a/app/api/service/order/Checkout.php b/app/api/service/order/Checkout.php
index 74c79b5c..08bd5172 100644
--- a/app/api/service/order/Checkout.php
+++ b/app/api/service/order/Checkout.php
@@ -875,6 +875,7 @@ class Checkout extends BaseService
             'order_status' => OrderStatusEnum::NORMAL,
             'platform' => getPlatform(),
             'store_id' => $this->storeId,
+            'merchant_id' => $order['merchantId'] ?? 0,
             'expect_receive_time' => $this->param['expect_receive_time'],//期待收货时间
             'is_street_take' => $this->param['is_street_take'],//是否街边1-在 0-不在
             'to_store_time' => $this->param['to_store_time'],//预计到店时间