|
|
@@ -78,19 +78,11 @@ class OrderService extends BaseService
|
|
|
self::payAfter($return, $payWay);
|
|
|
PurchaseService::payAfter($purchase, $payWay);
|
|
|
|
|
|
- if (isset($return->sendType) == false) {
|
|
|
- util::fail('没有找到配送方式');
|
|
|
- }
|
|
|
- //自取订单直接完成
|
|
|
- if ($return->sendType == OrderClass::SEND_TYPE_NO) {
|
|
|
- self::withoutSend($return, $purchase);
|
|
|
- }
|
|
|
-
|
|
|
return $return->attributes;
|
|
|
}
|
|
|
|
|
|
//自取免配送流程处理 ssh 2021.1.24
|
|
|
- public static function withoutSend($order, $purchase)
|
|
|
+ public static function withoutSend($order)
|
|
|
{
|
|
|
if (isset($order->status) == false) {
|
|
|
util::fail('没有订单状态');
|
|
|
@@ -100,7 +92,7 @@ class OrderService extends BaseService
|
|
|
}
|
|
|
//自取订单,订单直接完成。【现在有三个地方有订单完成操作】
|
|
|
$shopId = $order->shopId ?? 0;
|
|
|
- $shop = Shop::findBySql('select * from ' . Shop::tableName() . ' where id = :id for update', ['id' => $shopId])->one();
|
|
|
+ $shop = ShopClass::getLockById($shopId);
|
|
|
if (empty($shop)) {
|
|
|
util::fail('没有找到门店');
|
|
|
}
|
|
|
@@ -114,15 +106,6 @@ class OrderService extends BaseService
|
|
|
//订单完成
|
|
|
self::finish($order, $shop);
|
|
|
|
|
|
- $purchaseShopId = $purchase->shopId;
|
|
|
- $purchaseShop = Shop::findBySql('select * from ' . Shop::tableName() . ' where id = :id for update', ['id' => $purchaseShopId])->one();
|
|
|
- if (empty($purchaseShop)) {
|
|
|
- util::fail('没有找到门店');
|
|
|
- }
|
|
|
- $purchaseShop->cgUnSend -= 1;
|
|
|
- $purchaseShop->cgSending += 1;
|
|
|
- $purchaseShop->save();
|
|
|
-
|
|
|
OrderSendClass::withoutSend($order);
|
|
|
|
|
|
return OrderClass::TOTAL_FLOW;
|
|
|
@@ -469,7 +452,6 @@ class OrderService extends BaseService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//更新订单基础状态和支付状态
|
|
|
$order->payWay = $payWay;
|
|
|
$order->status = OrderClass::ORDER_STATUS_UN_SEND;
|
|
|
@@ -489,7 +471,7 @@ class OrderService extends BaseService
|
|
|
|
|
|
/**客户资产变化**/
|
|
|
$customId = $order->customId;
|
|
|
- $custom = Custom::findBySql('select * from ' . Custom::tableName() . ' where id = :id for update', ['id' => $customId])->one();
|
|
|
+ $custom = CustomClass::getLockById($customId);
|
|
|
if (empty($custom)) {
|
|
|
util::fail('没有找到客户信息');
|
|
|
}
|
|
|
@@ -512,6 +494,16 @@ class OrderService extends BaseService
|
|
|
$time = date("Y-m-d H:i:s");
|
|
|
$placeData = ['payTime' => $time, 'orderSn' => $orderSn, 'orderId' => $orderId];
|
|
|
OrderSendClass::placeOrder($placeData);
|
|
|
+
|
|
|
+ if (isset($order->sendType) == false) {
|
|
|
+ util::fail('没有找到配送方式');
|
|
|
+ }
|
|
|
+
|
|
|
+ //自取订单直接完成
|
|
|
+ if ($order->sendType == OrderClass::SEND_TYPE_NO) {
|
|
|
+ self::withoutSend($order);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|