diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index cd804d806..c666b5917 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: //现金支付 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; }