...
|
...
|
@@ -217,25 +217,25 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
// 检查输入参数
|
|
|
if (StringUtils.isEmpty(request.getAppid())) {
|
|
|
log.warn("activateUnion error because appid is empty with param is {}", request);
|
|
|
return new UnionResponse(201, "appid is empty");
|
|
|
return new UnionResponse(200, "appid is empty",new JSONObject());
|
|
|
}
|
|
|
if (StringUtils.isEmpty(request.getTd())) {
|
|
|
log.warn("activateUnion error because td is empty with param is {}", request);
|
|
|
return new UnionResponse(201, "td is empty");
|
|
|
return new UnionResponse(200, "td is empty",new JSONObject());
|
|
|
}
|
|
|
if (StringUtils.isEmpty(request.getUdid())) {
|
|
|
log.warn("activateUnion error because udid is empty with param is {}", request);
|
|
|
return new UnionResponse(201, "udid is empty");
|
|
|
return new UnionResponse(200, "udid is empty",new JSONObject());
|
|
|
}
|
|
|
|
|
|
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type()) && StringUtils.isEmpty(request.getIdfa())) {
|
|
|
log.warn("activateUnion error because idfa is empty with request is {}", request);
|
|
|
return new UnionResponse(201, "idfa is empty");
|
|
|
return new UnionResponse(200, "idfa is empty",new JSONObject());
|
|
|
}
|
|
|
|
|
|
if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type()) && StringUtils.isEmpty(request.getImei())) {
|
|
|
log.warn("activateUnion error because imei is empty with request is {}", request);
|
|
|
return new UnionResponse(201, "imei is empty");
|
|
|
return new UnionResponse(200, "imei is empty",new JSONObject());
|
|
|
}
|
|
|
|
|
|
try{
|
...
|
...
|
@@ -316,7 +316,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
value = yhValueOperations.get(key);
|
|
|
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(204, "user not click");
|
|
|
return new UnionResponse(200, "user not click",new JSONObject());
|
|
|
}
|
|
|
|
|
|
}
|
...
|
...
|
@@ -327,7 +327,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
// 如果redis中不存在存在该用户点击信息,则退出
|
|
|
if (StringUtils.isEmpty(value)) {
|
|
|
log.warn("activateUnion error user not click info. with param is {}", request);
|
|
|
return new UnionResponse(204, "user not click");
|
|
|
return new UnionResponse(200, "user not click",new JSONObject());
|
|
|
}
|
|
|
|
|
|
// 把存储的字符串变为对象
|
...
|
...
|
@@ -349,17 +349,23 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
//强制删除带ip的key
|
|
|
yHRedisTemplate.delete(UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey());
|
|
|
|
|
|
if (union != null && union.getIsActivate() != null && union.getIsActivate().byteValue() == 1) {
|
|
|
// 如果90天之内有过激活日志,则不允许重复激活
|
|
|
log.warn("activateUnion error because 90 days has activate info with param is {}", request);
|
|
|
return new UnionResponse(203, "have activite in 90 days");
|
|
|
}
|
|
|
String unionTypekey = "yh:union:uniontype:"+click.getUnion_type();
|
|
|
MktMarketingUrl mktMarketingUrl = redisValueCache.get(unionTypekey,MktMarketingUrl.class);
|
|
|
if(mktMarketingUrl==null){
|
|
|
mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(click.getUnion_type()));
|
|
|
redisValueCache.set(unionTypekey, mktMarketingUrl, 1, TimeUnit.HOURS);
|
|
|
}
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("landing_page_url",StringUtils.isEmpty(mktMarketingUrl.getLandingPageUrl()) ? "" : mktMarketingUrl.getLandingPageUrl());
|
|
|
|
|
|
if (union != null && union.getIsActivate() != null && union.getIsActivate().byteValue() == 1) {
|
|
|
// 如果90天之内有过激活日志,则不允许重复激活
|
|
|
log.warn("activateUnion error because 90 days has activate info with param is {}", request);
|
|
|
return new UnionResponse(200, "have activite in 90 days",result);
|
|
|
}
|
|
|
// UnionTypeModel u = UnionConstant.unionTypeMap.get(Integer.parseInt(click.getUnion_type()));
|
|
|
|
|
|
UnionTypeModel u = new UnionTypeModel();
|
|
|
u.setName(mktMarketingUrl.getName());
|
|
|
u.setValue(String.valueOf(mktMarketingUrl.getUnionType()));
|
...
|
...
|
@@ -407,7 +413,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
j.put("tdid", request.getTdid());
|
|
|
activeDingdang.info(j.toString());
|
|
|
}
|
|
|
return new UnionResponse(203, "have activite in 90 days");
|
|
|
return new UnionResponse(200, "have activite in 90 days",result);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -489,7 +495,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
}
|
|
|
if (StringUtils.isEmpty(url)) {
|
|
|
log.info("activateUnion in success request is {}", request);
|
|
|
return new UnionResponse();
|
|
|
return new UnionResponse(200,"success",result);
|
|
|
}
|
|
|
if(!"3".equals(union_type)||!"100000000000453".equals(union_type)){
|
|
|
url = URLDecoder.decode(url, "UTF-8");
|
...
|
...
|
@@ -506,7 +512,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
activeUnion.info("activateUnion call union success url={}, and result={}", url, pair);
|
|
|
if (pair.getLeft() != 200) {
|
|
|
log.warn("callback error with request={}", request);
|
|
|
return new UnionResponse(204, "callback error");
|
|
|
return new UnionResponse(200, "callback error",result);
|
|
|
}
|
|
|
//如果来源是广点通,则把广点通的一些信息记入表,给之后做转化上报使用
|
|
|
if(union_type.equals("3")){
|
...
|
...
|
@@ -520,12 +526,12 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
|
}
|
|
|
|
|
|
activeUnion.info("activateUnion in success request is {}", request);
|
|
|
|
|
|
return new UnionResponse();
|
|
|
|
|
|
return new UnionResponse(200,"success",result);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
log.error("activateUnion error with request={}", request, e);
|
|
|
return new UnionResponse(300, e.getMessage());
|
|
|
return new UnionResponse(200, e.getMessage(),new JSONObject());
|
|
|
}
|
|
|
|
|
|
}
|
...
|
...
|
|