无关风月
2024-11-26 5cf8494a6da08dfcdc5fdb4c5e55aefd8b27d684
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, "对不起,您的账号已被删除");
@@ -187,7 +191,7 @@
            throw new ServiceException("验证码错误");
        }
        //调用远程服务查询用户信息
        AppUser appUser = remoteAppUserService.getUserByCondition(
        AppUser appUser = remoteAppUserService.getUserByCondition1(
                AppUserDTO.builder().cellPhone(cellPhone).build(),
                SecurityConstants.INNER).getData();
        if (Objects.nonNull(appUser))
@@ -232,6 +236,7 @@
        appLoginUser.setCellPhone(cellPhone);
        appLoginUser.setAppUserId(appUserInfo.getId());
        appLoginUser.setSysUser(sysUser);
        return appLoginUser;
    }
@@ -276,10 +281,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;
    /**
     * 发送验证码
     *
@@ -295,8 +305,10 @@
                    TimeUnit.MINUTES);
            log.info("发送验证码成功,手机号:{} 验证码:{}", cellPhone, code);
            // TODO 修改sender参数及templateId
             HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8823121426646",
                     "767ad27dce184a32a4b4863517fbd301\n");
             HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8824110423893",
                     "767ad27dce184a32a4b4863517fbd301");
//            hwSendSms.sendSms(code, cellPhone);
        } catch (Exception e) {
            log.error("发送短信失败", e);
            throw new ServiceException("验证码发送失败");
@@ -402,8 +414,8 @@
     * @param appleId 苹果id
     * @return
     */
    public AppLoginUser appleLogin(String appleId) {
        R<AppLoginUser> userResult = remoteAppUserService.appleLogin(appleId,
    public AppLoginUser appleLogin(String appleId,String device) {
        R<AppLoginUser> userResult = remoteAppUserService.appleLogin(appleId,device,
                SecurityConstants.INNER);
        if (R.FAIL == userResult.getCode()) {
            throw new ServiceException(userResult.getMsg());
@@ -473,7 +485,7 @@
            throw new ServiceException("用户不存在或已注销");
        }
        // 修改密码
        sysUser.setPassword(body.getPassword());
        sysUser.setPassword(SecurityUtils.encryptPassword(body.getPassword()));
        sysUserClient.updateUser(sysUser);
        redisService.deleteObject(CacheConstants.APP_PASSWORD_SECRET_PREFIX + body.getCellPhone());
    }