Browse Source

发送短信验证码接口2 异常处理错误

master
wanghongjun 1 year ago
parent
commit
e00603f9ef
  1. 3
      app/controller/wechat/Wechat.php

3
app/controller/wechat/Wechat.php

@ -15,6 +15,7 @@ use think\cache\driver\Redis;
use think\exception\ValidateException;
use think\facade\Db;
use think\Request;
use think\Response;
class Wechat extends Base
{
@ -83,7 +84,7 @@ class Wechat extends Base
validate(WechatUserValidate::class)->scene('savePuCode')->check($param);
$res = (new AuthCodeUtil(new Redis()))->verifyCode($param['mobile'],$param['snsCode']);
if (!$res) {
throw new \Exception('短信验证码错误');
throw new ValidateException('短信验证码错误');
}
} catch (ValidateException $e) {
return $this->buildFailed(ReturnCode::INVALID,$e->getMessage());

Loading…
Cancel
Save