Commit 9032efd2 by 章家宝

feat: 登录错误码

1 parent c40a3be3
......@@ -35,6 +35,8 @@ public enum ErrorCodeEnum {
OPERATION_ERROR(1001007, "已绑定的检测报告不允许删除"),
DATA_NOT_FOUND(1001008, "{0}"),
VEHICLE_ALREADY_BIND(1001009, "{0}"),
INSPECTOR_NOT_EXISTS(1001010, "您当前不是系统检测师,请联系关联负责人"),
INSPECTOR_LOGIN_CODE_ERROR(1001011, "验证码错误请输入正确的验证码"),
/* 检测模版 */
......
......@@ -98,12 +98,12 @@ public class AuthController {
Inspector inspector = inspectorService.findByPhone(phone);
if (inspector == null) {
log.warn("用户手机号{}不存在", phone);
return BaseResp.fail("用户不存在");
throw new BusinessCodeException(ErrorCodeEnum.INSPECTOR_NOT_EXISTS);
}
String code = loginRequest.getVerifyCode();
if (!smsCodeUtil.validateCode(phone, code) && !envProfileUtils.isDevEnvironment()) {
log.warn("用户手机号{}验证码错误", phone);
return BaseResp.fail("验证码错误或已过期");
throw new BusinessCodeException(ErrorCodeEnum.INSPECTOR_LOGIN_CODE_ERROR);
}
LocalDateTime expireTime = jwtProvider.getExpireTime();
String token = jwtProvider.generateUser(phone, LocalDateTimeUtil.localDateTimeToDate(expireTime));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!