imeeting/frontend/src/api/business/hotword.ts

75 lines
1.6 KiB
TypeScript

import http from "../http";
export interface HotWordVO {
id: number;
word: string;
pinyinList: string[];
isPublic: number;
creatorId: number;
matchStrategy: number;
category: string;
weight: number;
status: number;
isSynced: number;
remark?: string;
createdAt: string;
updatedAt: string;
}
export interface HotWordDTO {
id?: number;
word: string;
pinyinList?: string[];
matchStrategy: number;
category?: string;
weight: number;
status: number;
remark?: string;
}
export const getHotWordPage = (params: {
current: number;
size: number;
word?: string;
category?: string;
matchStrategy?: number
}) => {
return http.get<any, { code: string; data: { records: HotWordVO[]; total: number }; msg: string }>(
"/api/biz/hotword/page",
{ params }
);
};
export const syncHotWord = (id: number) => {
return http.post<any, { code: string; data: boolean; msg: string }>(
`/api/biz/hotword/${id}/sync`
);
};
export const saveHotWord = (data: HotWordDTO) => {
return http.post<any, { code: string; data: HotWordVO; msg: string }>(
"/api/biz/hotword",
data
);
};
export const updateHotWord = (data: HotWordDTO) => {
return http.put<any, { code: string; data: HotWordVO; msg: string }>(
"/api/biz/hotword",
data
);
};
export const deleteHotWord = (id: number) => {
return http.delete<any, { code: string; data: boolean; msg: string }>(
`/api/biz/hotword/${id}`
);
};
export const getPinyinSuggestion = (word: string) => {
return http.get<any, { code: string; data: string[]; msg: string }>(
"/api/biz/hotword/pinyin",
{ params: { word } }
);
};