Authored by zhengwen.ge

增加td判断

... ... @@ -198,17 +198,59 @@ public class ClickUnionRest {
bo.setClient_type("android");
bo.setAppid("com.yoho");
String agent = request.getHeader("user-agent");
agent = "momochat/7.5.6 ios/664 (iphone 6s; ios 10.1.1; zh-hans_ae; iphone8,1; s1)";
agent = agent.toLowerCase();
log.info("addUnion4Stream user-agent={}", agent);
String url = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk";
try {
if (!StringUtils.isEmpty(agent)) {
if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0) {
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";
if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0 ||agent.indexOf("ipad")>0) {
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 ---这种情况比较多
if(agent.contains("youku")){
int first = agent.indexOf("ios;")+4;
String version1 = agent.substring(first);
String 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)
if(agent.contains("momochat")){
int first = agent.indexOf(" ios ")+4;
String version1 = agent.substring(first);
String 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";
}
//ios/6.6 com.jugg.doctor ipad5,3/8.3/768x1024/2.0 /1---这个应该就是ios_6.6
if(agent.contains("ios/")){
String 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";
}
if (agent.contains("ios")){
//user-agent=momochat/7.5.6 ios/664 (iphone 6; ios 10.2; zh_cn; iphone7,2; s1)
int first = agent.indexOf(" ios ")+4;
String version1 = agent.substring(first);
String 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 {
int index = agent.lastIndexOf("android");
if (index > 0) {
... ...
... ... @@ -87,7 +87,7 @@ public class OrderUnionRest {
orderInfo.setShippingCost(new BigDecimal(1));
orderInfo.setOrderStatus("1");
orderInfo.setOrderType("web");
orderInfo.setClientId("1010");
orderInfo.setClientId("1001");
orderInfo.setIsNew("N");
orderInfo.setMbrName("12776646");
orderInfo.setTrackingCode("NDgwMDB8MDBvYzI3MGJhZjU5MGI1YTQ1ZDk=");
... ...
//package com.test;
//
//import com.yoho.unions.server.service.impl.DuomaiServiceImpl;
//import com.yoho.unions.vo.OrderInfo;
//import com.yoho.unions.vo.OrdersGood;
//
//import java.math.BigDecimal;
//import java.net.URLDecoder;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by yoho on 2016/12/20.
// */
//public class DuomaiTest {
//
// public static void main(String args[]){
// List<OrderInfo> orderInfoList = new ArrayList<>();
// OrderInfo orderInfo = new OrderInfo();
// orderInfo.setOrderCode("1071030883");
// orderInfo.setClientId(3017);
// orderInfo.setOrderStatus("1");
// List<OrdersGood> ordersGoods = new ArrayList<>();
// OrdersGood ordersGood = new OrdersGood();
// ordersGood.setBuyNumber(2);
// ordersGood.setLastPrice(new BigDecimal(12));
// ordersGood.setProductName("NIKE");
// ordersGood.setProductSkn("20193911");
// ordersGoods.add(ordersGood);
// orderInfo.setOrdersGoods(ordersGoods);
// orderInfoList.add(orderInfo);
// DuomaiServiceImpl duomaiService = new DuomaiServiceImpl();
// duomaiService.pushOrder(orderInfoList);
//
// 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";
// try{
// String decode = URLDecoder.decode(encoude,"UTF-8");
// System.out.print(decode);
// }catch (Exception e){
//
// }
//
// }
//
//}
package com.test;
/**
* Created by yoho on 2016/12/20.
*/
public class DuomaiTest {
public static void main(String args[]){
String agent= "momochat/7.5.6 ios/664 (iphone 6; ios 10.2; zh_cn; iphone7,2; s1)";
int first = agent.indexOf(" ios ")+4;
String version1 = agent.substring(first);
String version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
System.out.print(version);
}
}
... ...