forked from golang/hotime
修复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")) + ","
|
data["index[~]"] = "," + ruleData.GetString(v.GetString("link")) + ","
|
||||||
|
|
||||||
} else {
|
} 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"))}
|
ids := Slice{ruleData.GetCeilInt(v.GetString("link"))}
|
||||||
for _, v := range idMap {
|
for _, v := range idMap {
|
||||||
ids = append(ids, v.GetCeilInt("id"))
|
ids = append(ids, v.GetCeilInt("id"))
|
||||||
@ -643,6 +643,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
|||||||
daterange := Map{}
|
daterange := Map{}
|
||||||
sort := Map{}
|
sort := Map{}
|
||||||
var ruleData Map
|
var ruleData Map
|
||||||
|
hasUser := false
|
||||||
|
|
||||||
keywordStr := req.FormValue("keyword")
|
keywordStr := req.FormValue("keyword")
|
||||||
for _, v := range that.TableColumns[table] {
|
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")] =
|
leftJoin["[>]"+v.GetString("link")] =
|
||||||
table + "." + v.GetString("name") + "=" +
|
table + "." + v.GetString("name") + "=" +
|
||||||
v.GetString("link") + ".id"
|
v.GetString("link") + ".id"
|
||||||
|
if v.GetString("link") == "admin" {
|
||||||
|
hasUser = true
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
reStr += table + "." + v.GetString("name") + ","
|
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")) + ","
|
data[table+".index[~]"] = "," + ruleData.GetString(v.GetString("link")) + ","
|
||||||
|
|
||||||
} else {
|
} 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"))}
|
ids := Slice{ruleData.GetCeilInt(v.GetString("link"))}
|
||||||
for _, v := range idMap {
|
for _, v := range idMap {
|
||||||
ids = append(ids, v.GetCeilInt("id"))
|
ids = append(ids, v.GetCeilInt("id"))
|
||||||
@ -813,6 +817,12 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
|||||||
where = data
|
where = data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(where) == 0 && hasUser {
|
||||||
|
|
||||||
|
where["admin.id"] = userData["id"]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if len(sort) != 0 {
|
if len(sort) != 0 {
|
||||||
for k, v := range sort {
|
for k, v := range sort {
|
||||||
where[k] = v
|
where[k] = v
|
||||||
|
BIN
example/bzyy.exe
BIN
example/bzyy.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user