mirror of
https://github.com/yoimiya-kokomi/miao-plugin.git
synced 2024-11-16 04:35:42 +00:00
一些已知问题修复
This commit is contained in:
parent
92419e1d73
commit
98282e3741
@ -396,15 +396,15 @@ async function uploadData (e) {
|
||||
if (!Cfg.get('wiki.abyss', false) && !isMatch) {
|
||||
return false
|
||||
}
|
||||
let mys = await MysApi.init(e)
|
||||
if (!mys) {
|
||||
let mys = await MysApi.init(e, { auth: 'cookie' })
|
||||
if (!mys || !mys.uid) {
|
||||
if (isMatch) {
|
||||
e.reply(`请绑定ck后再使用${e.original_msg || e.msg}`)
|
||||
}
|
||||
return false
|
||||
}
|
||||
let ret = {}
|
||||
let uid = e.selfUser.uid
|
||||
let uid = mys.uid
|
||||
let resDetail, resAbyss
|
||||
try {
|
||||
resAbyss = await mys.getSpiralAbyss(1)
|
||||
|
@ -56,7 +56,10 @@ let Profile = {
|
||||
const userFile = `${userPath}/${uid}.json`
|
||||
let userData = {}
|
||||
if (fs.existsSync(userFile)) {
|
||||
userData = JSON.parse(fs.readFileSync(userFile, 'utf8')) || {}
|
||||
try {
|
||||
userData = JSON.parse(fs.readFileSync(userFile, 'utf8')) || {}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
if (userData && userData.chars) {
|
||||
let char = Character.get(charId)
|
||||
|
@ -18,18 +18,11 @@ export default class MysApi {
|
||||
cfg = { auth: cfg }
|
||||
}
|
||||
let { auth = 'all' } = cfg
|
||||
let mys = await YzMysInfo.init(e, 'roleIndex')
|
||||
let mys = await YzMysInfo.init(e, auth === 'cookie' ? 'detail' : 'roleIndex')
|
||||
if (!mys) {
|
||||
return false
|
||||
}
|
||||
let uid = mys.uid
|
||||
/* 检查user ck */
|
||||
if (auth === 'cookie') {
|
||||
if (mys?.ckInfo?.uid * 1 !== uid * 1) {
|
||||
e.reply('请绑定CK以使用此功能...')
|
||||
return false
|
||||
}
|
||||
}
|
||||
e._mys = new MysApi(e, uid, mys)
|
||||
return e._mys
|
||||
}
|
||||
|
@ -19,11 +19,6 @@ await init()
|
||||
|
||||
if (!YzMysInfo) {
|
||||
// v2 MysInfo
|
||||
const apiCfg = {
|
||||
auth: 'all',
|
||||
targetType: 'all',
|
||||
cookieType: 'all'
|
||||
}
|
||||
YzMysInfo = class {
|
||||
constructor (e, uid, cookieUser) {
|
||||
if (e) {
|
||||
@ -37,8 +32,12 @@ if (!YzMysInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
static async init (e) {
|
||||
let MysApi = await e.getMysApi(apiCfg) // V2兼容
|
||||
static async init (e, api) {
|
||||
let MysApi = await e.getMysApi({
|
||||
auth: 'all',
|
||||
targetType: 'all',
|
||||
cookieType: api === 'detail' ? 'self:' : 'all'
|
||||
}) // V2兼容
|
||||
let { selfUser, targetUser, cookieUser } = MysApi
|
||||
let mys = new YzMysInfo(e, targetUser.uid || selfUser.uid, cookieUser)
|
||||
mys._MysApi = MysApi
|
||||
|
Loading…
Reference in New Issue
Block a user