From 71fd3964aacb88c150bec97b90452989fb2b380b Mon Sep 17 00:00:00 2001
From: rentaiming <806181062@qq.com>
Date: 星期四, 06 六月 2024 11:46:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java
index b0a943e..8a47337 100644
--- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java
+++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberServiceImpl.java
@@ -23,7 +23,6 @@
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.member.controller.management.dto.MgtMemberQuery;
 import com.ruoyi.member.controller.management.vo.MgtMemberVO;
-import com.ruoyi.member.dto.MemberDTO;
 import com.ruoyi.member.mapper.MemberMapper;
 import com.ruoyi.member.service.IMemberService;
 import com.ruoyi.member.util.HttpUtils;
@@ -34,6 +33,7 @@
 import com.ruoyi.system.api.domain.SysUser;
 import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO;
 import com.ruoyi.system.api.domain.dto.AppMiniRegisterDTO;
+import com.ruoyi.system.api.domain.dto.MemberDTO;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
@@ -120,7 +120,7 @@
 
 
     @Override
-    public AppMiniLoginVO loginThird(AppMiniLoginDTO appMiniLoginDto) {
+    public AppMiniLoginVO loginThird(AppMiniLoginDTO appMiniLoginDto) throws Exception {
         AppMiniLoginVO appMiniLoginVo = new AppMiniLoginVO();
 
         if(appMiniLoginDto.getType()==1){
@@ -144,6 +144,7 @@
                 }
                 //刷新令牌,上次换取访问令牌时得到。见出参的refresh_token字段
                 request.setRefreshToken(response.getAccessToken());
+
                 //返回成功时 就将唯一标识返回
                 if (response.isSuccess()) {
                     System.out.println("调用成功");
@@ -165,13 +166,16 @@
                         String memberId = IdUtils.simpleUUID();
                         sysUser = new SysUser();
                         sysUser.setUserName(memberId);
-                        sysUser.setUserType("03");
                         sysUser.setNickName("白金用户");
                         sysUser.setPhonenumber(response.getOpenId());
                         sysUser.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png");
                         String password = "123456";
                         sysUser.setPassword(SecurityUtils.encryptPassword(password));
                         sysUser = sysUserService.registerUser(sysUser).getData();
+
+                        if (sysUser==null){
+                            sysUser = sysUserService.getSysUser(member.getUserId()).getData();
+                        }
 
                         member = new Member();
                         member.setUserId(sysUser.getUserId());
@@ -205,7 +209,7 @@
                 sessionKey = session.getSessionKey();
                 //获取用户
                 LambdaQueryWrapper<Member> wrapper= Wrappers.lambdaQuery();
-                wrapper.eq(Member::getZfbOpenid,session.getOpenid());
+                wrapper.eq(Member::getMiniOpenid,session.getOpenid());
                 Member member=this.getOne(wrapper);
                 SysUser sysUser = null;
                 if (member != null) {
@@ -214,7 +218,7 @@
 
                 LambdaQueryWrapper<Member> wrapper1= Wrappers.lambdaQuery();
                 wrapper1.eq(Member::getMiniOpenid,openid);
-                Member member1=this.getOne(wrapper);
+                Member member1=this.getOne(wrapper1);
 
                 if (member1==null){
 
@@ -222,13 +226,14 @@
                         String memberId = IdUtils.simpleUUID();
                         sysUser = new SysUser();
                         sysUser.setUserName(memberId);
-                        sysUser.setUserType("03");
                         sysUser.setNickName("白金用户");
-                        sysUser.setPhonenumber(openid);
                         sysUser.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png");
                         String password = "123456";
                         sysUser.setPassword(SecurityUtils.encryptPassword(password));
                         sysUser = sysUserService.registerUser(sysUser).getData();
+                        if (sysUser==null){
+                            sysUser = sysUserService.getSysUser(member.getUserId()).getData();
+                        }
 
 
                         member = new Member();
@@ -378,7 +383,6 @@
                     String memberId = IdUtils.simpleUUID();
                     sysUser = new SysUser();
                     sysUser.setUserName(memberId);
-                    sysUser.setUserType("03");
                     sysUser.setNickName("白金用户");
                     sysUser.setPhonenumber(appMiniRegisterDTO.getMiniOpenid());
                     sysUser.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png");
@@ -417,7 +421,6 @@
                         String memberId = IdUtils.simpleUUID();
                         sysUser = new SysUser();
                         sysUser.setUserName(memberId);
-                        sysUser.setUserType("03");
                         sysUser.setNickName("白金用户");
                         sysUser.setPhonenumber(appMiniRegisterDTO.getMiniOpenid());
                         sysUser.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png");

--
Gitblit v1.7.1