Browse Source

微信登录

zyh
小久哥 3 years ago
parent
commit
510fb3814f
  1. 12
      yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
  2. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java

12
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java

@ -87,6 +87,8 @@ public class AuthController {
private UserRoleMapper userRoleMapper;
@Resource
private PasswordEncoder passwordEncoder;
@Resource
private WxMaService wxMaService;
@PostMapping("/login")
@ -105,12 +107,22 @@ public class AuthController {
// 企业微信登录
if ("wxcp".equals(dto.getCode())){
cpuser = cpUserService.getByUserId("test");
}else{
if (dto.getPlatform().equalsIgnoreCase("WX")){
//普通微信
WxMaJscode2SessionResult result = wxMaService.jsCode2SessionInfo(dto.getCode());
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)){
return CommonResult.error(ErrorCodeConstants.USER_NOT_EXISTS.getCode(),"未发现绑定的企业用户,暂时无法登录,请联系管理员");

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java

@ -146,7 +146,7 @@ public class FarmMsgAspect {
message.setAppId(appid);
message.setTitle(farmMsgDTO.getType().getDesc() + farmMsgDTO.getOperation().getDesc() + "通知");
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<>();
map2.put("发起人", createUser.getName());

Loading…
Cancel
Save