From f5f6319ea1dcdc5feda4b336f6289414eff1e8f3 Mon Sep 17 00:00:00 2001 From: SunRyK <108290923+SmallK111407@users.noreply.github.com> Date: Fri, 3 Feb 2023 23:05:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA`#=E5=96=B5=E5=96=B5=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?`=E5=A2=9E=E5=8A=A0=E9=9D=A2=E6=9D=BF=E6=8E=92=E8=A1=8C?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E8=87=AA=E5=AE=9A=E4=B9=89=EF=BC=8C=E8=8C=83?= =?UTF-8?q?=E5=9B=B45~30=EF=BC=8C=E9=BB=98=E8=AE=A415=20(#434)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/profile.js | 2 +- apps/profile/ProfileStat.js | 2 +- config/cfg_default.js | 3 +++ config/system/cfg_system.js | 8 ++++++++ models/ProfileRank.js | 5 +++-- 5 files changed, 16 insertions(+), 4 deletions(-) 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 }