diff --git a/CHANGELOG.md b/CHANGELOG.md index 634f5e3a..32d78afe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,9 @@ * MiaoApi面板服务更新 * 使用新版接口获取面板,大幅提高响应速度 * 使用statsIds存储圣遗物数据,能够更精确的计算角色属性 +* `#面板`、`#角色`等页面使用Q版头像(@QuAn_),可在#喵喵设置 中关闭 * 部分已知问题调整或优化 * 圣遗物、天赋更新策略及更新逻辑优化 - * `#面板`、`#角色`等页面使用Q版头像 * 面板更新的提醒文案逻辑优化 # 2.3.0 diff --git a/apps/profile/ProfileStat.js b/apps/profile/ProfileStat.js index 9e9b94f7..031e1b84 100644 --- a/apps/profile/ProfileStat.js +++ b/apps/profile/ProfileStat.js @@ -34,16 +34,10 @@ const ProfileStat = { }) if (avatarRet.length === 0) { - e.reply(`暂未获得#${uid}角色数据,请绑定CK或 #更新面板`) + e.reply(player.getErrMsg() || `查询失败,暂未获得#${uid}角色数据,请绑定CK或 #更新面板`) return true } - let talentNotice = [] - - if (!mys.isSelfCookie) { - talentNotice.push('未绑定CK,信息可能展示不完全') - } - let faceChar = Character.get(player.face || avatarRet[0]?.id) let imgs = faceChar.imgs let face = { @@ -72,8 +66,7 @@ const ProfileStat = { updateTime: player.getUpdateTime(), isSelfCookie: e.isSelfCookie, face, - avatars: avatarRet, - talentNotice + avatars: avatarRet }, { e, scale: 1.4 }) } } diff --git a/config/system/cfg_system.js b/config/system/cfg_system.js index cf0e52b7..6a4734c0 100644 --- a/config/system/cfg_system.js +++ b/config/system/cfg_system.js @@ -119,6 +119,11 @@ export const cfgSchema = { key: '图片', def: true }, + qFace: { + title: 'Q版角色头像', + key: '卡通头像', + def: true + }, charPicSe: { title: '小清新角色图', key: '小清新', diff --git a/models/Character.js b/models/Character.js index 6af8f438..372e14b9 100644 --- a/models/Character.js +++ b/models/Character.js @@ -6,7 +6,7 @@ * */ import lodash from 'lodash' import Base from './Base.js' -import { Data, Format } from '../components/index.js' +import { Data, Format, Cfg } from '../components/index.js' import CharImg from './character/CharImg.js' import CharTalent from './character/CharTalent.js' import CharId from './character/CharId.js' @@ -232,7 +232,11 @@ class Character extends Base { if (!this._imgs[cacheId]) { this._imgs[cacheId] = CharImg.getImgs(this.name, costumeIdx, this.isTraveler ? this.elem : '', this.source === 'amber' ? 'png' : 'webp') } - return this._imgs[cacheId] + let imgs = this._imgs[cacheId] + return { + ...imgs, + qFace: Cfg.get('qFace') ? imgs.qFace : imgs.face + } } // 基于角色名获取Character diff --git a/models/MysApi.js b/models/MysApi.js index e5b6df33..5d341790 100644 --- a/models/MysApi.js +++ b/models/MysApi.js @@ -76,6 +76,25 @@ export default class MysApi { } } + static async checkRetCode (retcode) { + switch (retcode) { + case -1: + case -100: + case 1001: + case 10001: + case 10103: + return 'CK失效或报错' + case 1008: + return '请先去米游社绑定角色' + case 10101: + return '查询已达今日上限' + case 10102: + return '请先去米游社绑定角色或公开数据' + case 1034: + return '米游社查询遇到验证码,请稍后再试' + } + } + async getMysApi (e, targetType = 'all', option = {}) { if (this.mys) { return this.mys @@ -110,6 +129,9 @@ export default class MysApi { if (!ret) { return false } + if (ret.retcode !== 0) { + e._retcode = ret.retcode + } return ret.data || ret } diff --git a/models/Player.js b/models/Player.js index 8d54411b..224f43d8 100644 --- a/models/Player.js +++ b/models/Player.js @@ -325,4 +325,8 @@ export default class Player extends Base { } return avatarRet } + + getErrMsg () { + return MysAvatar.getErrMsg(this.e) + } } diff --git a/models/player/MiaoData.js b/models/player/MiaoData.js index 3258b2cd..a905f41f 100644 --- a/models/player/MiaoData.js +++ b/models/player/MiaoData.js @@ -28,7 +28,8 @@ let MiaoData = { let talentRet = MiaoData.getTalentNew(char.id, ds.talent) avatar.setAvatar({ ...ds, - elem: talentRet.elem + elem: talentRet.elem, + talent: talentRet.talent }, 'miao') return avatar }, diff --git a/models/player/MysAvatar.js b/models/player/MysAvatar.js index 97326c61..b0b6622b 100644 --- a/models/player/MysAvatar.js +++ b/models/player/MysAvatar.js @@ -4,6 +4,28 @@ import { chestInfo } from '../../resources/meta/info/index.js' import moment from 'moment' const MysAvatar = { + getErrMsg (e) { + if (!e._retcode) { + return false + } + switch (e._retcode * 1) { + case -1: + case -100: + case 1001: + case 10001: + case 10103: + return 'CK失效或报错' + case 1008: + return '请先去米游社绑定角色' + case 10101: + return '查询已达今日上限' + case 10102: + return '请先去米游社绑定角色或公开数据' + case 1034: + return '米游社查询遇到验证码,请稍后再试' + } + return false + }, needRefresh (time, force = 0, forceMap = {}) { if (!time || force === 2) { @@ -27,7 +49,8 @@ const MysAvatar = { * @returns {Promise} */ async refreshMysDetail (player, force = 0) { - let mys = player?.e?._mys + let e = player.e || {} + let mys = e?._mys if (!mys) { return false }