From 968f345839443b4c52838cd22f82afc17da01b2a Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Dec 2025 18:04:41 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90system=E3=80=91=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1=E7=AE=A1=E7=90=86=E7=9A=84=E4=BC=98=E5=8C=96=EF=BC=9A?= =?UTF-8?q?api=20=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/sms/channel/index.ts | 45 ++++++ src/api/system/sms/index.ts | 138 ------------------ src/api/system/sms/log/index.ts | 34 +++++ src/api/system/sms/template/index.ts | 55 +++++++ src/pages-system/sms/channel/detail/index.vue | 4 +- src/pages-system/sms/channel/form/index.vue | 4 +- .../sms/components/channel-list.vue | 4 +- src/pages-system/sms/components/log-list.vue | 4 +- .../sms/components/template-list.vue | 4 +- src/pages-system/sms/log/detail/index.vue | 4 +- .../template/detail/components/send-form.vue | 4 +- .../sms/template/detail/index.vue | 4 +- src/pages-system/sms/template/form/index.vue | 6 +- 13 files changed, 154 insertions(+), 156 deletions(-) create mode 100644 src/api/system/sms/channel/index.ts delete mode 100644 src/api/system/sms/index.ts create mode 100644 src/api/system/sms/log/index.ts create mode 100644 src/api/system/sms/template/index.ts diff --git a/src/api/system/sms/channel/index.ts b/src/api/system/sms/channel/index.ts new file mode 100644 index 0000000..c898b21 --- /dev/null +++ b/src/api/system/sms/channel/index.ts @@ -0,0 +1,45 @@ +import type { PageParam, PageResult } from '@/http/types' +import { http } from '@/http/http' + +/** 短信渠道信息 */ +export interface SmsChannel { + id?: number + code: string + status: number + signature: string + remark?: string + apiKey: string + apiSecret?: string + callbackUrl?: string + createTime?: Date +} + +/** 获取短信渠道分页列表 */ +export function getSmsChannelPage(params: PageParam) { + return http.get>('/system/sms-channel/page', params) +} + +/** 获取短信渠道精简列表 */ +export function getSimpleSmsChannelList() { + return http.get('/system/sms-channel/simple-list') +} + +/** 获取短信渠道详情 */ +export function getSmsChannel(id: number) { + return http.get(`/system/sms-channel/get?id=${id}`) +} + +/** 创建短信渠道 */ +export function createSmsChannel(data: SmsChannel) { + return http.post('/system/sms-channel/create', data) +} + +/** 更新短信渠道 */ +export function updateSmsChannel(data: SmsChannel) { + return http.put('/system/sms-channel/update', data) +} + +/** 删除短信渠道 */ +export function deleteSmsChannel(id: number) { + return http.delete(`/system/sms-channel/delete?id=${id}`) +} diff --git a/src/api/system/sms/index.ts b/src/api/system/sms/index.ts deleted file mode 100644 index 4d155ca..0000000 --- a/src/api/system/sms/index.ts +++ /dev/null @@ -1,138 +0,0 @@ -import type { PageParam, PageResult } from '@/http/types' -import { http } from '@/http/http' - -// TODO @AI:拆成三个文件:channel.ts、template.ts、log.ts - -// ==================== 短信渠道 ==================== - -/** 短信渠道信息 */ -export interface SmsChannel { - id?: number - code: string - status: number - signature: string - remark?: string - apiKey: string - apiSecret?: string - callbackUrl?: string - createTime?: Date -} - -/** 获取短信渠道分页列表 */ -export function getSmsChannelPage(params: PageParam) { - return http.get>('/system/sms-channel/page', params) -} - -/** 获取短信渠道精简列表 */ -export function getSimpleSmsChannelList() { - return http.get('/system/sms-channel/simple-list') -} - -/** 获取短信渠道详情 */ -export function getSmsChannel(id: number) { - return http.get(`/system/sms-channel/get?id=${id}`) -} - -/** 创建短信渠道 */ -export function createSmsChannel(data: SmsChannel) { - return http.post('/system/sms-channel/create', data) -} - -/** 更新短信渠道 */ -export function updateSmsChannel(data: SmsChannel) { - return http.put('/system/sms-channel/update', data) -} - -/** 删除短信渠道 */ -export function deleteSmsChannel(id: number) { - return http.delete(`/system/sms-channel/delete?id=${id}`) -} - -// ==================== 短信模板 ==================== - -/** 短信模板信息 */ -export interface SmsTemplate { - id?: number - type?: number - status: number - code: string - name: string - content: string - remark?: string - apiTemplateId: string - channelId?: number - channelCode?: string - params?: string[] - createTime?: Date -} - -/** 发送短信请求 */ -export interface SmsSendReqVO { - mobile: string - templateCode: string - templateParams: Record -} - -/** 获取短信模板分页列表 */ -export function getSmsTemplatePage(params: PageParam) { - return http.get>('/system/sms-template/page', params) -} - -/** 获取短信模板详情 */ -export function getSmsTemplate(id: number) { - return http.get(`/system/sms-template/get?id=${id}`) -} - -/** 创建短信模板 */ -export function createSmsTemplate(data: SmsTemplate) { - return http.post('/system/sms-template/create', data) -} - -/** 更新短信模板 */ -export function updateSmsTemplate(data: SmsTemplate) { - return http.put('/system/sms-template/update', data) -} - -/** 删除短信模板 */ -export function deleteSmsTemplate(id: number) { - return http.delete(`/system/sms-template/delete?id=${id}`) -} - -/** 发送短信 */ -export function sendSms(data: SmsSendReqVO) { - return http.post('/system/sms-template/send-sms', data) -} - -// ==================== 短信日志 ==================== - -/** 短信日志信息 */ -export interface SmsLog { - id?: number - channelId?: number - channelCode: string - templateId?: number - templateCode: string - templateType?: number - templateContent: string - templateParams?: Record - apiTemplateId: string - mobile: string - userId?: number - userType?: number - sendStatus?: number - sendTime?: string - apiSendCode?: string - apiSendMsg?: string - apiRequestId?: string - apiSerialNo?: string - receiveStatus?: number - receiveTime?: string - apiReceiveCode?: string - apiReceiveMsg?: string - createTime?: string -} - -/** 获取短信日志分页列表 */ -export function getSmsLogPage(params: PageParam) { - return http.get>('/system/sms-log/page', params) -} diff --git a/src/api/system/sms/log/index.ts b/src/api/system/sms/log/index.ts new file mode 100644 index 0000000..c181f3f --- /dev/null +++ b/src/api/system/sms/log/index.ts @@ -0,0 +1,34 @@ +import type { PageParam, PageResult } from '@/http/types' +import { http } from '@/http/http' + +/** 短信日志信息 */ +export interface SmsLog { + id?: number + channelId?: number + channelCode: string + templateId?: number + templateCode: string + templateType?: number + templateContent: string + templateParams?: Record + apiTemplateId: string + mobile: string + userId?: number + userType?: number + sendStatus?: number + sendTime?: string + apiSendCode?: string + apiSendMsg?: string + apiRequestId?: string + apiSerialNo?: string + receiveStatus?: number + receiveTime?: string + apiReceiveCode?: string + apiReceiveMsg?: string + createTime?: string +} + +/** 获取短信日志分页列表 */ +export function getSmsLogPage(params: PageParam) { + return http.get>('/system/sms-log/page', params) +} diff --git a/src/api/system/sms/template/index.ts b/src/api/system/sms/template/index.ts new file mode 100644 index 0000000..2e02a57 --- /dev/null +++ b/src/api/system/sms/template/index.ts @@ -0,0 +1,55 @@ +import type { PageParam, PageResult } from '@/http/types' +import { http } from '@/http/http' + +/** 短信模板信息 */ +export interface SmsTemplate { + id?: number + type?: number + status: number + code: string + name: string + content: string + remark?: string + apiTemplateId: string + channelId?: number + channelCode?: string + params?: string[] + createTime?: Date +} + +/** 发送短信请求 */ +export interface SmsSendReqVO { + mobile: string + templateCode: string + templateParams: Record +} + +/** 获取短信模板分页列表 */ +export function getSmsTemplatePage(params: PageParam) { + return http.get>('/system/sms-template/page', params) +} + +/** 获取短信模板详情 */ +export function getSmsTemplate(id: number) { + return http.get(`/system/sms-template/get?id=${id}`) +} + +/** 创建短信模板 */ +export function createSmsTemplate(data: SmsTemplate) { + return http.post('/system/sms-template/create', data) +} + +/** 更新短信模板 */ +export function updateSmsTemplate(data: SmsTemplate) { + return http.put('/system/sms-template/update', data) +} + +/** 删除短信模板 */ +export function deleteSmsTemplate(id: number) { + return http.delete(`/system/sms-template/delete?id=${id}`) +} + +/** 发送短信 */ +export function sendSms(data: SmsSendReqVO) { + return http.post('/system/sms-template/send-sms', data) +} diff --git a/src/pages-system/sms/channel/detail/index.vue b/src/pages-system/sms/channel/detail/index.vue index c6bc915..3a42535 100644 --- a/src/pages-system/sms/channel/detail/index.vue +++ b/src/pages-system/sms/channel/detail/index.vue @@ -47,10 +47,10 @@