This commit is contained in:
aozhiwei 2022-05-30 22:49:20 +08:00
parent 7698457578
commit 091608bc1c

View File

@ -1,14 +1,3 @@
// game2006api-z1-test.xxx.xx
// game2006-z1-test.xxx.xx
// game2006-z1-test-1.xxx.xx
// -z1-test.cebg.gamesusa
// -z2-test.cebg.gamesjp
// -z3-test.cebg.gamessg
// -z4-test.cebg.gamestk
// game2006-z1-test-n1.cebg.games
// https://game2006ap-test.kingsome.cn
export var allBaseNet = {
usa: '-z1-test.cebg.games',
japan: '-z2-test.cebg.games',
@ -27,13 +16,31 @@ function isDevEnv() {
// return false
}
if (isDevEnv()) {
allBaseNet = {
usa: '-test.kingsome.cn',
japan: '-test.kingsome.cn',
singapore: '-test.kingsome.cn',
turkey: '-test-kingsome.cn',
};
function isExamining() {
//!isDevEnv() and (ios or aabb) and (serverSwitch.examining)
if (isDevEnv()){
return false;
}
return true;
}
function getDevEnvUrlSuffix() {
//'-test.kingsome.cn'
return btoa('LXRlc3Qua2luZ3NvbWUuY24=');
}
function getExaminingUrlSuffix() {
return '-test.cebg.games';
}
function getUrlSuffix() {
let urlSuffix = '-z3-test.cebg.games';
if (isDevEnv()) {
urlSuffix = getDevEnvUrlSuffix();
} else if (isExamining()) {
urlSuffix = getExaminingUrlSuffix();
}
return urlSuffix;
}
const netIdHash = (function () {
@ -72,18 +79,21 @@ function getCommonParam() {
} else {
os = cc.sys.os;
}
let version = '';
return (
'_net=' +
encodeURIComponent(localStorage.getItem('currentNet')) +
'&_os=' +
encodeURIComponent(os)
encodeURIComponent(os) +
'&_version=' +
encodeURIComponent(version)
);
}
export function getNormalApiUrl(name) {
return (
functionNet[name] +
(isDevEnv() ? '-test.kingsome.cn' : '-z3-test.cebg.games') +
getUrlSuffix() +
'/webapp/index.php?' +
getCommonParam()
);
@ -92,7 +102,7 @@ export function getNormalApiUrl(name) {
export function getExaminingUrl() {
return (
functionNet['login'] +
(isDevEnv() ? '-test.kingsome.cn' : '-z3-test.cebg.games') +
'-z3-test.cebg.games' +
'/webapp/index.php?' +
getCommonParam()
);
@ -101,7 +111,7 @@ export function getExaminingUrl() {
export function getRelationUrl() {
return (
functionNet['relation'] +
(isDevEnv() ? '-test.kingsome.cn' : '-z3-test.cebg.games') +
getUrlSuffix() +
'/friend/websocket'
);
}
@ -170,9 +180,12 @@ function getZName(zid) {
}
export function getGameServer(teamUuid) {
if (isDevEnv()) {
return 'wss://game2006-test.kingsome.cn/websocket';
}
if (isDevEnv()) {
return 'wss://game2006' + getDevEnvUrlSuffix() '/websocket';
}
if (isExamining()) {
return 'wss://game2006' + getExaminingUrlSuffix() '/websocket';
}
const nodeId = teamUuid ? teamUuid.split('_')[0] : cc.SDKManage.NodeId;
const zid = teamUuid
? teamUuid.split('_')[1]