From a5ea07cc5fa16fc88f4d488fcd514e7613af60cd Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Thu, 11 Nov 2021 22:50:23 +0800
Subject: [PATCH] fix

---
 zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
index 8e53584..571d201 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
@@ -281,6 +281,7 @@
         }
 
         AjaxResult ajaxResult = new AjaxResult();
+        ajaxResult.setStatus(AjaxResult.STATUS_SUCCESS);
         ajaxResult.putInMap("url", list.get(0).getComWebUrl());
         return ajaxResult;
     }
@@ -292,7 +293,7 @@
             return AjaxResult.buildFailInstance("code不存在");
         }
         AjaxResult res = new AjaxResult();
-        String requrl = weChatApiTools.getXcxLoginUrl(code, HostInterceptor.getCompanyId(), AppConstance.MINI_PROGRAM_MANAGER_APP_ID);
+        String requrl = weChatApiTools.getManagerXcxLoginUrl(code);
 
         String resultData = HttpCurlUtil.sendGetHttp(requrl, null);
         JSONObject json = JSONObject.fromObject(resultData);
@@ -316,8 +317,23 @@
 
         String token = userCacheManager.saveUserInfo(hasBind);
         LogUtil.info("用户token={}", token);
+
+        authorityManager.initUserPower(res, hasBind);
+
+        UserInfoVo userInfoVo = new UserInfoVo();
+        if(hasBind.getShopId()!=null){
+            SysShopInfo shopInfo = sysShopInfoService.findById(hasBind.getShopId());
+            hasBind.setShopName(shopInfo.getShopName());
+            userInfoVo.setShopName(shopInfo.getShopShortName());
+        }
+
+        userInfoVo.setId(hasBind.getSuId());
+        userInfoVo.setName(hasBind.getSuName());
+        userInfoVo.setRoleName(hasBind.getRoleName());
+        userInfoVo.setPhoto(hasBind.getSuPhoto());
+
         res.putInMap("token", token);
-        res.putInMap("userInfo", hasBind);
+        res.putInMap("userInfo", userInfoVo);
         return res;
     }
 
@@ -335,8 +351,21 @@
 
         AjaxResult result = AjaxResult.buildSuccessInstance("登陆成功");
         authorityManager.initUserPower(result, user);
+
+        UserInfoVo userInfoVo = new UserInfoVo();
+        if(user.getShopId()!=null){
+            SysShopInfo shopInfo = sysShopInfoService.findById(user.getShopId());
+            user.setShopName(shopInfo.getShopName());
+            userInfoVo.setShopName(shopInfo.getShopShortName());
+        }
+
+        userInfoVo.setId(user.getSuId());
+        userInfoVo.setName(user.getSuName());
+        userInfoVo.setRoleName(user.getRoleName());
+        userInfoVo.setPhoto(user.getSuPhoto());
+
         result.putInMap("token", token);
-        result.putInMap("userInfo", user);
+        result.putInMap("userInfo", userInfoVo);
 
         synchronized (this) {
             SysUsers hasBind = sysUsersService.findByOpenId(loginDto.getOpenId(), HostInterceptor.getCompanyId());

--
Gitblit v1.9.1