修改验证码校验相关

This commit is contained in:
liu 2024-06-25 15:05:58 +08:00
parent 5d5b2a28ca
commit 4a7a1fa263
3 changed files with 23 additions and 15 deletions

View File

@ -42,7 +42,6 @@ class StoreController extends BaseApiController
{
$store_id = (int)$this->request->get('store_id');
$phone = (int)$this->request->get('phone');
$code = $this->request->get('code','');
$where = [];
if($phone){
$where['phone'] = $phone;
@ -50,17 +49,6 @@ class StoreController extends BaseApiController
if($store_id){
$where['id'] = $store_id;
}
if($code && $phone){
$remark = $phone.'_reporting';
$codeCache = Cache::get($remark);
if(empty($codeCache)){
return $this->fail('验证码不存在');
}
if ($codeCache != $code) {
return $this->fail('验证码错误');
}
}
$info = StoreLogic::search($where);
if ($info) {
return $this->success('ok',$info);
@ -77,6 +65,18 @@ class StoreController extends BaseApiController
$params = (new UserValidate())->post()->goCheck('rechargeStoreMoney');
$auth_code = $this->request->post('auth_code'); //微信支付条码
$recharge_type = $this->request->post('recharge_type',''); //微信支付条码
$code = $this->request->post('code','');//验证码
$phone = $params['mobile'];
if($code && $phone){
$remark = $phone.'_reporting';
$codeCache = Cache::get($remark);
if(empty($codeCache)){
return $this->fail('验证码不存在');
}
if ($codeCache != $code) {
return $this->fail('验证码错误');
}
}
$find=User::where('mobile',$params['mobile'])->find();
if(!$find){
$params['create_uid']=$this->userId;

View File

@ -4,6 +4,7 @@ namespace app\api\controller\user;
use app\api\controller\BaseApiController;
use app\api\logic\user\UserLogic;
use app\api\service\UserTokenService;
use app\api\validate\UserValidate;
use app\common\enum\PayEnum;
use app\common\logic\PaymentLogic;
@ -38,7 +39,14 @@ class UserController extends BaseApiController
if ($result === false) {
return $this->fail(UserLogic::getError());
}
$data = UserLogic::info($this->userId);
if($result && is_numeric($result)){
$data = UserLogic::info($result);
$userInfo = UserTokenService::setToken($result, 1);
$data['token'] = $userInfo['token'];
}else{
$data = UserLogic::info($this->userId);
}
return $this->success('绑定成功', $data, 1, 1);
}
@ -165,7 +173,7 @@ class UserController extends BaseApiController
$params = (new UserValidate())->post()->goCheck('login');
$res = (new UserLogic())->dealReportingSms($params['account']);
if ($res){
return $this->success('发送成功');
return $this->success('发送成功',[],1,1);
}
return $this->fail('发送失败');

View File

@ -60,7 +60,7 @@ class UserLogic extends BaseLogic
UserAuth::where('user_id',$params['user_id'])->update([
'user_id'=>$user['id']
]);
User::destroy($params['user_id']);
return $user['id'];
// throw new \Exception('手机号已被其他账号绑定');
}