Authored by zhouxiang

Merge branch 'master' into dev-20170216

... ... @@ -78,6 +78,11 @@ public class ClickUnionRest {
String[] td1 = td.split("0_0_");
request.setTd(td1[1]);
}
//增加监控,把接口报上去,根据client_type来判断
request.setInterfaceType("addUnion_ios");
if(StringUtils.isNotEmpty(request.getClient_type())&&request.getClient_type().equals(ClientTypeEnum.ANDROID.getName())){
request.setInterfaceType("addUnion_android");
}
clickUnion.info("addUnion with param is {}", request);
UnionResponse response = unionService.clickUnion(request);
// log.info("addUnion with result is {}, and request is {}", response, request);
... ... @@ -310,7 +315,7 @@ public class ClickUnionRest {
String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
log.info("addUnion4Special version={}", version);
}
@RequestMapping("/addUnion4Jump")
public void addUnion4Stream(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
clickUnion.info("addUnion4Stream ClickUnionRequestBO{}", bo);
... ... @@ -339,7 +344,119 @@ public class ClickUnionRest {
}
if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0 ||agent.indexOf("ipad")>0) {
setClickUnionRequestBO(agent,bo,url);
if(agent.contains("os")&&agent.contains("like")){
String version = agent.substring(agent.indexOf(" os ") + 4, agent.indexOf(" like"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
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")){
String version = "";
if(agent.contains("ios")){
int first = agent.indexOf("ios;")+4;
String version1 = agent.substring(first);
version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
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;
String version1 = agent.substring(first);
version = version1.substring(version1.indexOf(" ") + 1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
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)
else if(agent.contains("momochat")){
String version = "";
if(agent.contains("ios")){
int first = agent.indexOf(" ios ")+4;
String version1 = agent.substring(first);
version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
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;
String version1 = agent.substring(first);
version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
}
else if(agent.contains("ios/")){
String version= "";
if(agent.contains("mozilla")){ // mozilla/5.0,ios/10.0.2,client/5.8.1,device/iphone6.2,theme/red
version = agent.substring(agent.indexOf("ios/")+4,agent.indexOf("client")-1);
}else if (agent.contains("iphone")) { //huazhu/ios/iphone9,2/10.2.1/6.5.3
int last = agent.lastIndexOf("/");
String version1 = agent.substring(0,last);
version = version1.substring(version1.lastIndexOf("/") + 1, version1.length());
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
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("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
else if(agent.contains("/ios")){
int first = agent.indexOf("/ios(") + 5;
String version1 = agent.substring(first);
String version = version1.substring(0,version1.indexOf("|"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
else if (agent.contains("ios")){
String version = "";
if(agent.contains("letvshop")){
//letvshop;1.6.6;iphone 6plus;ios-iphone;9.2;zh_cn
int lastIndex = agent.lastIndexOf(";");
String version1 = agent.substring(0,lastIndex);
version = agent.substring(version1.lastIndexOf(";")+1,lastIndex);
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
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);
int lastIndex = version1.indexOf(")");
version = version1.substring(version1.indexOf(" ") + 1, lastIndex);
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
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);
int lastIndex = version1.indexOf(";");
version = version1.substring(0, lastIndex);
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
}
}
} else {
int index = agent.lastIndexOf("android");
if (index > 0) {
... ... @@ -354,6 +471,12 @@ public class ClickUnionRest {
log.error("addUnion4Stream error with request={}", bo, e);
}
try {
//增加监控,把接口报上去,根据client_type来判断
bo.setInterfaceType("addUnion4Jump_ios");
if(StringUtils.isNotEmpty(bo.getClient_type())&&bo.getClient_type().equals(ClientTypeEnum.ANDROID.getName())){
bo.setInterfaceType("addUnion4Jump_android");
}
StringBuffer stringBuffer = new StringBuffer();
String bean = stringBuffer.append("UnionServiceImpl").append("_").append(bo.getUnion_type()).toString();
boolean containsBean = SpringContextUtil.containsBean(bean);
... ... @@ -417,6 +540,11 @@ public class ClickUnionRest {
log.error("addMonitor error with request={}",e1.getMessage());
}
//增加监控,把接口报上去,根据client_type来判断
bo.setInterfaceType("addMonitor_ios");
if(StringUtils.isNotEmpty(bo.getClient_type())&&bo.getClient_type().equals(ClientTypeEnum.ANDROID.getName())){
bo.setInterfaceType("addMonitor_android");
}
clickUnion.info("addMonitor request={}", bo);
//根据union_type区分不同的厂商
String union_type = request.getParameter("union_type");
... ...
... ... @@ -53,8 +53,10 @@ public class GDT2ServiceImpl extends UnionServiceImpl implements IUnionService {
bo.setClient_type(app_type);
if(app_type.equals(ClientTypeEnum.ANDROID.getName())){
bo.setImei(muid);
bo.setInterfaceType("addMonitor_android");
}else {
bo.setIdfa(muid);
bo.setInterfaceType("addMonitor_ios");
}
bo.setAppid(request.getParameter("appid"));
bo.setClickId(request.getParameter("click_id"));
... ...
... ... @@ -2,6 +2,7 @@ package com.yoho.unions.server.service.impl;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
... ... @@ -23,6 +24,10 @@ public class TouTiaoServiceImpl extends UnionServiceImpl implements IUnionServic
bo = new ClickUnionRequestBO();
String idfa = request.getParameter("idfa");
String imei = request.getParameter("imei");
bo.setInterfaceType("addMonitor_ios");
if(StringUtils.isNotEmpty(imei)) {
bo.setInterfaceType("addMonitor_android");
}
bo.setIdfa(idfa);
bo.setImei(imei);
//将毫秒级的转换为秒级别---头条有时候不传
... ...
... ... @@ -473,7 +473,8 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
}else if(StringUtils.isNotEmpty(request.getImei())){
muid = request.getImei();
}
DeviceActiveEvent activeEvent = new DeviceActiveEvent("deviceActive",source,source_id,muid);
String interfaceType = click.getInterfaceType();
DeviceActiveEvent activeEvent = new DeviceActiveEvent("deviceActive",interfaceType,source,source_id,muid);
//上报激活事件
try{
... ...
... ... @@ -2,6 +2,7 @@ package com.yoho.unions.server.service.impl;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
... ... @@ -26,6 +27,10 @@ public class WeiBoServiceImpl extends UnionServiceImpl implements IUnionService
String clicktime = request.getParameter("clicktime");
Long click = Long.valueOf(clicktime);
clickUnionRequestBO.setIdfa(request.getParameter("idfa_md5"));
clickUnionRequestBO.setInterfaceType("addMonitor_ios");
if(StringUtils.isNotEmpty(request.getParameter("imei_md5"))){
clickUnionRequestBO.setInterfaceType("addMonitor_android");
}
clickUnionRequestBO.setImei(request.getParameter("imei_md5"));
clickUnionRequestBO.setClickTime(click/1000);
clickUnionRequestBO.setCallbackurl(request.getParameter("IMP"));
... ...