Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7535300107 | |||
| be41a70c76 | |||
| 5b407824a5 | |||
| 56f66fcaed | |||
| a298cb3d52 | |||
| 68f2c0fd8f | |||
| d314891126 | |||
| c0ae31f499 | |||
| 25edb6b5b7 | |||
| ead64dc776 | |||
| 876e3b1f45 | |||
| d6e940803d |
@@ -329,6 +329,9 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
|
||||
if len(token) == 32 {
|
||||
sessionId = token
|
||||
//没有token,则查阅session
|
||||
if cookie == nil || cookie.Value != sessionId {
|
||||
needSetCookie = sessionId
|
||||
}
|
||||
} else if err == nil && cookie.Value != "" {
|
||||
sessionId = cookie.Value
|
||||
//session也没有则判断是否创建cookie
|
||||
|
||||
@@ -218,6 +218,9 @@ var TptProject = Proj{
|
||||
}
|
||||
inData["parent_ids"] = parent_ids + ObjToStr(re) + ","
|
||||
that.Db.Update(tableName, Map{"parent_ids": inData["parent_ids"]}, Map{"id": re})
|
||||
} else {
|
||||
inData["parent_ids"] = "," + ObjToStr(re) + ","
|
||||
that.Db.Update(tableName, Map{"parent_ids": inData["parent_ids"]}, Map{"id": re})
|
||||
}
|
||||
|
||||
that.Log["table_id"] = re
|
||||
@@ -365,22 +368,28 @@ var TptProject = Proj{
|
||||
|
||||
}
|
||||
|
||||
if inData.Get("parent_id") != nil {
|
||||
if _, ok := inData["parent_id"]; ok {
|
||||
//1
|
||||
//12 62
|
||||
//123 623
|
||||
Index := that.Db.Get(tableName, "parent_id,`parent_ids`", Map{"id": that.RouterString[2]})
|
||||
if inData.GetCeilInt64("parent_id") != Index.GetCeilInt64("parent_id") {
|
||||
parentIndex := that.Db.Get(tableName, "`parent_ids`", Map{"id": inData.Get("parent_id")})
|
||||
if strings.Contains(parentIndex.GetString("parent_ids"), ","+that.RouterString[2]+",") {
|
||||
that.Display(4, "不能将子级设置为父级")
|
||||
return
|
||||
}
|
||||
parent_ids := parentIndex.GetString("parent_ids") + that.RouterString[2] + ","
|
||||
childNodes := that.Db.Select(tableName, "id,`parent_ids`", Map{"parent_ids[~]": "," + that.RouterString[2] + ","})
|
||||
for _, v := range childNodes {
|
||||
v["parent_ids"] = strings.Replace(v.GetString("parent_ids"), Index.GetString("parent_ids"), parent_ids, -1)
|
||||
that.Db.Update(tableName, Map{"parent_ids": v["parent_ids"]}, Map{"id": v.GetCeilInt("id")})
|
||||
|
||||
if inData.GetCeilInt64("parent_id") == 0 {
|
||||
that.Db.Update(tableName, Map{"parent_ids": "," + that.RouterString[2] + ","}, Map{"id": that.RouterString[2]})
|
||||
} else {
|
||||
|
||||
Index := that.Db.Get(tableName, "parent_id,`parent_ids`", Map{"id": that.RouterString[2]})
|
||||
if inData.GetCeilInt64("parent_id") != Index.GetCeilInt64("parent_id") {
|
||||
parentIndex := that.Db.Get(tableName, "`parent_ids`", Map{"id": inData.Get("parent_id")})
|
||||
if strings.Contains(parentIndex.GetString("parent_ids"), ","+that.RouterString[2]+",") {
|
||||
that.Display(4, "不能将子级设置为父级")
|
||||
return
|
||||
}
|
||||
parent_ids := parentIndex.GetString("parent_ids") + that.RouterString[2] + ","
|
||||
childNodes := that.Db.Select(tableName, "id,`parent_ids`", Map{"parent_ids[~]": "," + that.RouterString[2] + ","})
|
||||
for _, v := range childNodes {
|
||||
v["parent_ids"] = strings.Replace(v.GetString("parent_ids"), Index.GetString("parent_ids"), parent_ids, -1)
|
||||
that.Db.Update(tableName, Map{"parent_ids": v["parent_ids"]}, Map{"id": v.GetCeilInt("id")})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,11 +555,11 @@ var TptProject = Proj{
|
||||
|
||||
column := that.MakeCodeRouter[hotimeName].TableColumns[tableName][k]
|
||||
|
||||
if column == nil {
|
||||
if column == nil || column["link"] == nil || !(column["list"] == nil || column["list"] == true) || v.GetCeilInt64(column.GetString("name")) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
if (column["list"] == nil || column["list"] == true) && column["name"] == "parent_id" && column.GetString("link") != "" {
|
||||
if column["name"] == "parent_id" {
|
||||
|
||||
parentC := that.Db.Get(column.GetString("link"), column.GetString("value"), Map{"id": v.GetCeilInt(k)})
|
||||
v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = ""
|
||||
@@ -559,8 +568,7 @@ var TptProject = Proj{
|
||||
}
|
||||
}
|
||||
|
||||
if column.GetString("link") != "" &&
|
||||
column.GetString("name") != "parent_id" {
|
||||
if column.GetString("name") != "parent_id" {
|
||||
reStr := ""
|
||||
|
||||
if column.GetString("value") == "name" && that.MakeCodeRouter[hotimeName].TableColumns[column.GetString("link")]["nickname"] != nil {
|
||||
@@ -572,7 +580,7 @@ var TptProject = Proj{
|
||||
}
|
||||
reStr += column.GetString("value")
|
||||
|
||||
joinData := that.Db.Get(column.GetString("link"), reStr, Map{"id": v.GetCeilInt(column.GetString("name"))})
|
||||
joinData := that.Db.Get(column.GetString("link"), reStr, Map{"id": v.GetCeilInt64(column.GetString("name"))})
|
||||
|
||||
if joinData != nil {
|
||||
for kj, vj := range joinData {
|
||||
@@ -867,11 +875,12 @@ var TptProject = Proj{
|
||||
}
|
||||
|
||||
linkAuthMap := that.Db.Get(v.GetString("link"), "auth", Map{"id": user.GetCeilInt(v.GetString("name"))})
|
||||
linkAuth := linkAuthMap.GetMap("auth")
|
||||
oldLinkAuth := linkAuthMap.GetMap("auth")
|
||||
linkAuth := Map{}
|
||||
//conf := ObjToMap(string(btes))
|
||||
//menus := conf.GetSlice("menus")
|
||||
if linkAuth == nil {
|
||||
linkAuth = Map{}
|
||||
if oldLinkAuth != nil {
|
||||
linkAuth = oldLinkAuth
|
||||
}
|
||||
|
||||
for k1, _ := range menus {
|
||||
@@ -882,7 +891,7 @@ var TptProject = Proj{
|
||||
}
|
||||
if v1["auth"] != nil {
|
||||
|
||||
if linkAuth[name] == nil {
|
||||
if oldLinkAuth == nil {
|
||||
linkAuth[name] = v1["auth"]
|
||||
} else {
|
||||
newAuth := Slice{}
|
||||
@@ -905,7 +914,7 @@ var TptProject = Proj{
|
||||
}
|
||||
if v2["auth"] != nil {
|
||||
|
||||
if linkAuth[name] == nil {
|
||||
if oldLinkAuth == nil {
|
||||
linkAuth[name] = v2["auth"]
|
||||
|
||||
} else {
|
||||
@@ -927,32 +936,36 @@ var TptProject = Proj{
|
||||
|
||||
for k1, _ := range menus {
|
||||
v1 := menus.GetMap(k1)
|
||||
//保证个人权限可用
|
||||
if fileConfig.GetString("table") == v1.GetString("table") {
|
||||
v1["auth"] = Slice{"info", "edit"}
|
||||
}
|
||||
|
||||
name := v1.GetString("name")
|
||||
if name == "" {
|
||||
name = v1.GetString("table")
|
||||
}
|
||||
|
||||
if linkAuth[name] != nil {
|
||||
if len(linkAuth.GetSlice(name)) != 0 {
|
||||
v1["auth"] = linkAuth[name]
|
||||
} else
|
||||
//保证个人权限可用
|
||||
if fileConfig.GetString("table") == v1.GetString("table") {
|
||||
v1["auth"] = Slice{"info", "edit"}
|
||||
} else {
|
||||
v1["auth"] = linkAuth[name]
|
||||
}
|
||||
|
||||
v1menus := v1.GetSlice("menus")
|
||||
for k2, _ := range v1menus {
|
||||
v2 := v1menus.GetMap(k2)
|
||||
//保证个人权限可用
|
||||
if fileConfig.GetString("table") == v2.GetString("table") {
|
||||
v2["auth"] = Slice{"info", "edit"}
|
||||
|
||||
}
|
||||
name := v2.GetString("name")
|
||||
if name == "" {
|
||||
name = v2.GetString("table")
|
||||
}
|
||||
if linkAuth[name] != nil {
|
||||
if len(linkAuth.GetSlice(name)) != 0 {
|
||||
v2["auth"] = linkAuth[name]
|
||||
} else if fileConfig.GetString("table") == v2.GetString("table") {
|
||||
v2["auth"] = Slice{"info", "edit"}
|
||||
|
||||
} else {
|
||||
v2["auth"] = linkAuth[name]
|
||||
}
|
||||
|
||||
|
||||
+80
-54
@@ -175,8 +175,9 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
||||
if coloum == nil {
|
||||
//根据类型判断真实类型
|
||||
for k, v1 := range ColumnDataType {
|
||||
if strings.Contains(info.GetString("name"), k) || strings.Contains(info.GetString("type"), k) {
|
||||
if strings.Contains(info.GetString("type"), k) {
|
||||
info["type"] = v1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -743,17 +744,23 @@ 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
|
||||
} else {
|
||||
if v.GetString("type") == "password" {
|
||||
data[v.GetString("name")] = Md5(reqValue)
|
||||
} else {
|
||||
data[v.GetString("name")] = reqValue
|
||||
}
|
||||
|
||||
if req.Form[v.GetString("name")] == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
reqValue := req.FormValue(v.GetString("name"))
|
||||
if reqValue == "null" {
|
||||
data[v.GetString("name")] = nil
|
||||
continue
|
||||
}
|
||||
|
||||
if v.GetString("type") == "password" {
|
||||
data[v.GetString("name")] = Md5(reqValue)
|
||||
continue
|
||||
}
|
||||
|
||||
data[v.GetString("name")] = reqValue
|
||||
|
||||
}
|
||||
//sn则自动生成
|
||||
if v.GetString("name") == "sn" {
|
||||
@@ -802,13 +809,21 @@ func (that *MakeCode) Edit(table string, req *http.Request) Map {
|
||||
}
|
||||
|
||||
if v.Get("edit") == nil || v.GetBool("edit") {
|
||||
|
||||
if len(req.Form[v.GetString("name")]) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
reqValue := req.FormValue(v.GetString("name"))
|
||||
if reqValue == "null" {
|
||||
data[v.GetString("name")] = nil
|
||||
continue
|
||||
}
|
||||
if v.GetString("type") == "number" && reqValue == "" {
|
||||
data[v.GetString("name")] = nil
|
||||
continue
|
||||
}
|
||||
|
||||
if v.GetString("type") == "password" {
|
||||
data[v.GetString("name")] = Md5(reqValue)
|
||||
} else {
|
||||
@@ -907,14 +922,14 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
// hasUser = true
|
||||
// }
|
||||
//
|
||||
// reqValue := req.FormValue(v.GetString("name"))
|
||||
// if reqValue != "" {
|
||||
// data[table+"."+v.GetString("name")] = reqValue
|
||||
// }
|
||||
reqValue := req.FormValue(v.GetString("name"))
|
||||
if v.GetString("name") != "parent_id" && reqValue != "" {
|
||||
data[v.GetString("name")] = reqValue
|
||||
}
|
||||
//
|
||||
//} else {
|
||||
|
||||
reStr += table + "." + v.GetString("name") + ","
|
||||
reStr += "`" + v.GetString("name") + "`,"
|
||||
//}
|
||||
|
||||
//if v["name"] == "parent_id" && v.GetString("link") != "" {
|
||||
@@ -972,7 +987,7 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
if strings.Contains(v.GetString("type"), "text") {
|
||||
reqValue := req.FormValue(v.GetString("name"))
|
||||
if reqValue != "" {
|
||||
data[table+"."+v.GetString("name")+"[~]"] = reqValue
|
||||
data[v.GetString("name")+"[~]"] = reqValue
|
||||
}
|
||||
|
||||
}
|
||||
@@ -980,9 +995,9 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
if v.GetString("type") == "unixtime" {
|
||||
|
||||
if len(req.Form[v.GetString("name")]) == 1 {
|
||||
daterange[table+"."+v.GetString("name")+"[>]"] = req.FormValue("daterange")
|
||||
daterange[v.GetString("name")+"[>]"] = req.FormValue("daterange")
|
||||
} else if len(req.Form[v.GetString("name")]) == 2 {
|
||||
daterange[table+"."+v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
|
||||
daterange[v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
|
||||
}
|
||||
|
||||
//fmt.Println(req.Form["daterange"])
|
||||
@@ -995,12 +1010,12 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
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
|
||||
daterange[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}
|
||||
daterange[v.GetString("name")+"[<>]"] = Slice{t1, t2}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1040,8 +1055,8 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
for _, v := range r {
|
||||
reqValue = append(reqValue, v.GetString("id"))
|
||||
}
|
||||
if data[table+"."+searchItemName] != nil {
|
||||
data[table+"."+searchItemName] = reqValue
|
||||
if data[searchItemName] != nil {
|
||||
data[searchItemName] = reqValue
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1065,10 +1080,10 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
if v.GetString("type") == "unixtime" {
|
||||
//fmt.Println(req.Form["daterange"])
|
||||
if len(req.Form["daterange"]) == 1 && req.Form["daterange"][0] != "" {
|
||||
daterange[table+"."+v.GetString("name")+"[>]"] = req.FormValue("daterange")
|
||||
daterange[v.GetString("name")+"[>]"] = req.FormValue("daterange")
|
||||
} else if len(req.Form["daterange"]) == 2 {
|
||||
|
||||
daterange[table+"."+v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
|
||||
daterange[v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
|
||||
}
|
||||
}
|
||||
if v.GetString("type") == "time" {
|
||||
@@ -1077,12 +1092,12 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
if len(req.Form["daterange"]) == 1 && req.Form["daterange"][0] != "" {
|
||||
t := time.Unix(ObjToCeilInt64(req.FormValue("daterange")), 0).Format("2006-01-02 15:04:05")
|
||||
|
||||
daterange[table+"."+v.GetString("name")+"[>]"] = t
|
||||
daterange[v.GetString("name")+"[>]"] = t
|
||||
|
||||
} else if len(req.Form["daterange"]) == 2 {
|
||||
t1 := time.Unix(ObjToCeilInt64(req.Form["daterange"][0]), 0).Format("2006-01-02 15:04:05")
|
||||
t2 := time.Unix(ObjToCeilInt64(req.Form["daterange"][1]), 0).Format("2006-01-02 15:04:05")
|
||||
daterange[table+"."+v.GetString("name")+"[<>]"] = Slice{t1, t2}
|
||||
daterange[v.GetString("name")+"[<>]"] = Slice{t1, t2}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1092,38 +1107,38 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
|
||||
if keywordTableStr != "" {
|
||||
if keywordTableStr == v.GetString("name") {
|
||||
data[table+"."+keywordTableStr+"[~]"] = keywordStr
|
||||
data[keywordTableStr+"[~]"] = keywordStr
|
||||
}
|
||||
|
||||
if keywordTableStr == v.GetString("value") {
|
||||
childs := db.Select(v.GetString("link"), "id", Map{v.GetString("value") + "[~]": keywordStr})
|
||||
childIds := Slice{}
|
||||
for _, cv := range childs {
|
||||
childIds = append(childIds, cv.GetString("id"))
|
||||
childIds = append(childIds, cv.GetCeilInt64("id"))
|
||||
}
|
||||
if len(childIds) != 0 {
|
||||
data[v.GetString("link")+".id"] = childIds
|
||||
data[v.GetString("name")] = childIds
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.Contains(v.GetString("type"), "text") {
|
||||
keyword[table+"."+v.GetString("name")+"[~]"] = keywordStr
|
||||
keyword[v.GetString("name")+"[~]"] = keywordStr
|
||||
|
||||
}
|
||||
if v.GetString("name") == "id" {
|
||||
keyword[table+"."+v.GetString("name")] = keywordStr
|
||||
keyword[v.GetString("name")] = keywordStr
|
||||
}
|
||||
if v.GetString("link") != "" &&
|
||||
v.GetString("name") != "parent_id" {
|
||||
childs := db.Select(v.GetString("link"), "id", Map{v.GetString("value") + "[~]": keywordStr})
|
||||
childIds := Slice{}
|
||||
for _, cv := range childs {
|
||||
childIds = append(childIds, cv.GetString("id"))
|
||||
childIds = append(childIds, cv.GetCeilInt64("id"))
|
||||
}
|
||||
if len(childIds) != 0 {
|
||||
keyword[v.GetString("link")+".id"] = childIds
|
||||
keyword[v.GetString("name")] = childIds
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1132,7 +1147,7 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
}
|
||||
|
||||
if len(reqValue) != 0 && searchItem.GetString("name") == "sort" && reqValue[0] != "" {
|
||||
sortMap["ORDER"] = table + "." + reqValue[0]
|
||||
sortMap["ORDER"] = reqValue[0]
|
||||
}
|
||||
|
||||
continue
|
||||
@@ -1143,7 +1158,7 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
parentID := ObjToInt(req.FormValue("parent_id"))
|
||||
if parentID == 0 {
|
||||
parentID = userData.GetCeilInt(table + "_id")
|
||||
data["OR"] = Map{table + ".id": parentID, table + ".parent_id": nil}
|
||||
data["OR"] = Map{"id": parentID, "parent_id": nil}
|
||||
} else {
|
||||
//是否展示全部子级
|
||||
where := Map{}
|
||||
@@ -1151,21 +1166,21 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
|
||||
for _, v := range reqValue {
|
||||
if len(where) == 0 {
|
||||
where[table+"."+parent_idsStr] = "," + v + ","
|
||||
where[parent_idsStr] = "," + v + ","
|
||||
continue
|
||||
}
|
||||
where = Map{"OR": where, table + "." + parent_idsStr: "," + v + ","}
|
||||
where = Map{"OR": where, parent_idsStr: "," + v + ","}
|
||||
}
|
||||
|
||||
} else {
|
||||
where[table+".parent_id"] = reqValue
|
||||
where["parent_id"] = reqValue
|
||||
}
|
||||
//是否展示自己
|
||||
if req.FormValue("showself") == "1" {
|
||||
if len(where) == 0 {
|
||||
data["OR"] = Map{table + ".id": reqValue}
|
||||
data["OR"] = Map{"id": reqValue}
|
||||
} else {
|
||||
data["OR"] = Map{"OR": where, table + ".id": reqValue}
|
||||
data["OR"] = Map{"OR": where, "id": reqValue}
|
||||
}
|
||||
} else {
|
||||
if len(where) != 0 {
|
||||
@@ -1181,26 +1196,37 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
|
||||
if parent_idsStr != "" {
|
||||
|
||||
where := Map{}
|
||||
//where := Map{}
|
||||
//是否全部展示
|
||||
if req.FormValue("showall") != "1" {
|
||||
where[table+"."+searchItem.GetString("name")] = reqValue
|
||||
if len(reqValue) != 0 {
|
||||
data[searchItem.GetString("name")] = reqValue
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
ls := []int64{}
|
||||
for _, v := range reqValue {
|
||||
if len(where) == 0 {
|
||||
where[searchItem.GetString("link")+"."+parent_idsStr] = "," + v + ","
|
||||
continue
|
||||
|
||||
ls1 := db.Select(searchItem.GetString("link"), "id", Map{"OR": Map{parent_idsStr: "," + v + ",", "id": v}})
|
||||
for _, vls1 := range ls1 {
|
||||
ls = append(ls, vls1.GetCeilInt64("id"))
|
||||
}
|
||||
where = Map{"OR": where, searchItem.GetString("link") + "." + parent_idsStr: "," + v + ","}
|
||||
}
|
||||
|
||||
if len(ls) != 0 {
|
||||
data[searchItem.GetString("name")] = ls
|
||||
}
|
||||
}
|
||||
|
||||
//用户
|
||||
if userData[searchItem.GetString("name")] != nil {
|
||||
|
||||
where = Map{"AND": Map{searchItem.GetString("link") + "." + parent_idsStr: "," + ObjToStr(userData.GetCeilInt64(searchItem.GetString("name"))) + ",", "OR": where}}
|
||||
}
|
||||
data["OR"] = where
|
||||
//if userData[searchItem.GetString("name")] != nil {
|
||||
//
|
||||
// where = Map{"AND": Map{searchItem.GetString("link") + "." + parent_idsStr: "," + ObjToStr(userData.GetCeilInt64(searchItem.GetString("name"))) + ",", "OR": where}}
|
||||
//}
|
||||
//if len(where)!=0{
|
||||
// data["OR"] = where
|
||||
//}
|
||||
|
||||
continue
|
||||
//r := db.Select(searchItem.GetString("link"), "id", where)
|
||||
@@ -1212,13 +1238,13 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
}
|
||||
|
||||
if len(reqValue) != 0 && reqValue[0] != "" {
|
||||
data[table+"."+searchItemName] = reqValue
|
||||
data[searchItemName] = reqValue
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if sortMap["ORDER"] == nil {
|
||||
sortMap["ORDER"] = table + ".id DESC"
|
||||
sortMap["ORDER"] = "id DESC"
|
||||
}
|
||||
|
||||
where := Map{}
|
||||
|
||||
+17
-1
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -103,7 +104,22 @@ func ObjToTime(obj interface{}, e ...*Error) time.Time {
|
||||
//字符串类型,只支持标准mysql datetime格式
|
||||
if tInt == 0 {
|
||||
tStr := ObjToStr(obj)
|
||||
|
||||
timeNewStr := ""
|
||||
timeNewStrs := strings.Split(tStr, "-")
|
||||
for _, v := range timeNewStrs {
|
||||
if v == "" {
|
||||
continue
|
||||
}
|
||||
if len(v) == 1 {
|
||||
v = "0" + v
|
||||
}
|
||||
if timeNewStr == "" {
|
||||
timeNewStr = v
|
||||
continue
|
||||
}
|
||||
timeNewStr = timeNewStr + "-" + v
|
||||
}
|
||||
tStr = timeNewStr
|
||||
if len(tStr) > 18 {
|
||||
t, e := time.Parse("2006-01-02 15:04:05", tStr)
|
||||
if e == nil {
|
||||
|
||||
@@ -0,0 +1,472 @@
|
||||
{
|
||||
"flow": {
|
||||
"admin": {
|
||||
"sql": {
|
||||
"role_id": "role_id"
|
||||
},
|
||||
"stop": false,
|
||||
"table": "admin"
|
||||
},
|
||||
"article": {
|
||||
"sql": {
|
||||
"admin_id": "id"
|
||||
},
|
||||
"stop": false,
|
||||
"table": "article"
|
||||
},
|
||||
"ctg": {
|
||||
"sql": {
|
||||
"admin_id": "id"
|
||||
},
|
||||
"stop": false,
|
||||
"table": "ctg"
|
||||
},
|
||||
"ctg_article": {
|
||||
"sql": {
|
||||
"admin_id": "id"
|
||||
},
|
||||
"stop": false,
|
||||
"table": "ctg_article"
|
||||
},
|
||||
"ctg_copy": {
|
||||
"sql": {
|
||||
"admin_id": "id"
|
||||
},
|
||||
"stop": false,
|
||||
"table": "ctg_copy"
|
||||
},
|
||||
"logs": {
|
||||
"sql": {
|
||||
|
||||
},
|
||||
"stop": false,
|
||||
"table": "logs"
|
||||
},
|
||||
"org": {
|
||||
"sql": {
|
||||
"admin_id": "id"
|
||||
},
|
||||
"stop": false,
|
||||
"table": "org"
|
||||
},
|
||||
"role": {
|
||||
"sql": {
|
||||
"admin_id": "id",
|
||||
"id": "role_id"
|
||||
},
|
||||
"stop": true,
|
||||
"table": "role"
|
||||
}
|
||||
},
|
||||
"id": "74a8a59407fa7d6c7fcdc85742dbae57",
|
||||
"label": "HoTime管理平台",
|
||||
"labelConfig": {
|
||||
"add": "添加",
|
||||
"delete": "删除",
|
||||
"download": "下载清单",
|
||||
"edit": "编辑",
|
||||
"info": "查看详情",
|
||||
"show": "开启"
|
||||
},
|
||||
"menus": [
|
||||
{
|
||||
"auth": [
|
||||
"show"
|
||||
],
|
||||
"icon": "Setting",
|
||||
"label": "ebw_news",
|
||||
"menus": [
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_news",
|
||||
"table": "ebw_news"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_news_addition_res",
|
||||
"table": "ebw_news_addition_res"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_annex",
|
||||
"table": "ebw_annex"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_customer",
|
||||
"table": "ebw_customer"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_items",
|
||||
"table": "ebw_items"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_res",
|
||||
"table": "ebw_res"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_vote",
|
||||
"table": "ebw_vote"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_vote_option",
|
||||
"table": "ebw_vote_option"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_user",
|
||||
"table": "ebw_user"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_attachment",
|
||||
"table": "ebw_attachment"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_jobs",
|
||||
"table": "ebw_jobs"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "ebw_vote_user",
|
||||
"table": "ebw_vote_user"
|
||||
}
|
||||
],
|
||||
"name": "sys:ebw"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show"
|
||||
],
|
||||
"icon": "Setting",
|
||||
"label": "系统管理",
|
||||
"menus": [
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"download"
|
||||
],
|
||||
"label": "日志管理",
|
||||
"table": "logs"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "角色管理",
|
||||
"table": "role"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "组织管理",
|
||||
"table": "org"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "人员管理",
|
||||
"table": "admin"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "文章管理",
|
||||
"table": "article"
|
||||
}
|
||||
],
|
||||
"name": "sys"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show"
|
||||
],
|
||||
"icon": "Setting",
|
||||
"label": "外部系统",
|
||||
"menus": [
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "外部系统",
|
||||
"table": "swiper_sys"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "顶部",
|
||||
"table": "swiper_top"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "飘窗",
|
||||
"table": "swiper_fly"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "底部",
|
||||
"table": "swiper_bottom"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "中间",
|
||||
"table": "swiper_center"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "关联专题",
|
||||
"table": "swiper_point"
|
||||
}
|
||||
],
|
||||
"name": "sys:swiper"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show"
|
||||
],
|
||||
"icon": "Setting",
|
||||
"label": "栏目管理",
|
||||
"menus": [
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "栏目管理",
|
||||
"table": "ctg"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "关联栏目",
|
||||
"table": "ctg_article"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "栏目管理",
|
||||
"table": "ctg_copy"
|
||||
}
|
||||
],
|
||||
"name": "sys:ctg"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show"
|
||||
],
|
||||
"icon": "Setting",
|
||||
"label": "纪委信箱",
|
||||
"menus": [
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "纪委信箱",
|
||||
"table": "mail_discipline"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "总经理信箱",
|
||||
"table": "mail"
|
||||
},
|
||||
{
|
||||
"auth": [
|
||||
"show",
|
||||
"add",
|
||||
"delete",
|
||||
"edit",
|
||||
"info",
|
||||
"download"
|
||||
],
|
||||
"label": "党委书记信箱",
|
||||
"table": "mail_part"
|
||||
}
|
||||
],
|
||||
"name": "sys:mail"
|
||||
}
|
||||
],
|
||||
"name": "admin",
|
||||
"stop": [
|
||||
"role",
|
||||
"org"
|
||||
]
|
||||
}
|
||||
+350
-347
File diff suppressed because it is too large
Load Diff
@@ -396,7 +396,7 @@
|
||||
"list": false,
|
||||
"must": false,
|
||||
"name": "auth",
|
||||
"strict": false,
|
||||
"strict": true,
|
||||
"type": "auth"
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user