LoadToolPricesFromJSONString replaces the complete operator price map. Invalid legacy entries are ignored individually so valid sibling overrides survive, while missing built-in keys continue to use hardcoded fallbacks.
(value string)
| 135 | // Invalid legacy entries are ignored individually so valid sibling overrides |
| 136 | // survive, while missing built-in keys continue to use hardcoded fallbacks. |
| 137 | func LoadToolPricesFromJSONString(value string) { |
| 138 | prices, err := decodeToolPricesJSON(value, true) |
| 139 | if err != nil { |
| 140 | common.SysError("加载工具价格失败,将使用硬编码兜底: " + err.Error()) |
| 141 | prices = make(map[string]float64) |
| 142 | } |
| 143 | toolPriceSetting.Prices = prices |
| 144 | RebuildToolPriceIndex() |
| 145 | } |
| 146 | |
| 147 | // RebuildToolPriceIndex rebuilds the lookup index from the current config. |
| 148 | // Called on init and after config updates. Not on the billing hot path. |