起名:添加屏蔽词检测

This commit is contained in:
luying
2021-11-10 19:41:06 +08:00
parent 32fe508625
commit a7f3bcc730
11 changed files with 178 additions and 33 deletions
+25 -2
View File
@@ -15,9 +15,9 @@ import { channelServer } from './chatChannelService';
import { AccuseRecModel, AccueseParam } from '../db/AccuseRec';
import { getSimpleRoleInfo, getSimpleRoleInfos } from './roleService';
import * as FCClient from '@alicloud/fc2';
import { Chat37Params } from '../domain/sdk';
import { Chat37Params, CheckGuild37Params, CheckName37Params } from '../domain/sdk';
import { UserModel } from '../db/User';
import { request37CheckChat } from '../pubUtils/httpUtil';
import { request37CheckChat, request37Post } from '../pubUtils/httpUtil';
export * from './chatChannelService';
export * from './sysChatService';
@@ -442,6 +442,29 @@ export async function checkOtherChat(roleId: string, channelPrefix: string, mess
return true;
}
export async function checkRoleName(roleId: string, roleName: string) {
let myRole = await RoleModel.findByRoleId(roleId);
let myUser = await UserModel.findUserByUid(myRole.userInfo.uid);
let body = new CheckName37Params(myRole, roleName, myUser);
if(myUser.channelType == '37') {
return await request37Post(SDK_37_ADDR.CHECK_NAME, body, SDK_37_CONST.CHAT_KEY);
}
return true;
}
export async function checkGuildName(guildCode: string, serverId: number, name: string, notice: string) {
let nameResult = true, noticeResult = true;
if(name) {
let body = new CheckGuild37Params(guildCode, serverId, 1, name);
nameResult = await request37Post(SDK_37_ADDR.CHECK_UNION, body, SDK_37_CONST.CHAT_KEY);
}
if(notice) {
let body = new CheckGuild37Params(guildCode, serverId, 2, notice);
noticeResult = await request37Post(SDK_37_ADDR.CHECK_UNION, body, SDK_37_CONST.CHAT_KEY);
}
return nameResult && noticeResult
}
export async function pushCurrentTime(time: number) {
let serverlists = await getAllServers()
for(let serverId of serverlists) {