修复重大故障: JwtAuthenticationFilter文件,远程读取用户接口导致的服务器请求数量跑满
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopMerchant, ShopMerchantParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config';
|
||||
import {COMMON_API_URL} from "~/config";
|
||||
|
||||
/**
|
||||
* 分页查询商户
|
||||
*/
|
||||
export async function pageShopMerchant(params: ShopMerchantParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopMerchant>>>(
|
||||
MODULES_API_URL + '/shop/shop-merchant/page',
|
||||
'/shop/shop-merchant/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,15 +24,15 @@ export async function pageShopMerchant(params: ShopMerchantParam) {
|
||||
*/
|
||||
export async function listShopMerchant(params?: ShopMerchantParam) {
|
||||
const res = await request.get<ApiResult<ShopMerchant[]>>(
|
||||
MODULES_API_URL + '/shop/shop-merchant',
|
||||
'/shop/shop-merchant',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,13 +40,13 @@ export async function listShopMerchant(params?: ShopMerchantParam) {
|
||||
*/
|
||||
export async function addShopMerchant(data: ShopMerchant) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-merchant',
|
||||
'/shop/shop-merchant',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,42 +54,42 @@ export async function addShopMerchant(data: ShopMerchant) {
|
||||
*/
|
||||
export async function updateShopMerchant(data: ShopMerchant) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-merchant',
|
||||
'/shop/shop-merchant',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商户
|
||||
*/
|
||||
export async function removeShopMerchant(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-merchant/' + id
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-merchant/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商户
|
||||
*/
|
||||
export async function removeBatchShopMerchant(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-merchant/batch',
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-merchant/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,10 +97,37 @@ export async function removeBatchShopMerchant(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getShopMerchant(id: number) {
|
||||
const res = await request.get<ApiResult<ShopMerchant>>(
|
||||
MODULES_API_URL + '/shop/shop-merchant/' + id
|
||||
'/shop/shop-merchant/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userId查询商户
|
||||
*/
|
||||
export async function getShopMerchantByUserId(id: number) {
|
||||
const res = await request.get<ApiResult<ShopMerchant>>(
|
||||
'/shop/shop-merchant/' + id
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据phone查询商户
|
||||
*/
|
||||
export async function getShopMerchantByPhone() {
|
||||
const res = await request.get<ApiResult<ShopMerchant>>(
|
||||
COMMON_API_URL + '/shop/shop-merchant/getByPhone'
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user