From be9cb8cf38fc827d1332e737aa7eb4f587fc4883 Mon Sep 17 00:00:00 2001 From: bbaban <3102509561@qq.com> Date: Thu, 12 Oct 2023 18:13:44 +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 | 6 ++++-- plugins/genshin/model/mys/mysInfo.js | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/plugins/genshin/model/mys/mysApi.js b/plugins/genshin/model/mys/mysApi.js index 4946f50..fa03be0 100644 --- a/plugins/genshin/model/mys/mysApi.js +++ b/plugins/genshin/model/mys/mysApi.js @@ -10,6 +10,8 @@ export default class MysApi { * @param cookie 米游社cookie * @param option 其他参数 * @param option.log 是否显示日志 + * @param isSr 是否星铁 + * @param device 设备device_id */ constructor (uid, cookie, option = {}, isSr = false, device = '') { this.uid = uid @@ -37,12 +39,12 @@ export default class MysApi { let urlMap = this.apiTool.getUrlMap({ ...data, deviceId: this.device }) if (!urlMap[type]) return false - let { url, query = '', body = '', sign = '' } = urlMap[type] + let { url, query = '', body = '' } = urlMap[type] if (query) url += `?${query}` if (body) body = JSON.stringify(body) - let headers = this.getHeaders(query, body, sign) + let headers = this.getHeaders(query, body) return { url, headers, body } } diff --git a/plugins/genshin/model/mys/mysInfo.js b/plugins/genshin/model/mys/mysInfo.js index c2323dd..e3f35ca 100644 --- a/plugins/genshin/model/mys/mysInfo.js +++ b/plugins/genshin/model/mys/mysInfo.js @@ -26,6 +26,8 @@ export default class MysInfo { // ck对应MysUser对象 this.ckUser = null this.auth = ['dailyNote', 'bbs_sign_info', 'bbs_sign_home', 'bbs_sign', 'ys_ledger', 'compute', 'avatarSkill', 'detail', 'blueprint', 'UserGame', 'deckList', 'avatar_cardList', 'action_cardList', 'avatarInfo'] + + this.gtest = false } static async init (e, api) { @@ -161,15 +163,15 @@ export default class MysInfo { let user = e.user?.getMysUser() let mysApi = new MysApi(mysInfo.uid, mysInfo.ckInfo.ck, option, e.isSr, user.device) - let device_fp = '' + let devicefp = '' if (!data?.headers?.['x-rpc-device_fp'] && api !== 'getFp') { - device_fp = (await mysApi.getData('getFp')).data?.device_fp + devicefp = (await mysApi.getData('getFp')).data?.device_fp if (data?.headers) { - data.headers['x-rpc-device_fp'] = device_fp + data.headers['x-rpc-device_fp'] = devicefp } else { if (!data) data = {} data.headers = { - 'x-rpc-device_fp': device_fp + 'x-rpc-device_fp': devicefp } } } @@ -181,11 +183,11 @@ export default class MysInfo { for (let i in api) { if (!api[i]?.headers?.['x-rpc-device_fp']) { if (api[i]?.headers) { - api[i].headers['x-rpc-device_fp'] = device_fp + api[i].headers['x-rpc-device_fp'] = devicefp } else { if (!api[i]) api[i] = {} api[i].headers = { - 'x-rpc-device_fp': device_fp + 'x-rpc-device_fp': devicefp } } } @@ -204,6 +206,7 @@ export default class MysInfo { for (let i in res) { res[i] = await mysInfo.checkCode(res[i], res[i].api, mysApi, api[res[i].api]) + mysInfo.gtest = true if (res[i]?.retcode === 0) continue @@ -417,8 +420,7 @@ export default class MysInfo { break case 1034: try { - let Validate = (await import(`file://${process.cwd()}/plugins/loveMys-plugin/model/mys/mysApi.js`)).default - res = await Validate.getvali(mysApi, type, data) + res = await Gtest.getvali(mysApi, type, data, this.gtest) } catch (error) { } if (!res || res?.retcode == 1034) {