diff --git a/adapter/index.js b/adapter/index.js index 1a28ebd1..e95b6b92 100644 --- a/adapter/index.js +++ b/adapter/index.js @@ -12,7 +12,7 @@ const importV3 = async function (file, def, key = 'default') { let MysInfo = await importV3('/plugins/genshin/model/mys/mysInfo.js', {}) let plugin = await importV3('lib/plugins/plugin.js', _plugin) -let puppeteer = _puppeteer +let puppeteer = await importV3('lib/plugins/plugin.js', _puppeteer) export { plugin, MysInfo, diff --git a/apps/character/profile-common.js b/apps/character/profile-common.js index 192ccee6..8591c03f 100644 --- a/apps/character/profile-common.js +++ b/apps/character/profile-common.js @@ -5,7 +5,7 @@ import lodash from 'lodash' import { segment } from 'oicq' import { profileList } from './profile-list.js' import { Profile, Version } from '../../components/index.js' -import { Character } from '../../models/index.js' +import { Character, MysApi } from '../../models/index.js' /* * 获取面板查询的 目标uid diff --git a/models/MysApi.js b/models/MysApi.js index 518ee039..c1ed9385 100644 --- a/models/MysApi.js +++ b/models/MysApi.js @@ -124,4 +124,4 @@ export default class MysApi { async getAvatarSkill (id) { return await this.getData('avatarSkill', { avatar_id: id }) } -} \ No newline at end of file +} diff --git a/models/mys-lib/MysInfo.js b/models/mys-lib/MysInfo.js index 8e362342..07e3762a 100644 --- a/models/mys-lib/MysInfo.js +++ b/models/mys-lib/MysInfo.js @@ -1,11 +1,17 @@ -import { Data } from '../../components/index.js' +import { Data, Version } from '../../components/index.js' let MysInfo = false +let MysUser = false async function init () { let mys = await Data.importModule('plugins/genshin/model/mys/mysInfo.js', 'root') if (mys && mys.default) { MysInfo = mys.default + } else { + let module = await Data.importModule('lib/components/models/MysUser.js', 'root') + if (module && module.default) { + MysUser = module.default + } } } @@ -33,22 +39,26 @@ if (!MysInfo) { static async init (e) { let MysApi = await e.getMysApi(apiCfg) // V2兼容 - let { targetUser, cookieUser } = MysApi - let mys = new MysInfo(e, targetUser.id, cookieUser) + let { selfUser, targetUser, cookieUser } = MysApi + let mys = new MysInfo(e, targetUser.uid || selfUser.uid, cookieUser) mys._MysApi = MysApi return mys } // 检查当前UID是否有CK绑定 static async checkUidBing (uid) { - + let user = await MysUser.get(uid) + return user.cookie } static async getUid (e) { - + let user = await e.checkAuth({ + auth: 'all' + }) + return user ? user.uid : false } - static async getData (e, api, data) { + static async get (e, api, data) { let MysApi = await e.getMysApi(apiCfg) // V2兼容 let ret = await MysApi.getData(api, data) if (ret) {