Authored by zhengwen.ge

IP优化有两个只取第一个

... ... @@ -99,7 +99,11 @@ public class ActivateUnionRest {
log.warn("activateUnion error with param is {}", vo);
return new ActiveUnionResponseBO(600, "error");
}
bo.setClientIp(RemoteIPInterceptor.getRemoteIP());
//IP取出来的有可能是42.239.40.36,123.151.42.50,只取第一个
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
bo.setClientIp(clientIp);
//多线程处理
exe.execute(new RunActivate(bo));
return new ActiveUnionResponseBO(200, "success");
... ...
... ... @@ -60,7 +60,11 @@ public class ClickUnionRest {
if ("iphone".equals(request.getClient_type())) {
request.setClient_type(ClientTypeEnum.IOS.getName());
}
request.setClientIp(RemoteIPInterceptor.getRemoteIP());
String IP = RemoteIPInterceptor.getRemoteIP();
// String IP = "42.236.215.29, 123.151.42.48";
String[] IPS = IP.split(",");
String clientIp = IPS[0];
request.setClientIp(clientIp);
clickUnion.info("addUnion with param is {}", request);
UnionResponse response = unionService.clickUnion(request);
log.info("addUnion with result is {}, and request is {}", response, request);
... ... @@ -85,8 +89,10 @@ public class ClickUnionRest {
}else {
request = unionService.clickHttpRequestTOBO(httpServletRequest,request);
}
request.setClientIp(RemoteIPInterceptor.getRemoteIP());
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
request.setClientIp(clientIp);
// IUnionService service = SpringContextUtil.getBean(bean, IUnionService.class);
clickUnion.info("addCommonUnion request is {}",request);
UnionResponse response = unionService.clickUnion(request);
... ... @@ -105,7 +111,10 @@ public class ClickUnionRest {
public void addUnion4Special(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
log.info("addUnion4Special with param is {}", bo);
try {
bo.setClientIp(RemoteIPInterceptor.getRemoteIP());
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
bo.setClientIp(clientIp);
String agent = request.getHeader("user-agent");
log.info("user-agent={}", agent);
if (StringUtils.isEmpty(agent)) {
... ... @@ -156,7 +165,10 @@ public class ClickUnionRest {
if (StringUtils.isEmpty(bo.getUnion_type())) {
return;
}
bo.setClientIp(RemoteIPInterceptor.getRemoteIP());
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
bo.setClientIp(clientIp);
bo.setClient_type("android");
bo.setAppid("com.yoho");
String agent = request.getHeader("user-agent");
... ... @@ -216,8 +228,11 @@ public class ClickUnionRest {
String key = e.nextElement();
log.info("addMonitor with key={}, value={}", key, request.getParameter(key));
}
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
bo.setClientIp(RemoteIPInterceptor.getRemoteIP());
bo.setClientIp(clientIp);
String agent = request.getHeader("user-agent");
log.info("addMonitor user-agent={}", agent);
try{
... ...
... ... @@ -65,7 +65,10 @@ public class MobvistaUnionRest {
req.setAppid("android");
downloadURL = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk";
}
req.setIp(RemoteIPInterceptor.getRemoteIP());
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
req.setIp(clientIp);
String url = "http://stat.mobvista.com/install?mobvista_pl="+req.getDevice_type()+"&mobvista_campuuid="+req.getUuid()+""
+ "&mobvista_ip="+req.getIp()+"&mobvista_clickid="+req.getClickid()+"&mobvista_gaid=&mobvista_devid=";
req.setCallbackurl(url);
... ...
... ... @@ -37,7 +37,11 @@ public interface IUnionService {
clickUnionRequestBO.setUnion_type(request.getParameter("union_type"));
clickUnionRequestBO.setImei(request.getParameter("imei"));
clickUnionRequestBO.setTd(request.getParameter("td"));
clickUnionRequestBO.setClientIp(RemoteIPInterceptor.getRemoteIP());
String IP = RemoteIPInterceptor.getRemoteIP();
String[] IPS = IP.split(",");
String clientIp = IPS[0];
clickUnionRequestBO.setClientIp(clientIp);
return clickUnionRequestBO;
}
... ...