This commit is contained in:
liu 2024-03-21 10:58:07 +08:00
commit dc7c90d466
5 changed files with 32 additions and 5 deletions

View File

@ -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') {

View File

@ -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('领取成功');
}
}

View File

@ -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]);

View File

@ -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']))

View File

@ -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);
//管理员订单