refactor(app): 优化 URL 处理和 JSON 解析逻辑

- 更新应用程序处理程序中的 URL 赋值逻辑,确保静态文件使用原始路径
- 修改缓存数据库的 JSON 解析方法,使用 JsonToObj 函数替代 json.Unmarshal,提升代码可读性和性能
- 在 Map 和 Slice 类型中新增获取四舍五入浮点数的方法,增强数据处理能力
- 在 Obj 类型中添加四舍五入功能,支持精度控制
- 改进数据库查询结果的处理逻辑,确保数据类型的准确性和一致性
- 优化日志格式设置,增强日志信息的可读性
This commit is contained in:
2026-03-10 23:44:41 +08:00
parent bf9bb5807d
commit fab7931d3c
15 changed files with 4116 additions and 147 deletions
+3 -3
View File
@@ -411,8 +411,8 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
return
}
//url赋值
path := that.Config.GetString("tpt") + tempHandlerStr
//url赋值,静态文件必须使用原始路径(Linux文件系统大小写敏感)
path := that.Config.GetString("tpt") + context.HandlerStr
//判断是否为默认
if path[len(path)-1] == '/' {
@@ -448,7 +448,7 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
t := strings.LastIndex(path, ".")
if t != -1 {
tt := path[t:]
tt := strings.ToLower(path[t:])
if MimeMaps[tt] != "" {