| | |
| | | import com.xinquan.auth.form.AppLoginBody; |
| | | import com.xinquan.auth.form.AppRegisterBody; |
| | | import com.xinquan.auth.form.VerifyResultVO; |
| | | import com.xinquan.auth.util.HuaWeiSMSUtil; |
| | | import com.xinquan.common.core.constant.CacheConstants; |
| | | import com.xinquan.common.core.constant.Constants; |
| | | import com.xinquan.common.core.constant.SecurityConstants; |
| | |
| | | sysUser.setUserName(cellPhone); |
| | | sysUser.setUserType("01"); |
| | | sysUser.setNickName(nickname); |
| | | sysUser.setPassword(password); |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(password)); |
| | | R<SysUser> registerResult = remoteUserService.registerAppUserInfo(sysUser, SecurityConstants.INNER); |
| | | |
| | | if (R.FAIL == registerResult.getCode()) |
| | |
| | | recordLogService.recordLogininfor(cellPhone, Constants.REGISTER, "注册成功"); |
| | | //TODO 默认头像待完善 |
| | | AppUserDTO appUserDTO = AppUserDTO.builder().userId(sysUser.getUserId()).cellPhone(cellPhone) |
| | | .avatar("qwer").nickname( |
| | | nickname).userStatus(1).sanskritFlag(2).balance(BigDecimal.ZERO) |
| | | .avatar("https://xqgwzh.obs.cn-south-1.myhuaweicloud.com/Logo%E7%A1%AE%E8%AE%A4%E7%89%88%281%29.jpg").nickname( |
| | | nickname).userStatus(1).sanskritFlag(2).balance(BigDecimal.ZERO).inviteUserId(appRegisterBody.getInviteUserId()) |
| | | .income(BigDecimal.ZERO).totalEnergyValue(0).registerTime( |
| | | LocalDateTime.now()).levelSettingId(1).build(); |
| | | if (appRegisterBody.getInviteUserId()!=null){ |
| | | appUserDTO.setInviteUserTime(LocalDateTime.now()); |
| | | } |
| | | R<AppUser> result = remoteAppUserService.registerAppUser(appUserDTO, |
| | | SecurityConstants.INNER); |
| | | if (R.FAIL == result.getCode()) { |
| | |
| | | return CacheConstants.APP_VERIFY_CAPTCHA_CODE_PREFIX; |
| | | case 5: |
| | | return CacheConstants.APP_CHANGE_PHONE_CODE_PREFIX; |
| | | case 6: |
| | | return CacheConstants.ADD_CARD_PHONE_CODE_PREFIX; |
| | | default: |
| | | return ""; |
| | | } |
| | |
| | | TimeUnit.MINUTES); |
| | | log.info("发送验证码成功,手机号:{} 验证码:{}", cellPhone, code); |
| | | // TODO 修改sender参数及templateId |
| | | // HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8823121426646", |
| | | // "cf1707ec44694627b1b483b0277e12fd"); |
| | | HuaWeiSMSUtil.sendSms("[\"" + code + "\"]", cellPhone, "8823121426646", |
| | | "767ad27dce184a32a4b4863517fbd301\n"); |
| | | } catch (Exception e) { |
| | | log.error("发送短信失败", e); |
| | | throw new ServiceException("验证码发送失败"); |
| | |
| | | "登录用户不存在"); |
| | | throw new ServiceException("登录用户:" + body.getCellPhone() + " 不存在"); |
| | | } |
| | | if (!sysUser.getPassword().equals(body.getPassword())){ |
| | | throw new ServiceException("密码错误"); |
| | | } |
| | | passwordService.validate(sysUser, body.getPassword()); |
| | | // if (!sysUser.getPassword().equals(body.getPassword())){ |
| | | // throw new ServiceException("密码错误"); |
| | | // } |
| | | AppLoginUser appLoginUser = new AppLoginUser(); |
| | | appLoginUser.setAppUserId(appUser.getId()); |
| | | appLoginUser.setCellPhone(appUser.getCellPhone()); |