Authored by DengXinFei

邀请码激活,app激活修改邀请码,不判断90天活跃 --add by 邓新飞

... ... @@ -85,6 +85,8 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
@Value("${exclude.union.type:100000000000349}")
private String EXCLUDE_UNION_TYPE;
private final static String NO_NEED_CHECK_ACTIVE_UNION = "100000000005441";
@Resource
IUnionLogsDAO unionLogsDAO;
... ... @@ -203,26 +205,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
key += "_" + request.getAppkey();
}
}
// String value = yhValueOperations.get(key);
// log.info("clickUnion get key={}, value={}", key, value);
// //如果redis中已经存在该用户点击信息,则不再重复保存
// if (StringUtils.isNotEmpty(value)) {
// log.warn("clickUnion error click info is exists with param is {}", request);
// return new UnionResponse(202, "click info is exists");
// }
// //查询该用户是否已经激活过
//
// UnionLogs union = unionLogsDAO.selectByTd(request.getTd());
// log.info("clickUnion in selectByTd result is {}", union);
// if (union != null && union.getIsActivate() != null && union.getIsActivate().byteValue() == 1) {
// //如果90天之内有过激活日志,则不允许重复激活
// log.warn("clickUnion error because 90 days has activate info with param is {}", request);
// return new UnionResponse(203, "have activite in 90 days");
// }
//保存到缓存中,根据不同的厂商,设置不同的有效期,3:
// log.info("clickUnion set redis with key={}, value={}", key, JSON.toJSONString(request));
clickUnion.info("clickUnion set redis with key={}, value={}", key, JSON.toJSONString(request));
String invalidTime = "activeTime"+"_"+request.getUnion_type();
... ... @@ -373,8 +356,14 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
noCheckActive.info("Active record without any check. client is {}, udid is {}, idfa is {}, imei is {}", request.getClient_type(), request.getUdid(), request.getIdfa(), request.getImei());
// 把存储的字符串变为对象
ClickUnionRequestBO click = JSON.parseObject(value, ClickUnionRequestBO.class);
//判断是否需要判断激活,90天活跃
boolean isNeedCheckActive = true;
if(NO_NEED_CHECK_ACTIVE_UNION.equals(click.getUnion_type())){
isNeedCheckActive = false;
}
// 查询该td在90天内是否已经激活过
UnionLogs union = unionLogsDAO.selectByClientType(request.getClient_type(), request.getIdfa(), request.getImei(), request.getAppkey());
UnionLogs union = unionLogsDAO.selectByClientType(request.getClient_type(), request.getIdfa(), request.getImei(), request.getAppkey());;
log.info("activateUnion in selectByClientType result is {}", union);
//删除redis中的点击记录
... ... @@ -395,9 +384,8 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
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());
UnionTypeModel u = new UnionTypeModel();
u.setName(mktMarketingUrl.getName());
... ... @@ -414,18 +402,16 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
} else if ("mars".equals(appkey)) {
app_key = "yohomars_ios";
}
// List<AppActivateIdfaList> _90DayIdfaList = appActivateIdfaListDAO.selectByUdidAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getUdid(), app_key));
// activeUnion.info("check ios active info in 90 days. udid is {} and app_key is {},yesterday is {} and result is {}", request.getUdid(), app_key, yesterday, (null == _90DayIdfaList || _90DayIdfaList.size() == 0)? "null": _90DayIdfaList.get(0));
BaseUserActiveDay baseUserActiveDay = baseUserActiveDayMapper.selectByUdidAndAppKey(request.getUdid(),app_key);
BaseUserActiveDay baseUserActiveDay = isNeedCheckActive ? baseUserActiveDayMapper.selectByUdidAndAppKey(request.getUdid(),app_key) : null;
activeUnion.info("check ios active info in 90 days. udid is {} and app_key is {}, result is {}", request.getUdid(), app_key,baseUserActiveDay);
List<AppActivateIdfaList> _15DayIdfaList = appActivateIdfaListDAO.select15DaysByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), app_key, null));
List<AppActivateIdfaList> _15DayIdfaList = isNeedCheckActive ? appActivateIdfaListDAO.select15DaysByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa(), app_key, null)) : null;
activeUnion.info("check ios active info in 15 days. udid is {} and app_key is {},yesterday is {} and result is {}", request.getUdid(), app_key, yesterday, (null == _15DayIdfaList || _15DayIdfaList.size() == 0)? "null": _15DayIdfaList.get(0));
//判断90天内是否在大数据有记录
if (baseUserActiveDay!=null) {
// log.warn("ios activateUnion error because 90 days has activate in bigdata database info with param is {}", request);
log.warn("ios activateUnion error because 90 days has activate in bigdata database info with param is {}", request);
String time = DateUtil.getcurrentTime();
udidPool.info("Has action in 90 days at bigdata. udid is {},idfa is {},current time is {}", request.getUdid(), request.getIdfa(),time);
//判断15天内是否在大数据有记录
... ... @@ -452,7 +438,6 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
activeDingdang.info(j.toString());
}
return new UnionResponse(200, "have activite in 90 days",result);
}
}
... ... @@ -460,8 +445,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
if (StringUtils.equals(ClientTypeEnum.ANDROID.getName(), request.getClient_type())){
String appKey = request.getAppkey()+"_android";
// 如果90天内有记录,则直接返回
// List<AppActivateUdidList> activateUdidLists = appActivateUdidListDAO.selectByImeiUdidDate(new AppActivateUdidList(Long.valueOf(yesterday), request.getUdid(), appKey));
BaseUserActiveDay baseUserActiveDay = baseUserActiveDayMapper.selectByUdidAndAppKey(request.getUdid(), appKey);
BaseUserActiveDay baseUserActiveDay = isNeedCheckActive?baseUserActiveDayMapper.selectByUdidAndAppKey(request.getUdid(), appKey) : null;
activeUnion.info("check android active info in 90 days. udid is {} and app_key is {},result is {}", request.getUdid(), appKey, baseUserActiveDay);
if (baseUserActiveDay!=null){
... ... @@ -506,7 +490,6 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
log.error("activity save unionlog error is {}",e.getMessage());
}
// 记录日志
JSONObject j = new JSONObject();
j.put("apptype", request.getClient_type());
... ... @@ -548,8 +531,14 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
log.warn("publish activate event fail! e {}", e);
}
//如果是通过邀请码二维码下载, 则返回落地页添加邀请码信息
String landingUrl = mktMarketingUrl.getLandingPageUrl();
if(StringUtils.isNotEmpty(landingUrl) && StringUtils.isNotEmpty(click.getInvite_code())){
landingUrl = (String)result.replace("invitecodeValue", click.getInvite_code());
}
result.put("landing_page_url", StringUtils.isEmpty(landingUrl) ? "" : mktMarketingUrl.getLandingPageUrl());
String url = null;
//取出具体是哪个union_type
//根据不同的url走不同的回调
try {
String union_type = click.getUnion_type();
... ... @@ -606,17 +595,13 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
if(union_type.equals("3")){
saveUnionActivity(click,request);
}
} catch (Exception e) {
log.error("callback error with request={}", request, e);
//return new UnionResponse(204, "callback error");
}
activeUnion.info("activateUnion in success request is {}", request);
return new UnionResponse(200,"success",result);
} catch (Exception e) {
log.error("activateUnion error with request={}", request, e);
return new UnionResponse(200, e.getMessage(),new JSONObject());
... ...
... ... @@ -326,8 +326,8 @@
} else if (params.IMEI) {
unionUrl += '&imei=' + params.IMEI;
}
if(params.params){
unionUrl += '&params=' + params.params;
if(params.invite_code){
unionUrl += '&invite_code=' + params.invite_code;
}
xhrGet(unionUrl, function () {
});
... ...