diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 8b5a8943..94f657b5 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -378,12 +378,13 @@ class StoreOrderLogic extends BaseLogic } $template = getenv('SMS_TEMPLATE'); $check =(new SmsService())->client($phone,$template,$code); - if($check){ if($type == 1){ $remark = $param['uid'].'_smsPay'; - }else{ + }elseif($type == 2){ $remark = $param['uid'].'_giftPay'; + }else{ + $remark = $param['uid'].'_moneyPay';//余额支付 } Cache::set($remark,$code,5*60); return true; diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 635f5e47..87f41a51 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -118,6 +118,10 @@ class StoreOrderController extends BaseAdminController if ($order['order']['pay_price'] > $user['integral']) { return $this->fail('当前用户礼品券不足支付'); } + }elseif($params['type'] == 3){ + if ($order['order']['pay_price'] > $user['now_money']) { + return $this->fail('当前用户余额不足支付'); + } } $res = (new StoreOrderLogic())->dealSendSms($params, $params['type']); @@ -165,6 +169,15 @@ class StoreOrderController extends BaseAdminController } } + if ($pay_type == PayEnum::BALANCE_PAY) { + $remark = $uid . '_moneyPay'; + $code = Cache::get($remark); + if ($code && isset($params['code']) && $code != $params['code']) { + throw new Exception('验证码错误'); + } + } + + $user = null; if ($uid) { $user = User::where('id', $uid)->find();