升级流程引擎配置文件版本
This commit is contained in:
@@ -247,20 +247,28 @@ var TptProject = Proj{
|
||||
}
|
||||
|
||||
conf := ObjToMap(string(btes))
|
||||
|
||||
stop := conf.GetSlice("stop")
|
||||
for k, _ := range stop {
|
||||
v := stop.GetString(k)
|
||||
//不能改对应行数据
|
||||
if tableName == v && data.GetCeilInt64(v+"_id") == ObjToCeilInt64(that.RouterString[2]) {
|
||||
that.Display(4, "你没有权限修改当前数据")
|
||||
return
|
||||
//相同则
|
||||
if tableName == fileConfig.GetString("table") {
|
||||
flows := conf.GetMap("flow")
|
||||
for k, _ := range flows {
|
||||
v := flows.GetMap(k)
|
||||
if v.GetBool("stop") {
|
||||
//不能改自身对应的数据
|
||||
if inData[k+"_id"] != nil {
|
||||
//fmt.Println(inData[k+"_id"])
|
||||
delete(inData, k+"_id")
|
||||
//fmt.Println(inData[k+"_id"])
|
||||
}
|
||||
}
|
||||
}
|
||||
//不能改自身对应的数据
|
||||
if tableName == fileConfig.GetString("table") && inData[v+"_id"] != nil {
|
||||
delete(inData, v+"_id")
|
||||
} else {
|
||||
flow := conf.GetMap("flow").GetMap(tableName)
|
||||
if flow != nil && flow.GetBool("stop") {
|
||||
if data.GetCeilInt64(tableName+"_id") == ObjToCeilInt64(that.RouterString[2]) {
|
||||
that.Display(4, "你没有权限修改当前数据")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if inData["auth"] != nil {
|
||||
@@ -392,7 +400,33 @@ var TptProject = Proj{
|
||||
tableName := that.RouterString[1]
|
||||
that.Log = Map{"table": tableName, "type": 3, "table_id": that.RouterString[2]}
|
||||
hotimeName := that.RouterString[0]
|
||||
fileConfig := that.MakeCodeRouter[hotimeName].FileConfig
|
||||
|
||||
//树状结构不允许修改自身的属性,修改别人的可以
|
||||
btes, err := ioutil.ReadFile(fileConfig.GetString("config"))
|
||||
if err != nil {
|
||||
that.Display(4, "找不到权限配置文件")
|
||||
return
|
||||
}
|
||||
|
||||
conf := ObjToMap(string(btes))
|
||||
data := that.Db.Get(fileConfig.GetString("table"), "*", Map{"id": that.Session(fileConfig.GetString("table") + "_id").ToCeilInt()})
|
||||
//相同则
|
||||
if tableName == fileConfig.GetString("table") {
|
||||
|
||||
if data.GetCeilInt64("id") == ObjToCeilInt64(that.RouterString[2]) {
|
||||
that.Display(4, "你不能删除自己")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
flow := conf.GetMap("flow").GetMap(tableName)
|
||||
if flow != nil && flow.GetBool("stop") {
|
||||
if data.GetCeilInt64(tableName+"_id") == ObjToCeilInt64(that.RouterString[2]) {
|
||||
that.Display(4, "你没有权限修改当前数据")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
re := int64(0)
|
||||
//有索引则删除对应的参数
|
||||
if that.MakeCodeRouter[hotimeName].TableColumns[tableName]["parent_id"] != nil {
|
||||
@@ -412,8 +446,51 @@ var TptProject = Proj{
|
||||
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()})
|
||||
where := Map{}
|
||||
|
||||
columnStr, leftJoin, where := that.MakeCodeRouter[hotimeName].Search(tableName, data, that.Req, that.Db)
|
||||
//树状结构不允许修改自身的属性,修改别人的可以
|
||||
btes, err := ioutil.ReadFile(fileConfig.GetString("config"))
|
||||
if err != nil {
|
||||
that.Display(4, "找不到权限配置文件")
|
||||
return
|
||||
}
|
||||
|
||||
conf := ObjToMap(string(btes))
|
||||
//相同则
|
||||
//if tableName!=fileConfig.GetString("table"){
|
||||
|
||||
flow := conf.GetMap("flow").GetMap(tableName)
|
||||
if flow != nil && flow.GetMap("sql") != nil {
|
||||
sql := ObjToMap(DeepCopyMap(flow.GetMap("sql")))
|
||||
for k, _ := range sql {
|
||||
//for uk,_:=range data{
|
||||
// if sql[uk]==nil{
|
||||
// continue
|
||||
// }
|
||||
// uv:=data.GetString(uk)
|
||||
//
|
||||
// tv:=strings.Replace(sql.GetString(uk),uk,uv,-1)
|
||||
// if tv!=uv{
|
||||
// where[k]=tv
|
||||
// break
|
||||
// }
|
||||
//}
|
||||
if k == "parent_ids[~]" && tableName == fileConfig.GetString("table") {
|
||||
where[tableName+"."+k] = strings.Replace(sql.GetString(k), "id", data.GetString("id"), -1)
|
||||
continue
|
||||
}
|
||||
if k == "parent_ids[~]" && data[tableName+"_id"] != nil {
|
||||
where[tableName+"."+k] = strings.Replace(sql.GetString(k), tableName+"_id", data.GetString(tableName+"_id"), -1)
|
||||
continue
|
||||
}
|
||||
if data[sql.GetString(k)] != nil {
|
||||
where[tableName+"."+k] = data[sql.GetString(k)]
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
columnStr, leftJoin, where := that.MakeCodeRouter[hotimeName].Search(tableName, data, where, that.Req, that.Db)
|
||||
|
||||
page := ObjToInt(that.Req.FormValue("page"))
|
||||
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
|
||||
|
||||
Reference in New Issue
Block a user