fix(pricing): 统一将计价计算从向下取整改为四舍五入
统一修复所有计价相关模块的取整逻辑:将Lua计价函数中的直接返回改为四舍五入取整,同时将前后端代码中的Math.floor替换为Math.round,确保全链路的票价计算采用标准四舍五入规则,避免出现不合理的定价偏差。
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user