From 5aff45755ef1913d0f39d6d0623ed592ea1710d1 Mon Sep 17 00:00:00 2001 From: TomyJan Date: Tue, 2 Jul 2024 18:14:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=83=A8=E5=88=86=20API=20=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=A7=8D=E5=AD=90=E5=A4=84=E7=90=86=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/kuroApi.js | 17 +++++++---------- model/kuroBBSLogin.js | 3 +-- model/mcGachaData.js | 6 +++--- model/utils.js | 4 ++++ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/model/kuroApi.js b/model/kuroApi.js index 6c1f2e6..bead189 100644 --- a/model/kuroApi.js +++ b/model/kuroApi.js @@ -169,7 +169,7 @@ export default class kuroApi { * @returns {JSON|string} code=200 时接口返回的原始 json 或者报错信息 */ async sdkLogin(data) { - return this.getData('sdkLogin', null, data) + return this.getData('sdkLogin', '1', data) } /** @@ -380,30 +380,27 @@ export default class kuroApi { /** * 鸣潮抽卡记录 - * @param {string} kuroUid 库洛 ID, 传 0 即可 * @param {object} data 传入 data.cardPoolId 卡池 id data.cardPoolType 卡池类型 data.playerId 游戏 uid data.recordId 记录 id data.serverId 服务器 id * @returns {JSON|string} code=0 时接口返回的原始 json 或者报错信息 */ - async mcGachaRecord(kuroUid, data) { - return this.getData('mcGachaRecord', kuroUid, data) + async mcGachaRecord(data) { + return this.getData('mcGachaRecord', '1', data) } /** * 从插件服务器获取库街区登录通信 token - * @param {string} kuroUid 库洛 ID, 传 0 即可 * @returns {JSON|string} code=0 时接口返回的原始 json 或者报错信息 */ - async getPluginServerKuroBbsLoginAuth(kuroUid) { - return this.getData('getPluginServerKuroBbsLoginAuth', kuroUid, {}) + async getPluginServerKuroBbsLoginAuth() { + return this.getData('getPluginServerKuroBbsLoginAuth', '1', {}) } /** * 从插件服务器获取库街区 token - * @param {string} kuroUid 库洛 ID, 传 0 即可 * @params {object} data 传入 data.token 通信 token * @returns {JSON|string} code=0 时接口返回的原始 json 或者报错信息 */ - async getPluginServerKuroBbsLoginToken(kuroUid, data) { - return this.getData('getPluginServerKuroBbsLoginToken', kuroUid, data) + async getPluginServerKuroBbsLoginToken(data) { + return this.getData('getPluginServerKuroBbsLoginToken', '1', data) } } diff --git a/model/kuroBBSLogin.js b/model/kuroBBSLogin.js index 3ee5503..198adc0 100644 --- a/model/kuroBBSLogin.js +++ b/model/kuroBBSLogin.js @@ -129,7 +129,7 @@ export default class kuroBBSLogin { async onlineLogin() { let kuroapi = new kuroApi(this.e.user_id) let rsp_getPluginServerKuroBbsLoginAuth = - await kuroapi.getPluginServerKuroBbsLoginAuth(0) + await kuroapi.getPluginServerKuroBbsLoginAuth() kuroLogger.debug( 'rsp_getPluginServerKuroBbsLoginAuth:', JSON.stringify(rsp_getPluginServerKuroBbsLoginAuth) @@ -170,7 +170,6 @@ export default class kuroBBSLogin { while (i < 36) { await sleepAsync(5000) let rsp_onlineLogin = await kuroapi.getPluginServerKuroBbsLoginToken( - 0, { token: rsp_getPluginServerKuroBbsLoginAuth.token, } diff --git a/model/mcGachaData.js b/model/mcGachaData.js index 745d7c0..c0d57ea 100644 --- a/model/mcGachaData.js +++ b/model/mcGachaData.js @@ -225,7 +225,7 @@ export default class mcGachaData { // 发送请求 let kuroapi = new kuroApi(qq) - let rsp_mcGachaRecord = await kuroapi.mcGachaRecord(0, { + let rsp_mcGachaRecord = await kuroapi.mcGachaRecord({ cardPoolId, cardPoolType: 7, playerId, @@ -259,7 +259,7 @@ export default class mcGachaData { curCardPoolToFetch <= 7; curCardPoolToFetch++ ) { - let rsp_mcGachaRecord = await kuroapi.mcGachaRecord(0, { + let rsp_mcGachaRecord = await kuroapi.mcGachaRecord({ cardPoolId, cardPoolType: curCardPoolToFetch, playerId, @@ -268,7 +268,7 @@ export default class mcGachaData { }) if (typeof rsp_mcGachaRecord === 'string') // 失败重试一次 - rsp_mcGachaRecord = await kuroapi.mcGachaRecord(0, { + rsp_mcGachaRecord = await kuroapi.mcGachaRecord({ cardPoolId, cardPoolType: curCardPoolToFetch, playerId, diff --git a/model/utils.js b/model/utils.js index 9b1e484..ac3bccd 100644 --- a/model/utils.js +++ b/model/utils.js @@ -78,6 +78,10 @@ export function generateUUID(inputString) { * @returns {string} 固定字符串 */ export function generateFixedString(inputString, length = 40) { + if (!inputString) { + kuroLogger.warn('生成固定字符串输入为空, 使用默认值 1') + inputString = '1' + } if (length > 64) { length = 64 kuroLogger.warn(