410 lines
14 KiB
TypeScript
410 lines
14 KiB
TypeScript
|
export class BJ_Casino_Deeplink {
|
||
|
|
||
|
//#region public
|
||
|
|
||
|
public Servertype: any[] = [5, ["不選擇版本", "Web", "Out", "Submit", "Internal_release", "Internal_Dev"]];
|
||
|
public Hostport: any[] = [1, ["不選擇環境", "內版", "肉乾", "賴宏", "40", "送審", "外版", "testing1", "testing2", "testing3"]];
|
||
|
public Patch: any[] = [1, [
|
||
|
"不選擇資源路徑",
|
||
|
"內版",
|
||
|
"B2B",
|
||
|
"送審",
|
||
|
"外版",
|
||
|
"alex",
|
||
|
"bowei",
|
||
|
"建喵-內版",
|
||
|
"建喵-B2B",
|
||
|
"建喵-送審",
|
||
|
"建喵-外版"
|
||
|
]];
|
||
|
|
||
|
//#endregion
|
||
|
|
||
|
//#region private
|
||
|
|
||
|
private _client: any;
|
||
|
|
||
|
private _u = navigator.userAgent;
|
||
|
private _isAndroid = this._u.indexOf('Android') > -1 || this._u.indexOf('Adr') > -1;
|
||
|
private _isiOS = !!this._u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
||
|
|
||
|
//#endregion
|
||
|
|
||
|
//#region Lifecycle
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
constructor(client: any) {
|
||
|
this._client = client;
|
||
|
this.onLoad();
|
||
|
}
|
||
|
|
||
|
public onLoad() {
|
||
|
this._client.servertype.value = this.Servertype[0];
|
||
|
this._client.hostport.value = this.Hostport[0];
|
||
|
this._client.patch.value = this.Patch[0];
|
||
|
this._client.servertypeDefault.value = this.Servertype[1][this._client.servertype.value];
|
||
|
this._client.hostportDefault.value = this.Hostport[1][this._client.hostport.value];
|
||
|
this._client.patchDefault.value = this.Patch[1][this._client.patch.value];
|
||
|
};
|
||
|
|
||
|
//#endregion
|
||
|
|
||
|
//#region Get Data
|
||
|
|
||
|
public SelectServertype(data: any) {
|
||
|
// data为el-option上:value绑定的对象
|
||
|
this._client.servertype.value = data;
|
||
|
}
|
||
|
|
||
|
public SelectHostport(data: any) {
|
||
|
// data为el-option上:value绑定的对象
|
||
|
this._client.hostport.value = data;
|
||
|
}
|
||
|
|
||
|
public SelectPatch(data: any) {
|
||
|
// data为el-option上:value绑定的对象
|
||
|
this._client.patch.value = data;
|
||
|
}
|
||
|
|
||
|
//#endregion
|
||
|
|
||
|
//#region Get Data
|
||
|
|
||
|
public GetServerType(): { key: string; value: string; label: string; }[] {
|
||
|
const servertypes: any[] = this.Servertype[1];
|
||
|
let options: any[] = [];
|
||
|
for (let i: number = 0; i < servertypes.length; i++) {
|
||
|
const servertype = servertypes[i];
|
||
|
options.push({
|
||
|
value: i,
|
||
|
label: servertype
|
||
|
});
|
||
|
}
|
||
|
return options;
|
||
|
}
|
||
|
|
||
|
public GetHostport(): { key: string; value: string; label: string; }[] {
|
||
|
const hostports: any[] = this.Hostport[1];
|
||
|
let options: any[] = [];
|
||
|
for (let i: number = 0; i < hostports.length; i++) {
|
||
|
const hostport = hostports[i];
|
||
|
options.push({
|
||
|
value: i,
|
||
|
label: hostport
|
||
|
});
|
||
|
}
|
||
|
return options;
|
||
|
}
|
||
|
|
||
|
public GetPatch(): { key: string; value: string; label: string; }[] {
|
||
|
const patchs: any[] = this.Patch[1];
|
||
|
let options: any[] = [];
|
||
|
for (let i: number = 0; i < patchs.length; i++) {
|
||
|
const patch = patchs[i];
|
||
|
options.push({
|
||
|
value: i,
|
||
|
label: patch
|
||
|
});
|
||
|
}
|
||
|
return options;
|
||
|
}
|
||
|
|
||
|
//#endregion
|
||
|
|
||
|
//#region Custom
|
||
|
|
||
|
public Install_Debug() {
|
||
|
if (this._isAndroid) {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/aoh4p9vs1lrofy2/BJ_Casino-debug.apk?v=" + Date.now(), '_self');
|
||
|
} else if (this._isiOS) {
|
||
|
window.open("itms-services://?action=download-manifest&url=https://dl.dropboxusercontent.com/s/z390yysswqiiii4/BJ_Casino-debug.plist", '_self');
|
||
|
} else {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/aoh4p9vs1lrofy2/BJ_Casino-debug.apk?v=" + Date.now(), '_blank');
|
||
|
window.open("https://dl.dropboxusercontent.com/s/4ki0rglk4w01ian/BJ_Casino-debug.ipa", '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Install_Release() {
|
||
|
if (this._isAndroid) {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/6mjrw913u6ma5w8/BJ_Casino-release.apk?v=" + Date.now(), '_self');
|
||
|
} else if (this._isiOS) {
|
||
|
window.open("itms-services://?action=download-manifest&url=https://dl.dropboxusercontent.com/s/9qckj6t66jgb6rw/BJ_Casino-release.plist", '_self');
|
||
|
} else {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/6mjrw913u6ma5w8/BJ_Casino-release.apk?v=" + Date.now(), '_blank');
|
||
|
window.open("https://dl.dropboxusercontent.com/s/hyyswyun3m42qbk/BJ_Casino-release.ipa?v=" + Date.now(), '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Install_Release_Debug() {
|
||
|
if (this._isAndroid) {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/16m2b5sncymj6f9/BJ_Casino-release-debug.apk?v=" + Date.now(), '_self');
|
||
|
} else if (this._isiOS) {
|
||
|
window.open("itms-services://?action=download-manifest&url=https://dl.dropboxusercontent.com/s/wixnsxbc7ctk87f/BJ_Casino-release-debug.plist", '_self');
|
||
|
} else {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/16m2b5sncymj6f9/BJ_Casino-release-debug.apk?v=" + Date.now(), '_blank');
|
||
|
window.open("https://dl.dropboxusercontent.com/s/f6qjm1gk8jjvmhx/BJ_Casino-release-debug.ipa?v=" + Date.now(), '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Install_B2B() {
|
||
|
if (this._isAndroid) {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/g66xrcdfj9e093i/BJ_Casino-B2B.apk?v=" + Date.now(), '_self');
|
||
|
} else if (this._isiOS) {
|
||
|
window.open("itms-services://?action=download-manifest&url=https://dl.dropboxusercontent.com/s/rrs1ev3llogrm0a/BJ_Casino-B2B.plist", '_self');
|
||
|
} else {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/g66xrcdfj9e093i/BJ_Casino-B2B.apk?v=" + Date.now(), '_blank');
|
||
|
window.open("https://dl.dropboxusercontent.com/s/fm79uc9ygrnzone/BJ_Casino-B2B.ipa?v=" + Date.now(), '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Install_JM() {
|
||
|
if (this._isAndroid) {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/9zlj6og4octmim8/BJ_Casino-JM.apk?v=" + Date.now(), '_self');
|
||
|
} else if (this._isiOS) {
|
||
|
window.open("itms-services://?action=download-manifest&url=https://dl.dropboxusercontent.com/s/23mx7l7cchbvjcv/BJ_Casino-JM.plist", '_self');
|
||
|
} else {
|
||
|
window.open("https://dl.dropboxusercontent.com/s/9zlj6og4octmim8/BJ_Casino-JM.apk?v=" + Date.now(), '_blank');
|
||
|
window.open("https://dl.dropboxusercontent.com/s/dwlil2rbfe1wi13/BJ_Casino-JM.ipa?v=" + Date.now(), '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Install_Store() {
|
||
|
if (this._isAndroid) {
|
||
|
window.open("https://play.google.com/store/apps/details?id=org.vicking.bj_casino", '_self');
|
||
|
} else if (this._isiOS) {
|
||
|
window.open("https://apps.apple.com/tw/app/爆機娛樂城/id1593328573", '_self');
|
||
|
} else {
|
||
|
window.open("https://play.google.com/store/apps/details?id=org.vicking.bj_casino", '_blank');
|
||
|
window.open("https://apps.apple.com/tw/app/爆機娛樂城/id1593328573", '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Install_Bowei() {
|
||
|
if (this._isAndroid) {
|
||
|
window.open("http://220.134.195.1/public/bonus_casino/html5/bowei/BJ_Casino-debug.apk?v=" + Date.now(), '_self');
|
||
|
} else if (this._isiOS) {
|
||
|
alert("iOS不提供");
|
||
|
} else {
|
||
|
window.open("http://220.134.195.1/public/bonus_casino/html5/bowei/BJ_Casino-debug.apk?v=" + Date.now(), '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Install_InternalTest(InternalTest: number): void {
|
||
|
// let InternalTest = document.getElementById("InternalTest").value;
|
||
|
// let InternalTest = "";
|
||
|
if (this._isAndroid && InternalTest) {
|
||
|
window.open(`https://play.google.com/apps/test/org.vicking.bj_casino/${InternalTest}`, '_self');
|
||
|
} else if (this._isiOS) {
|
||
|
alert("iOS不提供");
|
||
|
} else {
|
||
|
window.open(`https://play.google.com/apps/test/org.vicking.bj_casino/${InternalTest}`, '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public OnclickOpen() {
|
||
|
let hostport = this._client.hostport.value;
|
||
|
let servertype = +this._client.servertype.value;
|
||
|
let patch = +this._client.patch.value;
|
||
|
let E_iscustom: any = document.getElementById("iscustom");
|
||
|
let iscustom = E_iscustom.checked;
|
||
|
let URLscheme: any = {};
|
||
|
|
||
|
switch (servertype) {
|
||
|
case 0: {
|
||
|
break;
|
||
|
}
|
||
|
default: {
|
||
|
URLscheme["servertype"] = servertype;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
switch (hostport) {
|
||
|
|
||
|
// 不選擇環境
|
||
|
case 0: {
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// 外網連內版
|
||
|
case 1: {
|
||
|
URLscheme["host"] = "http://220.134.195.1";
|
||
|
URLscheme["port"] = "19005";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// 肉乾
|
||
|
case 2: {
|
||
|
URLscheme["host"] = "http://192.168.5.230";
|
||
|
URLscheme["port"] = "9006";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// 賴宏
|
||
|
case 3: {
|
||
|
URLscheme["host"] = "http://192.168.5.134";
|
||
|
URLscheme["port"] = "9005";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// 40
|
||
|
case 4: {
|
||
|
URLscheme["host"] = "http://192.168.5.12";
|
||
|
URLscheme["port"] = "9487";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// 送審
|
||
|
case 5: {
|
||
|
URLscheme["host"] = "https://submit.online-bj.com";
|
||
|
URLscheme["port"] = "9005";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// 外版
|
||
|
case 6: {
|
||
|
URLscheme["host"] = "https://game.online-bj.com";
|
||
|
URLscheme["port"] = "9005";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// testing1
|
||
|
case 7: {
|
||
|
URLscheme["host"] = "http://bj-testing1.casino.catan.com.tw";
|
||
|
URLscheme["port"] = "9005";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// testing2
|
||
|
case 8: {
|
||
|
URLscheme["host"] = "http://bj-testing2.casino.catan.com.tw";
|
||
|
URLscheme["port"] = "9005";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// testing3
|
||
|
case 9: {
|
||
|
URLscheme["host"] = "http://bj-testing3.casino.catan.com.tw";
|
||
|
URLscheme["port"] = "9005";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
default: {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
switch (patch) {
|
||
|
// "https://patch.online-bj.com/game/",
|
||
|
// "https://patch-submit.online-bj.com/game/",
|
||
|
// "http://220.134.195.1/public/bonus_casino/html5/alex/APPBundleTest/",
|
||
|
// "http://220.134.195.1/public/bonus_casino/html5/jianmiau/Bundle/",
|
||
|
// "http://patch-release.online-bj.com/",
|
||
|
// "http://patch-dev.online-bj.com/",
|
||
|
|
||
|
case 0: {
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// Dev
|
||
|
case 1: {
|
||
|
URLscheme["patch"] = "http://patch-dev.online-bj.com/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// B2B
|
||
|
case 2: {
|
||
|
URLscheme["patch"] = "http://patch-release.online-bj.com/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// 送審
|
||
|
case 3: {
|
||
|
URLscheme["patch"] = "https://patch-submit.online-bj.com/game/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// 外版
|
||
|
case 4: {
|
||
|
URLscheme["patch"] = "https://patch.online-bj.com/game/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// alex
|
||
|
case 5: {
|
||
|
URLscheme["patch"] = "http://220.134.195.1/public/bonus_casino/html5/alex/Bundle/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// bowei
|
||
|
case 6: {
|
||
|
URLscheme["patch"] = "http://220.134.195.1/public/bonus_casino/html5/bowei/Bundle/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// jianmiau-Dev
|
||
|
case 7: {
|
||
|
// URLscheme["patch"] = "http://220.134.195.1/public/bonus_casino/html5/jianmiau/Bundle/";
|
||
|
URLscheme["patch"] = "http://192.168.5.36/Source/_BJ_Source/BJ-Internal-Dev/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// jianmiau-Release
|
||
|
case 8: {
|
||
|
URLscheme["patch"] = "http://192.168.5.36/Source/_BJ_Source/BJ-Internal-Release/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// jianmiau-Submit
|
||
|
case 9: {
|
||
|
URLscheme["patch"] = "http://192.168.5.36/Source/_BJ_Source/BJ-Submit/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// jianmiau-Out
|
||
|
case 10: {
|
||
|
URLscheme["patch"] = "http://192.168.5.36/Source/_BJ_Source/BJ-Out/";
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
default: {
|
||
|
break;
|
||
|
}
|
||
|
// case 0: {
|
||
|
// break;
|
||
|
// }
|
||
|
// default: {
|
||
|
// URLscheme["patch"] = document.getElementById("patch").options[patch].label;
|
||
|
// break;
|
||
|
// }
|
||
|
}
|
||
|
|
||
|
let url = "";
|
||
|
if (iscustom) {
|
||
|
let URLscheme = new URL(location.href);
|
||
|
if (this._isiOS || this._isAndroid) {
|
||
|
url = `bjcasino://get/message${URLscheme.search}`;
|
||
|
} else {
|
||
|
url = `http://192.168.5.108:7456/phone.html${URLscheme.search}`;
|
||
|
}
|
||
|
} else {
|
||
|
let _URLSearchParams = new URLSearchParams(URLscheme).toString();
|
||
|
let _decodeURI = decodeURIComponent(_URLSearchParams);
|
||
|
if (this._isiOS || this._isAndroid) {
|
||
|
url = `bjcasino://get/message${_decodeURI ? `?${_decodeURI}` : ""}`;
|
||
|
} else {
|
||
|
url = `http://192.168.5.108:7456/phone.html${_decodeURI ? `?${_decodeURI}` : ""}`;
|
||
|
}
|
||
|
}
|
||
|
if (this._isiOS || this._isAndroid) {
|
||
|
window.open(url, '_self');
|
||
|
} else {
|
||
|
window.open(url, '_blank');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//#endregion
|
||
|
}
|