fix(1895): api/points/index.ts - apply TS/Lint fixes (ThunderboltOutlined/actions/typed/no-unused)

This commit is contained in:
2026-09-15 09:32:16 +08:00
parent b842d54c1d
commit 141a70edfe
+5 -5
View File
@@ -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<PointsTransaction & { balance_after?: number }>
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<Poi
if (POINTS_API_MOCK) {
const pkg = MOCK_PACKAGES.packages.find((p) => 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<string, number>)?.[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(
() =>