修复bug

This commit is contained in:
hoteas 2022-08-08 02:37:15 +08:00
parent 7419e03d67
commit c420e23edb
4 changed files with 37 additions and 6 deletions

View File

@ -23,7 +23,6 @@ type Application struct {
MakeCodeRouter map[string]*code.MakeCode MakeCodeRouter map[string]*code.MakeCode
MethodRouter MethodRouter
Router Router
ContextBase
Error Error
Log *logrus.Logger Log *logrus.Logger
WebConnectLog *logrus.Logger WebConnectLog *logrus.Logger

View File

@ -803,6 +803,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
continue continue
} }
if v["list"] != false { if v["list"] != false {
if v.GetString("link") != "" && if v.GetString("link") != "" &&
@ -881,6 +882,38 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
} }
if v.GetString("type") == "text" {
reqValue := req.FormValue(v.GetString("name"))
if reqValue != "" {
data[table+"."+v.GetString("name")+"[~]"] = reqValue
}
}
if v.GetString("type") == "unixtime" {
//fmt.Println(req.Form["daterange"])
if len(req.Form[v.GetString("name")]) == 1 {
daterange[table+"."+v.GetString("name")+"[>]"] = req.FormValue("daterange")
} else if len(req.Form[v.GetString("name")]) == 2 {
daterange[table+"."+v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
}
}
if v.GetString("type") == "time" {
//fmt.Println(req.Form["daterange"])
if len(req.Form[v.GetString("name")]) == 1 {
t := time.Unix(ObjToCeilInt64(req.FormValue(v.GetString("name"))), 0).Format("2006-01-02 15:04:05")
daterange[table+"."+v.GetString("name")+"[>]"] = t
} else if len(req.Form[v.GetString("name")]) == 2 {
t1 := time.Unix(ObjToCeilInt64(req.Form[v.GetString("name")][0]), 0).Format("2006-01-02 15:04:05")
t2 := time.Unix(ObjToCeilInt64(req.Form[v.GetString("name")][1]), 0).Format("2006-01-02 15:04:05")
daterange[table+"."+v.GetString("name")+"[<>]"] = Slice{t1, t2}
}
}
if keywordStr != "" { if keywordStr != "" {
if v.GetString("type") == "text" { if v.GetString("type") == "text" {
keyword[table+"."+v.GetString("name")+"[~]"] = keywordStr keyword[table+"."+v.GetString("name")+"[~]"] = keywordStr
@ -954,7 +987,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
if v.GetString("type") == "unixtime" { if v.GetString("type") == "unixtime" {
//fmt.Println(req.Form["daterange"]) //fmt.Println(req.Form["daterange"])
if len(req.Form["daterange"]) == 1 { if len(req.Form["daterange"]) == 1 {
daterange[table+"."+v.GetString("name")+"[<]"] = req.FormValue("daterange") daterange[table+"."+v.GetString("name")+"[>]"] = req.FormValue("daterange")
} else if len(req.Form["daterange"]) == 2 { } else if len(req.Form["daterange"]) == 2 {
daterange[table+"."+v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"]) daterange[table+"."+v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
@ -966,7 +999,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
if len(req.Form["daterange"]) == 1 { if len(req.Form["daterange"]) == 1 {
t := time.Unix(ObjToCeilInt64(req.FormValue("daterange")), 0).Format("2006-01-02 15:04:05") t := time.Unix(ObjToCeilInt64(req.FormValue("daterange")), 0).Format("2006-01-02 15:04:05")
daterange[table+"."+v.GetString("name")+"[<]"] = t daterange[table+"."+v.GetString("name")+"[>]"] = t
} else if len(req.Form["daterange"]) == 2 { } else if len(req.Form["daterange"]) == 2 {
t1 := time.Unix(ObjToCeilInt64(req.Form["daterange"][0]), 0).Format("2006-01-02 15:04:05") t1 := time.Unix(ObjToCeilInt64(req.Form["daterange"][0]), 0).Format("2006-01-02 15:04:05")

View File

@ -1,7 +1,6 @@
package hotime package hotime
import ( import (
. "code.hoteas.com/golang/hotime/cache"
. "code.hoteas.com/golang/hotime/common" . "code.hoteas.com/golang/hotime/common"
. "code.hoteas.com/golang/hotime/db" . "code.hoteas.com/golang/hotime/db"
"encoding/json" "encoding/json"
@ -19,7 +18,7 @@ type Context struct {
Db *HoTimeDB Db *HoTimeDB
RespData Map RespData Map
RespFunc func() RespFunc func()
CacheIns //CacheIns
SessionIns SessionIns
DataSize int DataSize int
HandlerStr string //复写请求url HandlerStr string //复写请求url

View File

@ -34,7 +34,7 @@ type HoTimeDB struct {
} }
type HotimeDBBuilder struct { type HotimeDBBuilder struct {
*HoTimeDB HoTimeDB *HoTimeDB
table string table string
selects []interface{} selects []interface{}
join Slice join Slice