perf: 主动收邮件

2.0/email-builder
Lei OT 11 months ago
parent afdca2c164
commit f5026e07e4

@ -56,30 +56,30 @@ export const getEmailDetailAction = async (param) => {
}
/**
* 主动收邮件
* @param {object} { opi_sn, mai_sn }
* @ignore 用下面的接口代替, 收所有账户
* 主动收邮件, 单个账户
* @param {object} { opi_sn, mat_sn }
*/
export const getEmailFetchAction = async (param) => {
const { result } = await fetchJSON(`${EMAIL_HOST}/email_fetch`, param);
return result;
const { opi_sn, mat_sn } = param
const { result } = await fetchJSON(`${EMAIL_HOST}/email_fetch`, {
opi_sn,
mat_sn,
// 以下是废弃的参数
externalid: 0,
actionid: 0,
token: 0,
})
return result
};
/**
* 主动收邮件, 所有账户
* @param {object} { opi_sn, mai_sn }
* @param {object} { opi_sn, mat_sn }
*/
export const getAllEmailFetchAction = async (emailList) => {
try {
const promises = emailList.map((eaccount) => fetchJSON(`${EMAIL_HOST}/email_fetch`, {
opi_sn: eaccount.opi_sn,
mat_sn: eaccount.mat_sn,
// 以下是废弃的参数
externalid: 0,
actionid: 0,
token: 0,
}))
const promises = emailList.map((eaccount) => getEmailFetchAction(eaccount))
const result = await Promise.all(promises);
return result;
} catch (error) {

@ -40,7 +40,6 @@ const EmailFetch = ({ ...props }) => {
const [fetchingText, setFetchingText] = useState('收邮件')
const handleGetEmail = async () => {
setEmailLoading(true)
// const ret = await getEmailFetchAction({ ...{}, opi_sn: userId })
const ret = await getAllEmailFetchAction(emailList)
// setFetchingText('...');
setEmailLoading(false)

Loading…
Cancel
Save