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)); } }