diff --git a/apps/admin-web/src/pages/AdminGameDistributionReviewPage.test.tsx b/apps/admin-web/src/pages/AdminGameDistributionReviewPage.test.tsx index 07299c9ab..b5f122a2b 100644 --- a/apps/admin-web/src/pages/AdminGameDistributionReviewPage.test.tsx +++ b/apps/admin-web/src/pages/AdminGameDistributionReviewPage.test.tsx @@ -472,14 +472,16 @@ test('试玩加载超过上限后给出超时说明与重建会话入口', async } }); -test('详情价格取版本冻结价,不回退游戏行当前价', async () => { +test('详情价格只渲染服务端下发的 priceMudPoints,不按冻结资料二次取价', async () => { vi.mocked(getAdminGameDistributionVersion).mockResolvedValue({ - // 游戏行现价与待审版本冻结价刻意取不同值:两者相同的话,无论实现取哪个字段 - // 用例都会绿,无法证明审核页展示的是这一版审核通过后真正生效的价格。 - game: { ...detailResponse.game, priceMudPoints: 999 }, + // 服务端 `version_detail_payload` 已把「待审版本冻结价优先、缺字段按 0」归一写进 + // `game.priceMudPoints`,审核页只渲染这个字段。 + game: { ...detailResponse.game, priceMudPoints: 30 }, version: { ...detailResponse.version, - frozenMetadata: { title: '测试游戏', priceMudPoints: 30 }, + // 对抗用例:冻结资料里的价格与服务端归一结果故意不同(999 ≠ 30)。客户端若自行 + // 复刻「冻结价优先」,就会显示 999 —— 这里必须仍然是服务端字段的 30。 + frozenMetadata: { title: '测试游戏', priceMudPoints: 999 }, }, }); @@ -496,6 +498,7 @@ test('详情价格取版本冻结价,不回退游戏行当前价', async () => expect(screen.getByText('价格')).toBeTruthy(); expect(screen.getByText('30 泥点')).toBeTruthy(); + expect(screen.queryByText('999 泥点')).toBeNull(); expect(screen.queryByText('免费')).toBeNull(); }); diff --git a/apps/admin-web/src/pages/AdminGameDistributionReviewPage.tsx b/apps/admin-web/src/pages/AdminGameDistributionReviewPage.tsx index 9410b369d..0fe3d3118 100644 --- a/apps/admin-web/src/pages/AdminGameDistributionReviewPage.tsx +++ b/apps/admin-web/src/pages/AdminGameDistributionReviewPage.tsx @@ -100,25 +100,11 @@ function applyFrozenGameMetadata( typeof metadata.orientation === 'string' ? metadata.orientation : game.orientation, - // 价格口径与服务端 `version_detail_payload` 对齐,并在客户端再兜一次:审核页展示的是 - // 这一版审核通过后会生效的价格,所以版本冻结价优先;快照没冻结价才回落游戏行价, - // 两者都缺时交给 `formatPriceMudPoints` 按免费展示。 - priceMudPoints: resolveFrozenPriceMudPoints(game, metadata), + // 价格不在这里二次叠加:服务端 `version_detail_payload` 已按「版本冻结价优先、 + // 缺字段按 0」把结果归一写进 `game.priceMudPoints`,客户端直接沿用该字段。 }; } -/** 版本冻结价优先、游戏行价兜底;只取值,不改「`0` 表示免费」的展示口径。 */ -function resolveFrozenPriceMudPoints( - game: AdminGameDistributionGameDetail, - metadata: Record, -) { - const frozenPriceMudPoints = metadata.priceMudPoints; - return typeof frozenPriceMudPoints === 'number' && - Number.isFinite(frozenPriceMudPoints) - ? frozenPriceMudPoints - : game.priceMudPoints; -} - function formatBytes(value: number) { if (value >= 1024 * 1024) { return `${(value / (1024 * 1024)).toFixed(1)} MiB`;