From fab1cb9b3bff7e144c9ccfd36ff81d6bbee9e664 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 1 Jul 2024 09:19:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=87=AA=E6=8F=90=E6=A0=A1=E9=AA=8C=E5=BE=97?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 4 ++-- app/api/validate/OrderValidate.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index c34a390fa..8c1bfc471 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -289,14 +289,14 @@ class OrderLogic extends BaseLogic //检查购物车对比店铺得商品数量差异 foreach ($cart_select as $v) { $store = StoreBranchProduct::where([ - 'store_id'=>$v['store_id'], + 'store_id'=>$params['store_id'], 'product_id'=>$v['product_id'], ])->field('id,store_name,stock')->withTrashed()->find(); if($store['stock'] < $v['cart_num']){ //缺失 $newArr[] = [ 'uid'=>$uid, - 'store_id'=>$v['store_id'], + 'store_id'=>$params['store_id'], 'product_id'=>$v['product_id'], 'missing_quantity'=> $v['cart_num'] - $store['stock'] ]; diff --git a/app/api/validate/OrderValidate.php b/app/api/validate/OrderValidate.php index 7d518c202..ca8a6ec38 100644 --- a/app/api/validate/OrderValidate.php +++ b/app/api/validate/OrderValidate.php @@ -24,6 +24,7 @@ class OrderValidate extends BaseValidate 'old_cart_id' => 'require|array', 'refund_type' => 'require|number', 'cart_id' => 'require', + 'store_id' => 'require', ]; @@ -39,11 +40,12 @@ class OrderValidate extends BaseValidate 'old_cart_id' => '购物车id', 'refund_type' => '退款申请类型', 'cart_id' => '购物车id', + 'store_id' => '店铺id', ]; public function sceneCart() { - return $this->only(['cart_id']); + return $this->only(['cart_id','store_id']); } From 677eaf781da96bd1b4f554a7560682ac11244f5e Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 1 Jul 2024 09:23:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index d72900ca9..20fb69e4a 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -105,7 +105,11 @@ class PayNotifyLogic extends BaseLogic } self::afterPay($order); if($order['reservation'] == 1&& in_array($order['shipping_type'],[1,2])){ - self::dealGoodsLeft($order['cart_id'],$order['uid'],$order['id']); + $checkArr =[ + 'cart_id'=>$order['cart_id'], + 'store_id'=>$order['store_id'], + ]; + self::dealGoodsLeft($checkArr,$order['uid'],$order['id']); } if ($extra && $extra['store_id']) { $params = [ @@ -219,7 +223,11 @@ class PayNotifyLogic extends BaseLogic } self::dealProductLog($order); if($order['reservation'] == 1&& in_array($order['shipping_type'],[1,2])){ - self::dealGoodsLeft($order['cart_id'],$order['uid'],$order['id']); + $checkArr =[ + 'cart_id'=>$order['cart_id'], + 'store_id'=>$order['store_id'], + ]; + self::dealGoodsLeft($checkArr,$order['uid'],$order['id']); } // $count = UserSign::where([ @@ -413,7 +421,11 @@ class PayNotifyLogic extends BaseLogic } $order->save(); if($order['reservation'] == 1&& in_array($order['shipping_type'],[1,2])){ - self::dealGoodsLeft($order['cart_id'],$order['uid'],$order['id']); + $checkArr =[ + 'cart_id'=>$order['cart_id'], + 'store_id'=>$order['store_id'], + ]; + self::dealGoodsLeft($checkArr,$order['uid'],$order['id']); } self::afterPay($order, $extra['transaction_id']); // self::addUserSing($order);