From 122565722bfc76bc60e29cc0dfbff69e6b3162a4 Mon Sep 17 00:00:00 2001 From: yoimiya-kokomi <592981798@qq.com> Date: Sat, 17 Sep 2022 20:46:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4V3=E4=B8=8BMysApi=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adapter/mys.js | 34 +++++++++++++++++----------------- apps/character/avatar-wife.js | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/adapter/mys.js b/adapter/mys.js index ea921706..9d970dd9 100644 --- a/adapter/mys.js +++ b/adapter/mys.js @@ -110,23 +110,21 @@ class Mys { export async function getMysApi (e, cfg) { let { auth = 'all' } = cfg - let uid = await MysInfo.getUid(e) - if (!uid) return false - - /* 检查user ck */ - let isCookieUser = await MysInfo.checkUidBing(uid) - if (auth === 'cookie') { - if (!isCookieUser) { - e.reply('尚未绑定Cookie...') - return false - } - e.isSelfCookie = true - } let MysApi = await MysInfo.init(e, 'roleIndex') if (!MysApi) { return false } - MysApi.isSelfCookie = !!e.isSelfCookie + let uid = MysApi.uid + let ckUid = MysApi.ckInfo?.uid + /* 检查user ck */ + if (auth === 'cookie') { + let isCookieUser = await MysInfo.checkUidBing(uid) + if (!isCookieUser || uid !== ckUid) { + e.reply('尚未绑定Cookie...') + return false + } + } + e.isSelfCookie = uid !== ckUid return new Mys(e, uid, MysApi) } @@ -140,10 +138,12 @@ export async function checkAuth (e, cfg) { } /* 检查user ck */ - let isCookieUser = await MysInfo.checkUidBing(uid) - if (auth === 'cookie' && !isCookieUser) { - e.reply('尚未绑定Cookie...') - return false + if (auth === 'cookie') { + let isCookieUser = await MysInfo.checkUidBing(uid) + if (!isCookieUser) { + e.reply('尚未绑定Cookie...') + return false + } } e.selfUser = new User({ id: e.user_id, uid }) diff --git a/apps/character/avatar-wife.js b/apps/character/avatar-wife.js index 38d2710e..fcb9c0eb 100644 --- a/apps/character/avatar-wife.js +++ b/apps/character/avatar-wife.js @@ -34,7 +34,7 @@ const relationMap = { const relation = lodash.flatMap(relationMap, (d) => d.keyword) export const wifeReg = `^#?\\s*(${relation.join('|')})\\s*(设置|选择|指定|列表|查询|列表|是|是谁|照片|相片|图片|写真|图像)?\\s*([^\\d]*)\\s*(\\d*)$` -export async function wife (e, { User }) { +export async function wife (e) { let msg = e.msg || '' if (!msg && !e.isPoke) return false