调整V3下MysApi调用逻辑

This commit is contained in:
yoimiya-kokomi 2022-09-17 20:46:39 +08:00
parent 6acfb6417a
commit 122565722b
2 changed files with 18 additions and 18 deletions

View File

@ -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 })

View File

@ -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