From 4d901eec65fe1c8ac911f60679e4f00a622f52b5 Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Tue, 6 Oct 2026 02:21:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=EF=BC=9A=E6=92=A4=E5=9B=9E?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E9=A1=B5=E4=BB=B7=E6=A0=BC=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E4=BA=8C=E6=AC=A1=E5=9B=9E=E9=80=80=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=93=91=E6=B8=B2=E6=9F=93=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AdminGameDistributionReviewPage.tsx:删除新增的 resolveFrozenPriceMudPoints,恢复「价格不在这里二次叠加」的单一实现 (服务端 version_detail_payload 已把版本冻结价优先、缺字段按 0 归一写进 game.priceMudPoints,M4 已明确客户端不得复刻该语义) - AdminGameDistributionReviewPage.test.tsx:详情价格用例改为直接编码「客户端保持哑渲染」约束 - 服务端下发 game.priceMudPoints = 30 → 详情显示「30 泥点」(列表侧由价格列用例覆盖同一字段) - 对抗用例:冻结资料故意传 frozenMetadata.priceMudPoints = 999,断言仍显示 30 且不出现「999 泥点」 --- .../AdminGameDistributionReviewPage.test.tsx | 13 ++++++++----- .../pages/AdminGameDistributionReviewPage.tsx | 18 ++---------------- 2 files changed, 10 insertions(+), 21 deletions(-) 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`;