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