Files
workspace/code/sllog/Sllog-User-Ui/src/service/message.ts
T
2025-06-18 16:30:01 +08:00

50 lines
1.3 KiB
TypeScript

import { httpPostJson } from "@/utils/http";
export interface GetChatsResult {
messageId?: string;
lastMessageTime?: string;
companyId: string;
companyName: string;
companyAvatar?: string;
isRollback?: number; // 0 正常,1撤回
noReadNumber?: number; // 0 未读 1已读
lastContent?: string;
lastContentType?: string;
}
export const getChatsApi = () => {
return httpPostJson<GetChatsResult[]>(`/imMessage/chats`);
};
export interface GetHistoryParams {
chatCompanyId: string;
}
export interface GetHistoryResult {
messageId: string;
sendId: string;
acceptId: string;
messageContent: string;
messageContentType: string;
isRollback: number;
quoteMessageId: string;
sendMessageTime: string;
}
export const getHistoryApi = (params: GetHistoryParams) => {
return httpPostJson<GetHistoryResult[]>(`/imMessage/history`, params);
};
export interface UpdateIsReadParams {
companyId: string;
}
export const updateIsReadApi = (params: UpdateIsReadParams) => {
return httpPostJson<null>(`/imMessage/updateIsRead`, params);
};
export interface GetAllNoReadNumberParams {}
export interface GetAllNoReadNumberResult {
noReadNumber: number;
}
export const getAllNoReadNumberApi = (params: GetAllNoReadNumberParams) => {
return httpPostJson<GetAllNoReadNumberResult>(`/imMessage/getAllNoReadNumber`, params);
};