From 1cb938fd0d0cd7c463ea4b73ba65967740177b57 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 20 Dec 2024 14:08:58 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95:?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/ConversationActions.js | 9 +++++---- src/stores/FormStore.js | 2 +- src/views/Conversations/History/MessagesList.jsx | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/actions/ConversationActions.js b/src/actions/ConversationActions.js index c847625..25bf728 100644 --- a/src/actions/ConversationActions.js +++ b/src/actions/ConversationActions.js @@ -205,7 +205,7 @@ export const fetchConversationsSearch = async (params) => { opi_sn: ele.OPI_SN || ele.opi_sn || 0, OPI_Name: `${ele.OPI_Name || ele.opi_name || ''}`.trim(), opi_name: `${ele.OPI_Name || ele.opi_name || ''}`.trim(), - dateText: dayjs((ele.lasttime || ele.lasttime)).format('MM-DD HH:mm'), + dateText: dayjs((ele.lasttime)).format('MM-DD HH:mm'), matchMsgList: parseRenderMessageList((ele.msglist_AsJOSN || [])), // .reverse()), coli_id: '', })); @@ -218,14 +218,15 @@ export const fetchConversationsSearch = async (params) => { */ export const fetchMessagesHistory = async (params) => { const defaultParams = { - opisn: '', - whatsappid: '', + // opisn: '', + // whatsappid: '', + conversationid: '', lasttime: '2024-01-01T00:00:00', pagesize: MESSAGE_PAGE_SIZE, pagedir: 'next', }; const _params = pick(params, Object.keys(defaultParams)); - if (isEmpty(_params.whatsappid)) { + if (isEmpty(_params.conversationid)) { return []; } const { errcode, result } = await fetchJSON(`${API_HOST}/get_item_messages`, {...defaultParams, ..._params}); diff --git a/src/stores/FormStore.js b/src/stores/FormStore.js index fff6a4b..d01c859 100644 --- a/src/stores/FormStore.js +++ b/src/stores/FormStore.js @@ -28,6 +28,6 @@ export const useFormStore = create( setOrderFollowForm: (orderFollowForm) => set({ orderFollowForm }), orderFollowAdvanceChecked: false, setOrderFollowAdvanceChecked: (orderFollowAdvanceChecked) => set({ orderFollowAdvanceChecked }), - })) + }), { name: 'form-store' }) ); export default useFormStore; diff --git a/src/views/Conversations/History/MessagesList.jsx b/src/views/Conversations/History/MessagesList.jsx index 50bbb1b..dc7b560 100644 --- a/src/views/Conversations/History/MessagesList.jsx +++ b/src/views/Conversations/History/MessagesList.jsx @@ -8,7 +8,7 @@ import { isEmpty, stringToColour, groupBy, isNotEmpty } from '@/utils/commons'; import { useShallow } from 'zustand/react/shallow'; import MergeConversationTo from './MergeConversationTo'; -const BIG_PAGE_SIZE = MESSAGE_PAGE_SIZE * 100; +const BIG_PAGE_SIZE = MESSAGE_PAGE_SIZE * 20; const MessagesList = ({ ...props }) => { const { message: appMessage } = App.useApp(); @@ -64,7 +64,8 @@ const MessagesList = ({ ...props }) => { if (isEmpty(selectedConversation.conversationid)) { return () => {}; } - const firstActionPageParams = { opisn: (selectedConversation.opi_sn || 0), whatsappid: selectedConversation.whatsapp_phone_number, loadNextPage: true }; + // opisn: (selectedConversation.opi_sn || 0), whatsappid: selectedConversation.whatsapp_phone_number, + const firstActionPageParams = { conversationid: selectedConversation.conversationid , loadNextPage: true }; // if (isEmpty(selectedConversation.matchMsgList)) { if (!isEmpty(formValues?.from_date)) { firstActionPageParams.lasttime = formValues.from_date;