去掉conversatNo的使用

im
dylanmay 2024-10-28 16:30:50 +08:00
parent 0d347643ca
commit 755bf1bb08
6 changed files with 18 additions and 13 deletions

View File

@ -17,8 +17,10 @@ export interface SendMsg {
}
export interface SessionMsgReq {
conversationNo: string
sendTime: Date
sendTime: string
receiverId: number
userId: number
conversationType: number
}
/**
@ -40,7 +42,7 @@ export default class MessageApi {
* @returns Promise<Array<MessageModelType>>
*/
static getSessionMsg(params: SessionMsgReq): Promise<Array<MessageModelType>> {
return request.get({ url: '/im/message/listByNo', params })
return request.get({ url: '/im/message/list', params })
}
/**

View File

@ -55,7 +55,7 @@ const createTextMessage = (content: string): TextMessage => {
chatStore.currentSession?.id || '',
chatStore.currentSession ? chatStore.currentSession.targetId : 0,
chatStore.currentSession?.type || CONVERSATION_TYPE.SINGLE,
chatStore.currentSession?.conversationNo || ''
chatStore.currentSession?.senderId || ''
)
return msg

View File

@ -13,7 +13,7 @@ export default class BaseMessage {
clientMessageId: string
receiverId: number
conversationType: number
conversationNo: string
conversationUserId: number
constructor(
id: string,
avatar: string,
@ -26,7 +26,7 @@ export default class BaseMessage {
conversationId: string,
receiverId: number,
conversationType: number,
conversationNo: string
conversationUserId: number
) {
this.id = id
this.avatar = avatar
@ -40,7 +40,7 @@ export default class BaseMessage {
this.receiverId = receiverId
this.clientMessageId = this.generateClientMessageId()
this.conversationType = conversationType
this.conversationNo = conversationNo
this.conversationUserId = conversationUserId
}
private generateClientMessageId() {

View File

@ -16,7 +16,7 @@ export default class ImageMessage extends BaseMessage {
conversationId: string,
receiverId: number,
conversationType: number,
conversationNo: string
conversationUserId: number
) {
super(
id,
@ -30,7 +30,7 @@ export default class ImageMessage extends BaseMessage {
conversationId,
receiverId,
conversationType,
conversationNo
conversationUserId
)
this.content = content
}

View File

@ -16,7 +16,7 @@ export default class TextMessage extends BaseMessage {
conversationId: string,
receiverId: number,
conversationType: number,
conversationNo: string
conversationUserId: number
) {
super(
id,
@ -30,7 +30,7 @@ export default class TextMessage extends BaseMessage {
conversationId,
receiverId,
conversationType,
conversationNo
conversationUserId
)
this.content = content
}

View File

@ -6,6 +6,7 @@ import { ConversationModelType, MessageRole, ContentType, SendStatus } from '../
import SessionApi from '../api/sessionApi'
import MessageApi, { SendMsg } from '../api/messageApi'
import { useUserStoreWithOut } from '@/store/modules/user'
import { formatDate } from '@/utils/formatTime'
// TODO @dylan是不是 chat => imsession => conversation这样统一一点哈。
interface ChatStoreModel {
@ -142,8 +143,10 @@ export const useChatStore = defineStore('chatStore', {
try {
const res = await MessageApi.getSessionMsg({
conversationNo: this.currentSession.conversationNo
// sendTime: new Date().toISOString().slice(0, -1)
receiverId: this.currentSession.targetId,
userId: this.currentSession.senderId,
// sendTime: formatDate(new Date(), 'YYYY-MM-DD HH:mm:ss')
conversationType: this.currentSession.type
})
this.currentSession.msgList = res.map((item) => {