From 735e1a9a6220c279e2028babd6975512cc237a56 Mon Sep 17 00:00:00 2001 From: bbaban <3102509561@qq.com> Date: Sat, 21 Oct 2023 18:06:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/model/mys/mysApi.js | 13 ++++++++++++- plugins/genshin/model/mys/mysInfo.js | 25 ------------------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/plugins/genshin/model/mys/mysApi.js b/plugins/genshin/model/mys/mysApi.js index 586d6db..17baeb1 100644 --- a/plugins/genshin/model/mys/mysApi.js +++ b/plugins/genshin/model/mys/mysApi.js @@ -70,7 +70,14 @@ export default class MysApi { } async getData (type, data = {}, cached = false) { - if (type == 'getFp') data = { seed_id: this.generateSeed(16) } + if (!this._device_fp && !data?.Getfp) { + this._device_fp = await this.getData('getFp', { + seed_id: this.getSeed_id(16), + Getfp: true + }) + } + if (type === 'getFp' && !data?.Getfp) return this._device_fp + let { url, headers, body } = this.getUrl(type, data) if (!url) return false @@ -85,6 +92,10 @@ export default class MysApi { headers = { ...headers, ...data.headers } } + if (type !== 'getFp' && !headers['x-rpc-device_fp']) { + headers['x-rpc-device_fp'] = this._device_fp.data?.device_fp + } + let param = { headers, agent: await this.getAgent(), diff --git a/plugins/genshin/model/mys/mysInfo.js b/plugins/genshin/model/mys/mysInfo.js index 107a355..65f1956 100644 --- a/plugins/genshin/model/mys/mysInfo.js +++ b/plugins/genshin/model/mys/mysInfo.js @@ -163,35 +163,10 @@ export default class MysInfo { let user = e.user?.getMysUser() let mysApi = new MysApi(mysInfo.uid, mysInfo.ckInfo.ck, option, e.isSr, user.device) - let devicefp = '' - if (!data?.headers?.['x-rpc-device_fp'] && api !== 'getFp') { - devicefp = (await mysApi.getData('getFp')).data?.device_fp - if (data?.headers) { - data.headers['x-rpc-device_fp'] = devicefp - } else { - if (!data) data = {} - data.headers = { - 'x-rpc-device_fp': devicefp - } - } - } - let res if (lodash.isObject(api)) { let all = [] /** 同步请求 */ - for (let i in api) { - if (!api[i]?.headers?.['x-rpc-device_fp']) { - if (api[i]?.headers) { - api[i].headers['x-rpc-device_fp'] = devicefp - } else { - if (!api[i]) api[i] = {} - api[i].headers = { - 'x-rpc-device_fp': devicefp - } - } - } - } if (e.apiSync) { res = [] for (let i in api) {