Authored by DengXinFei

新增测试文件

  1 +
  2 +
  3 +<!DOCTYPE html>
  4 +<html>
  5 +<head>
  6 + <meta charset="utf-8">
  7 + <title>潮流商品 | YOHO!有货</title>
  8 + <meta name="description" content="">
  9 + <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
  10 + <script type="text/javascript">
  11 + var agent = navigator.userAgent.toLowerCase() ;
  12 + var version, type, appid, td, queryString, downUrl;
  13 +
  14 + var jumpTypes = [110];
  15 +
  16 + function isInJump(unionType) {
  17 + for (var i = 0 ;i < jumpTypes.length; i++) {
  18 + if (unionType == jumpTypes[i]) {
  19 + return true;
  20 + }
  21 + }
  22 + return false;
  23 + }
  24 +
  25 + function getQueryString() {
  26 + var vars = [],
  27 + hash,
  28 + i;
  29 + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  30 +
  31 + for (i = 0; i < hashes.length; i++) {
  32 + hash = hashes[i].split('=');
  33 + vars.push(hash[0]);
  34 + vars[hash[0]] = hash[1];
  35 + }
  36 + return vars;
  37 + }
  38 +
  39 + queryString = getQueryString();
  40 + downUrl = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
  41 + //downUrl = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  42 + var appkey = queryString.appkey;
  43 +
  44 + if (appkey == "yoho") {
  45 + //yohonow
  46 + downUrl = "https://a.app.qq.com/o/simple.jsp?pkgname=cn.yoho.magazine#opened";
  47 + } else if (appkey == "mars") {
  48 + //mars
  49 + downUrl = "https://itunes.apple.com/cn/app/mars-xin-xian-hao-qu-chu-yu/id1056487123?l=en&mt=8";
  50 + //downUrl = "http://yoho-apps.qiniudn.com/YohoMars.apk";
  51 + }
  52 +
  53 + if (agent.indexOf("like mac os x") > 0) {
  54 + var regStr_saf = /os [\d._]*/gi ;
  55 + var verinfo = agent.match(regStr_saf) ;
  56 +
  57 + version = (verinfo+'').replace(/[^0-9|_.]/ig,'').replace(/_/ig, '.');
  58 + type = 'ios';
  59 + appid = '490655927';
  60 + td = window.screen.width + '_' + window.screen.height + '_' + type + '_' + version;
  61 +
  62 + } else if (agent.indexOf('android') > -1 || agent.indexOf('linux') > -1) {
  63 + type = 'android';
  64 + appid = 'com.yoho';
  65 + try {
  66 + var indextd = agent.indexOf('_td');
  67 + var index = agent.indexOf(' build');
  68 + var preString = '';
  69 + var deviceType = '';
  70 +
  71 + //alert(agent);
  72 + if (indextd > -1) {
  73 + preString = agent.substr(0, indextd);
  74 + preString = preString.substr(preString.lastIndexOf(";") + 1);
  75 + preString = preString.replace(/\s+/g,'').replace(/_/ig, '');
  76 +
  77 + var sansungIndex = preString.indexOf('samsung-');
  78 + if (sansungIndex > -1) {
  79 + preString = preString.substr(8);
  80 + }
  81 + } else if (index > -1) {
  82 + preString = agent.substr(0, index);
  83 + preString = preString.substr(preString.lastIndexOf(";") + 1);
  84 + preString = preString.replace(/\s+/g,'').replace(/_/ig, '');
  85 + //alert(preString);
  86 + }
  87 + deviceType = preString;
  88 + version = agent.substr(agent.indexOf('android') + 8, 3);
  89 + td = deviceType + '_' + type + '_' + version;
  90 + } catch(e) {
  91 +
  92 + }
  93 +
  94 +
  95 +
  96 + //downUrl = 'http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk';
  97 + }
  98 +
  99 +
  100 +
  101 + $.ajax({
  102 + method: 'POST',
  103 + url: 'http://union.yoho.cn/union/ClickUnionRest/addUnion',
  104 +// url: 'http://192.168.102.205:8088/union/ClickUnionRest/addUnion',
  105 + data: {
  106 + union_type: queryString.union_type,
  107 + identify_id: queryString.identify_id,
  108 + callbackurl: queryString.callbackurl,
  109 + client_type: type,
  110 + td: queryString.td ? queryString.td : td,
  111 + appid: queryString.appid ? queryString.appid : appid,
  112 + appkey: queryString.appkey,
  113 + idfa : queryString.idfa ? queryString.idfa : queryString.IDFA,
  114 + imei:queryString.imei?queryString.imei:queryString.IMEI
  115 + },
  116 + complete: function() {
  117 +
  118 + /* if (!downUrl) {
  119 + window.location.href = "http://m.yohobuy.com";
  120 + } else {
  121 + window.location.href = downUrl;
  122 + } */
  123 + window.location.href = downUrl;
  124 +
  125 + window.setTimeout(function() {
  126 + window.location.href = "http://m.yohobuy.com";
  127 + }, 2000);
  128 + }
  129 + });
  130 +
  131 +
  132 + </script>
  133 +</head>
  134 +<body>
  135 +</body>
  136 +</html>