微信登录
This commit is contained in:
+16
-4
@@ -87,6 +87,8 @@ public class AuthController {
|
|||||||
private UserRoleMapper userRoleMapper;
|
private UserRoleMapper userRoleMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private PasswordEncoder passwordEncoder;
|
private PasswordEncoder passwordEncoder;
|
||||||
|
@Resource
|
||||||
|
private WxMaService wxMaService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@@ -106,10 +108,20 @@ public class AuthController {
|
|||||||
if ("wxcp".equals(dto.getCode())){
|
if ("wxcp".equals(dto.getCode())){
|
||||||
cpuser = cpUserService.getByUserId("test");
|
cpuser = cpUserService.getByUserId("test");
|
||||||
}else{
|
}else{
|
||||||
//企业微信
|
if (dto.getPlatform().equalsIgnoreCase("WX")){
|
||||||
WxCpMaJsCode2SessionResult session = wxCpService.jsCode2Session(dto.getCode());
|
//普通微信
|
||||||
log.info("企业微信登录信息:{}", session);
|
WxMaJscode2SessionResult result = wxMaService.jsCode2SessionInfo(dto.getCode());
|
||||||
cpuser = cpUserService.getByUserId(session.getUserId());
|
log.info("微信登录信息,{}", result);
|
||||||
|
cpuser = cpUserService.getByUserId(result.getUnionid());
|
||||||
|
if (ObjectUtil.isEmpty(cpuser)){
|
||||||
|
cpuser = cpUserService.getByUserId("test");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//企业微信
|
||||||
|
WxCpMaJsCode2SessionResult session = wxCpService.jsCode2Session(dto.getCode());
|
||||||
|
log.info("企业微信登录信息:{}", session);
|
||||||
|
cpuser = cpUserService.getByUserId(session.getUserId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(cpuser)){
|
if (ObjectUtil.isEmpty(cpuser)){
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ public class FarmMsgAspect {
|
|||||||
message.setAppId(appid);
|
message.setAppId(appid);
|
||||||
message.setTitle(farmMsgDTO.getType().getDesc() + farmMsgDTO.getOperation().getDesc() + "通知");
|
message.setTitle(farmMsgDTO.getType().getDesc() + farmMsgDTO.getOperation().getDesc() + "通知");
|
||||||
message.setDescription(LocalDateTimeUtil.formatNormal(LocalDateTime.now()));
|
message.setDescription(LocalDateTimeUtil.formatNormal(LocalDateTime.now()));
|
||||||
message.setPage(farmMsgDTO.getType().equals(FarmMsgTypeEnum.PROJECT) ? "pages/project/index" : "pages/task/index");
|
message.setPage(farmMsgDTO.getType().equals(FarmMsgTypeEnum.PROJECT) ? "pages/project/index" : "pages/task/taskDetail/index?id="+ farmMsgDTO.getId());
|
||||||
|
|
||||||
Map<String, String> map2 = new HashMap<>();
|
Map<String, String> map2 = new HashMap<>();
|
||||||
map2.put("发起人", createUser.getName());
|
map2.put("发起人", createUser.getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user