2026-07-31 17:25:42 +08:00
|
|
|
/**
|
|
|
|
|
* 提现管理 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));
|
|
|
|
|
|
2026-08-05 17:34:01 +08:00
|
|
|
/** GET /admin/finance/withdraw/page — 提现列表分页 */
|
2026-07-31 17:25:42 +08:00
|
|
|
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),
|
|
|
|
|
};
|
|
|
|
|
}
|
2026-08-05 17:34:01 +08:00
|
|
|
return get('/admin/finance/withdraw/page', params as Record<string, any>);
|
2026-07-31 17:25:42 +08:00
|
|
|
}
|
|
|
|
|
|
2026-08-05 17:34:01 +08:00
|
|
|
/** GET /admin/finance/withdraw/info?id=xxx — 提现详情 */
|
2026-07-31 17:25:42 +08:00
|
|
|
export async function getWithdrawInfo(id: number): Promise<ApiResult<WithdrawInfoVO>> {
|
|
|
|
|
if (USE_MOCK) {
|
|
|
|
|
await delay(MOCK_DELAY);
|
|
|
|
|
return { code: 200, msg: 'success', data: buildMockWithdrawInfo(id) };
|
|
|
|
|
}
|
2026-08-05 17:34:01 +08:00
|
|
|
return get('/admin/finance/withdraw/info', { id: String(id) });
|
2026-07-31 17:25:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 提现审核请求参数 */
|
|
|
|
|
export interface WithdrawAuditParams {
|
|
|
|
|
/** 提现ID */
|
|
|
|
|
id: string;
|
|
|
|
|
/** 审核结果:1=通过,2=驳回 */
|
|
|
|
|
audit: string;
|
|
|
|
|
/** 审核内容 */
|
|
|
|
|
checkMsg: string;
|
|
|
|
|
/** 审核图片(逗号拼接的 URL) */
|
|
|
|
|
checkImg: string;
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-05 17:34:01 +08:00
|
|
|
/** POST /admin/finance/withdraw/audit — 审核提现 */
|
2026-07-31 17:25:42 +08:00
|
|
|
export async function postWithdrawAudit(params: WithdrawAuditParams): Promise<ApiResult<null>> {
|
2026-08-05 17:34:01 +08:00
|
|
|
return post('/admin/finance/withdraw/audit', params);
|
2026-07-31 17:25:42 +08:00
|
|
|
}
|