✨ feat(后台): 一键清理排行榜
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { Application, BackendSession, pinus } from 'pinus';
|
import { Application, BackendSession, pinus } from 'pinus';
|
||||||
import { resResult } from '../../../pubUtils/util';
|
import { resResult } from '../../../pubUtils/util';
|
||||||
import { STATUS } from '../../../consts/statusCode';
|
import { STATUS } from '../../../consts/statusCode';
|
||||||
import { getRoleOnlineInfo, updateUserInfo } from '../../../services/redisService';
|
import { getRoleOnlineInfo, redisClient, updateUserInfo } from '../../../services/redisService';
|
||||||
import { addItems } from '../../../services/role/rewardService';
|
import { addItems } from '../../../services/role/rewardService';
|
||||||
import { RewardInter } from '../../../pubUtils/interface';
|
import { RewardInter } from '../../../pubUtils/interface';
|
||||||
import { gameData, getExpByLv, getHeroExpByLv, getHeroLvByExp, getLvByExp, getEquipByJobClassAndEPlace } from '../../../pubUtils/data';
|
import { gameData, getExpByLv, getHeroExpByLv, getHeroLvByExp, getLvByExp, getEquipByJobClassAndEPlace } from '../../../pubUtils/data';
|
||||||
@@ -30,6 +30,8 @@ import { RoleCeModel } from '../../../db/RoleCe';
|
|||||||
import { setTrainLv } from '../../../services/gmService';
|
import { setTrainLv } from '../../../services/gmService';
|
||||||
import { ArtifactModel } from '../../../db/Artifact';
|
import { ArtifactModel } from '../../../db/Artifact';
|
||||||
import { roleLeave } from '../../../services/redisService';
|
import { roleLeave } from '../../../services/redisService';
|
||||||
|
import { KeyName } from '../../../domain/rank';
|
||||||
|
import { LadderMatchModel } from '../../../db/LadderMatch';
|
||||||
|
|
||||||
let timer: NodeJS.Timer;
|
let timer: NodeJS.Timer;
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
@@ -407,4 +409,29 @@ export class GmRoleHandler {
|
|||||||
await calculateCeWithRole(HERO_SYSTEM_TYPE.RE_CAL, roleId, role.serverId, null, {}, { role, schools, jewels, heroes, skins, artifacts });
|
await calculateCeWithRole(HERO_SYSTEM_TYPE.RE_CAL, roleId, role.serverId, null, {}, { role, schools, jewels, heroes, skins, artifacts });
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async clearRank(msg: { roleId: string }, session: BackendSession) {
|
||||||
|
let { roleId } = msg;
|
||||||
|
let role = await RoleModel.findByRoleId(roleId);
|
||||||
|
if(!role) return resResult(STATUS.WRONG_PARMS);
|
||||||
|
if(role.blockType != 2) return resResult(STATUS.GM_CANNOT_CLEAR_RANK)
|
||||||
|
let { serverId } = role;
|
||||||
|
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.TOWER_RANK, { serverId }).getName(), roleId);
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.LADDER, { serverId }).getName(), roleId);
|
||||||
|
await LadderMatchModel.updateByRoleId(roleId, { rank: 0 });
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.TOP_LINEUP_RANK, { serverId }).getName(), roleId);
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.TOP_HERO_RANK, { serverId }).getName(), roleId);
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.HERO_NUM_RANK, { serverId }).getName(), roleId);
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.SUM_CE_RANK, { serverId }).getName(), roleId);
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.USER_LV, { serverId }).getName(), roleId);
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.MAIN_RANK, { serverId }).getName(), roleId);
|
||||||
|
await redisClient().zremAsync(new KeyName(REDIS_KEY.MAIN_ELITE_RANK, { serverId }).getName(), roleId);
|
||||||
|
|
||||||
|
let keys = await redisClient().keysAsync(REDIS_KEY.PVP_RANK);
|
||||||
|
for(let key of keys) await redisClient().zremAsync(key, roleId);
|
||||||
|
|
||||||
|
return resResult(STATUS.SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -741,6 +741,8 @@ export const STATUS = {
|
|||||||
GM_ACTIVITY_TIME_ERR: { code: 60031, simStr: '时间不可有重叠' },
|
GM_ACTIVITY_TIME_ERR: { code: 60031, simStr: '时间不可有重叠' },
|
||||||
GM_USER_TYPE_ERR: { code: 60032, simStr: '您不可使用账号密码登录,请从专属后台点击链接进入' },
|
GM_USER_TYPE_ERR: { code: 60032, simStr: '您不可使用账号密码登录,请从专属后台点击链接进入' },
|
||||||
GM_GVG_TIME_ERR: { code: 60033, simStr: '时间配置错误' },
|
GM_GVG_TIME_ERR: { code: 60033, simStr: '时间配置错误' },
|
||||||
|
GM_CANNOT_CLEAR_RANK: { code: 60034, simStr: '没有封号的玩家不能清空' },
|
||||||
|
|
||||||
// 支付相关状态 70000 - 79999
|
// 支付相关状态 70000 - 79999
|
||||||
NO_PRODUCT_ID: { code: 70001, simStr: '无效商品' },
|
NO_PRODUCT_ID: { code: 70001, simStr: '无效商品' },
|
||||||
NO_PAY_TYPE: { code: 70002, simStr: '无效支付类型' },
|
NO_PAY_TYPE: { code: 70002, simStr: '无效支付类型' },
|
||||||
|
|||||||
@@ -1013,5 +1013,12 @@
|
|||||||
"name": "宝物查询",
|
"name": "宝物查询",
|
||||||
"module": "user",
|
"module": "user",
|
||||||
"type": "find"
|
"type": "find"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 147,
|
||||||
|
"api": "gm.gmRoleHandler.clearRank",
|
||||||
|
"name": "清空排行榜",
|
||||||
|
"module": "user",
|
||||||
|
"type": "update"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user