Browse Source

fix

release_toaliyun_real
xiaohanzi 5 years ago
parent
commit
4f6a7f4ea4
1 changed files with 17 additions and 2 deletions
  1. +17
    -2
      mallinkBApi/src/main/java/com/iformall/controller/BaseController.java

+ 17
- 2
mallinkBApi/src/main/java/com/iformall/controller/BaseController.java View File

@@ -77,8 +77,10 @@ public class BaseController {
return id;
}
public WxMerchantBUser getLoginBUser() {
Long userId = getMerchantBUserId();
private WxMerchantBUser getWxMerchantBUser(Long userId) {
if (null == userId) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"当前用户登陆信息已失效,请重新登陆.");
}
WxMerchantBUser user = wxMerchantBUserService.getById(userId);
if (user == null) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"BUser[id:"+userId+"]未查询到WxMerchantBUser。请联系管理员或者重新登陆.");
@@ -86,6 +88,19 @@ public class BaseController {
return user;
}
//该方法兼容微信登陆和非微信登陆
public WxMerchantBUser getLoginBUser() {
Long wxBuserId = getWxBuserId();
if (null != wxBuserId) {
WxBuser buser = getWxBuser();
Long userId = buser.getUserId();
return getWxMerchantBUser(userId);
}else {
Long userId = getMerchantBUserId();
return getWxMerchantBUser(userId);
}
}
public Long getWxBuserId() {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
Long id = (Long) request.getAttribute(Constant.LOGIN_USER_KEY);


Loading…
Cancel
Save