重构框架
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ThinkCoachTime, ThinkCoachTimeParam } from './model';
|
||||
import { THINK_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询教练组预约时间表
|
||||
*/
|
||||
export async function pageThinkCoachTime(params: ThinkCoachTimeParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ThinkCoachTime>>>(
|
||||
THINK_API_URL + '/think/think-coach-time/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询教练组预约时间表列表
|
||||
*/
|
||||
export async function listThinkCoachTime(params?: ThinkCoachTimeParam) {
|
||||
const res = await request.get<ApiResult<ThinkCoachTime[]>>(
|
||||
THINK_API_URL + '/think/think-coach-time',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加教练组预约时间表
|
||||
*/
|
||||
export async function addThinkCoachTime(data: ThinkCoachTime) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
THINK_API_URL + '/think/think-coach-time',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改教练组预约时间表
|
||||
*/
|
||||
export async function updateThinkCoachTime(data: ThinkCoachTime) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
THINK_API_URL + '/think/think-coach-time',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除教练组预约时间表
|
||||
*/
|
||||
export async function removeThinkCoachTime(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
THINK_API_URL + '/think/think-coach-time/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除教练组预约时间表
|
||||
*/
|
||||
export async function removeBatchThinkCoachTime(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
THINK_API_URL + '/think/think-coach-time/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询教练组预约时间表
|
||||
*/
|
||||
export async function getThinkCoachTime(id: number) {
|
||||
const res = await request.get<ApiResult<ThinkCoachTime>>(
|
||||
THINK_API_URL + '/think/think-coach-time/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
Reference in New Issue
Block a user