This commit is contained in:
bietiaop 2024-07-08 16:27:34 +08:00
parent 5d109ef51c
commit 4828a31163
11 changed files with 100 additions and 126 deletions

View file

@ -5,13 +5,19 @@ import crypto from 'crypto';
import ZZZApiTool from './mysapi/tool.js';
// const DEVICE_ID = randomString(32).toUpperCase()
const DEVICE_NAME = randomString(_.random(1, 10));
const game_region = [
'prod_gf_cn',
'prod_gf_cn',
'prod_gf_us',
'prod_gf_eu',
'prod_gf_jp',
'prod_gf_sg',
];
export default class MysZZZApi extends MysApi {
constructor(uid, cookie, option = {}) {
super(uid, cookie, option, true);
this.uid = uid;
this.server = this.getServer();
// this.isSr = true
// this.server = 'hkrpg_cn'
this.apiTool = new ZZZApiTool(uid, this.server);
if (typeof this.cookie != 'string' && this.cookie) {
let ck =
@ -25,23 +31,20 @@ export default class MysZZZApi extends MysApi {
}
getServer() {
switch (String(this.uid).slice(0, -8)) {
case '1':
case '2':
return 'prod_gf_cn'; // 官服
case '5':
return 'prod_qd_cn'; // B服
case '6':
return 'prod_official_usa'; // 美服
case '7':
return 'prod_official_euro'; // 欧服
case '8':
case '18':
return 'prod_official_asia'; // 亚服
case '9':
return 'prod_official_cht'; // 港澳台服
const _uid = this.uid.toString();
if (_uid.length < 10) {
return game_region[this.game][0]; // 官服
}
switch (_uid.slice(0, -8)) {
case '10':
return game_region[this.game][2]; // 美服
case '15':
return game_region[this.game][3]; // 欧服
case '13':
return game_region[this.game][4]; // 亚服
case '17':
return game_region[this.game][5]; // 港澳台服
}
return 'prod_gf_cn';
}
getUrl(type, data = {}) {