diff --git a/apps/web-antd/src/api/system/mail/account/index.ts b/apps/web-antd/src/api/system/mail/account/index.ts new file mode 100644 index 000000000..9ec32721d --- /dev/null +++ b/apps/web-antd/src/api/system/mail/account/index.ts @@ -0,0 +1,78 @@ +import type { PageParam } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailAccountApi { + export interface MailAccountVO { + id: number; + mail: string; + username: string; + password: string; + host: string; + port: number; + sslEnable: boolean; + starttlsEnable: boolean; + status: number; + createTime: Date; + remark: string; + } +} + +// 查询邮箱账号列表 +export const getMailAccountPage = async (params: PageParam) => { + return await requestClient.get<{ + list: SystemMailAccountApi.MailAccountVO[]; + total: number; + }>('/system/mail-account/page', { params }); +}; + +// 查询邮箱账号详情 +export const getMailAccount = async (id: number) => { + return await requestClient.get( + '/system/mail-account/get', + { + params: { id }, + }, + ); +}; + +// 新增邮箱账号 +export const createMailAccount = async ( + data: SystemMailAccountApi.MailAccountVO, +) => { + return await requestClient.post( + '/system/mail-account/create', + data, + ); +}; + +// 修改邮箱账号 +export const updateMailAccount = async ( + data: SystemMailAccountApi.MailAccountVO, +) => { + return await requestClient.put( + '/system/mail-account/update', + data, + ); +}; + +// 删除邮箱账号 +export const deleteMailAccount = async (id: number) => { + return await requestClient.delete('/system/mail-account/delete', { + params: { id }, + }); +}; + +// 获得邮箱账号精简列表 +export const getSimpleMailAccountList = async () => { + return await requestClient.get( + '/system/mail-account/simple-list', + ); +}; + +// 测试邮箱连接 +export const testMailAccount = async (id: number) => { + return await requestClient.post('/system/mail-account/test', null, { + params: { id }, + }); +}; diff --git a/apps/web-antd/src/api/system/mail/log/index.ts b/apps/web-antd/src/api/system/mail/log/index.ts new file mode 100644 index 000000000..651c90124 --- /dev/null +++ b/apps/web-antd/src/api/system/mail/log/index.ts @@ -0,0 +1,57 @@ +import type { PageParam } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailLogApi { + export interface MailLogVO { + id: number; + userId: number; + userType: number; + toMail: string; + accountId: number; + fromMail: string; + templateId: number; + templateCode: string; + templateNickname: string; + templateTitle: string; + templateContent: string; + templateParams: string; + sendStatus: number; + sendTime: Date; + sendMessageId: string; + sendException: string; + createTime: Date; + } +} + +// 查询邮件日志列表 +export const getMailLogPage = async (params: PageParam) => { + return await requestClient.get<{ + list: SystemMailLogApi.MailLogVO[]; + total: number; + }>('/system/mail-log/page', { params }); +}; + +// 查询邮件日志详情 +export const getMailLog = async (id: number) => { + return await requestClient.get( + '/system/mail-log/get', + { + params: { id }, + }, + ); +}; + +// 重新发送邮件 +export const resendMail = async (id: number) => { + return await requestClient.put('/system/mail-log/resend', null, { + params: { id }, + }); +}; + +// 批量删除邮件日志 +export const deleteMailLogs = async (ids: number[]) => { + return await requestClient.delete('/system/mail-log/delete', { + data: { ids }, + }); +}; diff --git a/apps/web-antd/src/api/system/mail/template/index.ts b/apps/web-antd/src/api/system/mail/template/index.ts new file mode 100644 index 000000000..70415679f --- /dev/null +++ b/apps/web-antd/src/api/system/mail/template/index.ts @@ -0,0 +1,78 @@ +import type { PageParam } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace SystemMailTemplateApi { + export interface MailTemplateVO { + id: number; + name: string; + code: string; + accountId: number; + nickname: string; + title: string; + content: string; + params: string; + status: number; + remark: string; + createTime: Date; + } + + export interface MailSendReqVO { + mail: string; + templateCode: string; + templateParams: Record; + } +} + +// 查询邮件模版列表 +export const getMailTemplatePage = async (params: PageParam) => { + return await requestClient.get<{ + list: SystemMailTemplateApi.MailTemplateVO[]; + total: number; + }>('/system/mail-template/page', { params }); +}; + +// 查询邮件模版详情 +export const getMailTemplate = async (id: number) => { + return await requestClient.get( + '/system/mail-template/get', + { + params: { id }, + }, + ); +}; + +// 新增邮件模版 +export const createMailTemplate = async ( + data: SystemMailTemplateApi.MailTemplateVO, +) => { + return await requestClient.post( + '/system/mail-template/create', + data, + ); +}; + +// 修改邮件模版 +export const updateMailTemplate = async ( + data: SystemMailTemplateApi.MailTemplateVO, +) => { + return await requestClient.put( + '/system/mail-template/update', + data, + ); +}; + +// 删除邮件模版 +export const deleteMailTemplate = async (id: number) => { + return await requestClient.delete('/system/mail-template/delete', { + params: { id }, + }); +}; + +// 发送邮件 +export const sendMail = async (data: SystemMailTemplateApi.MailSendReqVO) => { + return await requestClient.post( + '/system/mail-template/send-mail', + data, + ); +};