From 6fe44cb1cb9b3d9452ad761444c0de948607bcc7 Mon Sep 17 00:00:00 2001 From: hoteas <等> Date: Mon, 1 Aug 2022 16:45:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code.go | 18 ++++++++++-------- code/makecode.go | 4 ++++ db/hotimedb.go | 2 -- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/code.go b/code.go index 48b6f8e..625adef 100644 --- a/code.go +++ b/code.go @@ -711,14 +711,16 @@ var TptProject = Proj{ } for _, v := range reData { - v.RangeSort(func(k string, v1 interface{}) (isEnd bool) { + for k, _ := range v { + //v1:=v.GetMap(k) + //v.RangeSort(func(k string, v1 interface{}) (isEnd bool) { //如果有table字段则代为link if v["table"] != nil && v["table_id"] != nil { id := v.GetCeilInt64("table_id") - tableName := that.MakeCodeRouter[hotimeName].TableConfig.GetMap(v.GetString("table")).GetString("label") - v["table_table_name"] = strings.Replace(tableName, "管理", "", -1) - + tableNameLabel := that.MakeCodeRouter[hotimeName].TableConfig.GetMap(v.GetString("table")).GetString("label") + //v["table_table_name"] = strings.Replace(tableNameLabel, "管理", "", -1) + v["table_table_name"] = tableNameLabel sname := "name" if that.MakeCodeRouter[hotimeName].TableColumns[v.GetString("table")][sname] == nil { sname = "title" @@ -738,7 +740,7 @@ var TptProject = Proj{ column := that.MakeCodeRouter[hotimeName].TableColumns[tableName][k] if column == nil { - return isEnd + break } if (column["list"] == nil || column["list"] == true) && column["name"] == "parent_id" && column.GetString("link") != "" { @@ -750,8 +752,8 @@ var TptProject = Proj{ } } - return isEnd - }) + //return isEnd + } } if download == 1 { @@ -784,7 +786,7 @@ var TptProject = Proj{ } if v.GetString("name") == "table" { - f.SetCellValue(tableNameLabel, convertToTitle(n)+ObjToStr(k1+2), that.MakeCodeRouter[hotimeName].TableConfig.GetMap(v1.GetString("table")).GetString("label")) + f.SetCellValue(tableNameLabel, convertToTitle(n)+ObjToStr(k1+2), v1.GetString("table_"+v.GetString("name")+"_name")) continue } diff --git a/code/makecode.go b/code/makecode.go index 1609e30..7bd0e31 100644 --- a/code/makecode.go +++ b/code/makecode.go @@ -185,6 +185,10 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) { {"type": "search", "name": "sort", "label": "排序", "value": nil}, }, } + + if v.GetString("name") == "logs" { + that.TableConfig.GetMap(v.GetString("name"))["auth"] = []string{"show", "download"} + } } //初始化 diff --git a/db/hotimedb.go b/db/hotimedb.go index 4ebbb33..c35be85 100644 --- a/db/hotimedb.go +++ b/db/hotimedb.go @@ -6,7 +6,6 @@ import ( "database/sql" "encoding/json" "errors" - "fmt" _ "github.com/go-sql-driver/mysql" _ "github.com/mattn/go-sqlite3" "github.com/sirupsen/logrus" @@ -619,7 +618,6 @@ func (that *HoTimeDB) where(data Map) (string, []interface{}) { if v != nil && reflect.ValueOf(v).Type().String() == "common.Slice" && len(v.(Slice)) == 0 { continue } - fmt.Println(reflect.ValueOf(v).Type().String()) if v != nil && strings.Contains(reflect.ValueOf(v).Type().String(), "[]") && len(ObjToSlice(v)) == 0 { continue }