conf: api v3 地址

dev/ckeditor
Lei OT 3 weeks ago
parent 05a22161cd
commit cc471d93c8

@ -1,5 +1,5 @@
import { fetchJSON, postForm, postJSON } from '@/utils/request';
import { API_HOST, DATE_FORMAT, DATEEND_FORMAT, DATETIME_FORMAT, EMAIL_HOST } from '@/config';
import { API_HOST, API_HOST_V3, DATE_FORMAT, DATEEND_FORMAT, DATETIME_FORMAT, EMAIL_HOST } from '@/config';
import { buildTree, groupBy, isEmpty, objectMapper, omitEmpty, readIndexDB, uniqWith, writeIndexDB } from '@/utils/commons';
import dayjs from 'dayjs';
@ -167,7 +167,7 @@ const todoTypes = {
*/
export const getEmailDirAction = async (params = { opi_sn: '' }) => {
const defaultParams = { opi_sn: 0, year: dayjs().year(), by_start_date: -1, by_success: -1, important: -1, if_want_book: -1, if_thinking: -1 }
const { errcode, result } = await fetchJSON(`${API_HOST}/email_dir`, { ...defaultParams, ...params })
const { errcode, result } = await fetchJSON(`${API_HOST_V3}/email_dir`, { ...defaultParams, ...params })
const mailboxSort = result //.sort(sortBy('MDR_Order'));
let tree = buildTree(mailboxSort, { key: 'VKey', parent: 'VParent', name: 'VName', iconIndex: 'ImageIndex', rootKeys: [1], ignoreKeys: [-227001, -227002] })
tree = tree.filter((ele) => ele.key !== 1)
@ -309,7 +309,7 @@ export const queryEmailListAction = async ({ opi_sn = '', pagesize = 10, last_id
}
_params.mai_senddate1 = dayjs(_params.mai_senddate1).format(DATE_FORMAT)
const cacheKey = isEmpty(_params.coli_sn) ? `dir-${node.vkey}` : `order-${node.vkey}`;
const { errcode, result } = await fetchJSON(`${API_HOST}/mail_list`, _params)
const { errcode, result } = await fetchJSON(`${API_HOST_V3}/mail_list`, _params)
const ret = errcode === 0 ? result : []
if (!isEmpty(ret)) {
const listids = [...new Set(ret.map(ele => ele.MAI_SN))];
@ -322,8 +322,8 @@ export const queryEmailListAction = async ({ opi_sn = '', pagesize = 10, last_id
/**
* 更新邮件属性
*/
export const updateEmailAction = async (params = { mai_sn_list: [], set: {} }) => {
const { errcode, result } = await postJSON(`${EMAIL_HOST}/email/update`, params)
export const updateEmailAction = async (params = { opi_sn: '', mai_sn_list: [], set: {} }) => {
const { errcode, result } = await postJSON(`${API_HOST_V3}/mail_update`, params)
return errcode === 0 ? {} : result
}
@ -337,7 +337,7 @@ export const updateEmailAction = async (params = { mai_sn_list: [], set: {} }) =
* @param {number} [params.remind_index] - Index of the reminder.
*/
export const getEmailTemplateAction = async (params = { coli_sn: 0, lgc: 1, opi_sn: 0, remind_type: '', remind_index: 0 }) => {
const { errcode, result } = await fetchJSON(`${API_HOST}/reminder_letter`, params)
const { errcode, result } = await fetchJSON(`${API_HOST_V3}/reminder_letter`, params)
const { html, bodyContent, bodyText } = parseHTMLString(result?.MailContent, true) ;
return errcode === 0 ? {...result, bodyContent }: {}
}
@ -348,7 +348,7 @@ export const getEmailTemplateAction = async (params = { coli_sn: 0, lgc: 1, opi_
* @param {boolean} [isDraft=false] - Whether the email is a draft.
*/
export const saveEmailDraftOrSendAction = async (body, isDraft = false) => {
const url = isDraft !== false ? `${API_HOST}/email_draft_save` : `${EMAIL_HOST}/sendmail`;
const url = isDraft !== false ? `${API_HOST_V3}/email_draft_save` : `${EMAIL_HOST}/sendmail`;
const { attaList=[], atta, content, ...bodyData } = body;
bodyData.ordertype = 227001;
const formData = new FormData();
@ -367,6 +367,6 @@ export const saveEmailDraftOrSendAction = async (body, isDraft = false) => {
* 删除邮件附件
*/
export const deleteEmailAttachmentAction = async (ati_sn_list) => {
const { errcode, result } = await postJSON(`${API_HOST}/mail_attachment_delete`, { ati_sn_list })
const { errcode, result } = await postJSON(`${API_HOST_V3}/mail_attachment_delete`, { ati_sn_list })
return errcode === 0 ? result : {}
};

@ -6,7 +6,8 @@
// export const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_144'; // prod: Slave
// debug:
export const API_HOST = 'http://202.103.68.144:8889/v3';
// export const API_HOST = 'http://202.103.68.144:8889/v2';
export const API_HOST_V3 = 'http://202.103.68.144:8889/v3';
// export const WS_URL = 'ws://202.103.68.144:8888';
// export const EMAIL_HOST = 'http://202.103.68.231:888/service-mail';
// export const WAI_HOST = 'http://47.83.248.120/api/v1'; // 香港服务器
@ -18,7 +19,7 @@ export const EMAIL_ATTA_HOST = 'https://p9axztuwd7x8a7.mycht.cn/attachment'; //
// prod:
// export const WAI_HOST = 'https://wai-server-qq4qmtq7wc9he4.mycht.cn/api/v1';
export const EMAIL_HOST = 'https://p9axztuwd7x8a7.mycht.cn/mail-server/service-mail';
// export const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server/v2';
export const API_HOST = 'https://p9axztuwd7x8a7.mycht.cn/whatsapp_server/v2';
export const WS_URL = 'wss://p9axztuwd7x8a7.mycht.cn/whatsapp_server'; // prod:
export const VONAGE_URL = 'https://p9axztuwd7x8a7.mycht.cn/vonage-server'; // 语音和视频接口:
export const HT3 = process.env.NODE_ENV === 'production' ? 'https://p9axztuwd7x8a7.mycht.cn/ht3' : 'https://p9axztuwd7x8a7.mycht.cn/ht3';

@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react'
import { isEmpty, objectMapper, olog, readIndexDB, } from '@/utils/commons'
import { getEmailDetailAction, postResendEmailAction, getSalesSignatureAction, getEmailOrderAction, queryEmailListAction, getEmailTemplateAction, saveEmailDraftOrSendAction } from '@/actions/EmailActions'
import { getEmailDetailAction, postResendEmailAction, getSalesSignatureAction, getEmailOrderAction, queryEmailListAction, getEmailTemplateAction, saveEmailDraftOrSendAction, updateEmailAction } from '@/actions/EmailActions'
import { App } from 'antd'
import useConversationStore from '@/stores/ConversationStore';
import { msgStatusRenderMapped } from '@/channel/bubbleMsgUtils';
@ -133,7 +133,16 @@ export const useEmailDetail = (mai_sn, data={}, oid=0) => {
}
};
return { loading, mailData, orderDetail, postEmailResend, postEmailSaveOrSend }
const updateEmailProcessed = async (params) => {
try {
const x = await updateEmailAction(params);
refresh()
} catch (error) {
console.error(error)
}
}
return { loading, mailData, orderDetail, postEmailResend, postEmailSaveOrSend, updateEmailProcessed }
}
export const EmailBuilder = ({subject, content}) => {

Loading…
Cancel
Save