修复bug
This commit is contained in:
parent
3810ba6c0b
commit
72c086d726
@ -525,7 +525,7 @@ func (that *MakeCode) Info(table string, userData Map, db *db.HoTimeDB) (string,
|
||||
data["index[~]"] = "," + ruleData.GetString(v.GetString("link")) + ","
|
||||
|
||||
} else {
|
||||
idMap := db.Select(v.GetString("link"), "id", Map{"index[~]": ruleData.GetCeilInt(v.GetString("link"))})
|
||||
idMap := db.Select(v.GetString("link"), "id", Map{"index[~]": "," + ruleData.GetString(v.GetString("link")) + ","})
|
||||
ids := Slice{ruleData.GetCeilInt(v.GetString("link"))}
|
||||
for _, v := range idMap {
|
||||
ids = append(ids, v.GetCeilInt("id"))
|
||||
@ -643,6 +643,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
||||
daterange := Map{}
|
||||
sort := Map{}
|
||||
var ruleData Map
|
||||
hasUser := false
|
||||
|
||||
keywordStr := req.FormValue("keyword")
|
||||
for _, v := range that.TableColumns[table] {
|
||||
@ -663,6 +664,9 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
||||
leftJoin["[>]"+v.GetString("link")] =
|
||||
table + "." + v.GetString("name") + "=" +
|
||||
v.GetString("link") + ".id"
|
||||
if v.GetString("link") == "admin" {
|
||||
hasUser = true
|
||||
}
|
||||
|
||||
} else {
|
||||
reStr += table + "." + v.GetString("name") + ","
|
||||
@ -689,7 +693,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
||||
data[table+".index[~]"] = "," + ruleData.GetString(v.GetString("link")) + ","
|
||||
|
||||
} else {
|
||||
idMap := db.Select(v.GetString("link"), "id", Map{"index[~]": ruleData.GetCeilInt(v.GetString("link"))})
|
||||
idMap := db.Select(v.GetString("link"), "id", Map{"index[~]": "," + ruleData.GetString(v.GetString("link")) + ","})
|
||||
ids := Slice{ruleData.GetCeilInt(v.GetString("link"))}
|
||||
for _, v := range idMap {
|
||||
ids = append(ids, v.GetCeilInt("id"))
|
||||
@ -813,6 +817,12 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
||||
where = data
|
||||
}
|
||||
|
||||
if len(where) == 0 && hasUser {
|
||||
|
||||
where["admin.id"] = userData["id"]
|
||||
|
||||
}
|
||||
|
||||
if len(sort) != 0 {
|
||||
for k, v := range sort {
|
||||
where[k] = v
|
||||
|
BIN
example/bzyy.exe
BIN
example/bzyy.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user