fix: 去除已经实现过了的接口的假数据相关逻辑
This commit is contained in:
@@ -3,38 +3,19 @@
|
||||
* 对应 OpenAPI: GET /admin/finance/withdraw/page, GET /admin/finance/withdraw/info
|
||||
*/
|
||||
import { get, post } from '@/utils/request';
|
||||
import { USE_MOCK, MOCK_DELAY } from '@/config/mock';
|
||||
import { buildMockWithdrawPage } from '@/config/mock/withdrawList';
|
||||
import { buildMockWithdrawInfo } from '@/config/mock/withdrawInfo';
|
||||
import type { WithdrawQueryParams, WithdrawVO, WithdrawInfoVO, PageData, ApiResult } from './types';
|
||||
|
||||
export type { WithdrawVO, WithdrawInfoVO, WithdrawQueryParams, PageData, ApiResult } from './types';
|
||||
|
||||
const delay = (ms: number) => new Promise<void>((r) => setTimeout(r, ms));
|
||||
|
||||
/** GET /admin/finance/withdraw/page — 提现列表分页 */
|
||||
export async function getWithdrawList(
|
||||
params: WithdrawQueryParams,
|
||||
): Promise<ApiResult<PageData<WithdrawVO>>> {
|
||||
if (USE_MOCK) {
|
||||
await delay(MOCK_DELAY);
|
||||
const page = Number(params.page) || 1;
|
||||
const limit = Number(params.limit) || 10;
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: buildMockWithdrawPage(page, limit, params),
|
||||
};
|
||||
}
|
||||
return get('/admin/finance/withdraw/page', params as Record<string, any>);
|
||||
}
|
||||
|
||||
/** GET /admin/finance/withdraw/info?id=xxx — 提现详情 */
|
||||
export async function getWithdrawInfo(id: number): Promise<ApiResult<WithdrawInfoVO>> {
|
||||
if (USE_MOCK) {
|
||||
await delay(MOCK_DELAY);
|
||||
return { code: 200, msg: 'success', data: buildMockWithdrawInfo(id) };
|
||||
}
|
||||
return get('/admin/finance/withdraw/info', { id: String(id) });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user