客户自动注册并登录通用方法

This commit is contained in:
Vinjor 2024-10-11 14:06:17 +08:00
parent 7e450c719a
commit d8a2f4b3cb
4 changed files with 1877 additions and 79 deletions

View File

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.app.wechat.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.common.SystemEnum;
@ -8,7 +7,6 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.app.wechat.service.WechatService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.auth.AdminAuthService;
@ -158,7 +156,8 @@ public class WechatServiceImpl implements WechatService {
Long uid = userService.createUser(user);
wxUser = new AdminUserDO();
wxUser.setId(uid);
wxUser.setUsername(phoneNumber);
wxUser.setUsername(user.getUsername());
wxUser.setNickname(user.getNickname());
}
return wxUser;
}

View File

@ -91,6 +91,7 @@ public class LoginController {
AuthLoginRespVO loginVO = loginService.wxLoginByUserId(adminUserDO.getId(),adminUserDO.getUsername());
Map<String, Object> map = new HashMap<>();
map.put("token", loginVO.getAccessToken());
map.put("userinfo", adminUserDO);
return success(map);
} else {
return error(500, "微信登录失败!");

View File

@ -36,6 +36,12 @@
<groupId>cn.iocoder.boot</groupId>
<artifactId>dl-module-base</artifactId>
<version>${revision}</version>
<exclusions>
<exclusion>
<artifactId>commons-fileupload</artifactId>
<groupId>commons-fileupload</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 企业管理包 -->
<dependency>

File diff suppressed because it is too large Load Diff