fix(usage): make last-24-hours preset a true rolling window#4034
Open
feitianbubu wants to merge 1 commit into
Open
fix(usage): make last-24-hours preset a true rolling window#4034feitianbubu wants to merge 1 commit into
feitianbubu wants to merge 1 commit into
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.
「近24小时」目前实际查的是「昨天+今天」两个自然日,最长能覆盖到约 48 小时的记录。
接近24点时查看,数字比真实的 24 小时消费虚高近一倍;一过0点,昨天整天的数据瞬间掉出窗口,数字跳崖。我就是在 23:59 看到 800 多、零点后变 300 多才发现的。
影响面: 用户使用记录页、管理端使用记录页、管理端仪表盘三个页面的默认值*都是
近24小时,打开页面看到的总消费/总请求/图表默认的记录和显示语义不一致, 容易误导用户。
原因是预设算完 now-24h 后把时间部分丢了,只传日期到后端,后端按整数天解析。
改法:
YYYY-MM-DD整天语义完全不变的基础上,接受 RFC3339标准时间;自选日期行为不变utils/dateRange.ts修复前: 近24小时, 会显示超过24小时的记录, 实际是今天,昨天完整记录

修复后: 显示准确的近24小时记录
