57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
|
|
/**
|
||
|
|
* 提现管理 API
|
||
|
|
* 对应 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) });
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 提现审核请求参数 */
|
||
|
|
export interface WithdrawAuditParams {
|
||
|
|
/** 提现ID */
|
||
|
|
id: string;
|
||
|
|
/** 审核结果:1=通过,2=驳回 */
|
||
|
|
audit: string;
|
||
|
|
/** 审核内容 */
|
||
|
|
checkMsg: string;
|
||
|
|
/** 审核图片(逗号拼接的 URL) */
|
||
|
|
checkImg: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** POST /admin/finance/withdraw/audit — 审核提现 */
|
||
|
|
export async function postWithdrawAudit(params: WithdrawAuditParams): Promise<ApiResult<null>> {
|
||
|
|
return post('/admin/finance/withdraw/audit', params);
|
||
|
|
}
|