From 19393a2f15d7c3ec999fc404a7cf1ca6f7d06628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Thu, 28 Aug 2025 19:43:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(user):=20=E7=94=A8=E6=88=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E6=88=90=E5=8A=9F=E5=90=8E=E5=8F=91=E9=80=81=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在用户注册成功后,添加了发送邮件通知的功能 - 邮件内容包括用户名、密码和手机号码等信息 - 通过 EmailRecordService 发送邮件 --- .../common/system/controller/MainController.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/gxwebsoft/common/system/controller/MainController.java b/src/main/java/com/gxwebsoft/common/system/controller/MainController.java index 04ccd76..fc8d593 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/MainController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/MainController.java @@ -24,6 +24,7 @@ import com.gxwebsoft.common.core.security.JwtSubject; import com.gxwebsoft.common.core.security.JwtUtil; import com.gxwebsoft.common.core.utils.CacheClient; import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.DomainUtil; import com.gxwebsoft.common.core.utils.RedisUtil; import com.gxwebsoft.common.core.web.ApiResult; import com.gxwebsoft.common.core.web.BaseController; @@ -92,6 +93,8 @@ public class MainController extends BaseController { private UserRoleService userRoleService; @Resource private UserRefereeService userRefereeService; + @Resource + private EmailRecordService emailRecordService; @ApiOperation("用户登录") @@ -607,6 +610,7 @@ public class MainController extends BaseController { public ApiResult register(@RequestBody User user) { // 验证签名 String tenantName = user.getCompanyName(); // 应用名称 + String username = user.getUsername(); // 用户名 String phone = user.getPhone(); // 手机号码 String password = user.getPassword(); // 密码 String code = user.getCode(); // 短信验证码 @@ -628,6 +632,7 @@ public class MainController extends BaseController { userParam.setPhone(phone); userParam.setEmail(email); userParam.setPassword(password); + userParam.setUsername(username); userParam.setNickname(DesensitizedUtil.mobilePhone(phone)); if (user.getTemplateId() != null) { userParam.setTemplateId(user.getTemplateId()); @@ -638,6 +643,16 @@ public class MainController extends BaseController { // 签发token String access_token = JwtUtil.buildToken(new JwtSubject(phone, addUser.getTenantId()), tokenExpireTime, configProperties.getTokenKey()); + // 发送邮件通知 + String title = "恭喜!您的WebSoft账号已注册成功"; + String appUrl = "\r\n用户名:" + username; + String passwordStr = "\r\n密码:" + password; + String appName = "\r\n手机号码:" + phone; + String content = title + appUrl + appName + passwordStr; + // 发送邮件通知 + if (email != null) { + emailRecordService.sendEmail(title, content, email); + } return success("注册成功", new LoginResult(access_token, addUser)); } }