144 lines
4.8 KiB
HTML
144 lines
4.8 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>下載</title>
|
||
<style>
|
||
* {
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
|
||
html,
|
||
body {
|
||
width: 100%;
|
||
height: 100%;
|
||
background: #0f273d;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
</body>
|
||
|
||
</html>
|
||
<script>
|
||
var productUrl = 'https://api.pekolive.com'; // 正式环境
|
||
var testUrl = 'http://beta.api.pekolive.com'; // 测试环境
|
||
var urlData = getQueryString();
|
||
var browser = checkVersion();
|
||
var time = dateFormat(new Date().getTime(), 'yyyy-MM-dd hh:mm:ss');
|
||
let urlPrefix = getUrlPrefix()
|
||
var httpRequest = new XMLHttpRequest();
|
||
httpRequest.open('GET', urlPrefix + '/short/link/click', true);
|
||
httpRequest.send();
|
||
/**
|
||
* 获取数据后的处理程序
|
||
*/
|
||
httpRequest.onreadystatechange = function () {
|
||
if (httpRequest.readyState == 4 && httpRequest.status == 200) {
|
||
var json = httpRequest.responseText;//获取到json字符串,还需解析
|
||
console.log(json);
|
||
if (JSON.parse(json).code == 200) {
|
||
if (browser.ios) {
|
||
window.location.replace('https://app.adjust.com/14c9ggtx')
|
||
} else if (browser.android) {
|
||
window.location.replace('https://app.adjust.com/14ayv1j8')
|
||
} else {
|
||
window.location.replace('http://www.pekolive.com/')
|
||
}
|
||
|
||
}
|
||
}
|
||
};
|
||
// 根据域名判断 正式环境(含www)/测试环境(含beta), 并返回所需url前缀
|
||
// written by zxfxiong
|
||
function getUrlPrefix () {
|
||
if (!EnvCheck()) return undefined;
|
||
return EnvCheck() === 'live' ? productUrl : testUrl;
|
||
}
|
||
// 根据域名适配环境
|
||
function EnvCheck () {
|
||
if (window.location.href) {
|
||
var _url = window.location.href;
|
||
var res = _url.match(/uat/);
|
||
var res1 = _url.match(/120.79.211.243/);
|
||
var res2 = _url.match(/192.168./)
|
||
var res3 = _url.match(/127.0/)
|
||
var res4 = _url.match(/beta/)
|
||
if (res || res1 || res2 || res3 || res4) {
|
||
return 'test';
|
||
} else {
|
||
return 'live';
|
||
}
|
||
}
|
||
}
|
||
// 获取地址栏参数
|
||
function getQueryString () {
|
||
var _url = location.search;
|
||
var theRequest = new Object();
|
||
if (_url.indexOf('?') != -1) {
|
||
var str = _url.substr(1);
|
||
strs = str.split('&');
|
||
for (var i in strs) {
|
||
theRequest[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
|
||
}
|
||
}
|
||
return theRequest;
|
||
}
|
||
// 判断浏览器内核,手机类型
|
||
function checkVersion () {
|
||
var u = navigator.userAgent,
|
||
app = navigator.appVersion;
|
||
return {
|
||
trident: u.indexOf('Trident') > -1, //IE内核
|
||
presto: u.indexOf('Presto') > -1, //opera内核
|
||
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
|
||
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
|
||
mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
|
||
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
|
||
android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端
|
||
iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
|
||
iPad: u.indexOf('iPad') > -1, //是否iPad
|
||
webApp: u.indexOf('Safari') > -1, //是否web应该程序,没有头部与底部
|
||
weixin: u.indexOf('MicroMessenger') > -1, //是否微信
|
||
qq: u.match(/\sQQ/i) == " qq", //是否QQ
|
||
pekoApp: u.match('pekoApp'),
|
||
app: u.match('pekoApp') //是否在app内
|
||
};
|
||
}
|
||
function dateFormat (date, fmt) {
|
||
date = new Date(date);
|
||
var o = {
|
||
'M+': date.getMonth() + 1,
|
||
'd+': date.getDate(),
|
||
'h+': date.getHours(),
|
||
'm+': date.getMinutes(),
|
||
's+': date.getSeconds()
|
||
};
|
||
|
||
// 补全0
|
||
function padLeftZero (str) {
|
||
return ('00' + str).substr(str.length);
|
||
}
|
||
|
||
// 年份
|
||
if (/(y+)/.test(fmt)) {
|
||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
|
||
}
|
||
|
||
// 月日时分秒
|
||
for (var k in o) {
|
||
if (new RegExp('(' + k + ')').test(fmt)) {
|
||
var str = o[k] + '';
|
||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
|
||
}
|
||
}
|
||
|
||
date = o = padLeftZero = null;
|
||
return fmt;
|
||
}
|
||
</script> |