From fd6b15bdaf6d1648d1ad2e788715d56009da2d3e Mon Sep 17 00:00:00 2001 From: hoteas Date: Tue, 30 Aug 2022 06:21:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=9F=A5=E8=AF=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/makecode.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/code/makecode.go b/code/makecode.go index 2779580..02de126 100644 --- a/code/makecode.go +++ b/code/makecode.go @@ -1016,7 +1016,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db * if keywordTableStr != "" { if keywordTableStr == v.GetString("name") { - keyword[table+"."+keywordTableStr+"[~]"] = keywordStr + data[table+"."+keywordTableStr+"[~]"] = keywordStr } if keywordTableStr == v.GetString("value") { @@ -1026,7 +1026,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db * childIds = append(childIds, cv.GetString("id")) } if len(childIds) != 0 { - keyword[v.GetString("link")+".id"] = childIds + data[v.GetString("link")+".id"] = childIds } } continue @@ -1143,17 +1143,12 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db * data[k] = v } } + if len(keyword) > 1 { - - if data["AND"] != nil { - and := data.GetMap("AND") - for k, v := range keyword { - and[k] = v - } - - //data = Map{"AND":Map{"OR": keyword} data, } + if data["OR"] != nil { + data = Map{"AND": data, "OR": keyword} } else { - data["AND"] = keyword + data["OR"] = keyword } }