0 或负数"到账余额"未校验:结果渲染 Infinity,负余额把负成本排成"最便宜" - #3
Open
roy-tong wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
版本:commit
17df24e(2026-09-09)script.js:213的recharge_amount / balance在 balance=0 时产生 Infinity(渲染 "Infinity CNY / Infinity USD"),balance<0 时产生负成本——且结果按升序排序,负成本条目会被排到第 1 名,直接污染比价排名(本工具的核心输出)。主计算链与汇率换算本身正确(实测 $3/$15 × 1M+1M = $18 ✓)。复现(A 级,跑其真实 script.js + jsdom):余额 0 → Infinity;余额 -100 → 负成本且升至首位。
最小修复:提交前校验
balance > 0与recharge_amount > 0,非法输入禁用计算并给出提示。补丁方向已验证。