46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
|
|
import { api } from '@/apis';
|
||
|
|
import type { ResultDomain, SensitiveWord, PageParam } from '@/types';
|
||
|
|
|
||
|
|
export const sensitiveApi = {
|
||
|
|
/**
|
||
|
|
* 获取敏感词列表
|
||
|
|
* @returns Promise<ResultDomain<SensitiveWord>>
|
||
|
|
*/
|
||
|
|
async getSensitivePage(pageParam: PageParam, filter?: SensitiveWord): Promise<ResultDomain<SensitiveWord>> {
|
||
|
|
const response = await api.post<SensitiveWord>('/sensitive/page', {
|
||
|
|
pageParam,
|
||
|
|
filter,
|
||
|
|
});
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 添加敏感词
|
||
|
|
* @param sensitiveWord 敏感词信息
|
||
|
|
* @returns Promise<ResultDomain<SensitiveWord>>
|
||
|
|
*/
|
||
|
|
async addSensitiveWord(sensitiveWord: SensitiveWord): Promise<ResultDomain<SensitiveWord>> {
|
||
|
|
const response = await api.post<SensitiveWord>('/sensitive', sensitiveWord);
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改敏感词类型
|
||
|
|
* @param sensitiveWord 敏感词对象
|
||
|
|
* @returns Promise<ResultDomain<boolean>>
|
||
|
|
*/
|
||
|
|
async changeSensitiveWordType(sensitiveWord: SensitiveWord): Promise<ResultDomain<boolean>> {
|
||
|
|
const response = await api.put<boolean>(`/sensitive`, sensitiveWord);
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除敏感词
|
||
|
|
* @param sensitiveWord 敏感词对象
|
||
|
|
* @returns Promise<ResultDomain<boolean>>
|
||
|
|
*/
|
||
|
|
async deleteSensitiveWord(sensitiveWord: SensitiveWord): Promise<ResultDomain<boolean>> {
|
||
|
|
const response = await api.delete<boolean>(`/sensitive`, { data: sensitiveWord });
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
}
|