在线窗口: 获取消息

dev/chat
Lei OT 2 years ago
parent 9c8a607d4a
commit f5e0c94032

@ -31,8 +31,7 @@ export const fetchMessages = async (params) => {
const defaultParams = {
opisn: '',
whatsappid: '',
// lasttime: '',
lasttime: '2024-01-01T00:25:30', // test:
lasttime: '',
pagesize: MESSAGE_PAGE_SIZE,
};
const { errcode, result } = await fetchJSON(`${API_HOST}/getcusmessages`, {...defaultParams, ...params});

@ -73,7 +73,7 @@ const Conversations = () => {
};
const getMessages = async (item) => {
setMsgLoading(true);
const data = await fetchMessages({ opisn: userId, whatsappid: item.whatsapp_phone_number, lasttime: '2024-01-01T00:25:30' });
const data = await fetchMessages({ opisn: userId, whatsappid: item.whatsapp_phone_number, lasttime: '' });
setMsgLoading(false);
receivedMessageList(item.sn, data);
const thisLastTime = data.length > 0 ? data[data.length - 1].orgmsgtime : '';

@ -25,7 +25,7 @@ const MessagesWrapper = () => {
const getMoreMessages = async () => {
setShouldScrollBottom(false);
setLongListLoading(true);
const data = await fetchMessages({ opisn: currentConversation.opi_sn, whatsappid: currentConversation.whatsapp_phone_number, lasttime: currentConversation?.lasttime || '2024-01-01T00:00:00' });
const data = await fetchMessages({ opisn: currentConversation.opi_sn, whatsappid: currentConversation.whatsapp_phone_number, lasttime: currentConversation?.lasttime || '' });
setLongListLoading(false);
setLongList(prevValue => data.concat(prevValue));
const thisLastTime = data.length > 0 ? data[data.length - 1].orgmsgtime : '';

Loading…
Cancel
Save