diff --git a/apps/web/src/api/points/index.ts b/apps/web/src/api/points/index.ts index 1ed8535d8..21d92b3ff 100644 --- a/apps/web/src/api/points/index.ts +++ b/apps/web/src/api/points/index.ts @@ -236,16 +236,16 @@ function genMockTransactions(): PointsTransactionsResponse { // Rebuild balance_after going forward let running = 50 + 0 // after registration gift for (let i = items.length - 1; i >= 0; i--) { - const it = items[i] + const it = items[i] as PointsTransaction & { balance_after?: number } if (it.source === "task_reward" && it.description.includes("注册")) running = 50 } running = 50 - const fwd = [...items].reverse() + const fwd = [...items].reverse() as Array for (const it of fwd) { running += it.signed_amount it.balance_after = running } - return { items: fwd, total: fwd.length, page: 1, page_size: 20 } + return { items: fwd, total: fwd.length, page: 1, page_size: 20 } as PointsTransactionsResponse } // ==================== 真实 API ==================== @@ -284,8 +284,8 @@ export async function createPointsOrder(req: PointsRechargeRequest): Promise p.id === req.package_id) const mt = MOCK_PACKAGES.user_member_type - const discountKey = `discounted_price_for_${mt}` as const - const price = (pkg as PointsPackage & Record)?.[discountKey] ?? pkg?.price ?? 0 + const discountKey = `discounted_price_for_${mt}` as keyof PointsPackage + const price = (pkg?.[discountKey] as number | undefined) ?? pkg?.price ?? 0 return new Promise((r) => setTimeout( () =>