diff --git a/apps/admin/dist.zip b/apps/admin/dist.zip index f6bac1c..1d25311 100644 Binary files a/apps/admin/dist.zip and b/apps/admin/dist.zip differ diff --git a/apps/admin/public/assets/locales/zh-CN/lottery.json b/apps/admin/public/assets/locales/zh-CN/lottery.json index 02117f4..5a4f62b 100644 --- a/apps/admin/public/assets/locales/zh-CN/lottery.json +++ b/apps/admin/public/assets/locales/zh-CN/lottery.json @@ -119,7 +119,7 @@ "type": "奖品类型", "typeCommission": "佣金", "typeCoupon": "优惠券", - "typeCrypto": "加密货币", + "typeCrypto": "虚拟货币", "typeManualOther": "人工发放(其他)", "typeNone": "谢谢参与", "typePhysical": "实物奖品", diff --git a/apps/admin/src/sections/lottery/prize-form.tsx b/apps/admin/src/sections/lottery/prize-form.tsx index 0eb487d..b1511d6 100644 --- a/apps/admin/src/sections/lottery/prize-form.tsx +++ b/apps/admin/src/sections/lottery/prize-form.tsx @@ -59,43 +59,21 @@ const PRIZE_TYPE_OPTIONS: { labelDefault: "VPN Duration", }, { - value: "commission", - labelKey: "prize.typeCommission", - labelDefault: "Commission", + value: "crypto", + labelKey: "prize.typeCrypto", + labelDefault: "Crypto", }, { value: "none", labelKey: "prize.typeNone", labelDefault: "No Prize (Thanks)", }, - { - value: "crypto", - labelKey: "prize.typeCrypto", - labelDefault: "Crypto", - }, - { - value: "physical", - labelKey: "prize.typePhysical", - labelDefault: "Physical", - }, - { - value: "manual_other", - labelKey: "prize.typeManualOther", - labelDefault: "Manual (Other)", - }, ]; const getPrizeSchema = (t: TranslateFn) => z .object({ - type: z.enum([ - "vpn_duration", - "commission", - "none", - "crypto", - "physical", - "manual_other", - ]), + type: z.enum(["vpn_duration", "crypto", "none"]), name: z.string().min(1, t("prize.nameRequired", "Name is required")), icon_url: z .string() @@ -134,24 +112,6 @@ const getPrizeSchema = (t: TranslateFn) => ) ); } - if (data.type === "commission") { - const yuan = data.amount_yuan ?? 0; - const cents = yuan * CENTS_PER_YUAN; - if (yuan <= 0) { - issue( - "amount_yuan", - t("prize.amountRequired", "Amount must be greater than 0") - ); - } else if (Math.abs(Math.round(cents) - cents) > 1e-6) { - issue( - "amount_yuan", - t( - "prize.amountPrecision", - "Amount supports at most 2 decimal places" - ) - ); - } - } if (data.type === "crypto") { if (!data.crypto_amount?.trim()) { issue( @@ -256,11 +216,6 @@ function toConfig(values: PrizeFormValues): Record { } return config; } - if (values.type === "commission") { - return { - amount_cents: Math.round((values.amount_yuan ?? 0) * CENTS_PER_YUAN), - }; - } if (values.type === "crypto") { return withTtl({ amount: values.crypto_amount?.trim() ?? "", @@ -271,13 +226,6 @@ function toConfig(values: PrizeFormValues): Record { .filter(Boolean), }); } - if (values.type === "physical" || values.type === "manual_other") { - const config: Record = {}; - if (values.sku_name?.trim()) { - config.sku_name = values.sku_name.trim(); - } - return withTtl(config); - } return {}; } @@ -548,23 +496,6 @@ export default function PrizeForm({ )} /> )} - {type === "commission" && - renderInput( - "amount_yuan", - t("prize.amountYuan", "Commission Amount (CNY)"), - { - type: "number", - min: 0, - step: 0.01, - placeholder: "0.00", - prefix: "¥", - suffix: t("prize.yuanSuffix", "CNY"), - }, - t( - "prize.amountUnitHint", - "Entered in CNY (yuan), stored as cents; up to 2 decimal places" - ) - )} {type === "none" && (

{t( @@ -601,20 +532,7 @@ export default function PrizeForm({ )} )} - {(type === "physical" || type === "manual_other") && - renderInput( - "sku_name", - t("prize.skuName", "Item name (optional)"), - { - placeholder: t( - "prize.skuNamePlaceholder", - "e.g. Limited T-shirt" - ), - } - )} - {(type === "crypto" || - type === "physical" || - type === "manual_other") && ( + {type === "crypto" && ( <> {renderInput( "claim_ttl_hours",