第一次提交
This commit is contained in:
122
src/api/love/plan-icon/index.ts
Normal file
122
src/api/love/plan-icon/index.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type {
|
||||
UserPlanIcon,
|
||||
UserPlanIconParam
|
||||
} from '@/api/love/plan-icon/model';
|
||||
/**
|
||||
* 分页查询价格
|
||||
*/
|
||||
export async function pageUserPlanIcon(params: UserPlanIconParam) {
|
||||
const res = await request.get<ApiResult<PageResult<UserPlanIcon>>>(
|
||||
'/love/user-plan-icon/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询价格列表
|
||||
*/
|
||||
export async function listUserPlanIcon(params?: UserPlanIconParam) {
|
||||
const res = await request.get<ApiResult<UserPlanIcon[]>>(
|
||||
'/love/user-plan-icon',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加价格
|
||||
*/
|
||||
export async function addUserPlanIcon(data: UserPlanIcon) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/love/user-plan-icon',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改价格
|
||||
*/
|
||||
export async function updateUserPlanIcon(data: UserPlanIcon) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/love/user-plan-icon',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定价格
|
||||
*/
|
||||
export async function bindUserPlanIcon(data: UserPlanIcon) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/love/user-plan-icon/bind',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加设备
|
||||
*/
|
||||
export async function addBatchUserPlanIcon(data: UserPlanIcon[]) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/love/user-plan-icon/batch',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除价格
|
||||
*/
|
||||
export async function removeUserPlanIcon(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/love/user-plan-icon/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除价格
|
||||
*/
|
||||
export async function removeBatchUserPlanIcon(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/love/user-plan-icon/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
Reference in New Issue
Block a user