Authored by chaogeng

Merge branch 'baidu-tp' of http://git.yoho.cn/yoho30/yohobuy-union into baidu-tp

... ... @@ -32,8 +32,8 @@ public class ChannelGroupRest {
@Autowired
private IChannelGroupService channelGroupService;
// @Autowired
// private HttpSession session;
@Autowired
private HttpSession session;
@RequestMapping("/queryChannelGroupList")
... ... @@ -123,10 +123,10 @@ public class ChannelGroupRest {
public ApiResponse addGroup(@RequestBody ChannelUserRequest request) {
// 设置系统管理员 ID
// UserInfoBO userInfo = (UserInfoBO) session.getAttribute("userSession");
// checkNotNull(userInfo, "获取当前用户信息失败,请刷新当前页面");
UserInfoBO userInfo = (UserInfoBO) session.getAttribute("userSession");
checkNotNull(userInfo, "获取当前用户信息失败,请刷新当前页面");
// channelGroupService.saveGroup(request, userInfo);
channelGroupService.saveGroup(request, userInfo);
return new ApiResponse.ApiResponseBuilder().build();
}
... ...
... ... @@ -163,13 +163,13 @@ public class ClickUnionRest {
log.info("addUnion4Special version={}", version);
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
bo.setAppid("490655927");
log.info("addUnion4Special request={}", bo);
unionService.clickUnion(bo);
log.info("addUnion4Special with result is {}, and request is {}", response, bo);
clickUnion.info("addUnion4Special request is {}", bo);
response.setStatus(301);
response.sendRedirect("https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8");
response.sendRedirect("https://itunes.apple.com/us/app/id490655927?ls=1&mt=8");
} catch (IOException e) {
log.error("addUnion4Special error with request={}", bo, e);
}
... ... @@ -215,8 +215,8 @@ public class ClickUnionRest {
String version = agent.substring(agent.indexOf(" os ") + 4, agent.indexOf(" like"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
//youku;5.4;ios;10.2;iphone6,1 ---这种情况比较多
else if(agent.contains("youku")){
... ... @@ -227,8 +227,8 @@ public class ClickUnionRest {
version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
} //youku;5.4.1;iphone os;8.4.1;iphone6,2
else if(agent.contains("os")){
int first = agent.indexOf("os;") + 3;
... ... @@ -236,8 +236,8 @@ public class ClickUnionRest {
version = version1.substring(version1.indexOf(" ") + 1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
}
//momochat/7.5.6 ios/664 (iphone 6; ios 10.2; zh_cn; iphone7,2; s1)
... ... @@ -249,8 +249,8 @@ public class ClickUnionRest {
version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
else if(agent.contains("ios")){
int first = agent.indexOf(" ios ")+4;
... ... @@ -258,8 +258,8 @@ public class ClickUnionRest {
version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
} //momochat/7.5.6 ios/664 (iphone 6s; iphone os 9.2; zh_cn; iphone8,1; s1)
else if(agent.contains("os")){
int first = agent.indexOf(" os ")+3;
... ... @@ -267,8 +267,8 @@ public class ClickUnionRest {
version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
}
else if(agent.contains("ios/")){
... ... @@ -281,14 +281,14 @@ public class ClickUnionRest {
version = version1.substring(version1.lastIndexOf("/") + 1, version1.length());
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}else{ //ios/6.6 com.jugg.doctor ipad5,3/8.3/768x1024/2.0 /1---这个应该就是ios_6.6
version = agent.substring(agent.indexOf("ios/")+4,agent.indexOf(" "));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
}
//365jia news client/cn.ahurls.news/3.5.0_300500.209/ios(7.1|0|iphone)/59c2ed8b88175124c539e0c7a96a18d4eedb3d6c(none|none)/640x1136@2
... ... @@ -298,8 +298,8 @@ public class ClickUnionRest {
String version = version1.substring(0,version1.indexOf("|"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
else if (agent.contains("ios")){
String version = "";
... ... @@ -310,8 +310,8 @@ public class ClickUnionRest {
version = agent.substring(version1.lastIndexOf(";")+1,lastIndex);
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}else if(agent.contains("jxsg")) { //jxsg_ios-1.2.5/0.0.2 (iphone7,2; ios 10.2.1)
int first = agent.lastIndexOf("ios ") + 4;
String version1 = agent.substring(first);
... ... @@ -319,8 +319,8 @@ public class ClickUnionRest {
version = version1.substring(version1.indexOf(" ") + 1, lastIndex);
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}else{
int first = agent.lastIndexOf("ios ") + 4;
String version1 = agent.substring(first);
... ... @@ -328,8 +328,8 @@ public class ClickUnionRest {
version = version1.substring(0, lastIndex);
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("1048984814");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
}
... ... @@ -374,7 +374,7 @@ public class ClickUnionRest {
//response.setHeader("Location",url);
//如果不需要直接下载, 配置参数downloadDirect=N, 跳转应用宝下载
if(null != downloadDirect && "ios".equals(downloadDirect.trim())){
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8";
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}else if(null != downloadDirect && "android".equals(downloadDirect.trim())){
url = "http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445";
}
... ...
... ... @@ -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,16 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
log.warn("publish activate event fail! e {}", e);
}
//如果是通过邀请码二维码下载, 则返回落地页添加邀请码信息
String landingUrl = mktMarketingUrl.getLandingPageUrl();
activeUnion.info("get landing_page_url. mktMarketingUrl is {}, landingUrl is {}, invitecodeValue ={}", mktMarketingUrl, landingUrl, click.getInvite_code());
if(StringUtils.isNotEmpty(landingUrl) && StringUtils.isNotEmpty(click.getInvite_code())){
landingUrl = landingUrl.replace("invitecodeValue", click.getInvite_code());
}
result.put("landing_page_url", StringUtils.isEmpty(landingUrl) ? "" : mktMarketingUrl.getLandingPageUrl());
activeUnion.info("active union. union_type = {}, landing_page_url = {}, result = {}, idfa = {}, imei = {}", click.getUnion_type(), landingUrl, result, request.getIdfa(), request.getImei());
String url = null;
//取出具体是哪个union_type
//根据不同的url走不同的回调
try {
String union_type = click.getUnion_type();
... ... @@ -606,17 +597,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());
... ...
... ... @@ -47,6 +47,12 @@ rabbit_common_qq_user=yoho
rabbit_common_qq_password=yoho
##########common rabbitmq ##########
#-------------七牛云配置-------------------#
qiniu.accesskey=atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m
qiniu.secretkey=pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm
qiniu.domain = test
qiniu.bucket = test
zkAddress=127.0.0.1:2181
# web context
web.context=union
... ... @@ -122,9 +128,3 @@ baidu.tp.push.url=http://hoteltest.baidu.com/business/article_publish
baidu.app.id=1566454424306679
baidu.app.token=spdtkn_test12
baidu.union.type=100000000005493
\ No newline at end of file
# qiniu config
qiniu.accesskey: = atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m
qiniu.secretkey: = pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm
qiniu.domain: = test
qiniu.bucket = test
\ No newline at end of file
... ...
... ... @@ -125,8 +125,9 @@ baidu.app.id=${baidu.app.id}
baidu.app.token=${baidu.app.token}
baidu.union.type=${baidu.union.type}
qiniu.accesskey: = ${qiniu.accesskey}
qiniu.secretkey: = ${qiniu.secretkey}
qiniu.domain: = ${qiniu.domain}
qiniu.accesskey = ${qiniu.accesskey}
qiniu.secretkey = ${qiniu.secretkey}
qiniu.domain = ${qiniu.domain}
qiniu.bucket = ${qiniu.bucket}
... ...
... ... @@ -142,7 +142,11 @@
window.cookie = cookie;
var url = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
var params = queryString();
var openbyYohobuy = decodeURIComponent(params['openby:yohobuy'] || '') || '{"action":"go.home","params":{"gender":"1","channel":"2"}}';
var url = 'yohobuy://yohobuy.com/goapp?openby:yohobuy=' + openbyYohobuy;
var isWechat = /micromessenger/i.test(navigator.userAgent || '');
if(isWechat){
... ... @@ -157,12 +161,10 @@
var androidExp = new RegExp('MQQBrowser');//安卓QQ内置浏览器正则
var isAndroidQQ = androidExp.test(navigator.userAgent); //判断是不是QQ内置浏览器
var version, type, appid, td, params;
params = queryString();
var version, type, appid, td;
if(params.union_type){
url = 'yohobuy://yohobuy.com/goapp?ct='+params.union_type+'&openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
url = 'yohobuy://yohobuy.com/goapp?ct='+params.union_type+'&openby:yohobuy=' + openbyYohobuy;
}
if (isiOS) {
... ... @@ -221,7 +223,7 @@
//如果setTimeout 回调超过2500ms,则弹出下载
if ((+new Date()) - openTime > 500) {
if (isiOS) {
url = '//itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8';
url = '//itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8';
} else {
url = '//yoho-apps.qiniudn.com/YohoBuy_YOHO.apk';
}
... ... @@ -259,7 +261,7 @@
url = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
}else{
if (isiOS) {
url = '//itunes.apple.com/cn/app/yoho!-you-huo/id1048984814?mt=8';
url = '//itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8';
} else {
if(isAndroidQQ){ //安卓qq处理方式同微信,也进入应用宝下载
url = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
... ... @@ -324,6 +326,9 @@
} else if (params.IMEI) {
unionUrl += '&imei=' + params.IMEI;
}
if(params.invite_code){
unionUrl += '&invite_code=' + params.invite_code;
}
xhrGet(unionUrl, function () {
});
}
... ...
... ... @@ -56,7 +56,7 @@
version = (verinfo+'').replace(/[^0-9|_.]/ig,'').replace(/_/ig, '.');
type = 'ios';
appid = '1048984814';
appid = '490655927';
td = window.screen.width + '_' + window.screen.height + '_' + type + '_' + version;
} else if (agent.indexOf('android') > -1 || agent.indexOf('linux') > -1) {
... ... @@ -111,7 +111,8 @@
appid: queryString.appid ? queryString.appid : appid,
appkey: queryString.appkey,
idfa : queryString.idfa ? queryString.idfa : queryString.IDFA,
imei:queryString.imei?queryString.imei:queryString.IMEI
imei:queryString.imei?queryString.imei:queryString.IMEI,
params:queryString.params
},
complete: function() {
... ...