无关风月
2024-12-31 0c51a577db337520452022d9d6a22b720ef858d4
xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java
@@ -6,6 +6,7 @@
import com.xinquan.auth.form.AppLoginBody;
import com.xinquan.auth.form.AppRegisterBody;
import com.xinquan.auth.form.VerifyResultVO;
import com.xinquan.auth.util.HWSendSms;
import com.xinquan.auth.util.HuaWeiSMSUtil;
import com.xinquan.common.core.constant.CacheConstants;
import com.xinquan.common.core.constant.Constants;
@@ -114,6 +115,9 @@
        
        LoginUser userInfo = userResult.getData();
        SysUser user = userResult.getData().getSysUser();
        if (user.getStatus().equals("1")){
            throw new ServiceException("对不起,您的账号:" + username + " 已被冻结,请联系管理员");
        }
        if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
        {
            recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
@@ -246,9 +250,12 @@
        if (StringUtils.isNotBlank(cellPhone) && StringUtils.isNotBlank(captcha)) {
            String key = keyPrefix + cellPhone;
            String key1 = CacheConstants.APP_PASSWORD_CAPTCHA_CODE_PREFIX + cellPhone;
            String code = redisService.getCacheObject(key);
            String code1 = redisService.getCacheObject(key1);
            // 万能验证码
            if (captcha.equals("123456") || (StringUtils.isNotBlank(code) && code.equals(
                    captcha))||(StringUtils.isNotBlank(code1) && code1.equals(
                    captcha))) {
                redisService.deleteObject(key);
                return true;
@@ -277,10 +284,15 @@
                return CacheConstants.APP_CHANGE_PHONE_CODE_PREFIX;
            case 6:
                return CacheConstants.ADD_CARD_PHONE_CODE_PREFIX;
            case 7:
                return CacheConstants.MANAGEMENT_PASSWORD_SECRET_PREFIX;
            default:
                return "";
        }
    }
    @Autowired
    private HWSendSms hwSendSms;
    /**
     * 发送验证码
     *
@@ -297,7 +309,9 @@
            log.info("发送验证码成功,手机号:{} 验证码:{}", cellPhone, code);
            // TODO 修改sender参数及templateId
             HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8824110423893",
                     "767ad27dce184a32a4b4863517fbd301\n");
                     "767ad27dce184a32a4b4863517fbd301");
//            hwSendSms.sendSms(code, cellPhone);
        } catch (Exception e) {
            log.error("发送短信失败", e);
            throw new ServiceException("验证码发送失败");
@@ -322,7 +336,7 @@
        }
        // 查询用户信息
        AppUser appUser = remoteAppUserService.getUserByCondition(
                AppUserDTO.builder().cellPhone(body.getCellPhone()).device(body.getDevice()).build(),
                AppUserDTO.builder().cellPhone(body.getCellPhone()).build(),
                SecurityConstants.INNER).getData();
        if (StringUtils.isNull(appUser)) {
            recordLogService.recordLogininfor(body.getCellPhone(), Constants.LOGIN_FAIL,