...
|
...
|
@@ -72,15 +72,25 @@ public class ClickUnionRest { |
|
|
bo.setClientIp(RemoteIPInterceptor.getRemoteIP());
|
|
|
String agent = request.getHeader("user-agent");
|
|
|
log.info("user-agent={}", agent);
|
|
|
if (!StringUtils.isEmpty(agent)) {
|
|
|
if (agent.toLowerCase().indexOf("mac os x") >= 0 || agent.toLowerCase().indexOf("iphone") >= 0) {
|
|
|
String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
|
|
|
bo.setTd("ios_" + version.replaceAll("_", "."));
|
|
|
bo.setClient_type("ios");
|
|
|
bo.setAppid("490655927");
|
|
|
log.info("addUnion4Special request={}", bo);
|
|
|
}
|
|
|
if (StringUtils.isEmpty(agent)) {
|
|
|
log.warn("addUnion4Special user-agent is empty with bo={}", bo);
|
|
|
return;
|
|
|
}
|
|
|
if (agent.toLowerCase().indexOf("mac os x") < 0 && agent.toLowerCase().indexOf("iphone") < 0) {
|
|
|
log.warn("addUnion4Special is not ios with user-agent={}, bo={}", agent, bo);
|
|
|
return;
|
|
|
}
|
|
|
if (agent.indexOf(" like") < agent.indexOf(" OS ") + 4) {
|
|
|
log.warn("addUnion4Special agent is not correct with user-agent={}, bo={}", agent, bo);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
|
|
|
log.info("addUnion4Special version={}", version);
|
|
|
bo.setTd("ios_" + version.replaceAll("_", "."));
|
|
|
bo.setClient_type("ios");
|
|
|
bo.setAppid("490655927");
|
|
|
log.info("addUnion4Special request={}", bo);
|
|
|
unionService.clickUnion(bo);
|
|
|
log.info("addUnion4Special with result is {}, and request is {}", response, bo);
|
|
|
response.setStatus(301);
|
...
|
...
|
@@ -90,6 +100,19 @@ public class ClickUnionRest { |
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
String agent = "Mozilla/5.0 (iPhone; CPU iPhone OS like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile TADChid/0 AppVersion/4.5.0";
|
|
|
agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13B143 TADChid/0 AppVersion/4.8.5";
|
|
|
if (agent.toLowerCase().indexOf("mac os x") < 0 && agent.toLowerCase().indexOf("iphone") < 0) {
|
|
|
return;
|
|
|
}
|
|
|
if (agent.indexOf(" like") < agent.indexOf(" OS ") + 4) {
|
|
|
return;
|
|
|
}
|
|
|
String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
|
|
|
log.info("addUnion4Special version={}", version);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/addMonitor")
|
|
|
public void addMonitor(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
|
|
|
log.info("addMonitor with param is {}", bo);
|
...
|
...
|
|