Authored by zhengwen.ge

增加td判断

@@ -198,17 +198,59 @@ public class ClickUnionRest { @@ -198,17 +198,59 @@ public class ClickUnionRest {
198 bo.setClient_type("android"); 198 bo.setClient_type("android");
199 bo.setAppid("com.yoho"); 199 bo.setAppid("com.yoho");
200 String agent = request.getHeader("user-agent"); 200 String agent = request.getHeader("user-agent");
  201 + agent = "momochat/7.5.6 ios/664 (iphone 6s; ios 10.1.1; zh-hans_ae; iphone8,1; s1)";
201 agent = agent.toLowerCase(); 202 agent = agent.toLowerCase();
202 log.info("addUnion4Stream user-agent={}", agent); 203 log.info("addUnion4Stream user-agent={}", agent);
203 String url = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk"; 204 String url = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk";
204 try { 205 try {
205 if (!StringUtils.isEmpty(agent)) { 206 if (!StringUtils.isEmpty(agent)) {
206 - if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0) {  
207 - String version = agent.substring(agent.indexOf(" os ") + 4, agent.indexOf(" like"));  
208 - bo.setTd("ios_" + version.replaceAll("_", "."));  
209 - bo.setClient_type("ios");  
210 - bo.setAppid("490655927");  
211 - url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8"; 207 + if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0 ||agent.indexOf("ipad")>0) {
  208 + if(agent.contains("os")&&agent.contains("like")){
  209 + String version = agent.substring(agent.indexOf(" os ") + 4, agent.indexOf(" like"));
  210 + bo.setTd("ios_" + version.replaceAll("_", "."));
  211 + bo.setClient_type("ios");
  212 + bo.setAppid("490655927");
  213 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  214 + }
  215 + //youku;5.4;ios;10.2;iphone6,1 ---这种情况比较多
  216 + if(agent.contains("youku")){
  217 + int first = agent.indexOf("ios;")+4;
  218 + String version1 = agent.substring(first);
  219 + String version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
  220 + bo.setTd("ios_" + version.replaceAll("_", "."));
  221 + bo.setClient_type("ios");
  222 + bo.setAppid("490655927");
  223 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  224 + }
  225 + //momochat/7.5.6 ios/664 (iphone 6; ios 10.2; zh_cn; iphone7,2; s1)
  226 + if(agent.contains("momochat")){
  227 + int first = agent.indexOf(" ios ")+4;
  228 + String version1 = agent.substring(first);
  229 + String version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
  230 + bo.setTd("ios_" + version.replaceAll("_", "."));
  231 + bo.setClient_type("ios");
  232 + bo.setAppid("490655927");
  233 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  234 + }
  235 + //ios/6.6 com.jugg.doctor ipad5,3/8.3/768x1024/2.0 /1---这个应该就是ios_6.6
  236 + if(agent.contains("ios/")){
  237 + String version = agent.substring(agent.indexOf("ios/")+4,agent.indexOf(" "));
  238 + bo.setTd("ios_" + version.replaceAll("_", "."));
  239 + bo.setClient_type("ios");
  240 + bo.setAppid("490655927");
  241 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  242 + }
  243 + if (agent.contains("ios")){
  244 + //user-agent=momochat/7.5.6 ios/664 (iphone 6; ios 10.2; zh_cn; iphone7,2; s1)
  245 + int first = agent.indexOf(" ios ")+4;
  246 + String version1 = agent.substring(first);
  247 + String version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
  248 + bo.setTd("ios_" + version.replaceAll("_", "."));
  249 + bo.setClient_type("ios");
  250 + bo.setAppid("490655927");
  251 + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  252 + }
  253 +
212 } else { 254 } else {
213 int index = agent.lastIndexOf("android"); 255 int index = agent.lastIndexOf("android");
214 if (index > 0) { 256 if (index > 0) {
@@ -87,7 +87,7 @@ public class OrderUnionRest { @@ -87,7 +87,7 @@ public class OrderUnionRest {
87 orderInfo.setShippingCost(new BigDecimal(1)); 87 orderInfo.setShippingCost(new BigDecimal(1));
88 orderInfo.setOrderStatus("1"); 88 orderInfo.setOrderStatus("1");
89 orderInfo.setOrderType("web"); 89 orderInfo.setOrderType("web");
90 - orderInfo.setClientId("1010"); 90 + orderInfo.setClientId("1001");
91 orderInfo.setIsNew("N"); 91 orderInfo.setIsNew("N");
92 orderInfo.setMbrName("12776646"); 92 orderInfo.setMbrName("12776646");
93 orderInfo.setTrackingCode("NDgwMDB8MDBvYzI3MGJhZjU5MGI1YTQ1ZDk="); 93 orderInfo.setTrackingCode("NDgwMDB8MDBvYzI3MGJhZjU5MGI1YTQ1ZDk=");
1 -//package com.test;  
2 -//  
3 -//import com.yoho.unions.server.service.impl.DuomaiServiceImpl;  
4 -//import com.yoho.unions.vo.OrderInfo;  
5 -//import com.yoho.unions.vo.OrdersGood;  
6 -//  
7 -//import java.math.BigDecimal;  
8 -//import java.net.URLDecoder;  
9 -//import java.util.ArrayList;  
10 -//import java.util.List;  
11 -//  
12 -///**  
13 -// * Created by yoho on 2016/12/20.  
14 -// */  
15 -//public class DuomaiTest {  
16 -//  
17 -// public static void main(String args[]){  
18 -// List<OrderInfo> orderInfoList = new ArrayList<>();  
19 -// OrderInfo orderInfo = new OrderInfo();  
20 -// orderInfo.setOrderCode("1071030883");  
21 -// orderInfo.setClientId(3017);  
22 -// orderInfo.setOrderStatus("1");  
23 -// List<OrdersGood> ordersGoods = new ArrayList<>();  
24 -// OrdersGood ordersGood = new OrdersGood();  
25 -// ordersGood.setBuyNumber(2);  
26 -// ordersGood.setLastPrice(new BigDecimal(12));  
27 -// ordersGood.setProductName("NIKE");  
28 -// ordersGood.setProductSkn("20193911");  
29 -// ordersGoods.add(ordersGood);  
30 -// orderInfo.setOrdersGoods(ordersGoods);  
31 -// orderInfoList.add(orderInfo);  
32 -// DuomaiServiceImpl duomaiService = new DuomaiServiceImpl();  
33 -// duomaiService.pushOrder(orderInfoList);  
34 -//  
35 -// String encoude = "hash%3D96613bf38393aa3d16451218f22344a8%26euid%3D189018877%26order_sn%3D1612568846%26order_time%3D2016-12-05+22%3A13%3A40%26orders_price%3D158.0%26promotion_code%3D0%26is_new_custom%3D1%26channel%3D0%26status%3D0%26goods_id%3D690870%26goods_name%3D%2520N%2520O%2520T%2520H%2520O%2520M%2520M%2520E%2520%25%25202%25200%2520%E8%B4%B4%2520%E8%A2%8B%2520%E6%9D%9F%2520%E8%84%9A%2520%E5%B7%A5%2520%E8%A3%85%2520%E8%A3%A4%2520%26goods_price%3D158.0%26goods_ta%3D1%26goods_cate%3D129%26goods_cate_name%3D0%26totalPrice%3D158.0%26rate%3D0%26commission%3D%26commission_type%3D0%26coupon%3D0.0";  
36 -// try{  
37 -// String decode = URLDecoder.decode(encoude,"UTF-8");  
38 -// System.out.print(decode);  
39 -// }catch (Exception e){  
40 -//  
41 -// }  
42 -//  
43 -// }  
44 -//  
45 -//} 1 +package com.test;
  2 +
  3 +
  4 +/**
  5 + * Created by yoho on 2016/12/20.
  6 + */
  7 +public class DuomaiTest {
  8 +
  9 + public static void main(String args[]){
  10 + String agent= "momochat/7.5.6 ios/664 (iphone 6; ios 10.2; zh_cn; iphone7,2; s1)";
  11 + int first = agent.indexOf(" ios ")+4;
  12 + String version1 = agent.substring(first);
  13 + String version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
  14 + System.out.print(version);
  15 +
  16 + }
  17 +
  18 +}