|
|
|
@@ -75,13 +75,19 @@ public class WeappController { |
|
|
|
} |
|
|
|
|
|
|
|
log.info("微信login返回信息:{}", weChatUserInfo); |
|
|
|
R<SysEnterpriseStaff> staff = tenantService.existStaff(weChatUserInfo.getOpenid(), SecurityConstants.INNER); |
|
|
|
R<SysEnterpriseStaff> staffR = tenantService.queryStaff(weChatUserInfo.getOpenid(), SecurityConstants.INNER); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
try { |
|
|
|
map.put("weappAuth", CryptoUtil.encrypt(weChatUserInfo.toString())); |
|
|
|
if (staff.getData() != null) { |
|
|
|
R<LoginUser> loginInfoResult = remoteLoginService.getLoginInfoInnerByPhone(staff.getData().getPhone(), SecurityConstants.INNER); |
|
|
|
SysEnterpriseStaff staff = staffR.getData(); |
|
|
|
if (staff != null) { |
|
|
|
R<LoginUser> loginInfoResult = remoteLoginService.getLoginInfoInnerByPhone(staff.getPhone(), SecurityConstants.INNER); |
|
|
|
map.putAll(tokenService.createToken(loginInfoResult.getData())); |
|
|
|
String token = (String)map.get("access_token"); |
|
|
|
log.info("信息,token:{}, enterpriseName:{}, source:{}", token, JwtUtil.getEnterpriseName(token),JwtUtil.getSourceName(token)); |
|
|
|
JSONObject json = staffService.fetchStaffByPhone(staff.getPhone(), Long.valueOf(JwtUtil.getEnterpriseId(token)), JwtUtil.getSourceName(token), SecurityConstants.INNER); |
|
|
|
map.put("enterpriseName", loginInfoResult.getData().getEnterpriseName()); |
|
|
|
map.put("staff", json.get("data")); |
|
|
|
return AjaxResult.success(map); |
|
|
|
} |
|
|
|
return AjaxResult.success(map); |
|
|
|
|