// login-z1-test.xxx.xx:登录服 // service-z1-test.xxx.xx:裂变活动服 // gamelog-z1-test.xxx.xx:埋点数据上报服 // cloud-z1-test.xxx.xx:云信息存储服 // gamemail-z1-test.xxx.xx: 邮件服 // stat-z1-test.xxx.xx: 统计服 // relation-z1-test.xxx.xx: 关系服(好友) // game2006api-z1-test.xxx.xx // game2006-z1-test.xxx.xx // game2006-z1-test-1.xxx.xx // -z1-test.cebg.games:美国 // -z2-test.cebg.games:日本 // -z3-test.cebg.games:新加坡 // -z4-test.cebg.games:土耳其 // game2006-z1-test-n1.cebg.games // https://game2006ap-test.kingsome.cn export var allBaseNet = { usa: "-z1-test.cebg.games", japan: "-z2-test.cebg.games", singapore: "-z3-test.cebg.games", turkey: "-z4-test.cebg.games", }; const netIdHash = (function () { const result = {}; for (let key in allBaseNet) { const url = allBaseNet[key]; const zid = extractZid(url); result[zid] = { name: key, url: url, }; } return result; })(); const functionNet = { login: "https://login", // ok service: "https://service", // ok gamelog: "https://gamelog", // ok cloud: "https://cloud", // ok gamemail: "https://gamemail", notify: "https://notify", stat: "https://stat", // ok relation: "wss://relation", //ok //game gameapi: "https://game2006api", game: "wss://game2006", }; function getCommonParam() { let os = ""; if (cc.sys.os == cc.sys.OS_ANDROID) { os = "android"; } else if (cc.sys.os == cc.sys.OS_IOS) { os = "ios"; } else { os = cc.sys.os; } return ( "_net=" + encodeURIComponent(localStorage.getItem("currentNet")) + "&_os=" + encodeURIComponent(os) ); } export function getNormalApiUrl(name) { return ( functionNet[name] + "-z3-test.cebg.games" + "/webapp/index.php?" + getCommonParam() ); } export function getExaminingUrl() { return ( functionNet["login"] + "-z3-test.cebg.games" + "/webapp/index.php?" + getCommonParam() ); } export function getRelationUrl() { return ( functionNet["relation"] + "-z3-test.cebg.games" + "/friend/websocket" ); } export function getNodeUrl() { return ( functionNet["game"].replace("wss://", "https://") + localStorage.getItem("currentNet") + "/webapp/index.php?" + getCommonParam() ); } export function extractZid(url) { return Number(url[2]); } export function getZViewName(zid) { switch (zid) { case 1: { return "USA"; } break; case 2: { return "Japan"; } break; case 3: { return "Singapore"; } break; case 4: { return "Turkey"; } break; default: { return ""; } break; } } export function getCurrentZid() { try { return extractZid(localStorage.getItem("currentNet")); } catch (err) { return 0; } } function getZUrl(zid) { return netIdHash[zid]["url"]; } function getZName(zid) { return netIdHash[zid]["name"]; } export function getGameServer(teamUuid) { const nodeId = teamUuid ? teamUuid.split("_")[0] : cc.SDKManage.NodeId; const zid = teamUuid ? teamUuid.split("_")[1] : extractZid(localStorage.getItem("currentNet")); let urls = teamUuid ? getZUrl(zid) : localStorage.getItem("currentNet"); urls = urls.split("."); urls[0] += "-n" + nodeId; return functionNet["game"] + urls.join(".") + "/websocket"; } // game2006 -z1-test-n1 .cebg.games