refactor: 优化 mail api 格式
parent
2207db02f5
commit
b27529d695
|
@ -18,36 +18,36 @@ export namespace SystemMailAccountApi {
|
|||
remark: string;
|
||||
}
|
||||
}
|
||||
// TODO @puhui999:改成 function 风格;不用 await
|
||||
|
||||
/** 查询邮箱账号列表 */
|
||||
export const getMailAccountPage = async (params: PageParam) => {
|
||||
return await requestClient.get<PageResult<SystemMailAccountApi.SystemMailAccount>>(
|
||||
export function getMailAccountPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<SystemMailAccountApi.SystemMailAccount>>(
|
||||
'/system/mail-account/page',
|
||||
{ params },
|
||||
{ params }
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
/** 查询邮箱账号详情 */
|
||||
export const getMailAccount = async (id: number) => {
|
||||
return await requestClient.get<SystemMailAccountApi.SystemMailAccount>(`/system/mail-account/get?id=${id}`);
|
||||
};
|
||||
export function getMailAccount(id: number) {
|
||||
return requestClient.get<SystemMailAccountApi.SystemMailAccount>(`/system/mail-account/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增邮箱账号 */
|
||||
export const createMailAccount = async (data: SystemMailAccountApi.SystemMailAccount) => {
|
||||
return await requestClient.post<SystemMailAccountApi.SystemMailAccount>('/system/mail-account/create', data);
|
||||
};
|
||||
export function createMailAccount(data: SystemMailAccountApi.SystemMailAccount) {
|
||||
return requestClient.post('/system/mail-account/create', data);
|
||||
}
|
||||
|
||||
/** 修改邮箱账号 */
|
||||
export const updateMailAccount = async (data: SystemMailAccountApi.SystemMailAccount) => {
|
||||
return await requestClient.put<SystemMailAccountApi.SystemMailAccount>('/system/mail-account/update', data);
|
||||
};
|
||||
export function updateMailAccount(data: SystemMailAccountApi.SystemMailAccount) {
|
||||
return requestClient.put('/system/mail-account/update', data);
|
||||
}
|
||||
|
||||
/** 删除邮箱账号 */
|
||||
export const deleteMailAccount = async (id: number) => {
|
||||
return await requestClient.delete<boolean>(`/system/mail-account/delete?id=${id}`);
|
||||
};
|
||||
export function deleteMailAccount(id: number) {
|
||||
return requestClient.delete(`/system/mail-account/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得邮箱账号精简列表 */
|
||||
export const getSimpleMailAccountList = async () => {
|
||||
return await requestClient.get<SystemMailAccountApi.SystemMailAccount[]>('/system/mail-account/simple-list');
|
||||
};
|
||||
export function getSimpleMailAccountList() {
|
||||
return requestClient.get<SystemMailAccountApi.SystemMailAccount[]>('/system/mail-account/simple-list');
|
||||
}
|
||||
|
|
|
@ -24,21 +24,21 @@ export namespace SystemMailLogApi {
|
|||
createTime: string;
|
||||
}
|
||||
}
|
||||
// TODO @puhui999:改成 function 风格;不用 await
|
||||
|
||||
/** 查询邮件日志列表 */
|
||||
export const getMailLogPage = async (params: PageParam) => {
|
||||
return await requestClient.get<PageResult<SystemMailLogApi.SystemMailLog>>(
|
||||
export function getMailLogPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<SystemMailLogApi.SystemMailLog>>(
|
||||
'/system/mail-log/page',
|
||||
{ params }
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
/** 查询邮件日志详情 */
|
||||
export const getMailLog = async (id: number) => {
|
||||
return await requestClient.get<SystemMailLogApi.SystemMailLog>(`/system/mail-log/get?${id}`);
|
||||
};
|
||||
export function getMailLog(id: number) {
|
||||
return requestClient.get<SystemMailLogApi.SystemMailLog>(`/system/mail-log/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 重新发送邮件 */
|
||||
export const resendMail = async (id: number) => {
|
||||
return await requestClient.put<boolean>(`/system/mail-log/resend?id=${id}`);
|
||||
};
|
||||
export function resendMail(id: number) {
|
||||
return requestClient.put(`/system/mail-log/resend?id=${id}`);
|
||||
}
|
||||
|
|
|
@ -25,36 +25,36 @@ export namespace SystemMailTemplateApi {
|
|||
templateParams: Record<string, any>;
|
||||
}
|
||||
}
|
||||
// TODO @puhui999:改成 function 风格;不用 await
|
||||
|
||||
/** 查询邮件模版列表 */
|
||||
export const getMailTemplatePage = async (params: PageParam) => {
|
||||
return await requestClient.get<PageResult<SystemMailTemplateApi.SystemMailTemplate>>(
|
||||
export function getMailTemplatePage(params: PageParam) {
|
||||
return requestClient.get<PageResult<SystemMailTemplateApi.SystemMailTemplate>>(
|
||||
'/system/mail-template/page',
|
||||
{ params }
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
/** 查询邮件模版详情 */
|
||||
export const getMailTemplate = async (id: number) => {
|
||||
return await requestClient.get<SystemMailTemplateApi.SystemMailTemplate>(`/system/mail-template/get?id=${id}`);
|
||||
};
|
||||
export function getMailTemplate(id: number) {
|
||||
return requestClient.get<SystemMailTemplateApi.SystemMailTemplate>(`/system/mail-template/get?id=${id}`);
|
||||
}
|
||||
|
||||
/** 新增邮件模版 */
|
||||
export const createMailTemplate = async (data: SystemMailTemplateApi.SystemMailTemplate) => {
|
||||
return await requestClient.post<SystemMailTemplateApi.SystemMailTemplate>('/system/mail-template/create', data);
|
||||
};
|
||||
export function createMailTemplate(data: SystemMailTemplateApi.SystemMailTemplate) {
|
||||
return requestClient.post('/system/mail-template/create', data);
|
||||
}
|
||||
|
||||
/** 修改邮件模版 */
|
||||
export const updateMailTemplate = async (data: SystemMailTemplateApi.SystemMailTemplate) => {
|
||||
return await requestClient.put<SystemMailTemplateApi.SystemMailTemplate>('/system/mail-template/update', data);
|
||||
};
|
||||
export function updateMailTemplate(data: SystemMailTemplateApi.SystemMailTemplate) {
|
||||
return requestClient.put('/system/mail-template/update', data);
|
||||
}
|
||||
|
||||
/** 删除邮件模版 */
|
||||
export const deleteMailTemplate = async (id: number) => {
|
||||
return await requestClient.delete<boolean>(`/system/mail-template/delete?id=${id}`);
|
||||
};
|
||||
export function deleteMailTemplate(id: number) {
|
||||
return requestClient.delete(`/system/mail-template/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 发送邮件 */
|
||||
export const sendMail = async (data: SystemMailTemplateApi.MailSendReqVO) => {
|
||||
return await requestClient.post<boolean>('/system/mail-template/send-mail', data);
|
||||
};
|
||||
export function sendMail(data: SystemMailTemplateApi.MailSendReqVO) {
|
||||
return requestClient.post('/system/mail-template/send-mail', data);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue