...
|
...
|
@@ -84,8 +84,8 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
// @Redis("yohoNoSyncRedis")
|
|
|
// YHValueOperations yhValueOperations;
|
|
|
|
|
|
@Redis("yohoNoSyncRedis")
|
|
|
RedisValueCache yhValueOperations;
|
|
|
// @Redis("yohoNoSyncRedis")
|
|
|
// RedisValueCache yhValueOperations;
|
|
|
|
|
|
@Value("${exclude.union.type:100000000000349}")
|
|
|
private String EXCLUDE_UNION_TYPE;
|
...
|
...
|
@@ -222,11 +222,11 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
String invalidTime = "activeTime"+"_"+request.getUnion_type();
|
|
|
// 有效时间改成5天
|
|
|
DynamicIntProperty activeTime = DynamicPropertyFactory.getInstance().getIntProperty(invalidTime, 5 * 24);
|
|
|
yhValueOperations.set(key, JSON.toJSONString(request), 7 * 24, TimeUnit.HOURS);
|
|
|
redisValueCache.set(key, JSON.toJSONString(request), 7 * 24, TimeUnit.HOURS);
|
|
|
|
|
|
//把IP作为key,也保存到redis
|
|
|
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey();
|
|
|
yhValueOperations.set(key, JSON.toJSONString(request), activeTime.get(), TimeUnit.HOURS);
|
|
|
redisValueCache.set(key, JSON.toJSONString(request), activeTime.get(), TimeUnit.HOURS);
|
|
|
clickUnion.info("clickUnion set redis second success. with key={}, value={}", key, JSON.toJSONString(request));
|
|
|
|
|
|
return new UnionResponse();
|
...
|
...
|
@@ -281,14 +281,14 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
} else if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type())) {
|
|
|
key = UNION_KEY + "_" + request.getImei() + "_" + request.getAppkey();
|
|
|
}
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
if (StringUtils.isEmpty(value)) {
|
|
|
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
|
|
|
key = UNION_KEY + "_" + MD5.md5(request.getIdfa()) + "_" + request.getAppkey();
|
|
|
} else if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type())) {
|
|
|
key = UNION_KEY + "_" + MD5.md5(request.getImei()) + "_" + request.getAppkey();
|
|
|
}
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
}
|
|
|
//微博
|
|
|
if(StringUtils.isEmpty(value)){
|
...
|
...
|
@@ -297,7 +297,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
} else if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type())) {
|
|
|
key = UNION_KEY + "_" + MD5.md5(request.getImei()).toUpperCase() + "_" + request.getAppkey();
|
|
|
}
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
}
|
|
|
if(StringUtils.isEmpty(value)){
|
|
|
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
|
...
|
...
|
@@ -305,7 +305,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
} else if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type())) {
|
|
|
key = UNION_KEY + "_" + MD5.md5(request.getImei()).toLowerCase() + "_" + request.getAppkey();
|
|
|
}
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
}
|
|
|
if(StringUtils.isEmpty(value)){
|
|
|
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
|
...
|
...
|
@@ -313,7 +313,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
} else if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type())) {
|
|
|
key = UNION_KEY + "_" + MD5.md5(request.getImei().toUpperCase()).toUpperCase() + "_" + request.getAppkey();
|
|
|
}
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -322,7 +322,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
if (StringUtils.isNotEmpty(td)) {
|
|
|
if (StringUtils.isEmpty(value)) {
|
|
|
key = UNION_KEY + "_" + request.getClientIp() + "_" + td + "_" + request.getAppkey();
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
activeUnion.info("activateUnion with get redis first with key={}, value={}",key, value);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -331,7 +331,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
&& StringUtils.isEmpty(value)){
|
|
|
td = "samsung" + td;
|
|
|
key = UNION_KEY + "_" + request.getClientIp() + "_" + td + "_" + request.getAppkey();
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
activeUnion.info("activateUnion with get redis second with key={}, value={}",key, value);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -340,13 +340,13 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
if (arr.length > 3) {
|
|
|
td=(arr[2] + "_" + arr[3]);
|
|
|
key = UNION_KEY + "_" + request.getClientIp() + "_" + td + "_" + request.getAppkey();
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
activeUnion.info("activateUnion with get redis third with key={}, value={}", key, value);
|
|
|
}
|
|
|
if(arr.length==3){
|
|
|
td = (arr[1]+"_"+arr[2]);
|
|
|
key = UNION_KEY + "_" + request.getClientIp() + "_" + td + "_" + request.getAppkey();
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
activeUnion.info("activateUnion with get redis fourth with key={}, value={}", key, value);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -357,7 +357,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
value = null;
|
|
|
}else{
|
|
|
key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey();
|
|
|
value = yhValueOperations.get(key,String.class);
|
|
|
value = redisValueCache.get(key,String.class);
|
|
|
if(StringUtils.isNotEmpty(value)){
|
|
|
ipMatch.info("activateUnion with IP params td is {},imei is {},idfa is {},IP is {},---- clickMsg is {}",request.getTd(),request.getImei(),request.getIdfa(),request.getClientIp(),value);
|
|
|
return new UnionResponse(200, "user not click",new JSONObject());
|
...
|
...
|
@@ -478,7 +478,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
try{
|
|
|
DynamicIntProperty activeTime = DynamicPropertyFactory.getInstance().getIntProperty("activeTime_pay_channel", 90);
|
|
|
String payChannelKey = UNION_PAY_CHANNEL_KEY_PRE + request.getUdid();
|
|
|
yhValueOperations.set(payChannelKey, request.getClient_type(), activeTime.get(), TimeUnit.DAYS);
|
|
|
redisValueCache.set(payChannelKey, request.getClient_type(), activeTime.get(), TimeUnit.DAYS);
|
|
|
}catch (Exception e){
|
|
|
log.warn("set redis cache error, udid is {}, client_type is {}", request.getUdid(), request.getClient_type());
|
|
|
}
|
...
|
...
|
|