|
|
@ -127,6 +127,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
|
|
|
|
//获取访问的二级域名 |
|
|
|
String subDomain = getSubDomain(request); |
|
|
|
//log.info("前端访问域名: {}", subDomain); |
|
|
|
if (ObjectUtil.isNotEmpty(subDomain)){ |
|
|
|
//从商家设置的商城访问域名表中获取商家id,即project |
|
|
|
CerePlatformBusiness business = cerePlatformBusinessDAO.findByDomain(subDomain); |
|
|
@ -143,6 +144,8 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
project = "0"; |
|
|
|
} |
|
|
|
|
|
|
|
//log.info("商家project: {}", project); |
|
|
|
|
|
|
|
//user存在 设置user |
|
|
|
if(ObjectUtil.isNotNull(user)){ |
|
|
|
String userProject = user.getProject(); |
|
|
@ -206,12 +209,13 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { |
|
|
|
*/ |
|
|
|
private String getSubDomain(HttpServletRequest request) { |
|
|
|
//String host = request.getServerName(); |
|
|
|
String host = request.getHeader("Host"); |
|
|
|
String[] parts = host.split("\\."); |
|
|
|
//String host = request.getHeader("Host"); |
|
|
|
String forwardedHost = request.getHeader("X-Forwarded-Host"); |
|
|
|
/* String[] parts = host.split("\\."); |
|
|
|
if (parts.length >= 3){ |
|
|
|
return parts[0]; |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
return ""; |
|
|
|
return forwardedHost; |
|
|
|
} |
|
|
|
} |