|
@@ -217,25 +217,25 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
@@ -217,25 +217,25 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
217
|
// 检查输入参数
|
217
|
// 检查输入参数
|
218
|
if (StringUtils.isEmpty(request.getAppid())) {
|
218
|
if (StringUtils.isEmpty(request.getAppid())) {
|
219
|
log.warn("activateUnion error because appid is empty with param is {}", request);
|
219
|
log.warn("activateUnion error because appid is empty with param is {}", request);
|
220
|
- return new UnionResponse(201, "appid is empty");
|
220
|
+ return new UnionResponse(200, "appid is empty",new JSONObject());
|
221
|
}
|
221
|
}
|
222
|
if (StringUtils.isEmpty(request.getTd())) {
|
222
|
if (StringUtils.isEmpty(request.getTd())) {
|
223
|
log.warn("activateUnion error because td is empty with param is {}", request);
|
223
|
log.warn("activateUnion error because td is empty with param is {}", request);
|
224
|
- return new UnionResponse(201, "td is empty");
|
224
|
+ return new UnionResponse(200, "td is empty",new JSONObject());
|
225
|
}
|
225
|
}
|
226
|
if (StringUtils.isEmpty(request.getUdid())) {
|
226
|
if (StringUtils.isEmpty(request.getUdid())) {
|
227
|
log.warn("activateUnion error because udid is empty with param is {}", request);
|
227
|
log.warn("activateUnion error because udid is empty with param is {}", request);
|
228
|
- return new UnionResponse(201, "udid is empty");
|
228
|
+ return new UnionResponse(200, "udid is empty",new JSONObject());
|
229
|
}
|
229
|
}
|
230
|
|
230
|
|
231
|
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type()) && StringUtils.isEmpty(request.getIdfa())) {
|
231
|
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type()) && StringUtils.isEmpty(request.getIdfa())) {
|
232
|
log.warn("activateUnion error because idfa is empty with request is {}", request);
|
232
|
log.warn("activateUnion error because idfa is empty with request is {}", request);
|
233
|
- return new UnionResponse(201, "idfa is empty");
|
233
|
+ return new UnionResponse(200, "idfa is empty",new JSONObject());
|
234
|
}
|
234
|
}
|
235
|
|
235
|
|
236
|
if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type()) && StringUtils.isEmpty(request.getImei())) {
|
236
|
if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type()) && StringUtils.isEmpty(request.getImei())) {
|
237
|
log.warn("activateUnion error because imei is empty with request is {}", request);
|
237
|
log.warn("activateUnion error because imei is empty with request is {}", request);
|
238
|
- return new UnionResponse(201, "imei is empty");
|
238
|
+ return new UnionResponse(200, "imei is empty",new JSONObject());
|
239
|
}
|
239
|
}
|
240
|
|
240
|
|
241
|
try{
|
241
|
try{
|
|
@@ -316,7 +316,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
@@ -316,7 +316,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
316
|
value = yhValueOperations.get(key);
|
316
|
value = yhValueOperations.get(key);
|
317
|
if(StringUtils.isNotEmpty(value)){
|
317
|
if(StringUtils.isNotEmpty(value)){
|
318
|
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);
|
318
|
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);
|
319
|
- return new UnionResponse(204, "user not click");
|
319
|
+ return new UnionResponse(200, "user not click",new JSONObject());
|
320
|
}
|
320
|
}
|
321
|
|
321
|
|
322
|
}
|
322
|
}
|
|
@@ -327,7 +327,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
@@ -327,7 +327,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
327
|
// 如果redis中不存在存在该用户点击信息,则退出
|
327
|
// 如果redis中不存在存在该用户点击信息,则退出
|
328
|
if (StringUtils.isEmpty(value)) {
|
328
|
if (StringUtils.isEmpty(value)) {
|
329
|
log.warn("activateUnion error user not click info. with param is {}", request);
|
329
|
log.warn("activateUnion error user not click info. with param is {}", request);
|
330
|
- return new UnionResponse(204, "user not click");
|
330
|
+ return new UnionResponse(200, "user not click",new JSONObject());
|
331
|
}
|
331
|
}
|
332
|
|
332
|
|
333
|
// 把存储的字符串变为对象
|
333
|
// 把存储的字符串变为对象
|
|
@@ -349,17 +349,23 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
@@ -349,17 +349,23 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
349
|
//强制删除带ip的key
|
349
|
//强制删除带ip的key
|
350
|
yHRedisTemplate.delete(UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey());
|
350
|
yHRedisTemplate.delete(UNION_KEY + "_" + request.getClientIp() + "_" + request.getAppkey());
|
351
|
|
351
|
|
352
|
- if (union != null && union.getIsActivate() != null && union.getIsActivate().byteValue() == 1) {
|
|
|
353
|
- // 如果90天之内有过激活日志,则不允许重复激活
|
|
|
354
|
- log.warn("activateUnion error because 90 days has activate info with param is {}", request);
|
|
|
355
|
- return new UnionResponse(203, "have activite in 90 days");
|
|
|
356
|
- }
|
|
|
357
|
String unionTypekey = "yh:union:uniontype:"+click.getUnion_type();
|
352
|
String unionTypekey = "yh:union:uniontype:"+click.getUnion_type();
|
358
|
MktMarketingUrl mktMarketingUrl = redisValueCache.get(unionTypekey,MktMarketingUrl.class);
|
353
|
MktMarketingUrl mktMarketingUrl = redisValueCache.get(unionTypekey,MktMarketingUrl.class);
|
359
|
if(mktMarketingUrl==null){
|
354
|
if(mktMarketingUrl==null){
|
360
|
mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(click.getUnion_type()));
|
355
|
mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(click.getUnion_type()));
|
361
|
redisValueCache.set(unionTypekey, mktMarketingUrl, 1, TimeUnit.HOURS);
|
356
|
redisValueCache.set(unionTypekey, mktMarketingUrl, 1, TimeUnit.HOURS);
|
362
|
}
|
357
|
}
|
|
|
358
|
+
|
|
|
359
|
+ JSONObject result = new JSONObject();
|
|
|
360
|
+ result.put("landing_page_url",StringUtils.isEmpty(mktMarketingUrl.getLandingPageUrl()) ? "" : mktMarketingUrl.getLandingPageUrl());
|
|
|
361
|
+
|
|
|
362
|
+ if (union != null && union.getIsActivate() != null && union.getIsActivate().byteValue() == 1) {
|
|
|
363
|
+ // 如果90天之内有过激活日志,则不允许重复激活
|
|
|
364
|
+ log.warn("activateUnion error because 90 days has activate info with param is {}", request);
|
|
|
365
|
+ return new UnionResponse(200, "have activite in 90 days",result);
|
|
|
366
|
+ }
|
|
|
367
|
+// UnionTypeModel u = UnionConstant.unionTypeMap.get(Integer.parseInt(click.getUnion_type()));
|
|
|
368
|
+
|
363
|
UnionTypeModel u = new UnionTypeModel();
|
369
|
UnionTypeModel u = new UnionTypeModel();
|
364
|
u.setName(mktMarketingUrl.getName());
|
370
|
u.setName(mktMarketingUrl.getName());
|
365
|
u.setValue(String.valueOf(mktMarketingUrl.getUnionType()));
|
371
|
u.setValue(String.valueOf(mktMarketingUrl.getUnionType()));
|
|
@@ -407,7 +413,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
@@ -407,7 +413,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
407
|
j.put("tdid", request.getTdid());
|
413
|
j.put("tdid", request.getTdid());
|
408
|
activeDingdang.info(j.toString());
|
414
|
activeDingdang.info(j.toString());
|
409
|
}
|
415
|
}
|
410
|
- return new UnionResponse(203, "have activite in 90 days");
|
416
|
+ return new UnionResponse(200, "have activite in 90 days",result);
|
411
|
}
|
417
|
}
|
412
|
}
|
418
|
}
|
413
|
|
419
|
|
|
@@ -489,7 +495,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
@@ -489,7 +495,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
489
|
}
|
495
|
}
|
490
|
if (StringUtils.isEmpty(url)) {
|
496
|
if (StringUtils.isEmpty(url)) {
|
491
|
log.info("activateUnion in success request is {}", request);
|
497
|
log.info("activateUnion in success request is {}", request);
|
492
|
- return new UnionResponse();
|
498
|
+ return new UnionResponse(200,"success",result);
|
493
|
}
|
499
|
}
|
494
|
if(!"3".equals(union_type)||!"100000000000453".equals(union_type)){
|
500
|
if(!"3".equals(union_type)||!"100000000000453".equals(union_type)){
|
495
|
url = URLDecoder.decode(url, "UTF-8");
|
501
|
url = URLDecoder.decode(url, "UTF-8");
|
|
@@ -506,7 +512,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
@@ -506,7 +512,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
506
|
activeUnion.info("activateUnion call union success url={}, and result={}", url, pair);
|
512
|
activeUnion.info("activateUnion call union success url={}, and result={}", url, pair);
|
507
|
if (pair.getLeft() != 200) {
|
513
|
if (pair.getLeft() != 200) {
|
508
|
log.warn("callback error with request={}", request);
|
514
|
log.warn("callback error with request={}", request);
|
509
|
- return new UnionResponse(204, "callback error");
|
515
|
+ return new UnionResponse(200, "callback error",result);
|
510
|
}
|
516
|
}
|
511
|
//如果来源是广点通,则把广点通的一些信息记入表,给之后做转化上报使用
|
517
|
//如果来源是广点通,则把广点通的一些信息记入表,给之后做转化上报使用
|
512
|
if(union_type.equals("3")){
|
518
|
if(union_type.equals("3")){
|
|
@@ -520,12 +526,12 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
|
@@ -520,12 +526,12 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher |
520
|
}
|
526
|
}
|
521
|
|
527
|
|
522
|
activeUnion.info("activateUnion in success request is {}", request);
|
528
|
activeUnion.info("activateUnion in success request is {}", request);
|
523
|
-
|
|
|
524
|
- return new UnionResponse();
|
529
|
+
|
|
|
530
|
+ return new UnionResponse(200,"success",result);
|
525
|
|
531
|
|
526
|
} catch (Exception e) {
|
532
|
} catch (Exception e) {
|
527
|
log.error("activateUnion error with request={}", request, e);
|
533
|
log.error("activateUnion error with request={}", request, e);
|
528
|
- return new UnionResponse(300, e.getMessage());
|
534
|
+ return new UnionResponse(200, e.getMessage(),new JSONObject());
|
529
|
}
|
535
|
}
|
530
|
|
536
|
|
531
|
}
|
537
|
}
|