From 5cc5f448404c18e3d406920a3ed692254b05460e Mon Sep 17 00:00:00 2001 From: TomyJan Date: Tue, 2 Jul 2024 22:42:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=88=E4=BA=8E=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BA=86=E6=9C=AA=E7=BB=91=E5=AE=9A=E7=94=A8=E6=88=B7=E9=B8=A3?= =?UTF-8?q?=E6=BD=AE=E6=8A=BD=E5=8D=A1=E8=AE=B0=E5=BD=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/kuroApiHandler.js | 2 +- model/userConfig.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/model/kuroApiHandler.js b/model/kuroApiHandler.js index 57d59a1..a6923b8 100644 --- a/model/kuroApiHandler.js +++ b/model/kuroApiHandler.js @@ -18,7 +18,7 @@ export default class kuroApiHandler { * 取库洛接口返回 * 调用其他接口前请先校验 token 有效性 * @param {string} ApiName 接口名称 - * @param {string|boolean} kuroUid 库洛 ID, sdkLogin 和 mcGachaRecord 传入 false + * @param {string|boolean} kuroUid 库洛 ID, 不需要的接口 传入 114514 * @param {string} token 库洛 ID 的 token * @param {object} data 传入数据 * @returns {JSON|string} 接口返回的 原始 json 或者报错信息 diff --git a/model/userConfig.js b/model/userConfig.js index ba5785e..92db26c 100644 --- a/model/userConfig.js +++ b/model/userConfig.js @@ -149,6 +149,10 @@ export default class userConfig { let kuroUidToFetch = Object.keys(tokenData)[kuroUidIndex] let kuroapi = new kuroApi(qq) do { + if (!kuroUidToFetch) { + kuroLogger.warn(`用户 ${qq} 没有绑定 token, 无法通过 api 遍历找出 uid`) + break + } let rsp_roleList = await kuroapi.roleList(kuroUidToFetch, { gameId }) if (typeof rsp_roleList !== 'string') { if (rsp_roleList.data.length > 0) { @@ -224,6 +228,10 @@ export default class userConfig { let kuroUidToFetch = Object.keys(tokenData)[kuroUidIndex] let kuroapi = new kuroApi(qq) do { + if (!kuroUidToFetch) { + kuroLogger.warn(`用户 ${qq} 没有绑定 token, 无法通过 api 遍历找出 uid`) + break + } let rsp_roleList = await kuroapi.roleList(kuroUidToFetch, { gameId }) if (typeof rsp_roleList !== 'string') { if (rsp_roleList.data.length > 0) {