fix(pricing): 统一将计价计算从向下取整改为四舍五入

统一修复所有计价相关模块的取整逻辑:将Lua计价函数中的直接返回改为四舍五入取整,同时将前后端代码中的Math.floor替换为Math.round,确保全链路的票价计算采用标准四舍五入规则,避免出现不合理的定价偏差。
This commit is contained in:
2026-07-09 23:40:08 +08:00
parent e07536e8c0
commit b3fdf36f84
6 changed files with 27 additions and 8 deletions
+1 -1
View File
@@ -1644,7 +1644,7 @@ local function computeCost(src, dst, trainType)
local u, du = heapPop()
if not u then break end
if du == dist[u] then
if u == dst then return du end
if u == dst then return math.floor(du + 0.5) end
for v, w in pairs(adj[u] or {}) do
local nd = du + (tonumber(w) or 0)
if nd < (dist[v] or math.huge) then