/* eslint-disable */ import request from "@workspace/ui/lib/request"; /** * 创建抽奖活动 * POST /v1/admin/lottery/activities * @param body - 创建抽奖活动请求参数 * @param options - 可选的请求配置 * @returns 创建结果 */ export async function createLotteryActivity( body: API.CreateLotteryActivityRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/activities`, { method: "POST", headers: { "Content-Type": "application/json", }, data: body, ...(options || {}), } ); } /** * 更新抽奖活动 * PUT /v1/admin/lottery/activities * @param body - 更新抽奖活动请求参数 * @param options - 可选的请求配置 * @returns 更新结果 */ export async function updateLotteryActivity( body: API.UpdateLotteryActivityRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/activities`, { method: "PUT", headers: { "Content-Type": "application/json", }, data: body, ...(options || {}), } ); } /** * 获取抽奖活动分页列表 * GET /v1/admin/lottery/activities * @param params - 分页及筛选参数 * @param options - 可选的请求配置 * @returns 抽奖活动列表及总数 */ export async function getLotteryActivityList( params: API.GetLotteryActivityListParams, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/activities`, { method: "GET", params: { ...params, }, ...(options || {}), } ); } /** * 获取抽奖活动详情 * GET /v1/admin/lottery/activities/detail * @param params - 活动 ID 参数 * @param options - 可选的请求配置 * @returns 抽奖活动详情 */ export async function getLotteryActivityDetail( params: API.GetLotteryActivityDetailParams, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/activities/detail`, { method: "GET", params: { ...params, }, ...(options || {}), } ); } /** * 上架抽奖活动(draft → running) * POST /v1/admin/lottery/activities/publish * @param body - 上架活动请求参数 * @param options - 可选的请求配置 * @returns 上架结果 */ export async function publishLotteryActivity( body: API.PublishLotteryActivityRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/activities/publish`, { method: "POST", headers: { "Content-Type": "application/json", }, data: body, ...(options || {}), } ); } /** * 暂停抽奖活动 * POST /v1/admin/lottery/activities/pause * @param body - 暂停活动请求参数 * @param options - 可选的请求配置 * @returns 暂停结果 */ export async function pauseLotteryActivity( body: API.PauseLotteryActivityRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/activities/pause`, { method: "POST", headers: { "Content-Type": "application/json", }, data: body, ...(options || {}), } ); } /** * 更新抽奖活动规则(eligibility + chance_sources) * PUT /v1/admin/lottery/activities/rules * @param body - 更新活动规则请求参数 * @param options - 可选的请求配置 * @returns 更新结果 */ export async function updateLotteryActivityRules( body: API.UpdateLotteryActivityRulesRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/activities/rules`, { method: "PUT", headers: { "Content-Type": "application/json", }, data: body, ...(options || {}), } ); } /** * 创建抽奖奖品 * POST /v1/admin/lottery/prizes * @param body - 创建奖品请求参数 * @param options - 可选的请求配置 * @returns 创建结果 */ export async function createLotteryPrize( body: API.CreateLotteryPrizeRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/prizes`, { method: "POST", headers: { "Content-Type": "application/json", }, data: body, ...(options || {}), } ); } /** * 更新抽奖奖品 * PUT /v1/admin/lottery/prizes * @param body - 更新奖品请求参数 * @param options - 可选的请求配置 * @returns 更新结果 */ export async function updateLotteryPrize( body: API.UpdateLotteryPrizeRequest, options?: { [key: string]: any } ) { const { id, ...rest } = body; return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/prizes/${id}`, { method: "PUT", headers: { "Content-Type": "application/json", }, data: rest, ...(options || {}), } ); } /** * 删除抽奖奖品 * DELETE /v1/admin/lottery/prizes * @param body - 删除奖品请求参数 * @param options - 可选的请求配置 * @returns 删除结果 */ export async function deleteLotteryPrize( body: API.DeleteLotteryPrizeRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/prizes/${body.id}`, { method: "DELETE", ...(options || {}), } ); } /** * 获取抽奖奖品列表 * GET /v1/admin/lottery/prizes * @param params - 活动 ID 筛选参数 * @param options - 可选的请求配置 * @returns 奖品列表 */ export async function getLotteryPrizeList( params: API.GetLotteryPrizeListParams, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/prizes`, { method: "GET", params: { ...params, }, ...(options || {}), } ); } /** * 手动发放抽奖次数 * POST /v1/admin/lottery/chances/grant * @param body - 发放次数请求参数(source_ref 为幂等键) * @param options - 可选的请求配置 * @returns 发放结果 */ export async function grantLotteryChances( body: API.GrantLotteryChancesRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/chances/grant`, { method: "POST", headers: { "Content-Type": "application/json", }, data: body, ...(options || {}), } ); } /** * 领奖工单列表(Stage 2 人工奖) * GET /v1/admin/lottery/claims */ export async function getLotteryClaimList( params: API.GetLotteryClaimListParams, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/claims`, { method: "GET", params: { ...params }, ...(options || {}), } ); } /** * 领奖工单统计(各类型 reviewing/paying + 逾期) * GET /v1/admin/lottery/claims/summary */ export async function getLotteryClaimsSummary(options?: { [key: string]: any; }) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/claims/summary`, { method: "GET", ...(options || {}), } ); } /** * 审核通过领奖工单(reviewing → paying) * POST /v1/admin/lottery/claims/approve */ export async function approveLotteryClaim( body: API.ApproveLotteryClaimRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/claims/approve`, { method: "POST", headers: { "Content-Type": "application/json" }, data: body, ...(options || {}), } ); } /** * 驳回领奖工单(reviewing/paying → rejected,reason 必填) * POST /v1/admin/lottery/claims/reject */ export async function rejectLotteryClaim( body: API.RejectLotteryClaimRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/claims/reject`, { method: "POST", headers: { "Content-Type": "application/json" }, data: body, ...(options || {}), } ); } /** * 标记已发放(paying → paid),填 tx_hash / delivery_ref * POST /v1/admin/lottery/claims/mark-paid */ export async function markPaidLotteryClaim( body: API.MarkPaidLotteryClaimRequest, options?: { [key: string]: any } ) { return request( `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/lottery/claims/mark-paid`, { method: "POST", headers: { "Content-Type": "application/json" }, data: body, ...(options || {}), } ); }