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