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 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=92=8C=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: //现金支付 From d04149ba48da80abf9203c8b0a2aa10ffa384194 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 18:12:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/user/UserLists.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php index 7f7bc24fe..fb2746572 100644 --- a/app/store/lists/user/UserLists.php +++ b/app/store/lists/user/UserLists.php @@ -4,6 +4,7 @@ namespace app\store\lists\user; +use app\common\model\store_finance_flow\StoreFinanceFlow; use app\store\lists\BaseAdminDataLists; use app\common\model\user\User; use app\common\model\user\UserShip; @@ -37,7 +38,7 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface public function lists(): array { - $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time"; + $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds"; $lists = User::where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->field($field) @@ -46,6 +47,10 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface $data['sex_text'] = $data->sex_text; $data['mobile'] = substr_replace($data['mobile'], '****', 3, 4); $data['user_ship_name'] =$data['user_ship']==0?'一般用户':UserShip::where('id',$data['user_ship'])->value('title'); + $data['return_money'] = StoreFinanceFlow:: + where(['user_id'=>$data['id'],'status'=>0,'financial_pm'=>0]) + ->sum('number'); + })->toArray(); return $lists; }