| @@ -185,18 +185,18 @@ public class BaseController { | |||||
| return ipaddress; | return ipaddress; | ||||
| } | } | ||||
| public void checkLoginUserPhone(WxMerchantBUser orgUser,EnumAppPlat appPlat) throws Exception { | |||||
| if (null == orgUser) { | |||||
| public void checkLoginUserPhone(TenantEntity tenantEntity,String openId,String merchantBUserPhone,EnumAppPlat appPlat) throws Exception { | |||||
| if (StringUtils.isBlank(openId)) { | |||||
| return; | return; | ||||
| } | } | ||||
| CUser user = cuserFactory.getBUserService(appPlat).getById(orgUser.getId(), orgUser.getTenantId()); | |||||
| CUser user = cuserFactory.getBUserService(appPlat).getByOpenId(openId, tenantEntity.getTenantId()); | |||||
| if (null == user) { | if (null == user) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (StringUtils.isBlank(user.getPhone())) { | if (StringUtils.isBlank(user.getPhone())) { | ||||
| return; | return; | ||||
| } | } | ||||
| checkLoginUserPhone(orgUser,user.getPhone(),orgUser.getPhone()); | |||||
| checkLoginUserPhone(tenantEntity,user.getPhone(),merchantBUserPhone); | |||||
| } | } | ||||
| public void checkLoginUserPhone(TenantEntity tenantEntity,String cuserPhone,String merchantBUserPhone) { | public void checkLoginUserPhone(TenantEntity tenantEntity,String cuserPhone,String merchantBUserPhone) { | ||||
| @@ -106,16 +106,6 @@ public class WxInfoController extends BaseController { | |||||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | ||||
| } | } | ||||
| if (true) { | |||||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||||
| } | |||||
| try { | |||||
| this.checkLoginUserPhone(buUser, appPlat); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), e.getMessage()); | |||||
| } | |||||
| String session_key = null; | String session_key = null; | ||||
| String openId = null; | String openId = null; | ||||
| String unionId = null; | String unionId = null; | ||||
| @@ -139,6 +129,12 @@ public class WxInfoController extends BaseController { | |||||
| logger.error(e.getMessage(), e); | logger.error(e.getMessage(), e); | ||||
| return new ResultData(ErrorCode.SESSION_KEY_DECODE_ERR, resultMap); | return new ResultData(ErrorCode.SESSION_KEY_DECODE_ERR, resultMap); | ||||
| } | } | ||||
| try { | |||||
| this.checkLoginUserPhone(buUser,openId,buUser.getPhone(), appPlat); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), e.getMessage()); | |||||
| } | |||||
| logger.info("登录账号ID(bUserId):" + userId + "openId:" + openId); | logger.info("登录账号ID(bUserId):" + userId + "openId:" + openId); | ||||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | ||||
| @@ -258,23 +258,6 @@ public class WxMerchantBUserController extends BaseController { | |||||
| Map<String, Object> resultMap = new HashMap<>(); | Map<String, Object> resultMap = new HashMap<>(); | ||||
| resultMap.put("bUserId", orgUser.getId()); | resultMap.put("bUserId", orgUser.getId()); | ||||
| resultMap.put("logined", true); | resultMap.put("logined", true); | ||||
| try { | |||||
| WxAppinfo wxAppinfo = getAppInfo(appId); | |||||
| if(wxAppinfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| if(!wxAppinfo.getEnable().equals(EnumEnableType.Enable.getCode())){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_ENABLE); | |||||
| } | |||||
| EnumAppPlat appPlat = EnumAppPlat.getByCode(wxAppinfo.getPlat()); | |||||
| if(appPlat == null){ | |||||
| return new ResultData(ErrorCode.APP_PLAT_ERROR); | |||||
| } | |||||
| checkLoginUserPhone(orgUser, appPlat); | |||||
| }catch(Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| return new ResultData(resultMap); | return new ResultData(resultMap); | ||||
| } else { | } else { | ||||
| logger.error("B端用户不存在"); | logger.error("B端用户不存在"); | ||||