后台:角色封禁
This commit is contained in:
@@ -6,6 +6,7 @@ import { addItems, createHeroes } from '../../../services/rewardService';
|
||||
import { RewardInter } from '../../../pubUtils/interface';
|
||||
import { getExpByLv } from '../../../pubUtils/data';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { BLOCK_TYPE } from '../../../consts';
|
||||
let timer: NodeJS.Timer;
|
||||
export default function (app: Application) {
|
||||
return new GmRoleHandler(app);
|
||||
@@ -32,7 +33,7 @@ export class GmRoleHandler {
|
||||
await createHeroes(roleId, roleName, sid, serverId, heroes.map(hid => { return { hid, count: 1 }}))
|
||||
}
|
||||
if(lv && lv > 0) {
|
||||
let exp = getExpByLv(lv)?.sum||0;
|
||||
let exp = getExpByLv(lv - 1)?.sum||0;
|
||||
await RoleModel.updateRoleInfo(roleId, { lv, exp })
|
||||
let uids = [{ uid: roleId, sid }];
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerExpChange', resResult(STATUS.SUCCESS, {
|
||||
@@ -42,4 +43,18 @@ export class GmRoleHandler {
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
async handleBlock(msg: { roleId: string, blockType: BLOCK_TYPE, blockReason: string }, session: BackendSession) {
|
||||
let { roleId, blockType, blockReason } = msg;
|
||||
if(roleId == undefined || blockType == undefined || blockReason == undefined) return resResult(STATUS.WRONG_PARMS);
|
||||
let role = await RoleModel.updateRoleInfo(roleId, { blockType, blockReason });
|
||||
if(!role) return resResult(STATUS.ROLE_NOT_FOUND);
|
||||
let { isOnline, sid } = await getRoleOnlineInfo(roleId);
|
||||
if(isOnline) {
|
||||
await this.app.rpc.connector.connectorRemote.setOtherUseBlockTypeSession.toServer(sid,[{ roleId, blockType }]);
|
||||
if(blockType == BLOCK_TYPE.BLOCK) { // 踢走
|
||||
await this.app.rpc.connector.connectorRemote.remoteLogin.toServer(sid, roleId, STATUS.BLOCKED);
|
||||
}
|
||||
}
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user