云函数:屏蔽词
This commit is contained in:
@@ -14,6 +14,7 @@ import { ChatInfoModel } from '../db/ChatInfo';
|
||||
import { channelServer } from './chatChannelService';
|
||||
import { AccuseRecModel, AccueseParam } from '../db/AccuseRec';
|
||||
import { getSimpleRoleInfo, getSimpleRoleInfos } from './roleService';
|
||||
import * as FCClient from '@alicloud/fc2';
|
||||
|
||||
export * from './chatChannelService';
|
||||
export * from './sysChatService';
|
||||
@@ -375,3 +376,25 @@ export async function createAccuseData(roleId: string, targetRoleId: string, tar
|
||||
const result = await AccuseRecModel.createRec(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
const client = new FCClient('1475752363809339', {
|
||||
accessKeyID: 'LTAI5tFTwE7vwH5HGL7eV8xr',
|
||||
accessKeySecret: 'HZznAZfOrmXttBMevhA55jQX3OGw9j',
|
||||
region: 'cn-zhangjiakou',
|
||||
});
|
||||
|
||||
export async function checkFilterWords(word: string) {
|
||||
const resp = await client.post('/proxy/bantuUtils/filterWords/check',{
|
||||
word,
|
||||
salt: "bantu1filter2word3test"
|
||||
}, {});
|
||||
let hasBlock = true;
|
||||
try {
|
||||
let data = JSON.parse(resp.data);
|
||||
hasBlock = data.status != 0;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
return hasBlock;
|
||||
}
|
||||
Reference in New Issue
Block a user