增加权限管理
This commit is contained in:
parent
8f7380d796
commit
bb9092c3e5
423
code.go
423
code.go
@ -3,6 +3,7 @@ package hotime
|
|||||||
import (
|
import (
|
||||||
. "code.hoteas.com/golang/hotime/common"
|
. "code.hoteas.com/golang/hotime/common"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -15,8 +16,10 @@ var TptProject = Proj{
|
|||||||
"info": func(that *Context) {
|
"info": func(that *Context) {
|
||||||
hotimeName := that.RouterString[0]
|
hotimeName := that.RouterString[0]
|
||||||
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
||||||
|
tableName := that.RouterString[1]
|
||||||
|
|
||||||
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
||||||
str, inData := that.MakeCodeRouter[hotimeName].Info(that.RouterString[1], data, that.Db)
|
str, inData := that.MakeCodeRouter[hotimeName].Info(tableName, data, that.Db)
|
||||||
where := Map{"id": that.RouterString[2]}
|
where := Map{"id": that.RouterString[2]}
|
||||||
|
|
||||||
if len(inData) == 1 {
|
if len(inData) == 1 {
|
||||||
@ -27,7 +30,7 @@ var TptProject = Proj{
|
|||||||
where = Map{"AND": where}
|
where = Map{"AND": where}
|
||||||
}
|
}
|
||||||
|
|
||||||
re := that.Db.Get(that.RouterString[1], str, where)
|
re := that.Db.Get(tableName, str, where)
|
||||||
|
|
||||||
if re == nil {
|
if re == nil {
|
||||||
that.Display(4, "找不到对应信息")
|
that.Display(4, "找不到对应信息")
|
||||||
@ -35,7 +38,7 @@ var TptProject = Proj{
|
|||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range re {
|
for k, v := range re {
|
||||||
column := that.MakeCodeRouter[hotimeName].TableColumns[that.RouterString[1]][k]
|
column := that.MakeCodeRouter[hotimeName].TableColumns[tableName][k]
|
||||||
if column == nil {
|
if column == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -48,16 +51,48 @@ var TptProject = Proj{
|
|||||||
|
|
||||||
link := strings.Replace(column.GetString("name"), "_id", "", -1)
|
link := strings.Replace(column.GetString("name"), "_id", "", -1)
|
||||||
if link == "parent" {
|
if link == "parent" {
|
||||||
link = that.RouterString[1]
|
link = tableName
|
||||||
}
|
}
|
||||||
re[link] = that.Db.Get(column.GetString("link"), seStr, Map{"id": v})
|
re[link] = that.Db.Get(column.GetString("link"), seStr, Map{"id": v})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//权限设置
|
||||||
|
if column["type"] == "auth" {
|
||||||
|
|
||||||
|
btes, err := ioutil.ReadFile(fileConfig.GetString("config"))
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
that.Display(4, "找不到权限配置文件")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
conf := ObjToMap(string(btes))
|
||||||
|
menus := conf.GetSlice("menus")
|
||||||
|
|
||||||
|
userAuth := re.GetMap("auth")
|
||||||
|
|
||||||
|
for k1, _ := range menus {
|
||||||
|
v1 := menus.GetMap(k1)
|
||||||
|
if userAuth[v1.GetString("name")] != nil {
|
||||||
|
v1["auth"] = userAuth[v1.GetString("name")]
|
||||||
|
}
|
||||||
|
for k2, _ := range v1.GetSlice("menus") {
|
||||||
|
v2 := menus.GetMap(k2)
|
||||||
|
if userAuth[v2.GetString("name")] != nil {
|
||||||
|
v2["auth"] = userAuth[v2.GetString("name")]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
re["auth"] = menus
|
||||||
|
//that.Display(0,menus)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果有table字段则代为link
|
//如果有table字段则代为link
|
||||||
if re["table"] != nil && re["table_id"] != nil {
|
if re["table"] != nil && re["table_id"] != nil {
|
||||||
|
|
||||||
column := that.MakeCodeRouter[hotimeName].TableColumns[that.RouterString[1]][re.GetString("table")]
|
column := that.MakeCodeRouter[hotimeName].TableColumns[tableName][re.GetString("table")]
|
||||||
v := re.GetCeilInt64("table_id")
|
v := re.GetCeilInt64("table_id")
|
||||||
|
|
||||||
seStr := "id," + column.GetString("value")
|
seStr := "id," + column.GetString("value")
|
||||||
@ -68,7 +103,7 @@ var TptProject = Proj{
|
|||||||
|
|
||||||
link := strings.Replace(column.GetString("name"), "_id", "", -1)
|
link := strings.Replace(column.GetString("name"), "_id", "", -1)
|
||||||
if link == "parent" {
|
if link == "parent" {
|
||||||
link = that.RouterString[1]
|
link = tableName
|
||||||
}
|
}
|
||||||
re[link] = that.Db.Get(column.GetString("link"), seStr, Map{"id": v})
|
re[link] = that.Db.Get(column.GetString("link"), seStr, Map{"id": v})
|
||||||
|
|
||||||
@ -77,18 +112,38 @@ var TptProject = Proj{
|
|||||||
that.Display(0, re)
|
that.Display(0, re)
|
||||||
},
|
},
|
||||||
"add": func(that *Context) {
|
"add": func(that *Context) {
|
||||||
that.Log = Map{"table": that.RouterString[1], "type": 1}
|
tableName := that.RouterString[1]
|
||||||
|
that.Log = Map{"table": tableName, "type": 1}
|
||||||
|
|
||||||
hotimeName := that.RouterString[0]
|
hotimeName := that.RouterString[0]
|
||||||
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
||||||
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
||||||
inData := that.MakeCodeRouter[hotimeName].Add(that.RouterString[1], data, that.Req)
|
inData := that.MakeCodeRouter[hotimeName].Add(tableName, data, that.Req)
|
||||||
if inData == nil {
|
if inData == nil {
|
||||||
that.Display(3, "请求参数不足")
|
that.Display(3, "请求参数不足")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
re := that.Db.Insert(that.RouterString[1], inData)
|
if that.MakeCodeRouter[hotimeName].TableColumns[tableName]["auth"] != nil {
|
||||||
|
for _, v := range that.MakeCodeRouter[hotimeName].TableColumns[fileConfig.GetString("table")] {
|
||||||
|
if v.GetString("link") != "" {
|
||||||
|
linkHasAuth := that.MakeCodeRouter[hotimeName].TableColumns[v.GetString("link")]["auth"]
|
||||||
|
if linkHasAuth != nil {
|
||||||
|
|
||||||
|
linkAuthMap := that.Db.Get(v.GetString("link"), "auth", Map{"id": data.GetCeilInt(v.GetString("name"))})
|
||||||
|
linkAuth := linkAuthMap.GetMap("auth")
|
||||||
|
|
||||||
|
if linkAuth != nil {
|
||||||
|
inData["auth"] = ObjToStr(linkAuth)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
re := that.Db.Insert(tableName, inData)
|
||||||
|
|
||||||
if re == 0 {
|
if re == 0 {
|
||||||
that.Display(4, "无法插入对应数据")
|
that.Display(4, "无法插入对应数据")
|
||||||
@ -96,40 +151,129 @@ var TptProject = Proj{
|
|||||||
}
|
}
|
||||||
//索引管理,便于检索以及权限
|
//索引管理,便于检索以及权限
|
||||||
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
|
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
|
||||||
index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
|
index := that.Db.Get(tableName, "`index`", Map{"id": inData.Get("parent_id")})
|
||||||
inData["index"] = index.GetString("index") + ObjToStr(re) + ","
|
inData["index"] = index.GetString("index") + ObjToStr(re) + ","
|
||||||
that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re})
|
that.Db.Update(tableName, Map{"index": inData["index"]}, Map{"id": re})
|
||||||
} else if inData.GetString("index") != "" {
|
} else if inData.GetString("index") != "" {
|
||||||
inData["index"] = "," + ObjToStr(re) + ","
|
inData["index"] = "," + ObjToStr(re) + ","
|
||||||
that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re})
|
that.Db.Update(tableName, Map{"index": inData["index"]}, Map{"id": re})
|
||||||
}
|
}
|
||||||
that.Log["table_id"] = re
|
that.Log["table_id"] = re
|
||||||
that.Display(0, re)
|
that.Display(0, re)
|
||||||
},
|
},
|
||||||
"update": func(that *Context) {
|
"update": func(that *Context) {
|
||||||
|
tableName := that.RouterString[1]
|
||||||
that.Log = Map{"table": that.RouterString[1], "type": 2, "table_id": that.RouterString[2]}
|
that.Log = Map{"table": tableName, "type": 2, "table_id": that.RouterString[2]}
|
||||||
|
|
||||||
hotimeName := that.RouterString[0]
|
hotimeName := that.RouterString[0]
|
||||||
inData := that.MakeCodeRouter[hotimeName].Edit(that.RouterString[1], that.Req)
|
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
||||||
|
inData := that.MakeCodeRouter[hotimeName].Edit(tableName, that.Req)
|
||||||
|
|
||||||
if inData == nil {
|
if inData == nil {
|
||||||
that.Display(3, "没有找到要更新的数据")
|
that.Display(3, "没有找到要更新的数据")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if inData["auth"] != nil {
|
||||||
|
|
||||||
|
btes, err := ioutil.ReadFile(fileConfig.GetString("config"))
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
that.Display(4, "找不到配置文件")
|
||||||
|
}
|
||||||
|
|
||||||
|
conf := ObjToMap(string(btes))
|
||||||
|
menus := conf.GetSlice("menus")
|
||||||
|
|
||||||
|
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
||||||
|
for _, v := range that.MakeCodeRouter[hotimeName].TableColumns[fileConfig.GetString("table")] {
|
||||||
|
if v.GetString("link") != "" {
|
||||||
|
linkHasAuth := that.MakeCodeRouter[hotimeName].TableColumns[v.GetString("link")]["auth"]
|
||||||
|
if linkHasAuth != nil {
|
||||||
|
|
||||||
|
linkAuthMap := that.Db.Get(v.GetString("link"), "auth", Map{"id": data.GetCeilInt(v.GetString("name"))})
|
||||||
|
linkAuth := linkAuthMap.GetMap("auth")
|
||||||
|
myAuth := Map{}
|
||||||
|
if linkAuth != nil {
|
||||||
|
|
||||||
|
for k1, _ := range menus {
|
||||||
|
|
||||||
|
v1 := menus.GetMap(k1)
|
||||||
|
if linkAuth[v1.GetString("name")] != nil {
|
||||||
|
v1["auth"] = linkAuth[v1.GetString("name")]
|
||||||
|
}
|
||||||
|
|
||||||
|
myAuth[v1.GetString("name")] = v1
|
||||||
|
|
||||||
|
for k2, _ := range v1.GetSlice("menus") {
|
||||||
|
v2 := menus.GetMap(k2)
|
||||||
|
if linkAuth[v2.GetString("name")] != nil {
|
||||||
|
v2["auth"] = linkAuth[v2.GetString("name")]
|
||||||
|
}
|
||||||
|
myAuth[v2.GetString("name")] = v2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newAuth := inData.GetSlice("auth")
|
||||||
|
toDB := Map{}
|
||||||
|
for k1, _ := range newAuth {
|
||||||
|
v1 := newAuth.GetMap(k1)
|
||||||
|
|
||||||
|
if myAuth.GetMap(v1.GetString("name")) == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
auth := Slice{}
|
||||||
|
toDB[v1.GetString("name")] = auth
|
||||||
|
|
||||||
|
if strings.Contains(myAuth.GetMap(v1.GetString("name")).GetString("auth"), `"show"`) &&
|
||||||
|
strings.Contains(v1.GetString("auth"), `"show"`) {
|
||||||
|
auth = append(auth, "show")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(myAuth.GetMap(v1.GetString("name")).GetString("auth"), `"add"`) &&
|
||||||
|
strings.Contains(v1.GetString("auth"), `"add"`) {
|
||||||
|
auth = append(auth, "add")
|
||||||
|
//continue
|
||||||
|
}
|
||||||
|
if strings.Contains(myAuth.GetMap(v1.GetString("name")).GetString("auth"), `"edit"`) &&
|
||||||
|
strings.Contains(v1.GetString("auth"), `"edit"`) {
|
||||||
|
auth = append(auth, "edit")
|
||||||
|
|
||||||
|
}
|
||||||
|
if strings.Contains(myAuth.GetMap(v1.GetString("name")).GetString("auth"), `"delete"`) &&
|
||||||
|
strings.Contains(v1.GetString("auth"), `"delete"`) {
|
||||||
|
auth = append(auth, "delete")
|
||||||
|
|
||||||
|
}
|
||||||
|
if strings.Contains(myAuth.GetMap(v1.GetString("name")).GetString("auth"), `"info"`) &&
|
||||||
|
strings.Contains(v1.GetString("auth"), `"info"`) {
|
||||||
|
auth = append(auth, "info")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
inData["auth"] = toDB.ToJsonString()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//索引管理,便于检索以及权限
|
//索引管理,便于检索以及权限
|
||||||
if inData.GetString("index") != "" {
|
if inData.GetString("index") != "" {
|
||||||
if inData.Get("parent_id") != nil {
|
if inData.Get("parent_id") != nil {
|
||||||
Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]})
|
Index := that.Db.Get(tableName, "`index`", Map{"id": that.RouterString[2]})
|
||||||
parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
|
parentIndex := that.Db.Get(tableName, "`index`", Map{"id": inData.Get("parent_id")})
|
||||||
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + ","
|
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + ","
|
||||||
|
|
||||||
childNodes := that.Db.Select(that.RouterString[1], "id,`index``", Map{"index[~]": "," + that.RouterString[2] + ","})
|
childNodes := that.Db.Select(tableName, "id,`index``", Map{"index[~]": "," + that.RouterString[2] + ","})
|
||||||
|
|
||||||
for _, v := range childNodes {
|
for _, v := range childNodes {
|
||||||
v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1)
|
v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1)
|
||||||
that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")})
|
that.Db.Update(tableName, Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delete(inData, "index")
|
delete(inData, "index")
|
||||||
@ -137,7 +281,7 @@ var TptProject = Proj{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]})
|
re := that.Db.Update(tableName, inData, Map{"id": that.RouterString[2]})
|
||||||
|
|
||||||
if re == 0 {
|
if re == 0 {
|
||||||
that.Display(4, "更新数据失败")
|
that.Display(4, "更新数据失败")
|
||||||
@ -147,9 +291,10 @@ var TptProject = Proj{
|
|||||||
that.Display(0, re)
|
that.Display(0, re)
|
||||||
},
|
},
|
||||||
"remove": func(that *Context) {
|
"remove": func(that *Context) {
|
||||||
that.Log = Map{"table": that.RouterString[1], "type": 3, "table_id": that.RouterString[2]}
|
tableName := that.RouterString[1]
|
||||||
|
that.Log = Map{"table": tableName, "type": 3, "table_id": that.RouterString[2]}
|
||||||
hotimeName := that.RouterString[0]
|
hotimeName := that.RouterString[0]
|
||||||
inData := that.MakeCodeRouter[hotimeName].Delete(that.RouterString[1], that.Req)
|
inData := that.MakeCodeRouter[hotimeName].Delete(tableName, that.Req)
|
||||||
if inData == nil {
|
if inData == nil {
|
||||||
that.Display(3, "请求参数不足")
|
that.Display(3, "请求参数不足")
|
||||||
return
|
return
|
||||||
@ -157,9 +302,9 @@ var TptProject = Proj{
|
|||||||
re := int64(0)
|
re := int64(0)
|
||||||
//索引管理,便于检索以及权限
|
//索引管理,便于检索以及权限
|
||||||
if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil {
|
if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil {
|
||||||
re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","})
|
re = that.Db.Delete(tableName, Map{"index[~]": "," + that.RouterString[2] + ","})
|
||||||
} else {
|
} else {
|
||||||
re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]})
|
re = that.Db.Delete(tableName, Map{"id": that.RouterString[2]})
|
||||||
}
|
}
|
||||||
|
|
||||||
if re == 0 {
|
if re == 0 {
|
||||||
@ -172,10 +317,10 @@ var TptProject = Proj{
|
|||||||
"search": func(that *Context) {
|
"search": func(that *Context) {
|
||||||
hotimeName := that.RouterString[0]
|
hotimeName := that.RouterString[0]
|
||||||
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
||||||
|
tableName := that.RouterString[1]
|
||||||
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
||||||
|
|
||||||
columnStr, leftJoin, where := that.MakeCodeRouter[hotimeName].Search(that.RouterString[1], data, that.Req, that.Db)
|
columnStr, leftJoin, where := that.MakeCodeRouter[hotimeName].Search(tableName, data, that.Req, that.Db)
|
||||||
|
|
||||||
page := ObjToInt(that.Req.FormValue("page"))
|
page := ObjToInt(that.Req.FormValue("page"))
|
||||||
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
|
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
|
||||||
@ -188,9 +333,9 @@ var TptProject = Proj{
|
|||||||
pageSize = 20
|
pageSize = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
count := that.Db.Count(that.RouterString[1], leftJoin, where)
|
count := that.Db.Count(tableName, leftJoin, where)
|
||||||
reData := that.Db.Page(page, pageSize).
|
reData := that.Db.Page(page, pageSize).
|
||||||
PageSelect(that.RouterString[1], leftJoin, columnStr, where)
|
PageSelect(tableName, leftJoin, columnStr, where)
|
||||||
|
|
||||||
for _, v := range reData {
|
for _, v := range reData {
|
||||||
v.RangeSort(func(k string, v1 interface{}) (isEnd bool) {
|
v.RangeSort(func(k string, v1 interface{}) (isEnd bool) {
|
||||||
@ -209,7 +354,7 @@ var TptProject = Proj{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
column := that.MakeCodeRouter[hotimeName].TableColumns[that.RouterString[1]][k]
|
column := that.MakeCodeRouter[hotimeName].TableColumns[tableName][k]
|
||||||
|
|
||||||
if column == nil {
|
if column == nil {
|
||||||
return isEnd
|
return isEnd
|
||||||
@ -294,6 +439,7 @@ var TptProject = Proj{
|
|||||||
that.Session(fileConfig.GetString("table")+"_id", user.GetCeilInt("id"))
|
that.Session(fileConfig.GetString("table")+"_id", user.GetCeilInt("id"))
|
||||||
that.Session(fileConfig.GetString("table")+"_name", name)
|
that.Session(fileConfig.GetString("table")+"_name", name)
|
||||||
delete(user, "password")
|
delete(user, "password")
|
||||||
|
user["table"] = fileConfig.GetString("table")
|
||||||
that.Display(0, user)
|
that.Display(0, user)
|
||||||
},
|
},
|
||||||
"logout": func(that *Context) {
|
"logout": func(that *Context) {
|
||||||
@ -303,86 +449,181 @@ var TptProject = Proj{
|
|||||||
that.Session(fileConfig.GetString("table")+"_name", nil)
|
that.Session(fileConfig.GetString("table")+"_name", nil)
|
||||||
that.Display(0, "退出登录成功")
|
that.Display(0, "退出登录成功")
|
||||||
},
|
},
|
||||||
"info": func(that *Context) {
|
"config": func(that *Context) {
|
||||||
that.Log = Map{"table": that.RouterString[1], "type": 2, "table_id": that.RouterString[2]}
|
|
||||||
hotimeName := that.RouterString[0]
|
hotimeName := that.RouterString[0]
|
||||||
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
||||||
|
if that.Session(fileConfig.GetString("table")+"_id").Data == nil {
|
||||||
|
|
||||||
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
btes, err := ioutil.ReadFile(fileConfig.GetString("config"))
|
||||||
str, inData := that.MakeCodeRouter[hotimeName].Info(fileConfig.GetString("table"), data, that.Db)
|
|
||||||
where := Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()}
|
if err != nil {
|
||||||
if len(inData) == 1 {
|
that.Display(4, "找不到配置文件")
|
||||||
inData["id"] = where["id"]
|
|
||||||
where = Map{"AND": inData}
|
|
||||||
} else if len(inData) > 1 {
|
|
||||||
where["OR"] = inData
|
|
||||||
where = Map{"AND": where}
|
|
||||||
}
|
}
|
||||||
re := that.Db.Get(fileConfig.GetString("table"), str, where)
|
|
||||||
if re == nil {
|
conf := ObjToMap(string(btes))
|
||||||
that.Display(4, "找不到对应信息")
|
delete(conf, "menus")
|
||||||
|
delete(conf, "tables")
|
||||||
|
//没有登录只需要返回这些信息
|
||||||
|
that.Display(0, conf)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for k, v := range re {
|
|
||||||
column := that.MakeCodeRouter[hotimeName].TableColumns[fileConfig.GetString("table")][k]
|
btes, err := ioutil.ReadFile(fileConfig.GetString("config"))
|
||||||
if column == nil {
|
|
||||||
|
if err != nil {
|
||||||
|
that.Display(4, "找不到配置文件")
|
||||||
|
}
|
||||||
|
|
||||||
|
conf := ObjToMap(string(btes))
|
||||||
|
menus := conf.GetSlice("menus")
|
||||||
|
|
||||||
|
user := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": fileConfig.GetString("table") + "_id"})
|
||||||
|
|
||||||
|
if user == nil {
|
||||||
|
that.Display(2, "暂未登录")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range that.MakeCodeRouter[hotimeName].TableColumns[fileConfig.GetString("table")] {
|
||||||
|
if v.GetString("link") != "" {
|
||||||
|
linkHasAuth := that.MakeCodeRouter[hotimeName].TableColumns[v.GetString("link")]["auth"]
|
||||||
|
if linkHasAuth == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" {
|
|
||||||
|
|
||||||
//是角色表则取下角色值
|
linkAuthMap := that.Db.Get(v.GetString("link"), "auth", Map{"id": user.GetCeilInt(v.GetString("name"))})
|
||||||
if column.GetString("link") == "role" {
|
linkAuth := linkAuthMap.GetMap("auth")
|
||||||
|
|
||||||
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,auth,"+column.GetString("value"), Map{"id": v})
|
for k1, _ := range menus {
|
||||||
|
v1 := menus.GetMap(k1)
|
||||||
|
if linkAuth[v1.GetString("name")] != nil {
|
||||||
|
v1["auth"] = linkAuth[v1.GetString("name")]
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
for k2, _ := range v1.GetSlice("menus") {
|
||||||
|
v2 := menus.GetMap(k2)
|
||||||
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v})
|
if linkAuth[v2.GetString("name")] != nil {
|
||||||
|
v2["auth"] = linkAuth[v2.GetString("name")]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
that.Display(0, re)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
userAuth := user.GetMap("auth")
|
||||||
|
for k1, _ := range menus {
|
||||||
|
v1 := menus.GetMap(k1)
|
||||||
|
if userAuth[v1.GetString("name")] != nil {
|
||||||
|
v1["auth"] = userAuth[v1.GetString("name")]
|
||||||
|
}
|
||||||
|
|
||||||
|
for k2, _ := range v1.GetSlice("menus") {
|
||||||
|
v2 := menus.GetMap(k2)
|
||||||
|
if userAuth[v2.GetString("name")] != nil {
|
||||||
|
v2["auth"] = userAuth[v2.GetString("name")]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config := DeepCopyMap(that.MakeCodeRouter[hotimeName].Config).(Map)
|
||||||
|
|
||||||
|
config["menus"] = menus
|
||||||
|
newTables := Map{}
|
||||||
|
for k1, _ := range menus {
|
||||||
|
v1 := menus.GetMap(k1)
|
||||||
|
if config.GetMap("tables").GetMap(v1.GetString("name")) != nil {
|
||||||
|
newTables[v1.GetString("name")] = config.GetMap("tables").GetMap(v1.GetString("name"))
|
||||||
|
}
|
||||||
|
|
||||||
|
for k2, _ := range v1.GetSlice("menus") {
|
||||||
|
v2 := menus.GetMap(k2)
|
||||||
|
if config.GetMap("tables").GetMap(v2.GetString("name")) != nil {
|
||||||
|
newTables[v2.GetString("name")] = config.GetMap("tables").GetMap(v2.GetString("name"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config["tables"] = menus
|
||||||
|
|
||||||
|
that.Display(0, config)
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
//权限操作
|
||||||
|
"info": func(that *Context) {
|
||||||
|
//不存在配置文件则生成,存在则不管
|
||||||
|
hotimeName := that.RouterString[0]
|
||||||
|
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
||||||
|
btes, err := ioutil.ReadFile(fileConfig.GetString("config"))
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
that.Display(4, "找不到配置文件")
|
||||||
|
}
|
||||||
|
|
||||||
|
conf := ObjToMap(string(btes))
|
||||||
|
menus := conf.GetSlice("menus")
|
||||||
|
|
||||||
|
user := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": fileConfig.GetString("table") + "_id"})
|
||||||
|
|
||||||
|
if user == nil {
|
||||||
|
that.Display(2, "暂未登录")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range that.MakeCodeRouter[hotimeName].TableColumns[fileConfig.GetString("table")] {
|
||||||
|
if v.GetString("link") != "" {
|
||||||
|
linkHasAuth := that.MakeCodeRouter[hotimeName].TableColumns[v.GetString("link")]["auth"]
|
||||||
|
if linkHasAuth == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
linkAuthMap := that.Db.Get(v.GetString("link"), "auth", Map{"id": user.GetCeilInt(v.GetString("name"))})
|
||||||
|
linkAuth := linkAuthMap.GetMap("auth")
|
||||||
|
|
||||||
|
for k1, _ := range menus {
|
||||||
|
v1 := menus.GetMap(k1)
|
||||||
|
if linkAuth[v1.GetString("name")] != nil {
|
||||||
|
v1["auth"] = linkAuth[v1.GetString("name")]
|
||||||
|
}
|
||||||
|
|
||||||
|
for k2, _ := range v1.GetSlice("menus") {
|
||||||
|
v2 := menus.GetMap(k2)
|
||||||
|
if linkAuth[v2.GetString("name")] != nil {
|
||||||
|
v2["auth"] = linkAuth[v2.GetString("name")]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
userAuth := user.GetMap("auth")
|
||||||
|
for k1, _ := range menus {
|
||||||
|
v1 := menus.GetMap(k1)
|
||||||
|
if userAuth[v1.GetString("name")] != nil {
|
||||||
|
v1["auth"] = userAuth[v1.GetString("name")]
|
||||||
|
}
|
||||||
|
|
||||||
|
for k2, _ := range v1.GetSlice("menus") {
|
||||||
|
v2 := menus.GetMap(k2)
|
||||||
|
if userAuth[v2.GetString("name")] != nil {
|
||||||
|
v2["auth"] = userAuth[v2.GetString("name")]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
that.Display(0, menus)
|
||||||
|
|
||||||
|
},
|
||||||
|
//权限操作
|
||||||
|
"reset": func(that *Context) {
|
||||||
|
|
||||||
|
},
|
||||||
|
//权限操作
|
||||||
"update": func(that *Context) {
|
"update": func(that *Context) {
|
||||||
|
|
||||||
that.Log = Map{"table": that.RouterString[1], "type": 2, "table_id": that.RouterString[2]}
|
|
||||||
|
|
||||||
hotimeName := that.RouterString[0]
|
|
||||||
inData := that.MakeCodeRouter[hotimeName].Edit(that.RouterString[1], that.Req)
|
|
||||||
|
|
||||||
if inData == nil {
|
|
||||||
that.Display(3, "没有找到要更新的数据")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//索引管理,便于检索以及权限
|
|
||||||
if inData.GetString("index") != "" {
|
|
||||||
if inData.Get("parent_id") != nil {
|
|
||||||
Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]})
|
|
||||||
parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
|
|
||||||
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + ","
|
|
||||||
|
|
||||||
childNodes := that.Db.Select(that.RouterString[1], "id,`index``", Map{"index[~]": "," + that.RouterString[2] + ","})
|
|
||||||
|
|
||||||
for _, v := range childNodes {
|
|
||||||
v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1)
|
|
||||||
that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
delete(inData, "index")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]})
|
|
||||||
|
|
||||||
if re == 0 {
|
|
||||||
that.Display(4, "更新数据失败")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
that.Display(0, re)
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,7 @@ var ColumnNameType = []ColumnShow{
|
|||||||
{"time", true, true, true, false, "time", false},
|
{"time", true, true, true, false, "time", false},
|
||||||
{"level", false, false, true, false, "", false},
|
{"level", false, false, true, false, "", false},
|
||||||
{"rule", true, true, true, false, "form", false},
|
{"rule", true, true, true, false, "form", false},
|
||||||
|
{"auth", false, true, true, false, "auth", true},
|
||||||
{"table", true, false, true, false, "table", false},
|
{"table", true, false, true, false, "table", false},
|
||||||
{"table_id", true, false, true, false, "table_id", false},
|
{"table_id", true, false, true, false, "table_id", false},
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ type MakeCode struct {
|
|||||||
|
|
||||||
func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
||||||
isMake := false
|
isMake := false
|
||||||
hasConfigFile := false
|
//hasConfigFile := false
|
||||||
idSlice := Slice{}
|
idSlice := Slice{}
|
||||||
that.FileConfig = config
|
that.FileConfig = config
|
||||||
if that.TableColumns == nil {
|
if that.TableColumns == nil {
|
||||||
@ -38,25 +38,25 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//加载配置文件
|
//加载配置文件
|
||||||
btes, err := ioutil.ReadFile(config.GetString("config"))
|
//btes, err := ioutil.ReadFile(config.GetString("config"))
|
||||||
|
var err error
|
||||||
that.Config = DeepCopyMap(Config).(Map)
|
that.Config = DeepCopyMap(Config).(Map)
|
||||||
|
|
||||||
that.Config["name"] = config.GetString("table")
|
that.Config["name"] = config.GetString("table")
|
||||||
if err == nil {
|
//if err == nil {
|
||||||
cmap := Map{}
|
// cmap := Map{}
|
||||||
//文件是否损坏
|
// //文件是否损坏
|
||||||
cmap.JsonToMap(string(btes), &that.Error)
|
// cmap.JsonToMap(string(btes), &that.Error)
|
||||||
for k, v := range cmap {
|
// for k, v := range cmap {
|
||||||
that.Config[k] = v //程序配置
|
// that.Config[k] = v //程序配置
|
||||||
//Config[k] = v //系统配置
|
// //Config[k] = v //系统配置
|
||||||
}
|
// }
|
||||||
hasConfigFile = true
|
// hasConfigFile = true
|
||||||
} else {
|
//} else {
|
||||||
|
//
|
||||||
that.Error.SetError(errors.New("config配置文件不存在,或者配置出错,使用缺省默认配置"))
|
// that.Error.SetError(errors.New("config配置文件不存在,或者配置出错,使用缺省默认配置"))
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
//加载规则文件
|
//加载规则文件
|
||||||
btesRule, errRule := ioutil.ReadFile(config.GetString("rule"))
|
btesRule, errRule := ioutil.ReadFile(config.GetString("rule"))
|
||||||
that.RuleConfig = []Map{}
|
that.RuleConfig = []Map{}
|
||||||
@ -83,7 +83,7 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
|||||||
that.Error.SetError(errors.New("rule配置文件不存在,或者配置出错,使用缺省默认配置"))
|
that.Error.SetError(errors.New("rule配置文件不存在,或者配置出错,使用缺省默认配置"))
|
||||||
}
|
}
|
||||||
|
|
||||||
//that.IndexMenus = Map{}
|
that.IndexMenus = Map{}
|
||||||
//menusConfig := that.Config.GetSlice("menus")
|
//menusConfig := that.Config.GetSlice("menus")
|
||||||
////将配置写入到内存中仅作为判断用
|
////将配置写入到内存中仅作为判断用
|
||||||
//if menusConfig != nil {
|
//if menusConfig != nil {
|
||||||
@ -384,7 +384,7 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
|||||||
|
|
||||||
//目录没有收录
|
//目录没有收录
|
||||||
//if !isMenusGet {
|
//if !isMenusGet {
|
||||||
if !hasConfigFile {
|
//if !hasConfigFile {
|
||||||
tablePrefixCode := strings.Index(fk, "_")
|
tablePrefixCode := strings.Index(fk, "_")
|
||||||
isNewPrefix := false //假定表名没有前缀
|
isNewPrefix := false //假定表名没有前缀
|
||||||
prefixName := ""
|
prefixName := ""
|
||||||
@ -433,7 +433,7 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
|||||||
that.IndexMenus[prefixName] = mMenu
|
that.IndexMenus[prefixName] = mMenu
|
||||||
that.IndexMenus[prefixName+"/"+fk] = menuIns
|
that.IndexMenus[prefixName+"/"+fk] = menuIns
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
for k, v := range fv {
|
for k, v := range fv {
|
||||||
|
|
||||||
@ -566,12 +566,28 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//写入配置文件
|
//配置文件
|
||||||
//err = json.Indent(&configByte, []byte(that.Config.ToJsonString()), "", "\t")
|
if config.GetString("configDB") != "" {
|
||||||
if !hasConfigFile {
|
|
||||||
|
that.Config["id"] = id
|
||||||
|
_ = os.MkdirAll(filepath.Dir(config.GetString("configDB")), os.ModeDir)
|
||||||
|
err = ioutil.WriteFile(config.GetString("configDB"), []byte(that.Config.ToJsonString()), os.ModePerm)
|
||||||
|
if err != nil {
|
||||||
|
that.Error.SetError(err)
|
||||||
|
}
|
||||||
|
that.Logger.Warn("新建")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//不存在配置文件则生成,存在则不管
|
||||||
|
_, err = ioutil.ReadFile(config.GetString("config"))
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
that.Config["id"] = id
|
that.Config["id"] = id
|
||||||
_ = os.MkdirAll(filepath.Dir(config.GetString("config")), os.ModeDir)
|
_ = os.MkdirAll(filepath.Dir(config.GetString("config")), os.ModeDir)
|
||||||
err = ioutil.WriteFile(config.GetString("config"), []byte(that.Config.ToJsonString()), os.ModePerm)
|
newConfig := DeepCopyMap(that.Config).(Map)
|
||||||
|
delete(newConfig, "tables")
|
||||||
|
err = ioutil.WriteFile(config.GetString("config"), []byte(newConfig.ToJsonString()), os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
that.Error.SetError(err)
|
that.Error.SetError(err)
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
},
|
},
|
||||||
"codeConfig": [
|
"codeConfig": [
|
||||||
{
|
{
|
||||||
"config": "config/app.json",
|
"config": "config/admin.json",
|
||||||
|
"configDB": "config/adminDB.json",
|
||||||
"mode": 0,
|
"mode": 0,
|
||||||
"name": "",
|
"name": "",
|
||||||
"rule": "config/rule.json",
|
"rule": "config/rule.json",
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
"注释:配置即启用,非必须,默认无",
|
"注释:配置即启用,非必须,默认无",
|
||||||
{
|
{
|
||||||
"config": "默认config/app.json,必须,接口描述配置文件",
|
"config": "默认config/app.json,必须,接口描述配置文件",
|
||||||
"mode": "默认0,非必须,0为内嵌代码模式,1为生成代码模式,在开发模式下会显示更多的数据用于开发测试,并能够辅助研发,自动生成配置文件、代码等功能,",
|
"configDB": "默认无,非必须,有则每次将数据库数据生成到此目录用于配置读写,无则不生成",
|
||||||
|
"mode": "默认0,非必须,0为内嵌代码模式,1为生成代码模式",
|
||||||
"name": "默认无,非必须,有则生成代码到此目录,无则采用缺省模式使用表名,如设置为:admin,将在admin目录生成包名为admin的代码",
|
"name": "默认无,非必须,有则生成代码到此目录,无则采用缺省模式使用表名,如设置为:admin,将在admin目录生成包名为admin的代码",
|
||||||
"rule": "默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成",
|
"rule": "默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成",
|
||||||
"table": "默认admin,必须,根据数据库内当前表名做为用户生成数据"
|
"table": "默认admin,必须,根据数据库内当前表名做为用户生成数据"
|
||||||
@ -65,7 +66,7 @@
|
|||||||
},
|
},
|
||||||
"logFile": "无默认,非必须,如果需要存储日志文件时使用,保存格式为:a/b/c/20060102150405.txt,将生成:a/b/c/年月日时分秒.txt,按需设置",
|
"logFile": "无默认,非必须,如果需要存储日志文件时使用,保存格式为:a/b/c/20060102150405.txt,将生成:a/b/c/年月日时分秒.txt,按需设置",
|
||||||
"logLevel": "默认0,必须,0关闭,1打印,日志等级",
|
"logLevel": "默认0,必须,0关闭,1打印,日志等级",
|
||||||
"mode": "默认0,非必须,0生产模式,1,测试模式,2开发模式,web无缓存,数据库不启用缓存",
|
"mode": "默认0,非必须,0生产模式,1,测试模式,2开发模式,3内嵌代码模式,在开发模式下会显示更多的数据用于开发测试,并能够辅助研发,自动生成配置文件、代码等功能,web无缓存,数据库不启用缓存",
|
||||||
"modeRouterStrict": "默认false,必须,路由严格模式false,为大小写忽略必须匹配,true必须大小写匹配",
|
"modeRouterStrict": "默认false,必须,路由严格模式false,为大小写忽略必须匹配,true必须大小写匹配",
|
||||||
"port": "默认80,必须,web服务开启Http端口,0为不启用http服务,默认80",
|
"port": "默认80,必须,web服务开启Http端口,0为不启用http服务,默认80",
|
||||||
"sessionName": "默认HOTIME,必须,设置session的cookie名",
|
"sessionName": "默认HOTIME,必须,设置session的cookie名",
|
||||||
|
3
var.go
3
var.go
@ -18,7 +18,7 @@ var Config = Map{
|
|||||||
Map{
|
Map{
|
||||||
"table": "admin", //默认admin,必须,有则根据数据库内当前表名做为用户生成数据
|
"table": "admin", //默认admin,必须,有则根据数据库内当前表名做为用户生成数据
|
||||||
"name": "", //默认admin,非必须,有则生成代码到此目录,无则采用缺省模式使用表名
|
"name": "", //默认admin,非必须,有则生成代码到此目录,无则采用缺省模式使用表名
|
||||||
"config": "config/app.json", //默认config/app.json,必须,接口描述配置文件
|
"config": "config/app.json", //默认config/app.json,必须,接口描述配置文件,无则自动生成
|
||||||
"rule": "config/rule.json", //默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成
|
"rule": "config/rule.json", //默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成
|
||||||
"mode": 0, //默认0,非必须,0为内嵌代码模式,1为生成代码模式
|
"mode": 0, //默认0,非必须,0为内嵌代码模式,1为生成代码模式
|
||||||
},
|
},
|
||||||
@ -68,6 +68,7 @@ var ConfigNote = Map{
|
|||||||
"table": "默认admin,必须,根据数据库内当前表名做为用户生成数据",
|
"table": "默认admin,必须,根据数据库内当前表名做为用户生成数据",
|
||||||
"name": "默认无,非必须,有则生成代码到此目录,无则采用缺省模式使用表名,如设置为:admin,将在admin目录生成包名为admin的代码",
|
"name": "默认无,非必须,有则生成代码到此目录,无则采用缺省模式使用表名,如设置为:admin,将在admin目录生成包名为admin的代码",
|
||||||
"config": "默认config/app.json,必须,接口描述配置文件", //
|
"config": "默认config/app.json,必须,接口描述配置文件", //
|
||||||
|
"configDB": "默认无,非必须,有则每次将数据库数据生成到此目录用于配置读写,无则不生成", //
|
||||||
"rule": "默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成",
|
"rule": "默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成",
|
||||||
"mode": "默认0,非必须,0为内嵌代码模式,1为生成代码模式",
|
"mode": "默认0,非必须,0为内嵌代码模式,1为生成代码模式",
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user