V2半封测

This commit is contained in:
hoteas
2022-07-27 17:09:56 +08:00
parent c91c610d2d
commit e393d258a8
2 changed files with 425 additions and 70 deletions
+31 -23
View File
@@ -680,9 +680,9 @@ func (that *MakeCode) Add(table string, user Map, req *http.Request) Map {
}
if v.Get("add") == nil || v.GetBool("add") {
if len(req.Form[v.GetString("name")]) == 0 {
if len(req.Form[v.GetString("name")]) == 0 || req.FormValue(v.GetString("name")) == "" {
if user[v.GetString("name")] != nil {
if v["link"] != nil && user[v.GetString("name")] != nil {
data[v.GetString("name")] = user[v.GetString("name")]
continue
}
@@ -692,6 +692,13 @@ func (that *MakeCode) Add(table string, user Map, req *http.Request) Map {
continue
}
if user[v.GetString("name")] != nil {
data[v.GetString("name")] = user[v.GetString("name")]
continue
}
if v.GetBool("must") {
return nil
} else {
@@ -699,6 +706,7 @@ func (that *MakeCode) Add(table string, user Map, req *http.Request) Map {
}
}
reqValue := req.FormValue(v.GetString("name"))
if (reqValue == "" || reqValue == "null") && strings.Contains(v.GetString("name"), "id") {
data[v.GetString("name")] = nil
@@ -1010,27 +1018,27 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
}
//树节点模式搜索
if searchItemName == "parent_id" {
if parent_idsStr != "" {
where := Map{}
for _, v := range reqValue {
if len(where) == 0 {
where[parent_idsStr] = "," + v + ","
continue
}
where = Map{"OR": where, parent_idsStr: "," + v + ","}
}
//用户
if userData[searchItem.GetString("name")] != nil {
where = Map{"AND": Map{parent_idsStr: "," + ObjToStr(userData.GetCeilInt64(searchItem.GetString("name"))) + ",", "OR": where}}
}
r := db.Select(searchItem.GetString("link"), "id", where)
for _, v := range r {
reqValue = append(reqValue, v.GetString("id"))
}
}
//if parent_idsStr != "" {
//
// where := Map{}
//
// for _, v := range reqValue {
// if len(where) == 0 {
// where[parent_idsStr] = "," + v + ","
// continue
// }
// where = Map{"OR": where, parent_idsStr: "," + v + ","}
// }
// //用户
// if userData[searchItem.GetString("name")] != nil {
// where = Map{"AND": Map{parent_idsStr: "," + ObjToStr(userData.GetCeilInt64(searchItem.GetString("name"))) + ",", "OR": where}}
// }
// r := db.Select(searchItem.GetString("link"), "id", where)
// for _, v := range r {
// reqValue = append(reqValue, v.GetString("id"))
// }
//
//}
parentID := ObjToInt(req.FormValue("parent_id"))
if parentID == 0 {