Files
boluo-app-main/src/types/message.ts
2025-03-31 22:34:22 +08:00

120 lines
2.4 KiB
TypeScript

import { ChatWatchType, MessageActionStatus, MessageType } from '@/constants/message';
import { JobDetails } from '@/types/job';
import { AnchorInfo } from '@/types/material';
import { UserInfo } from '@/types/user';
export interface UserMessage {
count: number;
}
export interface MainMessage {
chatId: string;
toUserId: string;
toUserName: string;
toUserAvatarUrl: string;
lastContactMsgContent: string;
unReadMsgCount: number;
lastContactTime: number;
}
export interface IJobMessage
extends Pick<
JobDetails,
| 'id'
| 'title'
| 'employType'
| 'salary'
| 'lowPriceForFullTime'
| 'highPriceForFullTime'
| 'lowPriceForPartyTime'
| 'highPriceForPartyTime'
> {}
export interface IMaterialMessage
extends Pick<
AnchorInfo,
'id' | 'name' | 'age' | 'height' | 'weight' | 'gender' | 'shoeSize' | 'workedSecCategoryStr'
> {}
export interface ILocationMessage {
name: string;
address: string;
latitude: number;
longitude: number;
}
export interface IChatUser extends Pick<UserInfo, 'userId' | 'nickName'> {}
export interface IChatMessage {
msgId: string;
type: MessageType;
content: string;
actionId: string;
actionObject: string;
senderUserId: string;
senderName: string;
senderAvatarUrl: string;
receiverUserId: string;
receiverName: string;
receiverAvatarUrl: string;
timestamp: number;
jobId: string;
isRead: boolean;
}
export interface IChatInfo {
chatId: string;
participants: IChatUser[];
lastContactTime: number;
lastContactContent: string;
unReadCount: number;
messages: IChatMessage[];
lastJobId: string;
}
export interface IMessageStatus {
msgId: string;
isRead: boolean;
}
export interface IChatActionDetail {
id: string;
chatId: string;
status: MessageActionStatus;
type: MessageType;
bizId: string;
created: string;
}
export interface PostMessageRequest {
chatId: string;
type: MessageType;
bizId: string;
content?: string;
actionObject?: string;
}
export interface PostConfirmActionRequest {
actionId: string;
status: boolean;
}
export interface PostActionDetailRequest {
type: MessageType;
bizId: string;
toUserId: string;
}
export interface GetNewChatMessagesRequest {
chatId: string;
// 上次接口调用返回的最新的msgId Message.msgId字段
lastMsgId?: string;
}
export interface ChatWatchRequest {
type: ChatWatchType;
status: boolean;
jobId: string;
toUserId: string;
}