feat: 扩展开奖与结算管理,支持手动操作、导出和版本展示
This commit is contained in:
@@ -5,8 +5,12 @@ import { API_V1_PREFIX } from "./paths";
|
||||
import type { AdminDrawFinanceSummaryData } from "@/types/api/admin-draw-finance";
|
||||
import type {
|
||||
AdminDrawBatchesData,
|
||||
AdminDrawActionResponse,
|
||||
AdminDrawListData,
|
||||
AdminDrawBatchCreateResponse,
|
||||
AdminDrawManualBatchPayload,
|
||||
AdminDrawPublishResponse,
|
||||
AdminDrawPlanGenerateResponse,
|
||||
AdminDrawShowData,
|
||||
} from "@/types/api/admin-draws";
|
||||
|
||||
@@ -47,3 +51,33 @@ export async function postAdminPublishResultBatch(
|
||||
`${A}/draws/${drawId}/result-batches/${batchId}/publish`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function postAdminGenerateDrawPlan(): Promise<AdminDrawPlanGenerateResponse> {
|
||||
return adminRequest.post<AdminDrawPlanGenerateResponse>(`${A}/draws/generate-plan`);
|
||||
}
|
||||
|
||||
export async function postAdminManualCloseDraw(drawId: number): Promise<AdminDrawActionResponse> {
|
||||
return adminRequest.post<AdminDrawActionResponse>(`${A}/draws/${drawId}/manual-close`);
|
||||
}
|
||||
|
||||
export async function postAdminCancelDraw(drawId: number): Promise<AdminDrawActionResponse> {
|
||||
return adminRequest.post<AdminDrawActionResponse>(`${A}/draws/${drawId}/cancel`);
|
||||
}
|
||||
|
||||
export async function postAdminRunDrawRng(drawId: number): Promise<AdminDrawBatchCreateResponse> {
|
||||
return adminRequest.post<AdminDrawBatchCreateResponse>(`${A}/draws/${drawId}/rng`);
|
||||
}
|
||||
|
||||
export async function postAdminCreateManualResultBatch(
|
||||
drawId: number,
|
||||
payload: AdminDrawManualBatchPayload,
|
||||
): Promise<AdminDrawBatchCreateResponse> {
|
||||
return adminRequest.post<AdminDrawBatchCreateResponse>(
|
||||
`${A}/draws/${drawId}/result-batches`,
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
export async function postAdminReopenDraw(drawId: number): Promise<AdminDrawActionResponse> {
|
||||
return adminRequest.post<AdminDrawActionResponse>(`${A}/draws/${drawId}/reopen`);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { adminRequest } from "@/lib/admin-http";
|
||||
import { adminHttp, adminRequest } from "@/lib/admin-http";
|
||||
import { withAdminAuthHeader } from "@/lib/admin-auth";
|
||||
import { withAdminLocaleHeaders } from "@/lib/admin-locale";
|
||||
|
||||
import { API_V1_PREFIX } from "./paths";
|
||||
|
||||
@@ -6,6 +8,8 @@ import type {
|
||||
AdminSettlementBatchDetailsData,
|
||||
AdminSettlementBatchListData,
|
||||
AdminSettlementBatchShowData,
|
||||
AdminSettlementRunResponse,
|
||||
AdminSettlementWorkflowResponse,
|
||||
} from "@/types/api/admin-settlement";
|
||||
|
||||
const A = `${API_V1_PREFIX}/admin`;
|
||||
@@ -41,3 +45,42 @@ export async function getAdminSettlementBatchDetails(
|
||||
{ params: q },
|
||||
);
|
||||
}
|
||||
|
||||
export async function postAdminRunDrawSettlement(drawId: number): Promise<AdminSettlementRunResponse> {
|
||||
return adminRequest.post<AdminSettlementRunResponse>(`${A}/draws/${drawId}/settlement/run`);
|
||||
}
|
||||
|
||||
export async function postAdminApproveSettlementBatch(
|
||||
batchId: number,
|
||||
remark?: string,
|
||||
): Promise<AdminSettlementWorkflowResponse> {
|
||||
return adminRequest.post<AdminSettlementWorkflowResponse>(
|
||||
`${A}/settlement-batches/${batchId}/approve`,
|
||||
{ remark },
|
||||
);
|
||||
}
|
||||
|
||||
export async function postAdminRejectSettlementBatch(
|
||||
batchId: number,
|
||||
remark?: string,
|
||||
): Promise<AdminSettlementWorkflowResponse> {
|
||||
return adminRequest.post<AdminSettlementWorkflowResponse>(
|
||||
`${A}/settlement-batches/${batchId}/reject`,
|
||||
{ remark },
|
||||
);
|
||||
}
|
||||
|
||||
export async function postAdminPayoutSettlementBatch(batchId: number): Promise<AdminSettlementWorkflowResponse> {
|
||||
return adminRequest.post<AdminSettlementWorkflowResponse>(`${A}/settlement-batches/${batchId}/payout`);
|
||||
}
|
||||
|
||||
export async function downloadAdminSettlementBatchExport(batchId: number): Promise<Blob> {
|
||||
const res = await adminHttp.request<Blob>(
|
||||
withAdminAuthHeader(withAdminLocaleHeaders({
|
||||
url: `${A}/settlement-batches/${batchId}/export`,
|
||||
method: "GET",
|
||||
responseType: "blob",
|
||||
})),
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user