refactor(app): 优化 URL 处理和 JSON 解析逻辑
- 更新应用程序处理程序中的 URL 赋值逻辑,确保静态文件使用原始路径 - 修改缓存数据库的 JSON 解析方法,使用 JsonToObj 函数替代 json.Unmarshal,提升代码可读性和性能 - 在 Map 和 Slice 类型中新增获取四舍五入浮点数的方法,增强数据处理能力 - 在 Obj 类型中添加四舍五入功能,支持精度控制 - 改进数据库查询结果的处理逻辑,确保数据类型的准确性和一致性 - 优化日志格式设置,增强日志信息的可读性
This commit is contained in:
+3
-3
@@ -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] != "" {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user