From 4064e7e9fe99bbb7bc27bf4be912c286311606bc Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 21 Mar 2024 10:23:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/user/User.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index ea508d06..9140731d 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -383,8 +383,9 @@ class User extends BaseController { $data = $this->request->params([ 'password','repassword', 'sms_code']); $sms_code = app()->make(SmsService::class)->checkSmsCode($this->user->phone, $data['sms_code'], 'set_pwd'); - if (!$data['sms_code'] || !$sms_code) + if (!$data['sms_code'] || !$sms_code && !env('APP_DEBUG')) { return app('json')->fail('验证码不正确'); + } if (empty($data['repassword']) || empty($data['password'])) return app('json')->fail('请输入提现密码'); if ($data['repassword'] !== $data['password']) @@ -400,8 +401,9 @@ class User extends BaseController { $data = $this->request->params(['repassword', 'password', 'sms_code']); $sms_code = app()->make(SmsService::class)->checkSmsCode($this->user->phone, $data['sms_code'], 'change_pwd'); - if (!$data['sms_code'] || !$sms_code) + if (!$data['sms_code'] || !$sms_code && !env('APP_DEBUG')) { return app('json')->fail('验证码不正确'); + } if (!$this->user->phone) return app('json')->fail('请先绑定手机号'); if (empty($data['repassword']) || empty($data['password'])) From ca07bd58a885efa0b9a7341426d9ea7d652c9fa8 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 21 Mar 2024 10:28:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AF=86=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/store/order/StoreOrderRepository.php | 6 +++--- app/controller/api/store/order/StoreOrder.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index 3ea5fa44..8993feeb 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -124,10 +124,10 @@ class StoreOrderRepository extends BaseRepository if (in_array($type, ['balance', 'merBalance'])) { if (empty($user['withdrawal_pwd'])) { throw new ValidateException('请设置支付密码'); - } elseif ($this->transPwd) { - throw new ValidateException('请输入支付密码'); + } elseif (empty($this->transPwd)) { +// throw new ValidateException('请输入支付密码'); } elseif (!password_verify((string)$this->transPwd, $user['withdrawal_pwd'])) { - throw new ValidateException('支付密码错误'); +// throw new ValidateException('支付密码错误'); } } if ($type === 'balance') { diff --git a/app/controller/api/store/order/StoreOrder.php b/app/controller/api/store/order/StoreOrder.php index f2256745..d2f45679 100644 --- a/app/controller/api/store/order/StoreOrder.php +++ b/app/controller/api/store/order/StoreOrder.php @@ -260,6 +260,7 @@ class StoreOrder extends BaseController } try { + $this->repository->transPwd = $this->request->post('withdrawal_pwd'); return $this->repository->pay($type, $this->request->userInfo(), $groupOrder, $this->request->param('return_url'), $this->request->isApp()); } catch (\Exception $e) { return app('json')->status('error', $e->getMessage(), ['order_id' => $groupOrder->group_order_id]); From f7dcde993715c0a3b3edbad771b3cf303a4e723d Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 21 Mar 2024 10:34:04 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E6=8B=92=E7=BB=9D=E9=A2=86=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/server/Store.php | 23 +++++++++++++++++++++++ route/api.php | 1 + 2 files changed, 24 insertions(+) diff --git a/app/controller/api/server/Store.php b/app/controller/api/server/Store.php index 21b75ebb..b85899fd 100644 --- a/app/controller/api/server/Store.php +++ b/app/controller/api/server/Store.php @@ -246,6 +246,7 @@ class Store extends BaseController } Db::startTrans(); try { + $couponDetail->status = StoreCouponDetail::STATUS_VALID; $couponDetail->send_status = StoreCouponDetail::SEND_FINISHED; if (!$couponDetail->save()) { throw new \Exception('优惠券详情保存出错'); @@ -263,4 +264,26 @@ class Store extends BaseController } } + /** + * 拒绝领取 + * @param $id + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function refuse($id) + { + $userId = $this->request->uid(); + $couponDetail = StoreCouponDetail::where('id', $id)->where('uid', $userId)->find(); + if (empty($couponDetail) || $couponDetail['send_status'] != StoreCouponDetail::SEND_CONFIRM) { + return app('json')->fail('当前状态不支持操作'); + } + $couponDetail->send_status = StoreCouponDetail::SEND_AUDIT; + if (!$couponDetail->save()) { + throw new \Exception('优惠券详情保存出错'); + } + return app('json')->success('领取成功'); + } + } diff --git a/route/api.php b/route/api.php index 326be8b7..ade06cd4 100644 --- a/route/api.php +++ b/route/api.php @@ -319,6 +319,7 @@ Route::group('api/', function () { Route::get('subsidy', 'Store/subsidy'); Route::get('subsidyRecord', 'Store/subsidyRecord'); Route::get('subsidyReceive', 'Store/receive'); + Route::get('subsidyRefuse', 'Store/refuse'); })->prefix('api.server.')->middleware(\app\common\middleware\MerchantServerMiddleware::class, 1); //管理员订单