refactor: vue3 axios api ...
This commit is contained in:
@@ -1,32 +1,34 @@
|
||||
import { defHttp } from '@/config/axios'
|
||||
import { useAxios } from '@/hooks/web/useAxios'
|
||||
import type { SmsChannelVO } from './types'
|
||||
|
||||
const request = useAxios()
|
||||
|
||||
// 查询短信渠道列表
|
||||
export const getSmsChannelPageApi = ({ params }) => {
|
||||
return defHttp.get<PageResult<SmsChannelVO>>({ url: '/system/sms-channel/page', params })
|
||||
export const getSmsChannelPageApi = (params) => {
|
||||
return request.get({ url: '/system/sms-channel/page', params })
|
||||
}
|
||||
|
||||
// 获得短信渠道精简列表
|
||||
export function getSimpleSmsChannels() {
|
||||
return defHttp.get({ url: '/system/sms-channel/list-all-simple' })
|
||||
return request.get({ url: '/system/sms-channel/list-all-simple' })
|
||||
}
|
||||
|
||||
// 查询短信渠道详情
|
||||
export const getSmsChannelApi = (id: number) => {
|
||||
return defHttp.get<SmsChannelVO>({ url: '/system/sms-channel/get?id=' + id })
|
||||
return request.get({ url: '/system/sms-channel/get?id=' + id })
|
||||
}
|
||||
|
||||
// 新增短信渠道
|
||||
export const createSmsChannelApi = (params: SmsChannelVO) => {
|
||||
return defHttp.post({ url: '/system/sms-channel/create', params })
|
||||
export const createSmsChannelApi = (data: SmsChannelVO) => {
|
||||
return request.post({ url: '/system/sms-channel/create', data })
|
||||
}
|
||||
|
||||
// 修改短信渠道
|
||||
export const updateSmsChannelApi = (params: SmsChannelVO) => {
|
||||
return defHttp.put({ url: '/system/sms-channel/update', params })
|
||||
export const updateSmsChannelApi = (data: SmsChannelVO) => {
|
||||
return request.put({ url: '/system/sms-channel/update', data })
|
||||
}
|
||||
|
||||
// 删除短信渠道
|
||||
export const deleteSmsChannelApi = (id: number) => {
|
||||
return defHttp.delete({ url: '/system/sms-channel/delete?id=' + id })
|
||||
return request.delete({ url: '/system/sms-channel/delete?id=' + id })
|
||||
}
|
||||
|
@@ -1,12 +1,13 @@
|
||||
import { defHttp } from '@/config/axios'
|
||||
import type { SmsLogVO } from './types'
|
||||
import { useAxios } from '@/hooks/web/useAxios'
|
||||
|
||||
const request = useAxios()
|
||||
|
||||
// 查询短信日志列表
|
||||
export const getSmsLogPageApi = ({ params }) => {
|
||||
return defHttp.get<PageResult<SmsLogVO>>({ url: '/system/sms-log/page', params })
|
||||
export const getSmsLogPageApi = (params) => {
|
||||
return request.get({ url: '/system/sms-log/page', params })
|
||||
}
|
||||
|
||||
// 导出短信日志
|
||||
export const exportSmsLogApi = (params) => {
|
||||
return defHttp.get({ url: '/system/sms-log/export', params, responseType: 'blob' })
|
||||
return request.get({ url: '/system/sms-log/export', params, responseType: 'blob' })
|
||||
}
|
||||
|
@@ -1,37 +1,39 @@
|
||||
import { defHttp } from '@/config/axios'
|
||||
import { useAxios } from '@/hooks/web/useAxios'
|
||||
import type { SmsTemplateVO, SmsSendVO } from './types'
|
||||
|
||||
const request = useAxios()
|
||||
|
||||
// 查询短信模板列表
|
||||
export const getSmsTemplatePageApi = ({ params }) => {
|
||||
return defHttp.get<PageResult<SmsTemplateVO>>({ url: '/system/sms-template/page', params })
|
||||
export const getSmsTemplatePageApi = (params) => {
|
||||
return request.get({ url: '/system/sms-template/page', params })
|
||||
}
|
||||
|
||||
// 查询短信模板详情
|
||||
export const getSmsTemplateApi = (id: number) => {
|
||||
return defHttp.get<SmsTemplateVO>({ url: '/system/sms-template/get?id=' + id })
|
||||
return request.get({ url: '/system/sms-template/get?id=' + id })
|
||||
}
|
||||
|
||||
// 新增短信模板
|
||||
export const createSmsTemplateApi = (params: SmsTemplateVO) => {
|
||||
return defHttp.post({ url: '/system/sms-template/create', params })
|
||||
export const createSmsTemplateApi = (data: SmsTemplateVO) => {
|
||||
return request.post({ url: '/system/sms-template/create', data })
|
||||
}
|
||||
|
||||
// 修改短信模板
|
||||
export const updateSmsTemplateApi = (params: SmsTemplateVO) => {
|
||||
return defHttp.put({ url: '/system/sms-template/update', params })
|
||||
export const updateSmsTemplateApi = (data: SmsTemplateVO) => {
|
||||
return request.put({ url: '/system/sms-template/update', data })
|
||||
}
|
||||
|
||||
// 删除短信模板
|
||||
export const deleteSmsTemplateApi = (id: number) => {
|
||||
return defHttp.delete({ url: '/system/sms-template/delete?id=' + id })
|
||||
return request.delete({ url: '/system/sms-template/delete?id=' + id })
|
||||
}
|
||||
|
||||
// 发送短信
|
||||
export function sendSms(params: SmsSendVO) {
|
||||
return defHttp.post({ url: '/system/sms-template/send-sms', params })
|
||||
export function sendSms(data: SmsSendVO) {
|
||||
return request.post({ url: '/system/sms-template/send-sms', data })
|
||||
}
|
||||
|
||||
// 导出短信模板
|
||||
export const exportPostApi = (params) => {
|
||||
return defHttp.get({ url: '/system/sms-template/export-excel', params, responseType: 'blob' })
|
||||
return request.get({ url: '/system/sms-template/export-excel', params, responseType: 'blob' })
|
||||
}
|
||||
|
Reference in New Issue
Block a user