diff --git a/apps/profile.js b/apps/profile.js index 93ea7151..49452373 100644 --- a/apps/profile.js +++ b/apps/profile.js @@ -60,7 +60,7 @@ app.reg('profile-list', profileList, { }) app.reg('profile-stat', profileStat, { - rule: /^#(面板|喵喵)?练度统计$/, + rule: /^#(面板|喵喵|角色|武器|天赋|技能|圣遗物)?练度统计$/, name: '面板练度统计$' }) diff --git a/apps/profile/ProfileStat.js b/apps/profile/ProfileStat.js index 8a37a035..bec77af8 100644 --- a/apps/profile/ProfileStat.js +++ b/apps/profile/ProfileStat.js @@ -3,7 +3,7 @@ import {Cfg, Common, Data } from '../../components/index.js' import { AvatarList, ProfileRank } from '../../models/index.js' export async function profileStat (e) { - let isMatch = /^#(喵喵|面板)练度统计?$/.test(e.original_msg || e.msg || '') + let isMatch = /^#(面板|喵喵|角色|武器|天赋|技能|圣遗物)练度统计?$/.test(e.original_msg || e.msg || '') if (!Cfg.get('profileStat', false) && !isMatch) { return false } diff --git a/config/cfg_default.js b/config/cfg_default.js index edfb7258..942fc626 100644 --- a/config/cfg_default.js +++ b/config/cfg_default.js @@ -14,6 +14,9 @@ export const uploadAbyssData = false // 使用【#面板练度统计】功能取代【#练度统计】功能,默认关闭 export const profileStat = false +// 可选值5~30,建议15。设置高排行人数会导致渲染图片速度加长,发送缓慢 +export const rankNumber = 15 + // 老婆查询 export const avatarWife = true diff --git a/config/system/cfg_system.js b/config/system/cfg_system.js index e9b516f5..b1ab97af 100644 --- a/config/system/cfg_system.js +++ b/config/system/cfg_system.js @@ -49,6 +49,14 @@ export const cfgSchema = { oldCfgKey: 'profile.stat', desc: '使用【#面板练度统计】功能取代【#练度统计】功能,默认关闭' }, + rankNumber: { + title: '排行人数', + key: '排行人数', + type: 'num', + def: 15, + input: (n) => Math.min(30, Math.max(5, (n * 1 || 15))), + desc: '可选值5~30,建议15。设置高排行人数会导致渲染图片速度加长,发送缓慢' + }, avatarWife: { title: '老婆查询', key: '老婆', diff --git a/models/ProfileRank.js b/models/ProfileRank.js index 21f4be52..feb235d6 100644 --- a/models/ProfileRank.js +++ b/models/ProfileRank.js @@ -1,6 +1,6 @@ import lodash from 'lodash' import moment from 'moment' -import { Common, Data } from '../components/index.js' +import { Cfg, Common, Data, } from '../components/index.js' export default class ProfileRank { constructor (data) { @@ -151,7 +151,8 @@ export default class ProfileRank { * @returns {Promise[]|boolean>} */ static async getGroupUidList (groupId, charId, type = 'mark') { - let uids = await redis.zRangeWithScores(`miao:rank:${groupId}:${type}:${charId}`, -20, -1) + let number = Cfg.get('rankNumber', 15) + let uids = await redis.zRangeWithScores(`miao:rank:${groupId}:${type}:${charId}`, -`${number}`, -1) return uids ? uids.reverse() : false }