fix(充值商品): 移除已退役的 bonus_points / duration_days 入参

- 后台 upsert 请求 DTO 与 SpacetimeDB procedure 入参移除 bonus_points、duration_days(评审第 19 条)
- 充点商品固定「¥1 = 10 泥点、无首充赠送」,module 落库统一写 0,保留退役列兼容存量 schema
- 删除 InvalidRechargeProductFields 校验与错误文案;api-server / spacetime-client 同步收敛
- admin-web 表单移除「首充赠送」输入与状态,列表改为只展示基础泥点
- scripts/admin-web-fake-api.mjs 假数据同步 bonusPoints: 0
This commit is contained in:
2026-10-04 21:33:39 +08:00
parent dcaab089cc
commit 284b656b59
12 changed files with 21 additions and 77 deletions
-2
View File
@@ -680,8 +680,6 @@ export interface AdminUpsertProfileRechargeProductRequest {
priceCents: number;
kind: ProfileRechargeProductKind;
pointsAmount: number;
bonusPoints: number;
durationDays: number;
badgeLabel?: string | null;
description?: string | null;
enabled: boolean;
@@ -19,11 +19,7 @@ import {
} from '../api/adminApiClient';
import type { ProfileRechargeProductConfigAdminResponse } from '../api/adminApiTypes';
import { useAdminWriteConfirm } from '../components/useAdminWriteConfirm';
import {
handlePageError,
parseNonNegativeIntegerOrZero,
parsePositiveIntegerOrZero,
} from './pageUtils';
import { handlePageError, parsePositiveIntegerOrZero } from './pageUtils';
interface AdminRechargeProductPageProps {
token: string;
@@ -38,7 +34,6 @@ const DEFAULT_RECHARGE_PRODUCT_FORM = {
title: '60泥点',
priceCents: '600',
pointsAmount: '60',
bonusPoints: '0',
badgeLabel: '',
description: '60泥点',
enabled: true,
@@ -49,7 +44,7 @@ const DEFAULT_RECHARGE_PRODUCT_FORM = {
* 泥点充值商品。
*
* 会员档位已迁到独立的「会员档位」页(`profile_membership_plan`),本页只维护充点商品。
* 新方案固定「¥1 = 10 泥点、无任何首充赠送」,首充赠送字段保留能力但默认 0。
* 新方案固定「¥1 = 10 泥点、无首充赠送」,因此表单不再提供首充赠送 / 天数等已退役字段。
*/
export function AdminRechargeProductPage({
token,
@@ -70,9 +65,6 @@ export function AdminRechargeProductPage({
const [pointsAmount, setPointsAmount] = useState(
DEFAULT_RECHARGE_PRODUCT_FORM.pointsAmount,
);
const [bonusPoints, setBonusPoints] = useState(
DEFAULT_RECHARGE_PRODUCT_FORM.bonusPoints,
);
const [badgeLabel, setBadgeLabel] = useState(
DEFAULT_RECHARGE_PRODUCT_FORM.badgeLabel,
);
@@ -141,8 +133,6 @@ export function AdminRechargeProductPage({
priceCents: parsePositiveIntegerOrZero(priceCents),
kind: 'points',
pointsAmount: parsePositiveIntegerOrZero(pointsAmount),
bonusPoints: parseNonNegativeIntegerOrZero(bonusPoints),
durationDays: 0,
badgeLabel: badgeLabel.trim(),
description: description.trim(),
enabled,
@@ -172,7 +162,6 @@ export function AdminRechargeProductPage({
setTitle(entry.title);
setPriceCents(String(entry.priceCents));
setPointsAmount(String(entry.pointsAmount));
setBonusPoints(String(entry.bonusPoints));
setBadgeLabel(entry.badgeLabel);
setDescription(entry.description);
setEnabled(entry.enabled);
@@ -184,7 +173,6 @@ export function AdminRechargeProductPage({
setTitle(DEFAULT_RECHARGE_PRODUCT_FORM.title);
setPriceCents(DEFAULT_RECHARGE_PRODUCT_FORM.priceCents);
setPointsAmount(DEFAULT_RECHARGE_PRODUCT_FORM.pointsAmount);
setBonusPoints(DEFAULT_RECHARGE_PRODUCT_FORM.bonusPoints);
setBadgeLabel(DEFAULT_RECHARGE_PRODUCT_FORM.badgeLabel);
setDescription(DEFAULT_RECHARGE_PRODUCT_FORM.description);
setEnabled(DEFAULT_RECHARGE_PRODUCT_FORM.enabled);
@@ -248,26 +236,15 @@ export function AdminRechargeProductPage({
</AdminField>
</AdminFormRow>
<AdminFormRow>
<AdminField label="基础泥点">
<input
min={1}
step={1}
type="number"
value={pointsAmount}
onChange={(event) => setPointsAmount(event.target.value)}
/>
</AdminField>
<AdminField label="首充赠送">
<input
min={0}
step={1}
type="number"
value={bonusPoints}
onChange={(event) => setBonusPoints(event.target.value)}
/>
</AdminField>
</AdminFormRow>
<AdminField label="基础泥点">
<input
min={1}
step={1}
type="number"
value={pointsAmount}
onChange={(event) => setPointsAmount(event.target.value)}
/>
</AdminField>
<AdminFormRow>
<AdminField label="角标">
@@ -397,7 +374,7 @@ function sortProducts(entries: ProfileRechargeProductConfigAdminResponse[]) {
function formatProductContent(
entry: ProfileRechargeProductConfigAdminResponse,
) {
return `${entry.pointsAmount} + ${entry.bonusPoints} 泥点`;
return `${entry.pointsAmount} 泥点`;
}
function formatPrice(priceCents: number) {