起名:添加屏蔽词检测
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import {Application, RouteRecord, FrontendOrBackendSession, HandlerCallback, pinus} from "pinus";
|
||||
// import { checkEvent } from '../../../services/eventSercive';
|
||||
import { refresh } from '../../../services/refreshService';
|
||||
import { checkPrivateChat, checkGuildChat, checkOtherChat, getWorldChannelSid } from "../../../services/chatService";
|
||||
import { resResult, checkWhiteListWithUid } from "../../../pubUtils/util";
|
||||
import { checkPrivateChat, checkGuildChat, checkOtherChat, getWorldChannelSid, checkRoleName, checkGuildName } from "../../../services/chatService";
|
||||
import { resResult, checkWhiteListWithUid, genCode } from "../../../pubUtils/util";
|
||||
import { CHANNEL_PREFIX, STATUS } from "../../../consts";
|
||||
import { UserModel } from "../../../db/User";
|
||||
import { SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam";
|
||||
@@ -19,6 +19,7 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
||||
const sid: string = session.get('sid');
|
||||
const roleId: string = session.get('roleId');
|
||||
const uid: number = session.get('userid');
|
||||
let guildCode = session.get('guildCode');
|
||||
|
||||
session.push('teamCode', () => {});
|
||||
|
||||
@@ -52,7 +53,6 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
||||
case 'chat.chatHandler.sendGroupMessage':
|
||||
{
|
||||
if(msg.channel == CHANNEL_PREFIX.GUILD) {
|
||||
const guildCode = session.get('guildCode');
|
||||
let result = await checkGuildChat(roleId, guildCode, msg.content);
|
||||
if(!result) hasBlockWords = true;
|
||||
break;
|
||||
@@ -62,6 +62,24 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 'role.roleHandler.rename':
|
||||
case 'role.roleHandler.initRole':
|
||||
{
|
||||
let result = await checkRoleName(roleId, msg.roleName);
|
||||
if(!result) hasBlockWords = true;
|
||||
break;
|
||||
}
|
||||
case 'guild.guildHandler.createGuild':
|
||||
case 'guild.guildHandler.setGuildInfo':
|
||||
{
|
||||
if(!guildCode) {
|
||||
guildCode = genCode(6);
|
||||
msg.guildCode = guildCode;
|
||||
}
|
||||
let result = await checkGuildName(guildCode, serverId, msg.name, msg.notice);
|
||||
if(!result) hasBlockWords = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Application, BackendSession, ChannelService, HandlerService, pinus, } f
|
||||
import { AUCTION_STAGE, DEBUG_MAGIC_WORD, STATUS, CURRENCY_BY_TYPE, CURRENCY_TYPE, DATA_NAME, LOT_STATUS, CHANNEL_PREFIX, MAIL_TYPE } from "../../../consts";
|
||||
import { LotModel } from "../../../db/Lot";
|
||||
import { ItemReward } from "../../../domain/dbGeneral";
|
||||
import { resResult } from "../../../pubUtils/util";
|
||||
import { genCode, resResult } from "../../../pubUtils/util";
|
||||
import { auctionStage, calculateDividend, genAuction, sendUngotDividend, startGuildAuction, startWorldAuction, stopAuction, todayGuildBegin, getBasePrice, debugAuctionLots, officialAuctionLots, auctionBidStatus, getMaxPrice, guildBidStatus, getAuction, pushAuctionOver, treatSingleLotTime, treatLotsTime } from "../../../services/auctionService";
|
||||
import { addItems, handleCost } from '../../../services/rewardService';
|
||||
import { getSimpleRoleInfo } from '../../../services/roleService';
|
||||
@@ -254,7 +254,7 @@ export class AuctionHandler {
|
||||
const name = '测试公会'
|
||||
const icon = 1
|
||||
const notice = '测试公会'
|
||||
const guild = await GuildModel.createGuild({ name, icon, notice }, role, serverId);
|
||||
const guild = await GuildModel.createGuild({ guildCode: genCode(6), name, icon, notice }, role, serverId);
|
||||
if (!guild) return resResult(STATUS.GUILD_CREATE_ERROR);
|
||||
guild.leader = <RoleType>guild.leader;
|
||||
//创建科技树
|
||||
|
||||
@@ -40,13 +40,13 @@ export class GuildHandler {
|
||||
}
|
||||
|
||||
// 创建军团
|
||||
async createGuild(msg: guildInter & { name: string, icon: number, notice: string }, session: BackendSession) {
|
||||
async createGuild(msg: guildInter & { guildCode: string } & { name: string, icon: number, notice: string }, session: BackendSession) {
|
||||
|
||||
const roleId = session.get('roleId');
|
||||
const roleName = session.get('roleName');
|
||||
const sid = session.get('sid');
|
||||
const serverId = session.get('serverId');
|
||||
const { name, icon, notice } = msg;
|
||||
const { name, icon, notice, guildCode } = msg;
|
||||
|
||||
// 检查名字是否重
|
||||
const checkNameResult = await GuildModel.checkName(name, serverId);
|
||||
@@ -66,7 +66,7 @@ export class GuildHandler {
|
||||
await handleCost(roleId, sid, [getGoldObject(ARMY.ARMY_CREAT_COST)]);
|
||||
|
||||
// 创建公会
|
||||
const guild = await GuildModel.createGuild({ name, icon, notice }, role, serverId);
|
||||
const guild = await GuildModel.createGuild({ guildCode, name, icon, notice }, role, serverId);
|
||||
if (!guild) return resResult(STATUS.GUILD_CREATE_ERROR);
|
||||
guild.leader = <RoleType>guild.leader;
|
||||
//创建科技树
|
||||
|
||||
Reference in New Issue
Block a user