|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
|
|
|
|
|
import { groupBy, pick, sortArrayByOrder } from '@/utils/commons';
|
|
|
|
|
import { groupBy, isNotEmpty, pick, sortArrayByOrder } from '@/utils/commons';
|
|
|
|
|
import { fetchJSON, postJSON, postForm } from '@/utils/request'
|
|
|
|
|
import { parseRenderMessageList } from '@/channel/bubbleMsgUtils';
|
|
|
|
|
import { API_HOST } from '@/config';
|
|
|
|
@ -17,12 +17,28 @@ export const fetchTemplates = async () => {
|
|
|
|
|
return [...top, ...raw];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const CONVERSATION_PAGE_SIZE = 20;
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param {object} params { opisn }
|
|
|
|
|
*/
|
|
|
|
|
export const fetchConversationsList = async (params) => {
|
|
|
|
|
const { errcode, result: data } = await fetchJSON(`${API_HOST}/getconversations`, params);
|
|
|
|
|
const defaultParams = {
|
|
|
|
|
opisn: '',
|
|
|
|
|
pagesize: CONVERSATION_PAGE_SIZE,
|
|
|
|
|
lastpagetime: '',
|
|
|
|
|
tags: '',
|
|
|
|
|
olabel: '',
|
|
|
|
|
keyword: '',
|
|
|
|
|
ostate: '',
|
|
|
|
|
intour: '',
|
|
|
|
|
lastactivetime: dayjs('2024-09-01').format('YYYY-MM-DD 00:00'),
|
|
|
|
|
}
|
|
|
|
|
const combinedFilterStr = Object.values(pick(params, ['tags', 'olabel', 'intour', 'keyword', 'ostate'])).join()
|
|
|
|
|
if (isNotEmpty(combinedFilterStr)) {
|
|
|
|
|
params.lastactivetime = '';
|
|
|
|
|
}
|
|
|
|
|
const { errcode, result: data } = await fetchJSON(`${API_HOST}/getconversations`, { ...defaultParams, ...params })
|
|
|
|
|
if (errcode !== 0) return [];
|
|
|
|
|
const list = (data || []).map((ele) => ({
|
|
|
|
|
...ele,
|
|
|
|
@ -129,7 +145,6 @@ export const fetchConversationItemTop = async (body) => {
|
|
|
|
|
* ------------------------------------------------------------------------------------------------
|
|
|
|
|
* 历史记录
|
|
|
|
|
*/
|
|
|
|
|
export const CONVERSATION_PAGE_SIZE = 20;
|
|
|
|
|
/**
|
|
|
|
|
* @param {object} params { search, from_date, end_date, whatsapp_id, opisn, coli_id, msg_type }
|
|
|
|
|
* @todo msg_type
|
|
|
|
|