refactor(shop): 重构商铺相关 API
- 移除 ApiResult 和 PageResult 的冗余导入 - 更新请求路径,移除 MODULES_API_URL 的使用 - 调整请求头,移除不必要的 Content-Type 设置 -统一处理 enabled 字段类型
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api/index';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopDealerApply, ShopDealerApplyParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询分销商申请记录表
|
||||
*/
|
||||
export async function pageShopDealerApply(params: ShopDealerApplyParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopDealerApply>>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-apply/page',
|
||||
'/shop/shop-dealer-apply/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +23,7 @@ export async function pageShopDealerApply(params: ShopDealerApplyParam) {
|
||||
*/
|
||||
export async function listShopDealerApply(params?: ShopDealerApplyParam) {
|
||||
const res = await request.get<ApiResult<ShopDealerApply[]>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-apply',
|
||||
'/shop/shop-dealer-apply',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +39,7 @@ export async function listShopDealerApply(params?: ShopDealerApplyParam) {
|
||||
*/
|
||||
export async function addShopDealerApply(data: ShopDealerApply) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-apply',
|
||||
'/shop/shop-dealer-apply',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +53,7 @@ export async function addShopDealerApply(data: ShopDealerApply) {
|
||||
*/
|
||||
export async function updateShopDealerApply(data: ShopDealerApply) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-apply',
|
||||
'/shop/shop-dealer-apply',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +67,7 @@ export async function updateShopDealerApply(data: ShopDealerApply) {
|
||||
*/
|
||||
export async function removeShopDealerApply(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-apply/' + id
|
||||
'/shop/shop-dealer-apply/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +80,7 @@ export async function removeShopDealerApply(id?: number) {
|
||||
*/
|
||||
export async function removeBatchShopDealerApply(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-apply/batch',
|
||||
'/shop/shop-dealer-apply/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerApply(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getShopDealerApply(id: number) {
|
||||
const res = await request.get<ApiResult<ShopDealerApply>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-apply/' + id
|
||||
'/shop/shop-dealer-apply/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 分销商申请记录表
|
||||
|
||||
Reference in New Issue
Block a user