Authored by zhengwen.ge

update

@@ -310,7 +310,7 @@ public class ClickUnionRest { @@ -310,7 +310,7 @@ public class ClickUnionRest {
310 String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like")); 310 String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
311 log.info("addUnion4Special version={}", version); 311 log.info("addUnion4Special version={}", version);
312 } 312 }
313 - 313 +
314 @RequestMapping("/addUnion4Jump") 314 @RequestMapping("/addUnion4Jump")
315 public void addUnion4Stream(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) { 315 public void addUnion4Stream(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
316 clickUnion.info("addUnion4Stream ClickUnionRequestBO{}", bo); 316 clickUnion.info("addUnion4Stream ClickUnionRequestBO{}", bo);
@@ -339,7 +339,119 @@ public class ClickUnionRest { @@ -339,7 +339,119 @@ public class ClickUnionRest {
339 } 339 }
340 340
341 if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0 ||agent.indexOf("ipad")>0) { 341 if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0 ||agent.indexOf("ipad")>0) {
342 - setClickUnionRequestBO(agent,bo,url); 342 + if(agent.contains("os")&&agent.contains("like")){
  343 + String version = agent.substring(agent.indexOf(" os ") + 4, agent.indexOf(" like"));
  344 + bo.setTd("ios_" + version.replaceAll("_", "."));
  345 + bo.setClient_type("ios");
  346 + bo.setAppid("490655927");
  347 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  348 + }
  349 + //youku;5.4;ios;10.2;iphone6,1 ---这种情况比较多
  350 + else if(agent.contains("youku")){
  351 + String version = "";
  352 + if(agent.contains("ios")){
  353 + int first = agent.indexOf("ios;")+4;
  354 + String version1 = agent.substring(first);
  355 + version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
  356 + bo.setTd("ios_" + version.replaceAll("_", "."));
  357 + bo.setClient_type("ios");
  358 + bo.setAppid("490655927");
  359 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  360 + } //youku;5.4.1;iphone os;8.4.1;iphone6,2
  361 + else if(agent.contains("os")){
  362 + int first = agent.indexOf("os;") + 3;
  363 + String version1 = agent.substring(first);
  364 + version = version1.substring(version1.indexOf(" ") + 1, version1.indexOf(";"));
  365 + bo.setTd("ios_" + version.replaceAll("_", "."));
  366 + bo.setClient_type("ios");
  367 + bo.setAppid("490655927");
  368 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  369 + }
  370 + }
  371 + //momochat/7.5.6 ios/664 (iphone 6; ios 10.2; zh_cn; iphone7,2; s1)
  372 + else if(agent.contains("momochat")){
  373 + String version = "";
  374 + if(agent.contains("ios")){
  375 + int first = agent.indexOf(" ios ")+4;
  376 + String version1 = agent.substring(first);
  377 + version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
  378 + bo.setTd("ios_" + version.replaceAll("_", "."));
  379 + bo.setClient_type("ios");
  380 + bo.setAppid("490655927");
  381 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  382 + } //momochat/7.5.6 ios/664 (iphone 6s; iphone os 9.2; zh_cn; iphone8,1; s1)
  383 + else if(agent.contains("os")){
  384 + int first = agent.indexOf(" os ")+3;
  385 + String version1 = agent.substring(first);
  386 + version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
  387 + bo.setTd("ios_" + version.replaceAll("_", "."));
  388 + bo.setClient_type("ios");
  389 + bo.setAppid("490655927");
  390 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  391 + }
  392 + }
  393 + else if(agent.contains("ios/")){
  394 + String version= "";
  395 + if(agent.contains("mozilla")){ // mozilla/5.0,ios/10.0.2,client/5.8.1,device/iphone6.2,theme/red
  396 + version = agent.substring(agent.indexOf("ios/")+4,agent.indexOf("client")-1);
  397 + }else if (agent.contains("iphone")) { //huazhu/ios/iphone9,2/10.2.1/6.5.3
  398 + int last = agent.lastIndexOf("/");
  399 + String version1 = agent.substring(0,last);
  400 + version = version1.substring(version1.lastIndexOf("/") + 1, version1.length());
  401 + bo.setTd("ios_" + version.replaceAll("_", "."));
  402 + bo.setClient_type("ios");
  403 + bo.setAppid("490655927");
  404 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  405 + }else{ //ios/6.6 com.jugg.doctor ipad5,3/8.3/768x1024/2.0 /1---这个应该就是ios_6.6
  406 + version = agent.substring(agent.indexOf("ios/")+4,agent.indexOf(" "));
  407 + bo.setTd("ios_" + version.replaceAll("_", "."));
  408 + bo.setClient_type("ios");
  409 + bo.setAppid("490655927");
  410 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  411 + }
  412 + }
  413 + //365jia news client/cn.ahurls.news/3.5.0_300500.209/ios(7.1|0|iphone)/59c2ed8b88175124c539e0c7a96a18d4eedb3d6c(none|none)/640x1136@2
  414 + else if(agent.contains("/ios")){
  415 + int first = agent.indexOf("/ios(") + 5;
  416 + String version1 = agent.substring(first);
  417 + String version = version1.substring(0,version1.indexOf("|"));
  418 + bo.setTd("ios_" + version.replaceAll("_", "."));
  419 + bo.setClient_type("ios");
  420 + bo.setAppid("490655927");
  421 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  422 + }
  423 + else if (agent.contains("ios")){
  424 + String version = "";
  425 + if(agent.contains("letvshop")){
  426 + //letvshop;1.6.6;iphone 6plus;ios-iphone;9.2;zh_cn
  427 + int lastIndex = agent.lastIndexOf(";");
  428 + String version1 = agent.substring(0,lastIndex);
  429 + version = agent.substring(version1.lastIndexOf(";")+1,lastIndex);
  430 + bo.setTd("ios_" + version.replaceAll("_", "."));
  431 + bo.setClient_type("ios");
  432 + bo.setAppid("490655927");
  433 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  434 + }else if(agent.contains("jxsg")) { //jxsg_ios-1.2.5/0.0.2 (iphone7,2; ios 10.2.1)
  435 + int first = agent.lastIndexOf("ios ") + 4;
  436 + String version1 = agent.substring(first);
  437 + int lastIndex = version1.indexOf(")");
  438 + version = version1.substring(version1.indexOf(" ") + 1, lastIndex);
  439 + bo.setTd("ios_" + version.replaceAll("_", "."));
  440 + bo.setClient_type("ios");
  441 + bo.setAppid("490655927");
  442 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  443 + }else{
  444 + int first = agent.lastIndexOf("ios ") + 4;
  445 + String version1 = agent.substring(first);
  446 + int lastIndex = version1.indexOf(";");
  447 + version = version1.substring(0, lastIndex);
  448 + bo.setTd("ios_" + version.replaceAll("_", "."));
  449 + bo.setClient_type("ios");
  450 + bo.setAppid("490655927");
  451 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  452 + }
  453 + }
  454 +
343 } else { 455 } else {
344 int index = agent.lastIndexOf("android"); 456 int index = agent.lastIndexOf("android");
345 if (index > 0) { 457 if (index > 0) {