兼容自定义短链

This commit is contained in:
Dragon
2023-09-21 16:29:57 +08:00
parent deab819661
commit 8a8da3d3d2

View File

@@ -33,7 +33,7 @@
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?code=${urlData.code}`, true);
httpRequest.open('GET', `${urlPrefix}/short/link/click?code=${urlData.code}&clientTime=${time}`, true);
httpRequest.send();
/**
* 获取数据后的处理程序
@@ -41,16 +41,19 @@
httpRequest.onreadystatechange = function () {
if (httpRequest.readyState == 4 && httpRequest.status == 200) {
var json = httpRequest.responseText;//获取到json字符串还需解析
console.log(json);
var res = JSON.parse(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')
if (res.data.type == 1) {
window.location.replace(res.data.customValue);
} else {
window.location.replace('http://www.pekolive.com/')
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/')
}
}
}
}
};