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 { ShopDealerWithdraw, ShopDealerWithdrawParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询分销商提现明细表
|
||||
*/
|
||||
export async function pageShopDealerWithdraw(params: ShopDealerWithdrawParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopDealerWithdraw>>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-withdraw/page',
|
||||
'/shop/shop-dealer-withdraw/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +23,7 @@ export async function pageShopDealerWithdraw(params: ShopDealerWithdrawParam) {
|
||||
*/
|
||||
export async function listShopDealerWithdraw(params?: ShopDealerWithdrawParam) {
|
||||
const res = await request.get<ApiResult<ShopDealerWithdraw[]>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-withdraw',
|
||||
'/shop/shop-dealer-withdraw',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +39,7 @@ export async function listShopDealerWithdraw(params?: ShopDealerWithdrawParam) {
|
||||
*/
|
||||
export async function addShopDealerWithdraw(data: ShopDealerWithdraw) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-withdraw',
|
||||
'/shop/shop-dealer-withdraw',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +53,7 @@ export async function addShopDealerWithdraw(data: ShopDealerWithdraw) {
|
||||
*/
|
||||
export async function updateShopDealerWithdraw(data: ShopDealerWithdraw) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-withdraw',
|
||||
'/shop/shop-dealer-withdraw',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +67,7 @@ export async function updateShopDealerWithdraw(data: ShopDealerWithdraw) {
|
||||
*/
|
||||
export async function removeShopDealerWithdraw(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-withdraw/' + id
|
||||
'/shop/shop-dealer-withdraw/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +80,7 @@ export async function removeShopDealerWithdraw(id?: number) {
|
||||
*/
|
||||
export async function removeBatchShopDealerWithdraw(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-withdraw/batch',
|
||||
'/shop/shop-dealer-withdraw/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +96,7 @@ export async function removeBatchShopDealerWithdraw(data: (number | undefined)[]
|
||||
*/
|
||||
export async function getShopDealerWithdraw(id: number) {
|
||||
const res = await request.get<ApiResult<ShopDealerWithdraw>>(
|
||||
MODULES_API_URL + '/shop/shop-dealer-withdraw/' + id
|
||||
'/shop/shop-dealer-withdraw/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
Reference in New Issue
Block a user