index.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import type { PageParam, PageResult } from '@/http/types'
  2. import { http } from '@/http/http'
  3. /** 短信模板信息 */
  4. export interface SmsTemplate {
  5. id?: number
  6. type?: number
  7. status: number
  8. code: string
  9. name: string
  10. content: string
  11. remark?: string
  12. apiTemplateId: string
  13. channelId?: number
  14. channelCode?: string
  15. params?: string[]
  16. createTime?: Date
  17. }
  18. /** 发送短信请求 */
  19. export interface SmsSendReqVO {
  20. mobile: string
  21. templateCode: string
  22. templateParams: Record<string, any>
  23. }
  24. /** 获取短信模板分页列表 */
  25. export function getSmsTemplatePage(params: PageParam) {
  26. return http.get<PageResult<SmsTemplate>>('/system/sms-template/page', params)
  27. }
  28. /** 获取短信模板详情 */
  29. export function getSmsTemplate(id: number) {
  30. return http.get<SmsTemplate>(`/system/sms-template/get?id=${id}`)
  31. }
  32. /** 创建短信模板 */
  33. export function createSmsTemplate(data: SmsTemplate) {
  34. return http.post<number>('/system/sms-template/create', data)
  35. }
  36. /** 更新短信模板 */
  37. export function updateSmsTemplate(data: SmsTemplate) {
  38. return http.put<boolean>('/system/sms-template/update', data)
  39. }
  40. /** 删除短信模板 */
  41. export function deleteSmsTemplate(id: number) {
  42. return http.delete<boolean>(`/system/sms-template/delete?id=${id}`)
  43. }
  44. /** 发送短信 */
  45. export function sendSms(data: SmsSendReqVO) {
  46. return http.post<number>('/system/sms-template/send-sms', data)
  47. }