Authored by ping

修改,兼容uc

... ... @@ -94,11 +94,11 @@ public class ClickUnionRest {
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("addMonitor request={}", bo);
}
}
bo.setClient_type("ios");
bo.setAppid("490655927");
log.info("addMonitor request={}", bo);
unionService.clickUnion(bo);
log.info("addMonitor with result is {}, and request is {}", response, bo);
response.setStatus(200);
... ...
... ... @@ -77,10 +77,10 @@ public class UnionServiceImpl implements IUnionService {
log.warn("clickUnion error because appid is empty with param is {}", request);
return new UnionResponse(201, "appid is empty");
}
if (StringUtils.isEmpty(request.getTd())) {
log.warn("clickUnion error because td is empty with param is {}", request);
return new UnionResponse(201, "td is empty");
}
// if (StringUtils.isEmpty(request.getTd())) {
// log.warn("clickUnion error because td is empty with param is {}", request);
// return new UnionResponse(201, "td is empty");
// }
if (StringUtils.isEmpty(request.getUnion_type())) {
log.warn("clickUnion error because union_type is empty with param is {}", request);
return new UnionResponse(201, "union_type is empty");
... ... @@ -100,8 +100,10 @@ public class UnionServiceImpl implements IUnionService {
// }
//组装redis保存的key
String key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd();
String key = UNION_KEY + "_" + request.getClientIp();
if (StringUtils.isNotEmpty(request.getTd())) {
key += "_" + request.getTd();
}
// String value = yhValueOperations.get(key);
// log.info("clickUnion get key={}, value={}", key, value);
// //如果redis中已经存在该用户点击信息,则不再重复保存
... ... @@ -185,9 +187,9 @@ public class UnionServiceImpl implements IUnionService {
String key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd();
String value = yhValueOperations.get(key);
if (StringUtils.isEmpty(value) && ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
String[] arr = request.getTd().split("_");
request.setTd(arr[2] + "_" + arr[3]);
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd();
// String[] arr = request.getTd().split("_");
// request.setTd(arr[2] + "_" + arr[3]);
key = UNION_KEY + "_" + request.getClientIp();
value = yhValueOperations.get(key);
}
... ...