Authored by DengXinFei

Merge branch 'master' of git.yoho.cn:yoho30/yohobuy-union

... ... @@ -21,6 +21,17 @@ public class CommonJumpReqVO {
//暂时用不到
private String u_id;
// PC WAP链接 使用的共通参数
private String union_data;
public String getUnion_data() {
return union_data;
}
public void setUnion_data(String union_data) {
this.union_data = union_data;
}
public String getClient_id() {
return client_id;
}
... ...
... ... @@ -36,6 +36,17 @@ public class OrderInfo implements Serializable {
private String isNew;
// 共通参数
private String unionData;
public String getUnionData() {
return unionData;
}
public void setUnionData(String unionData) {
this.unionData = unionData;
}
public String getIsNew() {
return isNew;
}
... ...
package com.yoho.unions.dal;
import com.yoho.unions.dal.model.UserOrdersRelation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
public interface IUserOrdersRelationDAO {
int deleteByPrimaryKey(Integer id);
int insert(UserOrdersRelation record);
int insertSelective(UserOrdersRelation record);
UserOrdersRelation selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserOrdersRelation record);
int updateByPrimaryKey(UserOrdersRelation record);
List<UserOrdersRelation> selectByUserOrderId(@Param("list") List<Integer> list);
}
\ No newline at end of file
... ...
... ... @@ -15,12 +15,22 @@ public class UnionClickLogs {
private String clientType;
public String getUserAgent() {
return userAgent;
}
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
private String td;
private String appKey;
private String clientIp;
private String userAgent;
public Integer getId() {
return id;
}
... ...
... ... @@ -21,12 +21,23 @@ public class UnionLogs {
private Integer createTime;
private Integer updateTime;
private String clientType;
private String td;
private String appKey;
public String getInterfaceType() {
return interfaceType;
}
public void setInterfaceType(String interfaceType) {
this.interfaceType = interfaceType;
}
private String interfaceType;
public Integer getId() {
return id;
}
... ...
... ... @@ -55,6 +55,16 @@ public class UserOrders {
//目前没有使用
private Integer isPush;
private String unionData;
public String getUnionData() {
return unionData;
}
public void setUnionData(String unionData) {
this.unionData = unionData;
}
public Integer getId() {
return id;
}
... ...
package com.yoho.unions.dal.model;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class UserOrdersRelation {
private Integer id;
private Integer userOrdersId;
private String unionData;
private Integer createTime;
}
\ No newline at end of file
... ...
... ... @@ -12,9 +12,10 @@
<result column="td" property="td" jdbcType="VARCHAR" />
<result column="app_key" property="appKey" jdbcType="VARCHAR" />
<result column="client_ip" property="clientIp" jdbcType="VARCHAR" />
<result column="user_agent" property="userAgent" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, app_id, idfa, imei, union_type, create_time, client_type, td, app_key, client_ip
id, app_id, idfa, imei, union_type, create_time, client_type, td, app_key, client_ip,user_agent
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
... ... @@ -30,11 +31,11 @@
insert into union_click_logs (id, app_id, idfa,
imei, union_type, create_time,
client_type, td, app_key,
client_ip)
client_ip,user_agent)
values (#{id,jdbcType=INTEGER}, #{appId,jdbcType=VARCHAR}, #{idfa,jdbcType=VARCHAR},
#{imei,jdbcType=VARCHAR}, #{unionType,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER},
#{clientType,jdbcType=VARCHAR}, #{td,jdbcType=VARCHAR}, #{appKey,jdbcType=VARCHAR},
#{clientIp,jdbcType=VARCHAR})
#{clientIp,jdbcType=VARCHAR},#{userAgent,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UnionClickLogs" >
insert into union_click_logs
... ... @@ -69,6 +70,9 @@
<if test="clientIp != null" >
client_ip,
</if>
<if test="userAgent != null" >
user_agent,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
... ... @@ -101,6 +105,9 @@
<if test="clientIp != null" >
#{clientIp,jdbcType=VARCHAR},
</if>
<if test="userAgent != null" >
#{userAgent,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="selectByIdfa" resultMap="BaseResultMap">
... ... @@ -129,7 +136,8 @@
client_type = #{clientType,jdbcType=VARCHAR},
td = #{td,jdbcType=VARCHAR},
app_key = #{appKey,jdbcType=VARCHAR},
client_ip = #{clientIp,jdbcType=VARCHAR}
client_ip = #{clientIp,jdbcType=VARCHAR},
user_agent = #{userAgent,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -17,11 +17,12 @@
<result column="client_type" property="clientType" jdbcType="VARCHAR" />
<result column="td" property="td" jdbcType="VARCHAR" />
<result column="app_key" property="appKey" jdbcType="VARCHAR" />
<result column="interface_type" property="interfaceType" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, app_id, udid, idfa, imei, is_activate, union_type, add_params,
activate_params,
create_time, update_time, client_type, td, app_key
create_time, update_time, client_type, td, app_key,interface_type
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
... ... @@ -38,13 +39,13 @@
insert into union_logs (id, app_id, udid,
idfa, imei, is_activate,
union_type, add_params, activate_params,
create_time, update_time, client_type, td, app_key)
create_time, update_time, client_type, td, app_key,interface_type)
values (#{id,jdbcType=INTEGER}, #{appId,jdbcType=VARCHAR},
#{udid,jdbcType=VARCHAR},
#{idfa,jdbcType=VARCHAR}, #{imei,jdbcType=VARCHAR}, #{isActivate,jdbcType=TINYINT},
#{unionType,jdbcType=INTEGER}, #{addParams,jdbcType=VARCHAR},
#{activateParams,jdbcType=VARCHAR},
#{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{clientType}, #{td}, #{appKey})
#{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{clientType}, #{td}, #{appKey}, #{interfaceType})
</insert>
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionLogs">
update union_logs
... ... @@ -58,7 +59,8 @@
activate_params = #{activateParams,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=INTEGER},
client_type=#{clientType},
app_key=#{appKey}
app_key=#{appKey},
interface_type=#{interfaceType}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateUnionLogs">
... ...
... ... @@ -62,7 +62,7 @@
#{uId,jdbcType=INTEGER}, #{orderTime,jdbcType=INTEGER}, #{isPush,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UserOrders" >
<insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.yoho.unions.dal.model.UserOrders" >
insert into user_orders
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.unions.dal.IUserOrdersRelationDAO" >
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UserOrdersRelation" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="user_orders_id" property="userOrdersId" jdbcType="INTEGER" />
<result column="union_data" property="unionData" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, user_orders_id, union_data, create_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from user_orders_relation
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from user_orders_relation
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.UserOrdersRelation" >
insert into user_orders_relation (id, user_orders_id, union_data,
create_time)
values (#{id,jdbcType=INTEGER}, #{userOrdersId,jdbcType=INTEGER}, #{unionData,jdbcType=VARCHAR},
#{createTime,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UserOrdersRelation" >
insert into user_orders_relation
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="userOrdersId != null" >
user_orders_id,
</if>
<if test="unionData != null" >
union_data,
</if>
<if test="createTime != null" >
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="userOrdersId != null" >
#{userOrdersId,jdbcType=INTEGER},
</if>
<if test="unionData != null" >
#{unionData,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UserOrdersRelation" >
update user_orders_relation
<set >
<if test="userOrdersId != null" >
user_orders_id = #{userOrdersId,jdbcType=INTEGER},
</if>
<if test="unionData != null" >
union_data = #{unionData,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UserOrdersRelation" >
update user_orders_relation
set user_orders_id = #{userOrdersId,jdbcType=INTEGER},
union_data = #{unionData,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByUserOrderId" resultMap="BaseResultMap" parameterType="java.util.List">
select
<include refid="Base_Column_List" />
from user_orders_relation
where 1=1 and
user_orders_id in
<foreach collection="list" index="index" item="code" open="(" separator="," close=")">
#{code}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.message.YhMessageConsumer;
import com.yoho.unions.common.utils.DateUtil;
import com.yoho.unions.dal.IUserOrdersDAO;
import com.yoho.unions.dal.IUserOrdersRelationDAO;
import com.yoho.unions.dal.model.UserOrders;
import com.yoho.unions.dal.model.UserOrdersRelation;
import com.yoho.unions.message.CommonMessageConsumer;
import com.yoho.unions.server.service.IOrderPushService;
import org.apache.commons.lang.StringUtils;
... ... @@ -30,6 +32,9 @@ public class OrderPushConsumer implements CommonMessageConsumer {
@Autowired
IUserOrdersDAO userOrdersDAO;
@Autowired
IUserOrdersRelationDAO userOrdersRelationDAO;
@Override
public String getMessageTopic() {
return ORDER_PUSH_TOPIC;
... ... @@ -55,12 +60,28 @@ public class OrderPushConsumer implements CommonMessageConsumer {
private void saveUnionOrder(String orderData) {
UserOrders userOrders = convertData(orderData);
userOrdersDAO.insertSelective(userOrders);
// 将从订单那边传过来的union_data 存进db
String unionData = userOrders.getUnionData();
if (org.apache.commons.lang3.StringUtils.isNotBlank(unionData)){
UserOrdersRelation userOrdersRelation = new UserOrdersRelation();
userOrdersRelation.setUserOrdersId(userOrders.getId());
userOrdersRelation.setCreateTime(DateUtil.getCurrentTimeSecond());
userOrdersRelation.setUnionData(unionData);
userOrdersRelationDAO.insert(userOrdersRelation);
}
}
private UserOrders convertData(String orderData) {
JSONObject jsonObject = JSON.parseObject(orderData);
JSONObject unionCookie = JSONObject.parseObject(jsonObject.getString("unionCookie"));
UserOrders userOrders = new UserOrders();
userOrders.setUnionData(unionCookie.getString("union_data"));
//联盟id
userOrders.setUid(jsonObject.getString("clientId"));
... ...
... ... @@ -333,6 +333,7 @@ public class ClickUnionRest {
bo.setAppid("com.yoho");
String agent = request.getHeader("user-agent");
agent = agent.toLowerCase();
bo.setUserAgent(agent);
log.info("addUnion4Stream user-agent={}", agent);
String url = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk";
try {
... ...
... ... @@ -56,6 +56,7 @@ public class OrderPushServiceImpl implements IOrderPushService{
param.put("orderType",orderInfo.getOrderType());
//是否是新客
param.put("isNew",orderInfo.getIsNew());
param.put("union_data", orderInfo.getUnionData());
//商品最终支付金额
BigDecimal proRealPay = new BigDecimal(0);
//如果有多个则需要将多个商品进行分割
... ...
... ... @@ -10,6 +10,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.beans.PropertyDescriptor;
... ... @@ -76,7 +77,26 @@ public class RedirectServiceImpl implements IRedirectService {
logger.warn("jump: channelId is null, requst param is {}", commonJumpReqVO);
return;
}
String redirectUrl = builderCommonUrl(commonJumpReqVO);
// 将 union_data写到cookies里面(页面负责将此值写到cookie里面)
String union_data = null;
if (StringUtils.isNotBlank(commonJumpReqVO.getUnion_data())){
try {
union_data = URLEncoder.encode(commonJumpReqVO.getUnion_data(), "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.warn("builderUrlForFanli: urlEncode failed: request param is {}", commonJumpReqVO.getUnion_data());
}
}
if (StringUtils.isNotBlank(union_data)){
Cookie cookie = new Cookie("union_data", union_data);
cookie.setDomain(".yohobuy.com");
cookie.setPath("/");
response.addCookie(cookie);
}
response.setStatus(301);
response.sendRedirect(redirectUrl);
}catch (IOException e){
... ... @@ -157,6 +177,7 @@ public class RedirectServiceImpl implements IRedirectService {
}else {
targetUrl.append("?union_type=").append(commonJumpReqVO.getUnion_type());
}
logger.info("builderCommonUrl url is {}", targetUrl.toString());
return targetUrl.toString();
}
... ...
... ... @@ -432,6 +432,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
logs.setAddParams(value);
logs.setTd(request.getTd());
logs.setAppKey(request.getAppkey());
logs.setInterfaceType(click.getInterfaceType());
unionLogsDAO.insert(logs);
log.info("activateUnion add db success with request is {}, and dbData={}", request, logs);
... ... @@ -552,6 +553,7 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
unionClickLogs.setAppKey(request.getAppkey());
unionClickLogs.setAppId(request.getAppid());
unionClickLogs.setCreateTime(DateUtil.getCurrentTimeSecond());
unionClickLogs.setUserAgent(request.getUserAgent());
unionClickLogsDAO.insertSelective(unionClickLogs);
}
});
... ...
... ... @@ -7,8 +7,10 @@ import com.yoho.unions.common.enums.UnionTypeStatusEnum;
import com.yoho.unions.common.utils.SpringContextUtil;
import com.yoho.unions.dal.IUnionTypeManageDAO;
import com.yoho.unions.dal.IUserOrdersDAO;
import com.yoho.unions.dal.IUserOrdersRelationDAO;
import com.yoho.unions.dal.model.UnionTypeManage;
import com.yoho.unions.dal.model.UserOrders;
import com.yoho.unions.dal.model.UserOrdersRelation;
import com.yoho.unions.server.service.IOrderPushService;
import com.yoho.unions.server.service.IUnionOrderService;
import com.yoho.unions.vo.OrderInfo;
... ... @@ -19,6 +21,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import sun.text.resources.sr.CollationData_sr_Latn;
import javax.annotation.Resource;
import java.util.List;
... ... @@ -44,6 +47,9 @@ public class BigDataOrderInfoTask {
@Autowired
IUnionTypeManageDAO unionTypeManageDAO;
@Autowired
IUserOrdersRelationDAO userOrdersRelationDAO;
@Scheduled(cron = "* 0/3 * * * ?")
public void run() {
UnionOrderReqVO reqVO = new UnionOrderReqVO();
... ... @@ -66,6 +72,24 @@ public class BigDataOrderInfoTask {
});
//获取校验后的订单code
List<UserOrders> userOrderList = userOrdersDAO.getExistOrderCodes(orderMap.keySet());
// 获取关联表中的 union_data
List<Integer> userOrderIdList = Lists.newArrayList();
for (UserOrders userOrder : userOrderList){
userOrderIdList.add(userOrder.getId());
}
Map<Integer, UserOrdersRelation> userOrdersRelationMap = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(userOrderIdList)){
List<UserOrdersRelation> userOrdersRelations = userOrdersRelationDAO.selectByUserOrderId(userOrderIdList);
userOrdersRelationMap = Maps.uniqueIndex(userOrdersRelations, new Function<UserOrdersRelation, Integer>() {
@Override
public Integer apply(UserOrdersRelation input) {
return input.getUserOrdersId();
}
});
}
logger.info("execute: userOrdersDAO.getExistOrderCodes: param is {}, result is {}", orderMap.keySet(), userOrderList == null ? 0 : userOrderList.size());
//按source分类
Map<String, List<OrderInfo>> orderInfoMap = Maps.newHashMap();
... ... @@ -86,6 +110,12 @@ public class BigDataOrderInfoTask {
orderInfoMap.put(orderInfo.getClientId(), Lists.newArrayList(orderInfo));
continue;
}
// 获取 union_data返回
UserOrdersRelation userOrdersRelation = userOrdersRelationMap.get(userOrders.getId());
if (userOrdersRelation != null){
orderInfo.setUnionData(userOrdersRelation.getUnionData());
}
orderInfoMap.get(orderInfo.getClientId()).add(orderInfo);
}
... ...
... ... @@ -44,5 +44,6 @@ datasources:
- com.yoho.unions.dal.ITencentMktCouponHistoryDAO
- com.yoho.unions.dal.IUnionActivityDAO
- com.yoho.unions.dal.IUnionConfigDAO
- com.yoho.unions.dal.IUserOrdersRelationDAO
readOnlyInSlave: true
\ No newline at end of file
... ...
... ... @@ -45,5 +45,6 @@ datasources:
- com.yoho.unions.dal.ITencentMktCouponHistoryDAO
- com.yoho.unions.dal.IUnionActivityDAO
- com.yoho.unions.dal.IUnionConfigDAO
- com.yoho.unions.dal.IUserOrdersRelationDAO
readOnlyInSlave: true
\ No newline at end of file
... ...
... ... @@ -19,11 +19,11 @@
<url-pattern>/yohoHomedown.html</url-pattern>
<url-pattern>/yohoHomedownV2.html</url-pattern>
<url-pattern>/downmars.html</url-pattern>
<url-pattern>/nowsdownapp.html</url-pattern>
<url-pattern>/downshow.html</url-pattern>
<url-pattern>/downyohoshow.html</url-pattern>
<url-pattern>/downapp3.html</url-pattern>
<url-pattern>/app-downloads.html</url-pattern>
<url-pattern>/nowapp-downloads.html</url-pattern>
<url-pattern>/js/*</url-pattern>
<url-pattern>/tencentMkt/index.html</url-pattern>
<url-pattern>/tencentMkt/css/*</url-pattern>
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Yoho!Buy有货|年轻人潮流购物中心,中国潮流购物风向标</title>
<meta name="keywords"
content="Yoho!Buy有货 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
<meta name="description" content="Yoho!Buy有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta content="telephone=no" name="format-detection"/>
<meta content="email=no" name="format-detection"/>
<link rel="dns-prefetch" href="//cdn.yoho.cn">
<link rel="dns-prefetch" href="//static.yohobuy.com">
<link rel="dns-prefetch" href="//img10.static.yhbimg.com">
<link rel="dns-prefetch" href="//img11.static.yhbimg.com">
<link rel="dns-prefetch" href="//img12.static.yhbimg.com">
<link rel="dns-prefetch" href="//img13.static.yhbimg.com">
<link rel="dns-prefetch" href="//analytics.m.yohobuy.com">
<link rel="dns-prefetch" href="//search.m.yohobuy.com">
<link rel="dns-prefetch" href="//list.m.yohobuy.com">
<link rel="dns-prefetch" href="//guang.m.yohobuy.com">
<script type="text/javascript">
(function (d, c) {
var e = d.documentElement, a = "orientationchange" in window ? "orientationchange" : "resize", b = function () {
var f = e.clientWidth;
if (!f) {
return
}
if (f >= 640) {
e.style.fontSize = "40px"
} else {
e.style.fontSize = 40 * (f / 640) + "px"
}
};
if (!d.addEventListener) {
return
}
b();
c.addEventListener(a, b, false);
d.addEventListener("DOMContentLoaded", b, false)
})(document, window);
</script>
<link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-node/5.3.20/common.css">
<link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-node/5.3.20/activity.app-downloads.css">
<link rel="apple-touch-icon-precomposed"
href="//static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png">
<link rel="apple-touch-startup-image" sizes="640x920"
href="//static.yohobuy.com/m/v1/img/startup/startup-retina.png"
media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" sizes="320x460" href="//static.yohobuy.com/m/v1/img/startup/startup.png"
media="screen and (max-device-width: 320)">
</head>
<body class=" ">
<div class="main-wrap" id="main-wrap">
<div class="container">
<div id="no-download"></div>
<div class="banner"></div>
<div class="main">
<div class="slide-box">
<div class="swiper-wrapper clearfix">
<div class="yohobuy" tag="0">
<div class="swiper-yohobuy bg"></div>
<div class="ewm-area">
<img src="//cdn.yoho.cn/yohocn/160315/images/ewm-yohobuy.png"/>
<div class="ewm-info"></div>
</div>
<span id="download" class="download-btn" onclick="downloadApp();">点击下载 · Yoho!Now</span>
</div>
</div>
</div>
<div class="slide-pagination clearfix">
</div>
</div>
<div class="footer">
CopyRight © 2007-2017 YOHO!新力传媒
</div>
<div class="mask">
<div class="wx-img1"></div>
<div class="wx-img2"></div>
<div class="wx-img3"></div>
</div>
</div>
</div>
<script>var STATIC_RESOURCE_PATH = '//cdn.yoho.cn/m-yohobuy-node/assets';</script>
<script src="//cdn.yoho.cn/m-yohobuy-node/5.3.20/libs.js"></script>
<!--<script src="//cdn.yoho.cn/m-yohobuy-node/5.3.20/activity.app-downloads.js"></script>-->
<script type="text/javascript">
function cookie(name) {
var cookies = document.cookie,
cookieVal;
if (cookies) {
cookies = cookies.split(';');
cookies.forEach(function (c) {
if (c.indexOf(name) > -1) {
cookieVal = decodeURIComponent($.trim(c.replace(name + '=', '')));
return;
}
});
}
return cookieVal;
}
function queryString() {
var vars = {},
hash,
i;
var hashes = window.location.search.slice(1).split('&');
for (i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars[hash[0]] = hash[1];
}
return vars;
}
function xhrGet(url, cb) {
var conn = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
conn.onreadystatechange = function () {
if (conn.readyState == 4 && conn.status == 200) {
cb(conn.responseText)
}
};
conn.open("GET", url, true);
conn.send();
}
window.cookie = cookie;
var url = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
var isWechat = /micromessenger/i.test(navigator.userAgent || '');
if(isWechat){
url = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
location.href = url;
}
var u = navigator.userAgent.toLowerCase();
var isiOS = u.indexOf('os') > -1 || u.indexOf('iphone') > -1 || u.indexOf('mac') > -1 || u.indexOf('ipad') > -1;
var androidExp = new RegExp('MQQBrowser');//安卓QQ内置浏览器正则
var isAndroidQQ = androidExp.test(navigator.userAgent); //判断是不是QQ内置浏览器
var version, type, appid, td, params;
params = queryString();
if(params.union_type){
url = 'yohobuy://yohobuy.com/goapp?ct='+params.union_type+'&openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
}
if (isiOS) {
var regStr_saf = /os [\d._]*/gi;
var verinfo = u.match(regStr_saf);
version = (verinfo + '').replace(/[^0-9|_.]/ig, '').replace(/_/ig, '.');
type = 'ios';
appid = '490655927';
td = window.screen.width + '_' + window.screen.height + '_' + type + '_' + version;
} else if (u.indexOf('android') > -1 || u.indexOf('linux') > -1) {
type = 'android';
appid = 'com.yoho';
try {
var indextd = u.indexOf('_td');
var index = u.indexOf(' build');
var preString = '';
if (indextd > -1) {
preString = u.substr(0, indextd);
preString = preString.substr(preString.lastIndexOf(";") + 1);
preString = preString.replace(/\s+/g, '').replace(/_/ig, '');
var sansungIndex = preString.indexOf('samsung-');
if (sansungIndex > -1) {
preString = preString.substr(8);
}
} else if (index > -1) {
preString = u.substr(0, index);
preString = preString.substr(preString.lastIndexOf(";") + 1);
preString = preString.replace(/\s+/g, '').replace(/_/ig, '');
//alert(preString);
}
deviceType = preString;
version = u.substr(u.indexOf('android') + 8, 3);
td = deviceType + '_' + type + '_' + version;
} catch (e) {
}
}
var appPath = url;
var ifr;
setTimeout(function () {
//记录唤醒时间
var openTime = +new Date();
window.setTimeout(function () {
if (ifr) {
document.body.removeChild(ifr);
}
//如果setTimeout 回调超过2500ms,则弹出下载
if ((+new Date()) - openTime > 500) {
if (isiOS) {
url = '//itunes.apple.com/app/id530419467?mt=8';
} else {
url = '//yoho-apps.qiniudn.com/Yoho.apk';
}
//unionClick();
location.href = url;
// window.open(url);
}
}, 1000);
if (isiOS) {
window.location.href = appPath;
} else {
ifr = document.createElement('iframe');
ifr.src = appPath;
ifr.style.display = 'none';
document.body.appendChild(ifr);
}
}, 500);
//1: 男生,2-女生,3-潮童,4-创意生活
var CHANNELS = {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
};
function downloadApp() {
var url;
var channel = window.cookie('_Channel');
if(isWechat){
url = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
}else{
if (isiOS) {
url = '//itunes.apple.com/app/id530419467?mt=8';
} else {
if(isAndroidQQ){ //安卓qq处理方式同微信,也进入应用宝下载
url = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
}else{
url = '//itunes.apple.com/app/id530419467?mt=8';
}
}
}
// 上报 nginx 数据
xhrGet('//m.yohobuy.com/activitylog.json?download2', function () {
});
// 上报 yas 数据
if (typeof _yas !== 'undefined') {
_yas.sendCustomInfo && _yas.sendCustomInfo({
op: 'YB_DOWNLOAD_C',
param: JSON.stringify({
C_ID: CHANNELS[channel],
TO_URL: encodeURIComponent(url)
})
}, true);
}
// 联盟点击
if (params.union_type) {
//unionClick();
}
location.href = url;
}
function unionClick() {
var unionUrl = 'https://union.yoho.cn/union/ClickUnionRest/addUnion?client_type=' + type;
// var unionUrl = 'http://127.0.0.1:8088/union/ClickUnionRest/addUnion?client_type=' + type;
if (params.union_type) {
unionUrl += '&union_type=' + params.union_type;
}
if (params.identify_id) {
unionUrl += '&identify_id=' + params.identify_id;
}
if (params.callbackurl) {
unionUrl += '&callbackurl=' + params.callbackurl;
}
if (params.td) {
unionUrl += '&td=' + params.td;
} else {
unionUrl += '&td=' + td;
}
if (params.appid) {
unionUrl += '&appid=' + params.appid;
} else {
unionUrl += '&appid=' + appid;
}
if (params.idfa) {
unionUrl += '&idfa=' + params.idfa;
} else if (params.IDFA) {
unionUrl += '&idfa=' + params.IDFA;
}
if (params.imei) {
unionUrl += '&imei=' + params.imei;
} else if (params.IMEI) {
unionUrl += '&imei=' + params.IMEI;
}
xhrGet(unionUrl, function () {
});
}
</script>
<script>
(function (w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function () {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.1/yas.js', '_yas'));
var _hmt = _hmt || [];
(function () {
function getUid() {
var uid,
name = '_UID',
cookies = (document.cookie && document.cookie.split(';')) || [];
cookies.forEach(function (c) {
if (c.indexOf(name) > -1) {
uid = decodeURIComponent(c.replace(name + '=', '').trim());
return;
}
});
if (!uid) return 0;
uid = uid.split('::');
if (!uid || uid.length < 4) {
return 0;
}
return uid[1];
}
// function queryString() {
// var vars = {},
// hash,
// i;
// var hashes = window.location.search.slice(1).split('&');
//
// for (i = 0; i < hashes.length; i++) {
// hash = hashes[i].split('=');
// vars[hash[0]] = hash[1];
// }
// return vars;
// }
var uid = getUid() || params.uid;
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '2.2.1', 'yohobuy_m', uid, '', '');
}
// 非登录状态,加载百度统计
if (!uid) {
setTimeout(function () {
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function () {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?e5b83a487a4458aa5abca43f5779b764";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}, 1000);
}
}());
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>潮流商品 | YOHO!有货</title>
<meta name="description" content="">
<script src="//lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
var agent = navigator.userAgent.toLowerCase() ;
var version, type, appid, td, queryString, downUrl;
var jumpTypes = [110];
function isInJump(unionType) {
for (var i = 0 ;i < jumpTypes.length; i++) {
if (unionType == jumpTypes[i]) {
return true;
}
}
return false;
}
function getQueryString() {
var vars = [],
hash,
i;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
queryString = getQueryString();
downUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=cn.yoho.magazine';
//downUrl = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
window.location.href = downUrl;
</script>
</head>
<body>
</body>
</html>
\ No newline at end of file
... ...