From bf98d4837afd0381545386650961981cc22163e1 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 18:00:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=9E=E8=B0=83=E5=92=8C?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=88=90=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 2 +- app/queue/redis/StoreStorageSend.php | 3 ++- .../store_order/StoreOrderController.php | 15 ++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f40bd4027..710970f6c 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -96,7 +96,7 @@ class PayNotifyLogic extends BaseLogic public static function purchase_funds($orderSn, $extra = []) { $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); - $user = User::where('id', $order['uid'])->find(); + $user = User::where('id', $extra['uid'])->find(); if ($user['purchase_funds'] < $order['pay_price']) { throw new \Exception('采购款不足'); } diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index 1f4e58e7e..23e864870 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -55,7 +55,8 @@ class StoreStorageSend implements Consumer 'bar_code' => $find['bar_code'], 'cate_id' => $find['cate_id'], 'price' => $find['price'], - 'cost' => $find['cost'], +// 'cost' => $find['cost'], //v1.0 + 'cost' => $find['purchase'], 'vip_price' => $find['vip_price'], 'unit' => $find['unit'], 'store_id' => $store_id, diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index eecfe3e13..2a08a4f1f 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -4,6 +4,7 @@ namespace app\store\controller\store_order; use app\api\logic\order\OrderLogic; use app\api\validate\OrderValidate; +use app\common\model\order\Cart; use app\common\model\user\User; use app\store\lists\store_order\StoreOrderLists; use app\common\controller\Definitions; @@ -141,7 +142,7 @@ class StoreOrderController extends BaseAdminController } $res = (new StoreOrderLogic())->dealSendSms($params); if($res){ - return $this->success('发送成功',[],1,1); + return $this->success('发送成功',[],0,1); }else{ return $this->fail('发送失败'); } @@ -156,20 +157,24 @@ class StoreOrderController extends BaseAdminController $addressId = (int)$this->request->post('address_id'); $auth_code = $this->request->post('auth_code'); //微信支付条码 $params = $this->request->post(); - if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { + if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS) { return $this->fail('支付条码不能为空'); } if (count($cartId) > 100) { return $this->fail('购物车商品不能超过100个'); } + $user = null; + if($pay_type == PayEnum::PURCHASE_FUNDS){ + $user = User::where('id',$this->request->post('uid'))->find(); + } $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 - $order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params); + $order = StoreOrderLogic::createOrder($cartId, $addressId, $user, $params); if ($order != false) { switch ($pay_type) { case PayEnum::PURCHASE_FUNDS: //采购款支付 - PayNotifyLogic::handle('purchase_funds', $order['order_id']); - return $this->success('采购款支付成功'); + PayNotifyLogic::handle('purchase_funds', $order['order_id'],['uid'=>$this->request->post('uid')]); + return $this->success('采购款支付成功',[],0,1); case PayEnum::CASH_PAY: //现金支付