From 9e5d3f634b52333c076eb443a64de873c5ddceed Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期六, 09 十一月 2024 14:39:46 +0800
Subject: [PATCH] 代码提交

---
 xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java b/xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java
index 408f29d..99ac720 100644
--- a/xinquan-auth/src/main/java/com/xinquan/auth/service/SysLoginService.java
+++ b/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.HuaWeiSMSUtil;
 import com.xinquan.common.core.constant.CacheConstants;
 import com.xinquan.common.core.constant.Constants;
 import com.xinquan.common.core.constant.SecurityConstants;
@@ -199,7 +200,7 @@
         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())
@@ -210,10 +211,13 @@
         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()) {
@@ -289,8 +293,8 @@
                     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("验证码发送失败");
@@ -340,9 +344,10 @@
                     "登录用户不存在");
             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());

--
Gitblit v1.7.1