2025-11-22 14:03:40 +08:00
|
|
|
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>> {
|
2025-12-18 14:13:29 +08:00
|
|
|
const response = await api.delete<boolean>(`/sensitive`, sensitiveWord);
|
2025-11-22 14:03:40 +08:00
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
}
|