|
|
@@ -1,5 +1,6 @@
|
|
|
package thyyxxk.webserver.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -10,6 +11,7 @@ import thyyxxk.webserver.entity.dictionary.CodeName;
|
|
|
import thyyxxk.webserver.entity.login.UserInfo;
|
|
|
import thyyxxk.webserver.entity.login.VueMenu;
|
|
|
import thyyxxk.webserver.entity.settings.permissions.MenuItem;
|
|
|
+import thyyxxk.webserver.service.externalhttp.CorpWxSrvc;
|
|
|
import thyyxxk.webserver.service.redislike.RedisLikeService;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
|
@@ -24,12 +26,14 @@ public class LoginService {
|
|
|
private final LoginDao dao;
|
|
|
private final TokenService tokenService;
|
|
|
private final RedisLikeService redisLikeService;
|
|
|
+ private final CorpWxSrvc srvc;
|
|
|
|
|
|
@Autowired
|
|
|
- public LoginService(LoginDao dao, TokenService tokenService, RedisLikeService redisLikeService) {
|
|
|
+ public LoginService(LoginDao dao, TokenService tokenService, RedisLikeService redisLikeService, CorpWxSrvc srvc) {
|
|
|
this.dao = dao;
|
|
|
this.tokenService = tokenService;
|
|
|
this.redisLikeService = redisLikeService;
|
|
|
+ this.srvc = srvc;
|
|
|
}
|
|
|
|
|
|
public ResultVo<UserInfo> login(UserInfo userInfo) {
|
|
|
@@ -46,6 +50,12 @@ public class LoginService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.INVALID_PASSWORD);
|
|
|
}
|
|
|
String token = tokenService.getToken(tempUserInfo);
|
|
|
+ try {
|
|
|
+ JSONObject json = srvc.getUserinfo(TokenUtil.getWeComAddressBookToken(), tempUserInfo.getCodeRs());
|
|
|
+ tempUserInfo.setAvatar(json.getString("avatar"));
|
|
|
+ } catch (Exception ignored) {
|
|
|
+ }
|
|
|
+
|
|
|
tempUserInfo.setToken(token);
|
|
|
tempUserInfo.setSid(makeSid(tempUserInfo.getCode(), token, userInfo.getSid()));
|
|
|
tempUserInfo.setRoles(dao.getUserRoles(tempUserInfo.getCode()));
|