From d2c90cc6440a411495d400fa27df77d72bd6c5b7 Mon Sep 17 00:00:00 2001 From: ctrlcvs <1509167646@qq.com> Date: Tue, 11 Jul 2023 11:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=AD=A3`#=E5=88=B7=E6=96=B0=E5=85=85?= =?UTF-8?q?=E5=80=BC=E8=AE=B0=E5=BD=95`=E9=93=BE=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96sk=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/user.js | 14 ++++++++------ model/mys/mihoyoApi.js | 2 +- model/user.js | 9 +++++++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/apps/user.js b/apps/user.js index 06d36cd..be531bb 100644 --- a/apps/user.js +++ b/apps/user.js @@ -43,7 +43,7 @@ export const rule = { describe: "云原神签到token获取" }, delSign: { - reg: "^#*删除(我的)*(stoken|(云原神|云ck))$", + reg: "^#*删除(我的)*((stoken|sk)|(云原神|云ck))$", describe: "删除云原神、stoken数据" }, updCookie: { @@ -98,11 +98,11 @@ export async function gcPaylog(e) { e.reply("请私聊发送") return true; } - let authkey = await getAuthKey(e, user) + let authkey = await getAuthKey(e, user,{auth_appid:'csc'}) if (!authkey) { return true; } - let url = `https://hk4e-api.mihoyo.com/ysulog/api/getCrystalLog?selfquery_type=3&lang=zh-cn&sign_type=2&auth_appid=csc&authkey_ver=1&authkey=${encodeURIComponent(authkey)}&game_biz=hk4e_cn&app_client=bbs&type=3&size=6®ion=${e.region}&end_id=` + let url = `https://webstatic.mihoyo.com/event/user-game-search/hk4e/index.html?selfquery_type=3&lang=zh-cn&sign_type=2&auth_appid=csc&authkey_ver=1&authkey=${encodeURIComponent(authkey)}&game_biz=hk4e_cn&app_client=bbs&type=3&size=6®ion=${e.region}&end_id=` e.msg = url // e.reply(e.msg) let sendMsg = []; @@ -183,12 +183,14 @@ export async function gclog(e) { }); return true; } -async function getAuthKey(e, user) { +async function getAuthKey(e, user,data={ + auth_appid:'webview_gacha' +}) { if (!e.uid) { e.uid = e?.runtime?.user?._regUid } e.region = getServer(e.uid) - let authkeyrow = await user.getData("authKey", {}); + let authkeyrow = await user.getData("authKey", data); if (!authkeyrow?.data) { e.reply(`uid:${e.uid},authkey获取失败:` + (authkeyrow.message.includes("登录失效") ? "请重新绑定stoken" : authkeyrow.message)) return false; @@ -310,7 +312,7 @@ export async function cloudToken(e) { export async function delSign(e) { let user = new User(e); e.msg = e.msg.replace(/#|删除|我的/g, ""); - let url = e.msg == "stoken" ? `${YamlDataUrl}` : `${yunpath}`; + let url = /sk|stoken/.test(e.msg) ? `${YamlDataUrl}` : `${yunpath}`; await user.delSytk(url, e) return true; } diff --git a/model/mys/mihoyoApi.js b/model/mys/mihoyoApi.js index 6e0c38b..1b9ffb4 100644 --- a/model/mys/mihoyoApi.js +++ b/model/mys/mihoyoApi.js @@ -244,7 +244,7 @@ export default class miHoYoApi { url: `${this.apiMap.apiWeb}/binding/api/genAuthKey`, // url:`https://gameapi-account.mihoyo.com/binding/api/genAuthKey`, body: { - 'auth_appid':'webview_gacha',//'apicdkey',// 'webview_gacha', + 'auth_appid':data.auth_appid ?? 'webview_gacha',//'apicdkey',// 'webview_gacha', 'game_biz': this.isOs ? 'hk4e_global' : 'hk4e_cn', 'game_uid': this.e.uid * 1, 'region': this.e.region, diff --git a/model/user.js b/model/user.js index f52e753..d8fa935 100644 --- a/model/user.js +++ b/model/user.js @@ -893,7 +893,12 @@ export default class user { if (!ck[e.uid]) { return true; } - delete ck[e.uid]; + let sk=ck[e.uid] + lodash.forEach(ck,(v,i)=>{ + if(sk?.stoken===v?.stoken){ + delete ck[i]; + } + }) if (Object.keys(ck) == 0) { fs.unlinkSync(file); } else { @@ -901,7 +906,7 @@ export default class user { fs.writeFileSync(file, ck, 'utf8') } } - e.reply(`已删除${e.msg}`) + e.reply(`已删除${/米游社|mys|米币|米游币|sk|stoken/.test(e.msg)?'stoken':'云原神token'}`) return true; }) }