Authored by ping

修改,兼容uc

@@ -94,11 +94,11 @@ public class ClickUnionRest { @@ -94,11 +94,11 @@ public class ClickUnionRest {
94 if (agent.toLowerCase().indexOf("mac os x") >= 0 || agent.toLowerCase().indexOf("iphone") >= 0) { 94 if (agent.toLowerCase().indexOf("mac os x") >= 0 || agent.toLowerCase().indexOf("iphone") >= 0) {
95 String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like")); 95 String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
96 bo.setTd("ios_" + version.replaceAll("_", ".")); 96 bo.setTd("ios_" + version.replaceAll("_", "."));
  97 + }
  98 + }
97 bo.setClient_type("ios"); 99 bo.setClient_type("ios");
98 bo.setAppid("490655927"); 100 bo.setAppid("490655927");
99 log.info("addMonitor request={}", bo); 101 log.info("addMonitor request={}", bo);
100 - }  
101 - }  
102 unionService.clickUnion(bo); 102 unionService.clickUnion(bo);
103 log.info("addMonitor with result is {}, and request is {}", response, bo); 103 log.info("addMonitor with result is {}, and request is {}", response, bo);
104 response.setStatus(200); 104 response.setStatus(200);
@@ -77,10 +77,10 @@ public class UnionServiceImpl implements IUnionService { @@ -77,10 +77,10 @@ public class UnionServiceImpl implements IUnionService {
77 log.warn("clickUnion error because appid is empty with param is {}", request); 77 log.warn("clickUnion error because appid is empty with param is {}", request);
78 return new UnionResponse(201, "appid is empty"); 78 return new UnionResponse(201, "appid is empty");
79 } 79 }
80 - if (StringUtils.isEmpty(request.getTd())) {  
81 - log.warn("clickUnion error because td is empty with param is {}", request);  
82 - return new UnionResponse(201, "td is empty");  
83 - } 80 +// if (StringUtils.isEmpty(request.getTd())) {
  81 +// log.warn("clickUnion error because td is empty with param is {}", request);
  82 +// return new UnionResponse(201, "td is empty");
  83 +// }
84 if (StringUtils.isEmpty(request.getUnion_type())) { 84 if (StringUtils.isEmpty(request.getUnion_type())) {
85 log.warn("clickUnion error because union_type is empty with param is {}", request); 85 log.warn("clickUnion error because union_type is empty with param is {}", request);
86 return new UnionResponse(201, "union_type is empty"); 86 return new UnionResponse(201, "union_type is empty");
@@ -100,8 +100,10 @@ public class UnionServiceImpl implements IUnionService { @@ -100,8 +100,10 @@ public class UnionServiceImpl implements IUnionService {
100 // } 100 // }
101 101
102 //组装redis保存的key 102 //组装redis保存的key
103 - String key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd();  
104 - 103 + String key = UNION_KEY + "_" + request.getClientIp();
  104 + if (StringUtils.isNotEmpty(request.getTd())) {
  105 + key += "_" + request.getTd();
  106 + }
105 // String value = yhValueOperations.get(key); 107 // String value = yhValueOperations.get(key);
106 // log.info("clickUnion get key={}, value={}", key, value); 108 // log.info("clickUnion get key={}, value={}", key, value);
107 // //如果redis中已经存在该用户点击信息,则不再重复保存 109 // //如果redis中已经存在该用户点击信息,则不再重复保存
@@ -185,9 +187,9 @@ public class UnionServiceImpl implements IUnionService { @@ -185,9 +187,9 @@ public class UnionServiceImpl implements IUnionService {
185 String key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd(); 187 String key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd();
186 String value = yhValueOperations.get(key); 188 String value = yhValueOperations.get(key);
187 if (StringUtils.isEmpty(value) && ClientTypeEnum.IOS.getName().equals(request.getClient_type())) { 189 if (StringUtils.isEmpty(value) && ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
188 - String[] arr = request.getTd().split("_");  
189 - request.setTd(arr[2] + "_" + arr[3]);  
190 - key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd(); 190 +// String[] arr = request.getTd().split("_");
  191 +// request.setTd(arr[2] + "_" + arr[3]);
  192 + key = UNION_KEY + "_" + request.getClientIp();
191 value = yhValueOperations.get(key); 193 value = yhValueOperations.get(key);
192 } 194 }
193 195