From ce656bf7a1303de38a6715e045358cc06e31df4c Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 8 Oct 2020 20:13:45 +0800 Subject: [PATCH 001/201] readme:update team --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ec76e7f7..0e6b122c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@

- [English](https://github.com/wenjianzhang/go-admin/blob/master/README.en.md) | 简体中文 + [English](https://github.com/go-admin-team/go-admin/blob/master/README.en.md) | 简体中文 ##### 基于Gin + Vue + Element UI的前后端分离权限管理系统 @@ -27,7 +27,7 @@ [在线文档国内](http://mydearzwj.gitee.io/go-admin-site/) -[前端项目](https://github.com/wenjianzhang/go-admin-ui) +[前端项目](https://github.com/go-admin-team/go-admin-ui) [视频教程](https://space.bilibili.com/565616721/channel/detail?cid=125737) @@ -128,10 +128,10 @@ cd goadmin ```bash # 获取后端代码 -git clone https://github.com/wenjianzhang/go-admin.git +git clone https://github.com/go-admin-team/go-admin.git # 获取前端代码 -git clone https://github.com/wenjianzhang/go-admin-ui.git +git clone https://github.com/go-admin-team/go-admin-ui.git ``` @@ -258,7 +258,7 @@ zhuqiyun LLL狐 星星之火 cjj770 Sam 唐*i 晓聪 aLong *渊 海马 魏镇坪 ## 🔑 License -[MIT](https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md) +[MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md) Copyright (c) 2020 wenjianzhang From faa8de7dc2783766a2b0fae26825463fbff0946f Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 9 Oct 2020 16:15:51 +0800 Subject: [PATCH 002/201] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=80=BC=EF=BC=8Clevel=E5=80=BC?= =?UTF-8?q?=E4=B8=8D=E8=A2=AB=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/apis/api.go | 6 +++--- logger/logger.go | 2 +- tools/app/return.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/apis/api.go b/common/apis/api.go index db4868d0..59ffbe62 100644 --- a/common/apis/api.go +++ b/common/apis/api.go @@ -27,7 +27,7 @@ func (e *Api) Error(c *gin.Context, code int, err error, msg string) { res.Msg = msg } res.RequestId = tools.GenerateMsgIDFromContext(c) - c.JSON(http.StatusOK, res.ReturnError(code)) + c.AbortWithStatusJSON(http.StatusOK, res.ReturnError(code)) } // OK 通常成功数据处理 @@ -38,7 +38,7 @@ func (e *Api) OK(c *gin.Context, data interface{}, msg string) { res.Msg = msg } res.RequestId = tools.GenerateMsgIDFromContext(c) - c.JSON(http.StatusOK, res.ReturnOK()) + c.AbortWithStatusJSON(http.StatusOK, res.ReturnOK()) } // PageOK 分页数据处理 @@ -53,5 +53,5 @@ func (e *Api) PageOK(c *gin.Context, result interface{}, count int, pageIndex in // Custom 兼容函数 func (e *Api) Custom(c *gin.Context, data gin.H) { - c.JSON(http.StatusOK, data) + c.AbortWithStatusJSON(http.StatusOK, data) } diff --git a/logger/logger.go b/logger/logger.go index ad3b41a1..627f1ba9 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -3,7 +3,7 @@ package logger var ( // Default logger - DefaultLogger Logger = NewHelper(NewLogger()) + DefaultLogger Logger ) // Logger is a generic logging interface diff --git a/tools/app/return.go b/tools/app/return.go index 2e2aded9..94a05a4c 100644 --- a/tools/app/return.go +++ b/tools/app/return.go @@ -18,7 +18,7 @@ func Error(c *gin.Context, code int, err error, msg string) { res.Msg = msg } res.RequestId = tools.GenerateMsgIDFromContext(c) - c.JSON(http.StatusOK, res.ReturnError(code)) + c.AbortWithStatusJSON(http.StatusOK, res.ReturnError(code)) } // 通常成功数据处理 @@ -29,7 +29,7 @@ func OK(c *gin.Context, data interface{}, msg string) { res.Msg = msg } res.RequestId = tools.GenerateMsgIDFromContext(c) - c.JSON(http.StatusOK, res.ReturnOK()) + c.AbortWithStatusJSON(http.StatusOK, res.ReturnOK()) } // 分页数据处理 @@ -44,5 +44,5 @@ func PageOK(c *gin.Context, result interface{}, count int, pageIndex int, pageSi // 兼容函数 func Custum(c *gin.Context, data gin.H) { - c.JSON(http.StatusOK, data) + c.AbortWithStatusJSON(http.StatusOK, data) } From 7db918c495e2e3d7f20b187b6b99b51317caa1d8 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 9 Oct 2020 16:46:04 +0800 Subject: [PATCH 003/201] =?UTF-8?q?readme=EF=BC=9Aupdate=20msg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0e6b122c..603e04d3 100644 --- a/README.md +++ b/README.md @@ -159,11 +159,11 @@ vi ./config/setting.yml #### 初始化数据库,以及服务启动 ``` # 首次配置需要初始化数据库资源信息 -./go-admin migrate -c config/settings.yml -m dev +./go-admin migrate -c config/settings.yml # 启动项目,也可以用IDE进行调试 -./go-admin server -c config/settings.yml -p 8000 -m dev +./go-admin server -c config/settings.yml -p 8000 ``` From 3b5ce7ffaf7c55a51d8809345c17c131378bf4b5 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 9 Oct 2020 17:46:16 +0800 Subject: [PATCH 004/201] bug:fix tpl gen bug (#248) --- app/admin/apis/tools/gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/apis/tools/gen.go b/app/admin/apis/tools/gen.go index 50a4576d..a96cfda2 100644 --- a/app/admin/apis/tools/gen.go +++ b/app/admin/apis/tools/gen.go @@ -21,7 +21,7 @@ func Preview(c *gin.Context) { table.TableId = id t1, err := template.ParseFiles("template/v3/model.go.template") tools2.HasError(err, "", -1) - t2, err := template.ParseFiles("template/v3/no_actions/api.go.template") + t2, err := template.ParseFiles("template/v3/no_actions/apis.go.template") tools2.HasError(err, "", -1) t3, err := template.ParseFiles("template/v3/js.go.template") tools2.HasError(err, "", -1) @@ -29,7 +29,7 @@ func Preview(c *gin.Context) { tools2.HasError(err, "", -1) t5, err := template.ParseFiles("template/v3/no_actions/router_check_role.go.template") tools2.HasError(err, "", -1) - t6, err := template.ParseFiles("template/v3/no_actions/dto.go.template") + t6, err := template.ParseFiles("template/v3/dto.go.template") tools2.HasError(err, "", -1) tab, _ := table.Get() var b1 bytes.Buffer From 4741137c9a57a706e3221817f103e27b91e26b45 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 9 Oct 2020 19:32:08 +0800 Subject: [PATCH 005/201] =?UTF-8?q?=E6=95=B4=E5=90=88gorm=E7=9A=84log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/database/mysql_drive.go | 15 +++++++++------ common/database/pgsql_driver.go | 15 +++++++++------ logger/level.go | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/common/database/mysql_drive.go b/common/database/mysql_drive.go index fa83e47a..6ed0b294 100644 --- a/common/database/mysql_drive.go +++ b/common/database/mysql_drive.go @@ -3,7 +3,6 @@ package database import ( "database/sql" "log" - "os" "time" "gorm.io/driver/mysql" @@ -13,6 +12,7 @@ import ( "go-admin/common/config" "go-admin/common/global" + goAdminLogger "go-admin/logger" "go-admin/tools" toolsConfig "go-admin/tools/config" ) @@ -47,11 +47,14 @@ func (e *Mysql) Setup() { } if toolsConfig.LoggerConfig.EnabledDB { - global.Eloquent.Logger = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), logger.Config{ - SlowThreshold: time.Second, - Colorful: true, - LogLevel: logger.Info, - }) + global.Eloquent.Logger = logger.New( + log.New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", log.LstdFlags), + logger.Config{ + SlowThreshold: time.Second, + Colorful: true, + LogLevel: logger.LogLevel( + goAdminLogger.DefaultLogger.Options().Level.LevelForGorm()), + }) } } diff --git a/common/database/pgsql_driver.go b/common/database/pgsql_driver.go index e3980e13..e6b0c0bb 100644 --- a/common/database/pgsql_driver.go +++ b/common/database/pgsql_driver.go @@ -3,7 +3,6 @@ package database import ( "database/sql" "log" - "os" "time" "gorm.io/driver/postgres" @@ -13,6 +12,7 @@ import ( "go-admin/common/config" "go-admin/common/global" + goAdminLogger "go-admin/logger" "go-admin/tools" toolsConfig "go-admin/tools/config" ) @@ -49,11 +49,14 @@ func (e *PgSql) Setup() { } if toolsConfig.LoggerConfig.EnabledDB { - global.Eloquent.Logger = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), logger.Config{ - SlowThreshold: time.Second, - Colorful: true, - LogLevel: logger.Info, - }) + global.Eloquent.Logger = logger.New( + log.New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", log.LstdFlags), + logger.Config{ + SlowThreshold: time.Second, + Colorful: true, + LogLevel: logger.LogLevel( + goAdminLogger.DefaultLogger.Options().Level.LevelForGorm()), + }) } } diff --git a/logger/level.go b/logger/level.go index 915f0d47..14bca250 100644 --- a/logger/level.go +++ b/logger/level.go @@ -41,6 +41,20 @@ func (l Level) String() string { return "" } +// LevelForGorm 转换成gorm日志级别 +func (l Level) LevelForGorm() int { + switch l { + case FatalLevel, ErrorLevel: + return 2 + case WarnLevel: + return 3 + case InfoLevel, DebugLevel, TraceLevel: + return 4 + default: + return 1 + } +} + // Enabled returns true if the given level is at or above this level. func (l Level) Enabled(lvl Level) bool { return lvl >= l From 1e8544f1cea62c89de9e75ac70564b4584c8a4d3 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Mon, 12 Oct 2020 20:15:28 +0800 Subject: [PATCH 006/201] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=99=90=E6=B5=81?= =?UTF-8?q?=EF=BC=8C200QPS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/router/initrouter.go | 9 +- common/middleware/sentinel.go | 23 ++ go.mod | 5 +- go.sum | 393 ++++++++++++++++++++++++++++++++- 4 files changed, 422 insertions(+), 8 deletions(-) create mode 100644 common/middleware/sentinel.go diff --git a/app/admin/router/initrouter.go b/app/admin/router/initrouter.go index 2ed811f4..8bc82ed7 100644 --- a/app/admin/router/initrouter.go +++ b/app/admin/router/initrouter.go @@ -1,15 +1,18 @@ package router import ( - "github.com/gin-gonic/gin" + "os" + "go-admin/app/admin/middleware" "go-admin/app/admin/middleware/handler" "go-admin/common/global" "go-admin/common/log" + common "go-admin/common/middleware" _ "go-admin/pkg/jwtauth" "go-admin/tools" "go-admin/tools/config" - "os" + + "github.com/gin-gonic/gin" ) func InitRouter() { @@ -30,6 +33,8 @@ func InitRouter() { r.Use(handler.TlsHandler()) } r.Use(middleware.WithContextDb(middleware.GetGormFromConfig(global.Cfg))) + + r.Use(common.Sentinel()) middleware.InitMiddleware(r) // the jwt middleware var err error diff --git a/common/middleware/sentinel.go b/common/middleware/sentinel.go new file mode 100644 index 00000000..f10cdfc0 --- /dev/null +++ b/common/middleware/sentinel.go @@ -0,0 +1,23 @@ +package middleware + +import ( + sentinelPlugin "github.com/alibaba/sentinel-golang/adapter/gin" + "github.com/alibaba/sentinel-golang/core/system" + "github.com/gin-gonic/gin" + + "go-admin/common/log" +) + +// Sentinel 限流 +func Sentinel() gin.HandlerFunc { + if _, err := system.LoadRules([]*system.Rule{ + { + MetricType: system.InboundQPS, + TriggerCount: 200, + Strategy: system.BBR, + }, + }); err != nil { + log.Fatalf("Unexpected error: %+v", err) + } + return sentinelPlugin.SentinelMiddleware() +} diff --git a/go.mod b/go.mod index caa3eb7a..4f72913e 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,12 @@ module go-admin go 1.14 require ( - github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 + github.com/alibaba/sentinel-golang v0.6.1 github.com/casbin/casbin/v2 v2.11.2 github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-ole/go-ole v1.2.4 // indirect github.com/go-redis/redis/v7 v7.4.0 github.com/go-sql-driver/mysql v1.5.0 github.com/gogf/gf v1.13.4 @@ -31,9 +30,7 @@ require ( github.com/swaggo/gin-swagger v1.2.0 github.com/swaggo/swag v1.6.7 github.com/unrolled/secure v1.0.8 - go.uber.org/multierr v1.5.0 // indirect golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a - gopkg.in/ffmt.v1 v1.5.6 gorm.io/driver/mysql v0.3.2 gorm.io/driver/postgres v0.2.9 gorm.io/driver/sqlite v1.0.9 diff --git a/go.sum b/go.sum index 3f614562..8d60a14e 100644 --- a/go.sum +++ b/go.sum @@ -5,75 +5,168 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/AlecAivazis/survey/v2 v2.0.5/go.mod h1:WYBhg6f0y/fNYUuesWQc0PKbJcEliGcYHB9sNT3Bg74= +github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= +github.com/Azure/go-autorest/autorest v0.5.0/go.mod h1:9HLKlQjVBH6U3oDfsXOeVc56THsLPw1L03yban4xThw= +github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= +github.com/Azure/go-autorest/autorest/adal v0.2.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= +github.com/Azure/go-autorest/autorest/azure/auth v0.1.0/go.mod h1:Gf7/i2FUpyb/sGBLIFxTBzrNzBo7aPXXE3ZVeDRwdpM= +github.com/Azure/go-autorest/autorest/azure/cli v0.1.0/go.mod h1:Dk8CUAt/b/PzkfeRsWzVG9Yj3ps8mS8ECztu43rdU8U= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocmRAJWqST1wQYhyyjXJ3SJc= +github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= +github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= +github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c/go.mod h1:7xhjOwRV2+0HXGmM0jxaEu+ZiXJFoVZOTfL/dmqbrD8= +github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks= github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.0/go.mod h1:zpDJeKyp9ScW4NNrbdr+Eyxvry3ilGPewKoXw3XGN1k= +github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE= +github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alibaba/sentinel-golang v0.6.1 h1:Pxyw2X7ryklvToF40KG9l4uuO90jRZA2MWb8Z3d1wPo= +github.com/alibaba/sentinel-golang v0.6.1/go.mod h1:5jemKdyCQCKVf+quEia53fo9a17OSe+wnl9HX2NbNpc= +github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190808125512-07798873deee/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ= +github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk= +github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= +github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= +github.com/caddyserver/certmagic v0.10.6/go.mod h1:Y8jcUBctgk/IhpAzlHKfimZNyXCkfGgRTC0orl8gROQ= github.com/casbin/casbin/v2 v2.2.2/go.mod h1:XXtYGrs/0zlOsJMeRteEdVi/FsB0ph7KgNfjoCoJUD8= github.com/casbin/casbin/v2 v2.11.2 h1:kdJ3ZMfPtz6uzKwAaW4G4NIld0U2KeHrgFcEhi40evc= github.com/casbin/casbin/v2 v2.11.2/go.mod h1:XXtYGrs/0zlOsJMeRteEdVi/FsB0ph7KgNfjoCoJUD8= github.com/casbin/gorm-adapter/v3 v3.0.2 h1:4F2VFElwPyFzvHfgwizD2JQxk2OFLwvRFZct1np0yBg= github.com/casbin/gorm-adapter/v3 v3.0.2/go.mod h1:mQI09sqvXfy5p6kZB5HBzZrgKWwxaJ4xMWpd5OGfHRY= +github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= +github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= +github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28 h1:LdXxtjzvZYhhUaonAaAKArG3pyC67kGL3YY+6hGG8G4= github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= +github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= +github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.18+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.25+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= +github.com/dnaeon/go-vcr v0.0.0-20180814043457-aafff18a5cc2/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/dnsimple/dnsimple-go v0.30.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg= +github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/ef-ds/deque v1.0.4-0.20190904040645-54cb57c252a1/go.mod h1:HvODWzv6Y6kBf3Ah2WzN1bHjDUezGLaAhwuWVwfpEJs= +github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= +github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= +github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pFdJbAhRf7rh6YYMUdIQGyzne6zYL1tCUW8QV2B3UfY= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -81,13 +174,26 @@ github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= +github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0 h1:rdQovo0JtjoBTUQzzrTqnXxxFi4etuhvXrUZHwI9z7w= github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= +github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= +github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= +github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= +github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -105,9 +211,12 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= @@ -120,30 +229,54 @@ github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRf github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogf/gf v1.13.4 h1:+IWX/L/SNYjwp9C0tXABZ8vJfYaFKyx0cTAb2DE2a1Y= github.com/gogf/gf v1.13.4/go.mod h1:dGX0/BElXDBYbdJGascqfrWScj8IMeOietDjVD6/5Fc= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -153,25 +286,43 @@ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gqcn/structs v1.1.1 h1:cyzGRwfmn3d1d54fwW3KUNyG9QxR0ldIeqwFGeBt638= github.com/gqcn/structs v1.1.1/go.mod h1:/aBhTBSsKQ2Ec9pbnYdGphtdWXHFn4KrCL0fXM/Adok= +github.com/grokify/html-strip-tags-go v0.0.0-20190921062105-daaa06bf1aaf h1:wIOAyJMMen0ELGiFzlmqxdcV1yGbkyHBAB6PolcNbLA= github.com/grokify/html-strip-tags-go v0.0.0-20190921062105-daaa06bf1aaf/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= +github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -179,15 +330,23 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= +github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= +github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -206,6 +365,7 @@ github.com/jackc/pgconn v1.6.4 h1:S7T6cx5o2OqmxdHaXLH1ZeD1SbI8jBznyYE9Ec0RCQ8= github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= @@ -246,37 +406,66 @@ github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0f github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E= github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/kolo/xmlrpc v0.0.0-20190717152603-07c4ee3fd181/go.mod h1:o03bZfuBwAXHetKXuInt4S7omeXUu62/A845kiycsSQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= +github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= +github.com/labstack/echo/v4 v4.1.15/go.mod h1:GWO5IBVzI371K8XJe50CSvHjQCafK6cw8R/moLhEU6o= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570/go.mod h1:BLt8L9ld7wVsvEWQbuLrUZnCMnUmLZ+CGDzKtclrTlE= +github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f/go.mod h1:UGmTpUd3rjbtfIpwAPrcfmGf/Z1HS95TATB+m57TPB8= +github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPpsiPUEh0zFL1Snz4crhMlBe60PYxRHr5oFF3rRYg0= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA= +github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ= +github.com/lucas-clemente/quic-go v0.14.1/go.mod h1:Vn3/Fb0/77b02SGhQk36KzOUmXgVpFfizUfW5WMaqyU= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -284,6 +473,9 @@ github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/marten-seemann/chacha20 v0.2.0/go.mod h1:HSdjFau7GzYRj+ahFNwsO3ouVJr1HFkWoEwNDb4TMtE= +github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= +github.com/marten-seemann/qtls v0.4.1/go.mod h1:pxVXcHHw1pNIt8Qo0pwSYQEoZ8yYOOPXTCZLQQunvRc= github.com/matchstalk/go-admin-core v1.2.0 h1:yk8bnH7dVGDgyEliG2MchSyupdh24wc0sDUrxnu8sGY= github.com/matchstalk/go-admin-core v1.2.0/go.mod h1:iCxDnmPHR3+d/5Q+yrdt+QBXhmWhbj7+GeHcUjD9Rn8= github.com/matchstalk/redisqueue v1.0.3 h1:ZRrEhnvA6/YxLu2EbzdZYeQHQQYT8yZBAi1qv/USEQA= @@ -292,6 +484,7 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -299,20 +492,34 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= +github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/goveralls v0.0.5 h1:spfq8AyZ0cCk57Za6/juJ5btQxeE1FaEGMdfcI+XO48= github.com/mattn/goveralls v0.0.5/go.mod h1:Xg2LHi51faXLyKXwsndxiW6uxEEQT9+3sjGzzwU4xy0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= +github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= @@ -325,35 +532,86 @@ github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0= github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY= +github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mssola/user_agent v0.5.2 h1:CZkTUahjL1+OcZ5zv3kZr8QiJ8jy2H08vZIEkBeRbxo= github.com/mssola/user_agent v0.5.2/go.mod h1:TTPno8LPY3wAIEKRpAtkdMT0f8SE24pLRGPahjCH4uw= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nacos-group/nacos-sdk-go v1.0.0/go.mod h1:hlAPn3UdzlxIlSILAyOXKxjFSvDJ9oLzTJ9hLAK1KzA= +github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.6/go.mod h1:BL1NOtaBQ5/y97djERRVWNouMW7GT3gxnmbE/eC8u8A= +github.com/nats-io/nats.go v1.9.2/go.mod h1:AjGArbfyR50+afOUotNX2Xs5SYHf+CoOa5HH1eEl2HE= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk= +github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw= +github.com/nrdcg/dnspod-go v0.4.0/go.mod h1:vZSoFSFeQVm2gWLMkyX61LZ8HI3BaqtHZWgPTGKr6KQ= +github.com/nrdcg/goinwx v0.6.1/go.mod h1:XPiut7enlbEdntAqalBIqcYcTEVhpv/dKWgDCX2SwKQ= +github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= +github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ= +github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKcyumwBO6qip7RNQ5r77yrssm9bfCowcLEBcU5IA= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -361,24 +619,34 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shamsher31/goimgext v1.0.0 h1:wFKf9GeeE0Xr6UQtliaPgYYgTju2izobM7XpCEgUCC8= github.com/shamsher31/goimgext v1.0.0/go.mod h1:rYLKgXuTGBIaH49z+jUVSWz7gUWIZmqvYUsdvJbNNOc= github.com/shamsher31/goimgtype v1.0.0 h1:7nmPz5GEb01sjFUojCbZJcBI68A8tmLXoCFbb5I34u4= github.com/shamsher31/goimgtype v1.0.0/go.mod h1:OZm3NZQDbK0ezlk9IV5oq3cWQwjF1oVSxKNx19bkf64= +github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w= github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -398,11 +666,13 @@ github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -412,8 +682,17 @@ github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05 github.com/swaggo/swag v1.5.1/go.mod h1:1Bl9F/ZBpVWh22nY0zmYyASPO1lI/zIwRDrpZU+tv8Y= github.com/swaggo/swag v1.6.7 h1:e8GC2xDllJZr3omJkm9YfmK0Y56+rMO3cg0JBKNz09s= github.com/swaggo/swag v1.6.7/go.mod h1:xDhTyuFIujYiN3DKWC/H/83xcfHp+UE/IzWWampG7Zc= +github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ= +github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog= +github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7/go.mod h1:imsgLplxEC/etjIhdr3dNzV3JeT27LbVu5pYWm0JCBY= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE= +github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY= +github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY= github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8= +github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= @@ -424,37 +703,70 @@ github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/unrolled/secure v1.0.8 h1:JaMvKbe4CRt8oyxVXn+xY+6jlqd7pyJNSVkmsBxxQsM= github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8p0BXDPI= +github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.3 h1:FpNT6zq26xNpHZy08emi755QwzLPs6Pukqjlc7RfOMU= github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/fasttemplate v1.1.0/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA= +github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/ratelimit v0.0.0-20180316092928-c15da0234277/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -463,6 +775,7 @@ golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= @@ -474,12 +787,16 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -489,7 +806,9 @@ golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190228165749-92fc7df08ae7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -499,11 +818,17 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191027093000-83d349e8ac1a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM= golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -514,6 +839,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -521,8 +848,11 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -530,19 +860,30 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -552,8 +893,12 @@ golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -563,6 +908,7 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -576,24 +922,33 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200113040837-eac381796e91 h1:OOkytthzFBKHY5EfEgLUabprb0LtJVkQtNxAQ02+UE4= golang.org/x/tools v0.0.0-20200113040837-eac381796e91/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b h1:zSzQJAznWxAh9fZxiPy2FZo+ZZEYoYFYYDYdOrU7AaM= +golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -602,33 +957,63 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/AlecAivazis/survey.v1 v1.8.8 h1:5UtTowJZTz1j7NxVzDGKTz6Lm9IWm8DDF6b7a2wq9VY= gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ffmt.v1 v1.5.6 h1:4Bu3riZp5sAIXW2T/18JM9BkwJLodurXFR0f7PXp+cw= gopkg.in/ffmt.v1 v1.5.6/go.mod h1:LssvGOZFiBGoBcobkTqnyh+uN1VzIRoibW+c0JI/Ha4= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/kyokomi/emoji.v1 v1.5.1 h1:beetH5mWDMzFznJ+Qzd5KVHp79YKhVUMcdO8LpRLeGw= gopkg.in/kyokomi/emoji.v1 v1.5.1/go.mod h1:N9AZ6hi1jHOPn34PsbpufQZUcKftSD7WgS2pgpmH4Lg= +gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiVLxyifmMBrBIuCWFBPYKbRssXB9z67Hw= +gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v0.3.0 h1:LPEy7sEsoZHSPiUk9ySGJLEmWQfbj7MWqE4sTwG7nx4= gorm.io/driver/mysql v0.3.0/go.mod h1:A7H1JD9dKdcjeUTpTuWKEC+E1a74qzW7/zaXqKaTbfM= @@ -638,6 +1023,7 @@ gorm.io/driver/postgres v0.2.6 h1:hoE6SzA5wKOo6AYxz2V7ooxnzD6S6ToLAHHDDawt+b0= gorm.io/driver/postgres v0.2.6/go.mod h1:AsPyuhKFOplSmQwOPsycVKbe0dRxF8v18KZ7p9i8dIs= gorm.io/driver/postgres v0.2.9 h1:oMY4f4tLEUVg3eapqHFzVEplWKy1Gj1cGBEe9wJ1yWM= gorm.io/driver/postgres v0.2.9/go.mod h1:YATpayFLKALuiVXVRNbDfoEJwECHSMYzl1SmXJ2+CIg= +gorm.io/driver/sqlite v1.0.9 h1:rqOPFRPY3U5fL5AZSDVa9Np+XpkUbxLVmvpG+i1VHjg= gorm.io/driver/sqlite v1.0.9/go.mod h1:xkm8/CEmA3yc4zRd0pdCqm43BjO8Hm6avfTpxWb/7c4= gorm.io/driver/sqlserver v0.2.4 h1:AGofGL/TfzTZotzIHlaLISfxEKJpzj0ATbtXJW+ga1A= gorm.io/driver/sqlserver v0.2.4/go.mod h1:TcPfkdce5b8qlCMgyUeUdm7HQa1ZzWUuxzI+odcueLA= @@ -645,12 +1031,15 @@ gorm.io/gorm v0.2.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v0.2.19/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v0.2.23/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v0.2.36/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= -gorm.io/gorm v0.2.38 h1:zHrkh0Xckf78itpEmA4MdjgU9HcelE3gG5FeEb+MQYM= -gorm.io/gorm v0.2.38/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.20.1 h1:+hOwlHDqvqmBIMflemMVPLJH7tZYK4RxFDBHEfJTup0= gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= From d1d545b29c99ba85a10b426d5024628c624095ac Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 13 Oct 2020 22:19:59 +0800 Subject: [PATCH 007/201] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8Dhttpjob?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E8=B0=83=E7=94=A8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/jobbase.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/jobs/jobbase.go b/app/jobs/jobbase.go index 2555dc80..d2e20475 100644 --- a/app/jobs/jobbase.go +++ b/app/jobs/jobbase.go @@ -44,7 +44,11 @@ func (e *ExecJob) Run() { global.JobLogger.Warning(" ExecJob Run job nil", e) return } - CallExec(obj.(JobsExec), e.Args) + err := CallExec(obj.(JobsExec), e.Args) + if err != nil { + // 如果失败暂停一段时间重试 + fmt.Println(time.Now().Format(timeFormat), " [ERROR] mission failed! ", err) + } // 结束时间 endTime := time.Now() @@ -54,6 +58,7 @@ func (e *ExecJob) Run() { //str := time.Now().Format(timeFormat) + " [INFO] JobCore " + string(e.EntryId) + "exec success , spend :" + latencyTime.String() //ws.SendAll(str) global.JobLogger.Info(time.Now().Format(timeFormat), " [INFO] JobCore ", e, "exec success , spend :", latencyTime) + return } //http 任务接口 @@ -61,19 +66,21 @@ func (h *HttpJob) Run() { startTime := time.Now() var count = 0 + var err error + var str string /* 循环 */ LOOP: if count < retryCount { /* 跳过迭代 */ - str, err := pkg.Get(h.InvokeTarget) + str, err = pkg.Get(h.InvokeTarget) if err != nil { // 如果失败暂停一段时间重试 fmt.Println(time.Now().Format(timeFormat), " [ERROR] mission failed! ", err) - fmt.Printf(time.Now().Format(timeFormat)+" [INFO] Retry after the task fails %d seconds! %s \n", time.Duration(count)*time.Second, str) - time.Sleep(time.Duration(count) * time.Second) + fmt.Printf(time.Now().Format(timeFormat)+" [INFO] Retry after the task fails %d seconds! %s \n", (count+1)*5, str) + time.Sleep(time.Duration(count+1) * 5 * time.Second) + count = count + 1 goto LOOP } - count = count + 1 } // 结束时间 endTime := time.Now() @@ -83,6 +90,7 @@ LOOP: //TODO: 待完善部分 global.JobLogger.Info(time.Now().Format(timeFormat), " [INFO] JobCore ", h, "exec success , spend :", latencyTime) + return } // 初始化 From 21603d5a4c57990c38cc079c3fa221446b9ce3c5 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 14 Oct 2020 11:42:01 +0800 Subject: [PATCH 008/201] =?UTF-8?q?=E4=BC=98=E5=8C=96sysconfig=20=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/sys_config/sys_config.go | 43 +++++ app/admin/apis/system/config.go | 149 ------------------ app/admin/models/config.go | 134 ---------------- app/admin/models/sys_config.go | 30 ++++ app/admin/router/sys_config.go | 37 +++++ app/admin/router/sysrouter.go | 21 +-- app/admin/service/dto/sys_config.go | 93 +++++++++++ app/admin/service/sys_config.go | 27 ++++ .../version/1599190683670_migrate.go | 8 +- .../version/1602644950000_migrate.go | 27 ++++ 10 files changed, 262 insertions(+), 307 deletions(-) create mode 100644 app/admin/apis/sys_config/sys_config.go delete mode 100644 app/admin/apis/system/config.go delete mode 100644 app/admin/models/config.go create mode 100644 app/admin/models/sys_config.go create mode 100644 app/admin/router/sys_config.go create mode 100644 app/admin/service/dto/sys_config.go create mode 100644 app/admin/service/sys_config.go create mode 100644 cmd/migrate/migration/version/1602644950000_migrate.go diff --git a/app/admin/apis/sys_config/sys_config.go b/app/admin/apis/sys_config/sys_config.go new file mode 100644 index 00000000..1b9c4a5d --- /dev/null +++ b/app/admin/apis/sys_config/sys_config.go @@ -0,0 +1,43 @@ +package sys_config + +import ( + "github.com/gin-gonic/gin" + + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + "go-admin/tools" + "go-admin/tools/app" +) + +type SysConfig struct { + apis.Api +} + +// GetSysConfigByKEYForService 根据Key获取SysConfig的Service +func (e *SysConfig) GetSysConfigByKEYForService(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + db, err := e.GetOrm(c) + if err != nil { + log.Errorf("msgID[%s] error:%s", msgID, err) + app.Error(c, 500, err, "") + return + } + var v dto.SysConfigControl + err = c.Bind(&v) + if err != nil { + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") + return + } + s := service.SysConfig{} + s.MsgID = msgID + s.Orm = db + err = s.GetSysConfigByKEY(&v) + if err != nil { + app.Error(c, 500, err, "") + return + } + app.OK(c, v, s.Msg) +} diff --git a/app/admin/apis/system/config.go b/app/admin/apis/system/config.go deleted file mode 100644 index 9a07a63b..00000000 --- a/app/admin/apis/system/config.go +++ /dev/null @@ -1,149 +0,0 @@ -package system - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" - "go-admin/tools/app/msg" -) - -// @Summary 配置列表数据 -// @Description 获取JSON -// @Tags 配置 -// @Param configKey query string false "configKey" -// @Param configName query string false "configName" -// @Param configType query string false "configType" -// @Param pageSize query int false "页条数" -// @Param pageIndex query int false "页码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/configList [get] -// @Security Bearer -func GetConfigList(c *gin.Context) { - var data models.SysConfig - var err error - var pageSize = 10 - var pageIndex = 1 - - if size := c.Request.FormValue("pageSize"); size != "" { - pageSize, err = tools.StringToInt(size) - } - - if index := c.Request.FormValue("pageIndex"); index != "" { - pageIndex, err = tools.StringToInt(index) - } - - data.ConfigKey = c.Request.FormValue("configKey") - data.ConfigName = c.Request.FormValue("configName") - data.ConfigType = c.Request.FormValue("configType") - data.DataScope = tools.GetUserIdStr(c) - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - var mp = make(map[string]interface{}, 3) - mp["list"] = result - mp["count"] = count - mp["pageIndex"] = pageIndex - mp["pageSize"] = pageSize - - var res app.Response - res.Data = mp - - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 获取配置 -// @Description 获取JSON -// @Tags 配置 -// @Param configId path int true "配置编码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/config/{configId} [get] -// @Security Bearer -func GetConfig(c *gin.Context) { - var Config models.SysConfig - Config.ConfigId, _ = tools.StringToInt(c.Param("configId")) - result, err := Config.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - var res app.Response - res.Data = result - - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 获取配置 -// @Description 获取JSON -// @Tags 配置 -// @Param configKey path int true "configKey" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/configKey/{configKey} [get] -// @Security Bearer -func GetConfigByConfigKey(c *gin.Context) { - var Config models.SysConfig - Config.ConfigKey = c.Param("configKey") - result, err := Config.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - app.OK(c, result, result.ConfigValue) -} - -// @Summary 添加配置 -// @Description 获取JSON -// @Tags 配置 -// @Accept application/json -// @Product application/json -// @Param data body models.SysConfig true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/dict/data [post] -// @Security Bearer -func InsertConfig(c *gin.Context) { - var data models.SysConfig - err := c.BindWith(&data, binding.JSON) - data.CreateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - - app.OK(c, result, "") -} - -// @Summary 修改配置 -// @Description 获取JSON -// @Tags 配置 -// @Accept application/json -// @Product application/json -// @Param data body models.SysConfig true "body" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/config [put] -// @Security Bearer -func UpdateConfig(c *gin.Context) { - var data models.SysConfig - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "数据解析失败", -1) - data.UpdateBy = tools.GetUserIdStr(c) - result, err := data.Update(data.ConfigId) - tools.HasError(err, "", -1) - app.OK(c, result, "") -} - -// @Summary 删除配置 -// @Description 删除数据 -// @Tags 配置 -// @Param configId path int true "configId" -// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" -// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" -// @Router /api/v1/config/{configId} [delete] -func DeleteConfig(c *gin.Context) { - var data models.SysConfig - data.UpdateBy = tools.GetUserIdStr(c) - IDS := tools.IdsStrToIdsIntGroup("configId", c) - result, err := data.BatchDelete(IDS) - tools.HasError(err, "修改失败", 500) - app.OK(c, result, msg.DeletedSuccess) -} diff --git a/app/admin/models/config.go b/app/admin/models/config.go deleted file mode 100644 index d41cd6c3..00000000 --- a/app/admin/models/config.go +++ /dev/null @@ -1,134 +0,0 @@ -package models - -import ( - "errors" - _ "time" - - orm "go-admin/common/global" - "go-admin/tools" -) - -type SysConfig struct { - ConfigId int `json:"configId" gorm:"primary_key;auto_increment;"` //编码 - ConfigName string `json:"configName" gorm:"size:128;"` //参数名称 - ConfigKey string `json:"configKey" gorm:"size:128;"` //参数键名 - ConfigValue string `json:"configValue" gorm:"size:255;"` //参数键值 - ConfigType string `json:"configType" gorm:"size:64;"` //是否系统内置 - Remark string `json:"remark" gorm:"size:128;"` //备注 - CreateBy string `json:"createBy" gorm:"size:128;"` - UpdateBy string `json:"updateBy" gorm:"size:128;"` - BaseModel - - DataScope string `json:"dataScope" gorm:"-"` - Params string `json:"params" gorm:"-"` -} - -func (SysConfig) TableName() string { - return "sys_config" -} - -// Config 创建 -func (e *SysConfig) Create() (SysConfig, error) { - var doc SysConfig - var i int64 - orm.Eloquent.Table(e.TableName()).Where("config_name=? or config_key = ?", e.ConfigName, e.ConfigKey).Count(&i) - if i > 0 { - return doc, errors.New("参数名称或者参数键名已经存在!") - } - - result := orm.Eloquent.Table(e.TableName()).Create(&e) - if result.Error != nil { - err := result.Error - return doc, err - } - doc = *e - return doc, nil -} - -// 获取 Config -func (e *SysConfig) Get() (SysConfig, error) { - var doc SysConfig - - table := orm.Eloquent.Table(e.TableName()) - if e.ConfigId != 0 { - table = table.Where("config_id = ?", e.ConfigId) - } - - if e.ConfigKey != "" { - table = table.Where("config_key = ?", e.ConfigKey) - } - - if err := table.First(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -func (e *SysConfig) GetPage(pageSize int, pageIndex int) ([]SysConfig, int, error) { - var doc []SysConfig - - table := orm.Eloquent.Table(e.TableName()) - - if e.ConfigName != "" { - table = table.Where("config_name = ?", e.ConfigName) - } - if e.ConfigKey != "" { - table = table.Where("config_key = ?", e.ConfigKey) - } - if e.ConfigType != "" { - table = table.Where("config_type = ?", e.ConfigType) - } - - // 数据权限控制 - dataPermission := new(DataPermission) - dataPermission.UserId, _ = tools.StringToInt(e.DataScope) - table, err := dataPermission.GetDataScope("sys_config", table) - if err != nil { - return nil, 0, err - } - var count int64 - - if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil { - return nil, 0, err - } - //table.Where("`deleted_at` IS NULL").Count(&count) - return doc, int(count), nil -} - -func (e *SysConfig) Update(id int) (update SysConfig, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("config_id = ?", id).First(&update).Error; err != nil { - return - } - - if e.ConfigName != "" && e.ConfigName != update.ConfigName { - return update, errors.New("参数名称不允许修改!") - } - - if e.ConfigKey != "" && e.ConfigKey != update.ConfigKey { - return update, errors.New("参数键名不允许修改!") - } - - //参数1:是要修改的数据 - //参数2:是修改的数据 - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { - return - } - return -} - -func (e *SysConfig) Delete() (success bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("config_id = ?", e.ConfigId).Delete(&SysConfig{}).Error; err != nil { - success = false - return - } - success = true - return -} - -func (e *SysConfig) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("config_id in (?)", id).Delete(&SysConfig{}).Error; err != nil { - return - } - Result = true - return -} diff --git a/app/admin/models/sys_config.go b/app/admin/models/sys_config.go new file mode 100644 index 00000000..4ae196de --- /dev/null +++ b/app/admin/models/sys_config.go @@ -0,0 +1,30 @@ +package models + +import ( + "gorm.io/gorm" + + "go-admin/common/models" +) + +type SysConfig struct { + gorm.Model + models.ControlBy + ConfigName string `json:"configName" gorm:"type:varchar(128);comment:ConfigName"` // + ConfigKey string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"` // + ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"` // + ConfigType string `json:"configType" gorm:"type:varchar(64);comment:ConfigType"` // + Remark string `json:"remark" gorm:"type:varchar(128);comment:Remark"` // +} + +func (SysConfig) TableName() string { + return "sys_config" +} + +func (e *SysConfig) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysConfig) GetId() interface{} { + return e.ID +} diff --git a/app/admin/router/sys_config.go b/app/admin/router/sys_config.go new file mode 100644 index 00000000..5e3f43ec --- /dev/null +++ b/app/admin/router/sys_config.go @@ -0,0 +1,37 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/sys_config" + "go-admin/app/admin/middleware" + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + "go-admin/common/actions" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysConfigRouter) +} + +// 需认证的路由代码 +func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + r := v1.Group("/config").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + model := &models.SysConfig{} + r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.SysConfigSearch), func() interface{} { + list := make([]models.SysConfig, 0) + return &list + })) + r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.SysConfigById), nil)) + r.POST("", actions.CreateAction(new(dto.SysConfigControl))) + r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.SysConfigControl))) + r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.SysConfigById))) + } + + r1 := v1.Group("/configKey").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + model := &sys_config.SysConfig{} + r1.POST("", model.GetSysConfigByKEYForService) + } +} diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sysrouter.go index 04c48aa9..58c186a6 100644 --- a/app/admin/router/sysrouter.go +++ b/app/admin/router/sysrouter.go @@ -67,13 +67,9 @@ func sysNoCheckRoleRouter(r *gin.RouterGroup) { v1.GET("/dict/databytype/:dictType", dict.GetDictDataByDictType) registerDBRouter(v1) - registerSysTableRouter(v1) - registerPublicRouter(v1) - registerSysSettingRouter(v1) - } func registerDBRouter(api *gin.RouterGroup) { @@ -103,11 +99,8 @@ func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle r.POST("/login", authMiddleware.LoginHandler) // Refresh time can be longer than token timeout r.GET("/refresh_token", authMiddleware.RefreshHandler) - r.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/ws/:id/:channel", ws.WebsocketManager.WsClient) - r.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/wslogout/:id/:channel", ws.WebsocketManager.UnWsClient) - v1 := r.Group("/api/v1") registerPageRouter(v1, authMiddleware) @@ -116,7 +109,6 @@ func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle registerDictRouter(v1, authMiddleware) registerSysUserRouter(v1, authMiddleware) registerRoleRouter(v1, authMiddleware) - registerConfigRouter(v1, authMiddleware) registerUserCenterRouter(v1, authMiddleware) registerPostRouter(v1, authMiddleware) registerMenuRouter(v1, authMiddleware) @@ -137,7 +129,6 @@ func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar v1auth.GET("/menuids", system.GetMenuIDS) v1auth.GET("/operloglist", log2.GetOperLogList) - v1auth.GET("/configKey/:configKey", system.GetConfigByConfigKey) } } @@ -148,7 +139,7 @@ func registerPageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar v1auth.GET("/deptTree", system.GetDeptTree) v1auth.GET("/sysUserList", system.GetSysUserList) v1auth.GET("/rolelist", system.GetRoleList) - v1auth.GET("/configList", system.GetConfigList) + //v1auth.GET("/configList", system.GetConfigList) v1auth.GET("/postlist", system.GetPostList) v1auth.GET("/menulist", system.GetMenuList) v1auth.GET("/loginloglist", log2.GetLoginLogList) @@ -202,16 +193,6 @@ func registerMenuRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar } } -func registerConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - config := v1.Group("/config").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - config.GET("/:configId", system.GetConfig) - config.POST("", system.InsertConfig) - config.PUT("", system.UpdateConfig) - config.DELETE("/:configId", system.DeleteConfig) - } -} - func registerRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { role := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { diff --git a/app/admin/service/dto/sys_config.go b/app/admin/service/dto/sys_config.go new file mode 100644 index 00000000..13b736fd --- /dev/null +++ b/app/admin/service/dto/sys_config.go @@ -0,0 +1,93 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "gorm.io/gorm" + + "go-admin/app/admin/models" + "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" +) + +type SysConfigSearch struct { + dto.Pagination `search:"-"` + ConfigName string `form:"configName" search:"type:exact;column:config_name;table:sys_config" comment:""` + ConfigKey string `form:"configKey" search:"type:exact;column:config_key;table:sys_config" comment:""` + ConfigType string `form:"configType" search:"type:exact;column:config_type;table:sys_config" comment:""` +} + +func (m *SysConfigSearch) GetNeedSearch() interface{} { + return *m +} + +func (m *SysConfigSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +func (m *SysConfigSearch) Generate() dto.Index { + o := *m + return &o +} + +type SysConfigControl struct { + ID uint `uri:"ID" comment:"编码"` // 编码 + ConfigName string `json:"configName" comment:""` + ConfigKey string `json:"configKey" comment:""` + ConfigValue string `json:"configValue" comment:""` + ConfigType string `json:"configType" comment:""` + Remark string `json:"remark" comment:""` +} + +func (s *SysConfigControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysConfigControl) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysConfigControl) GenerateM() (common.ActiveRecord, error) { + return &models.SysConfig{ + Model: gorm.Model{ID: s.ID}, + ConfigName: s.ConfigName, + ConfigKey: s.ConfigKey, + ConfigValue: s.ConfigValue, + ConfigType: s.ConfigType, + Remark: s.Remark, + }, nil +} + +func (s *SysConfigControl) GetId() interface{} { + return s.ID +} + +type SysConfigById struct { + dto.ObjectById +} + +func (s *SysConfigById) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysConfigById) GenerateM() (common.ActiveRecord, error) { + return &models.SysConfig{}, nil +} diff --git a/app/admin/service/sys_config.go b/app/admin/service/sys_config.go new file mode 100644 index 00000000..4f774493 --- /dev/null +++ b/app/admin/service/sys_config.go @@ -0,0 +1,27 @@ +package service + +import ( + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + "go-admin/common/log" + "go-admin/common/service" +) + +type SysConfig struct { + service.Service +} + +// GetSysConfigByKEY 根据Key获取SysConfig +func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigControl) error { + var err error + var data models.SysConfig + msgID := e.MsgID + data.ConfigKey = c.ConfigKey + err = e.Orm.Table(data.TableName()).Where("config_key = ?", data.ConfigKey).First(c).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + + return nil +} diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index 85a6196f..904c5b4a 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -1,7 +1,6 @@ package version import ( - common "go-admin/common/models" "runtime" "time" @@ -9,6 +8,7 @@ import ( "go-admin/app/admin/models" "go-admin/cmd/migrate/migration" + common "go-admin/common/models" ) func init() { @@ -261,9 +261,9 @@ func _1599190683670Test(db *gorm.DB, version string) error { } list4 := []models.SysConfig{ - {ConfigId: 1, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {ConfigId: 2, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {ConfigId: 3, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"}, + {Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"}, + {Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"}, } list5 := []models.Post{ diff --git a/cmd/migrate/migration/version/1602644950000_migrate.go b/cmd/migrate/migration/version/1602644950000_migrate.go new file mode 100644 index 00000000..585dc93e --- /dev/null +++ b/cmd/migrate/migration/version/1602644950000_migrate.go @@ -0,0 +1,27 @@ +package version + +import ( + "go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1602644950000Test) +} + +func _1602644950000Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + err := db.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id") + if err != nil { + return err + } + return db.Create(&common.Migration{ + Version: version, + }).Error + }) +} From d12b1b73847cec07e958a895d68d9bded799b0af Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 14 Oct 2020 11:57:20 +0800 Subject: [PATCH 009/201] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/migrate/server.go | 49 ++++++++++++++++++++++++++++----------- template/migrate.template | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 template/migrate.template diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index d40a3901..898a66ed 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -1,7 +1,13 @@ package migrate import ( + "bytes" "fmt" + tools2 "go-admin/tools" + "strconv" + "text/template" + "time" + "github.com/spf13/cobra" "go-admin/cmd/migrate/migration" _ "go-admin/cmd/migrate/migration/version" @@ -14,7 +20,7 @@ import ( var ( configYml string - exec bool + generate bool StartCmd = &cobra.Command{ Use: "migrate", Short: "Initialize the database", @@ -27,7 +33,7 @@ var ( func init() { StartCmd.PersistentFlags().StringVarP(&configYml, "config", "c", "config/settings.yml", "Start server with provided configuration file") - //StartCmd.PersistentFlags().BoolVarP(&exec, "exec", "e", false, "exec script") + StartCmd.PersistentFlags().BoolVarP(&generate, "generate", "g", false, "generate migration file") } func run() { @@ -37,18 +43,11 @@ func run() { config.Setup(configYml) //2. 设置日志 logger.Setup() - //3. 初始化数据库链接 - database.Setup(config.DatabaseConfig.Driver) - //4. 数据库迁移 - fmt.Println("数据库迁移开始") - _ = migrateModel() - //fmt.Println("数据库结构初始化成功!") - //5. 数据初始化完成 - //if err := models.InitDb(); err != nil { - // global.Logger.Fatalf("数据库基础数据初始化失败!error: %v ", err) - //} - usage = `数据库基础数据初始化成功` - fmt.Println(usage) + if !generate { + _ = initDB() + } else { + _ = genFile() + } } func migrateModel() error { @@ -63,3 +62,25 @@ func migrateModel() error { migration.Migrate.Migrate() return err } +func initDB() error { + //3. 初始化数据库链接 + database.Setup(config.DatabaseConfig.Driver) + //4. 数据库迁移 + fmt.Println("数据库迁移开始") + _ = migrateModel() + fmt.Println(`数据库基础数据初始化成功`) + return nil +} + +func genFile() error { + t1, err := template.ParseFiles("template/migrate.template") + if err != nil { + return err + } + m := map[string]string{} + m["GenerateTime"] = strconv.FormatInt(time.Now().UnixNano()/1e6, 10) + var b1 bytes.Buffer + err = t1.Execute(&b1, m) + tools2.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go") + return nil +} diff --git a/template/migrate.template b/template/migrate.template new file mode 100644 index 00000000..1c77103a --- /dev/null +++ b/template/migrate.template @@ -0,0 +1,41 @@ +package version + +import ( + "go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _{{.GenerateTime}}Test) +} + +func _{{.GenerateTime}}Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + // TODO: 这里开始写入要变更的内容 + + // TODO: 例如 修改表字段 使用过程中请删除此段代码 + err := db.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id") + if err != nil { + return err + } + + // TODO: 例如 新增表结构 使用过程中请删除此段代码 + err = db.Debug().Migrator().AutoMigrate( + new(models.CasbinRule), + ) + if err != nil { + return err + } + + + return db.Create(&common.Migration{ + Version: version, + }).Error + }) +} From 7a0fff117bc805fa5fc8c7e4cc917a9a2a416bfe Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 14 Oct 2020 12:18:39 +0800 Subject: [PATCH 010/201] Update 1602644950000_migrate.go --- .../migration/version/1602644950000_migrate.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmd/migrate/migration/version/1602644950000_migrate.go b/cmd/migrate/migration/version/1602644950000_migrate.go index 585dc93e..3d81340d 100644 --- a/cmd/migrate/migration/version/1602644950000_migrate.go +++ b/cmd/migrate/migration/version/1602644950000_migrate.go @@ -20,6 +20,20 @@ func _1602644950000Test(db *gorm.DB, version string) error { if err != nil { return err } + list2 := []models.CasbinRule{ + {PType: "p", V0: "admin", V1: "/api/v1/config", V2: "GET"}, + } + err = tx.Create(list2).Error + if err != nil { + return err + } + + menu := models.Menu{MenuId: 86, Path: "/api/v1/config"} + err = tx.Model(&menu).Where("menu_id = ?", 86).Update("Path", "/api/v1/config").Error + if err != nil { + return err + } + return db.Create(&common.Migration{ Version: version, }).Error From 8705ad043647343b9fe63afa74af027a57ec2afd Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sat, 17 Oct 2020 17:52:20 +0800 Subject: [PATCH 011/201] =?UTF-8?q?=E8=B0=83=E6=95=B4sysconfig=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/{ => system}/sys_config/sys_config.go | 0 app/admin/models/{ => system}/sys_config.go | 2 +- app/admin/router/sys_config.go | 8 ++++---- app/admin/service/dto/sys_config.go | 6 +++--- app/admin/service/sys_config.go | 4 ++-- cmd/migrate/migration/version/1599190683659_tables.go | 5 +++-- cmd/migrate/migration/version/1599190683670_migrate.go | 3 ++- cmd/migrate/migration/version/1602644950000_migrate.go | 3 ++- common/global/adm.go | 2 +- 9 files changed, 18 insertions(+), 15 deletions(-) rename app/admin/apis/{ => system}/sys_config/sys_config.go (100%) rename app/admin/models/{ => system}/sys_config.go (98%) diff --git a/app/admin/apis/sys_config/sys_config.go b/app/admin/apis/system/sys_config/sys_config.go similarity index 100% rename from app/admin/apis/sys_config/sys_config.go rename to app/admin/apis/system/sys_config/sys_config.go diff --git a/app/admin/models/sys_config.go b/app/admin/models/system/sys_config.go similarity index 98% rename from app/admin/models/sys_config.go rename to app/admin/models/system/sys_config.go index 4ae196de..6df7dbc1 100644 --- a/app/admin/models/sys_config.go +++ b/app/admin/models/system/sys_config.go @@ -1,4 +1,4 @@ -package models +package system import ( "gorm.io/gorm" diff --git a/app/admin/router/sys_config.go b/app/admin/router/sys_config.go index 5e3f43ec..c489d14b 100644 --- a/app/admin/router/sys_config.go +++ b/app/admin/router/sys_config.go @@ -2,9 +2,9 @@ package router import ( "github.com/gin-gonic/gin" - "go-admin/app/admin/apis/sys_config" + "go-admin/app/admin/apis/system/sys_config" "go-admin/app/admin/middleware" - "go-admin/app/admin/models" + "go-admin/app/admin/models/system" "go-admin/app/admin/service/dto" "go-admin/common/actions" jwt "go-admin/pkg/jwtauth" @@ -18,9 +18,9 @@ func init() { func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { r := v1.Group("/config").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - model := &models.SysConfig{} + model := &system.SysConfig{} r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.SysConfigSearch), func() interface{} { - list := make([]models.SysConfig, 0) + list := make([]system.SysConfig, 0) return &list })) r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.SysConfigById), nil)) diff --git a/app/admin/service/dto/sys_config.go b/app/admin/service/dto/sys_config.go index 13b736fd..77c1ca93 100644 --- a/app/admin/service/dto/sys_config.go +++ b/app/admin/service/dto/sys_config.go @@ -2,9 +2,9 @@ package dto import ( "github.com/gin-gonic/gin" + "go-admin/app/admin/models/system" "gorm.io/gorm" - "go-admin/app/admin/models" "go-admin/common/dto" "go-admin/common/log" common "go-admin/common/models" @@ -65,7 +65,7 @@ func (s *SysConfigControl) Generate() dto.Control { } func (s *SysConfigControl) GenerateM() (common.ActiveRecord, error) { - return &models.SysConfig{ + return &system.SysConfig{ Model: gorm.Model{ID: s.ID}, ConfigName: s.ConfigName, ConfigKey: s.ConfigKey, @@ -89,5 +89,5 @@ func (s *SysConfigById) Generate() dto.Control { } func (s *SysConfigById) GenerateM() (common.ActiveRecord, error) { - return &models.SysConfig{}, nil + return &system.SysConfig{}, nil } diff --git a/app/admin/service/sys_config.go b/app/admin/service/sys_config.go index 4f774493..8ab25a0c 100644 --- a/app/admin/service/sys_config.go +++ b/app/admin/service/sys_config.go @@ -1,7 +1,7 @@ package service import ( - "go-admin/app/admin/models" + "go-admin/app/admin/models/system" "go-admin/app/admin/service/dto" "go-admin/common/log" "go-admin/common/service" @@ -14,7 +14,7 @@ type SysConfig struct { // GetSysConfigByKEY 根据Key获取SysConfig func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigControl) error { var err error - var data models.SysConfig + var data system.SysConfig msgID := e.MsgID data.ConfigKey = c.ConfigKey err = e.Orm.Table(data.TableName()).Where("config_key = ?", data.ConfigKey).First(c).Error diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 4e0a8673..42eeda3b 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -1,6 +1,7 @@ package version import ( + "go-admin/app/admin/models/system" "runtime" "gorm.io/gorm" @@ -20,7 +21,7 @@ func _1599190683659Tables(db *gorm.DB, version string) error { err := db.Debug().Migrator().AutoMigrate( new(models.CasbinRule), new(models.SysDept), - new(models.SysConfig), + new(system.SysConfig), new(tools.SysTables), new(tools.SysColumns), new(models.Menu), @@ -34,7 +35,7 @@ func _1599190683659Tables(db *gorm.DB, version string) error { new(models.DictData), new(models.DictType), new(models.SysJob), - new(models.SysConfig), + new(system.SysConfig), new(models.SysSetting), new(models.SysFileDir), new(models.SysFileInfo), diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index 904c5b4a..63f505cb 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -1,6 +1,7 @@ package version import ( + "go-admin/app/admin/models/system" "runtime" "time" @@ -260,7 +261,7 @@ func _1599190683670Test(db *gorm.DB, version string) error { {DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } - list4 := []models.SysConfig{ + list4 := []system.SysConfig{ {Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"}, {Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"}, {Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"}, diff --git a/cmd/migrate/migration/version/1602644950000_migrate.go b/cmd/migrate/migration/version/1602644950000_migrate.go index 3d81340d..4a900478 100644 --- a/cmd/migrate/migration/version/1602644950000_migrate.go +++ b/cmd/migrate/migration/version/1602644950000_migrate.go @@ -2,6 +2,7 @@ package version import ( "go-admin/app/admin/models" + "go-admin/app/admin/models/system" "gorm.io/gorm" "runtime" @@ -16,7 +17,7 @@ func init() { func _1602644950000Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - err := db.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id") + err := db.Migrator().RenameColumn(&system.SysConfig{}, "config_id", "id") if err != nil { return err } diff --git a/common/global/adm.go b/common/global/adm.go index 9ef4e8d7..b559381c 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -11,7 +11,7 @@ import ( const ( // go-admin Version Info - Version = "1.2.0" + Version = "1.2.1" ) var Cfg config.Conf = config.DefaultConfig() From 93feb4779e05107c23a88adb141d64d667aa3e95 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sat, 17 Oct 2020 18:54:40 +0800 Subject: [PATCH 012/201] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E4=B8=BA4=E4=BD=8D=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/captcha/captcha.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/captcha/captcha.go b/tools/captcha/captcha.go index 1ce36935..8562e044 100644 --- a/tools/captcha/captcha.go +++ b/tools/captcha/captcha.go @@ -33,7 +33,7 @@ func DriverStringFunc() (id, b64s string, err error) { func DriverDigitFunc() (id, b64s string, err error) { e := configJsonBody{} e.Id = uuid.New().String() - e.DriverDigit = base64Captcha.DefaultDriverDigit + e.DriverDigit = base64Captcha.NewDriverDigit(80, 240, 4, 0.7, 80) driver := e.DriverDigit cap := base64Captcha.NewCaptcha(driver, store) return cap.Generate() From 01c519e8940afd7394f0ff7f1ec7e8004aeb3761 Mon Sep 17 00:00:00 2001 From: kikiyou Date: Mon, 19 Oct 2020 18:10:35 +0800 Subject: [PATCH 013/201] =?UTF-8?q?v1.2.1=E6=94=AF=E6=8C=81sqlite3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/db.go | 3 ++ common/database/initialize.go | 8 ++--- common/database/initialize_sqlite3.go | 21 ++++++++++++ common/database/sqlite3_driver.go | 24 ++++++++++---- config/settings.sqlite.yml | 44 ++++++++++++++++++++++++++ sqlite.db | Bin 163840 -> 0 bytes sqlite3.db | Bin 163840 -> 155648 bytes 7 files changed, 87 insertions(+), 13 deletions(-) create mode 100644 common/database/initialize_sqlite3.go create mode 100644 config/settings.sqlite.yml delete mode 100644 sqlite.db diff --git a/app/admin/middleware/db.go b/app/admin/middleware/db.go index 80da3b40..1cf494d3 100644 --- a/app/admin/middleware/db.go +++ b/app/admin/middleware/db.go @@ -6,6 +6,7 @@ import ( "gorm.io/driver/mysql" "gorm.io/driver/postgres" + "gorm.io/driver/sqlite" "gorm.io/gorm" "gorm.io/gorm/schema" @@ -23,6 +24,8 @@ func getGormFromDb(driver string, db *sql.DB, config *gorm.Config) (*gorm.DB, er return gorm.Open(mysql.New(mysql.Config{Conn: db}), config) case "postgres": return gorm.Open(postgres.New(postgres.Config{Conn: db}), config) + case "sqlite3": + return gorm.Open(sqlite.Open(global.Source), config) default: return nil, errors.New("not support this db driver") } diff --git a/common/database/initialize.go b/common/database/initialize.go index c377458d..f78fc0ca 100644 --- a/common/database/initialize.go +++ b/common/database/initialize.go @@ -1,3 +1,5 @@ +// +build !sqlite3 + package database func Setup(driver string) { @@ -7,12 +9,6 @@ func Setup(driver string) { db.Setup() } - //TODO: 如果需要sqlite3请开启下面注释 - //if dbType == "sqlite3" { - // var db = new(SqLite) - // db.Setup() - //} - if dbType == "postgres" { var db = new(PgSql) db.Setup() diff --git a/common/database/initialize_sqlite3.go b/common/database/initialize_sqlite3.go new file mode 100644 index 00000000..7bd6523e --- /dev/null +++ b/common/database/initialize_sqlite3.go @@ -0,0 +1,21 @@ +// +build sqlite3 + +package database + +func Setup(driver string) { + dbType := driver + if dbType == "mysql" { + var db = new(Mysql) + db.Setup() + } + + if dbType == "sqlite3" { + var db = new(SqLite) + db.Setup() + } + + if dbType == "postgres" { + var db = new(PgSql) + db.Setup() + } +} diff --git a/common/database/sqlite3_driver.go b/common/database/sqlite3_driver.go index bbe5f764..a02d5324 100644 --- a/common/database/sqlite3_driver.go +++ b/common/database/sqlite3_driver.go @@ -3,6 +3,7 @@ package database import ( + "database/sql" "log" "os" "time" @@ -12,8 +13,10 @@ import ( "gorm.io/gorm/logger" "gorm.io/gorm/schema" + "go-admin/common/config" "go-admin/common/global" - "go-admin/tools/config" + "go-admin/tools" + toolsConfig "go-admin/tools/config" ) type SqLite struct { @@ -24,7 +27,15 @@ func (e *SqLite) Setup() { global.Source = e.GetConnect() log.Println(global.Source) - global.Eloquent, err = e.Open(e.GetDriver(), &gorm.Config{ + db, err := sql.Open("sqlite3", global.Source) + if err != nil { + global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) + } + global.Cfg.SetDb(&config.DBConfig{ + Driver: "sqlite3", + DB: db, + }) + global.Eloquent, err = e.Open(e.GetConnect(), &gorm.Config{ NamingStrategy: schema.NamingStrategy{ SingularTable: true, }, @@ -40,7 +51,7 @@ func (e *SqLite) Setup() { log.Fatalf("database error %v", global.Eloquent.Error) } - if config.LoggerConfig.EnabledDB { + if toolsConfig.LoggerConfig.EnabledDB { global.Eloquent.Logger = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), logger.Config{ SlowThreshold: time.Second, Colorful: true, @@ -51,14 +62,13 @@ func (e *SqLite) Setup() { // 打开数据库连接 func (*SqLite) Open(conn string, cfg *gorm.Config) (db *gorm.DB, err error) { - eloquent, err := gorm.Open(sqlite.Open(conn), cfg) - return eloquent, err + return gorm.Open(sqlite.Open(conn), cfg) } func (e *SqLite) GetConnect() string { - return config.DatabaseConfig.Source + return toolsConfig.DatabaseConfig.Source } func (e *SqLite) GetDriver() string { - return config.DatabaseConfig.Driver + return toolsConfig.DatabaseConfig.Driver } diff --git a/config/settings.sqlite.yml b/config/settings.sqlite.yml new file mode 100644 index 00000000..0d10baab --- /dev/null +++ b/config/settings.sqlite.yml @@ -0,0 +1,44 @@ +settings: + application: + # dev开发环境 test测试环境 prod线上环境 + mode: dev + # 服务器ip,默认使用 0.0.0.0 + host: 0.0.0.0 + # 服务名称 + name: testApp + # 端口号 + port: 8000 # 服务端口号 + readtimeout: 1 + writertimeout: 2 + # 数据权限功能开关 + enabledp: false + logger: + # 日志存放路径 + path: temp/logs + # 控制台日志 + stdout: true + # 日志等级 + level: all + # 业务日志开关 + enabledbus: true + # 请求日志开关 + enabledreq: false + # 数据库日志开关 dev模式,将自动开启 + enableddb: false + # 自动任务日志开关 dev模式,将自动开启 + enabledjob: false + jwt: + # token 密钥,生产环境时及的修改 + secret: go-admin + # token 过期时间 单位:秒 + timeout: 3600 + database: + # 数据库类型 mysql,sqlite3, postgres + driver: sqlite3 + # 数据库连接sqlite3数据文件的路径 + source: sqlite3.db + gen: + # 代码生成读取的数据库名称 + dbname: dbname + # 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径 + frontpath: ../go-admin-ui/src diff --git a/sqlite.db b/sqlite.db deleted file mode 100644 index f250f704b9d3eb65ba021bd725d393605114f53d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 163840 zcmeHw349#ImG>N)OQV?v6nPNF)=0K23tOJ)IdmE0Lza!PWE(7lPsB(X%Y!A2JTtN} zIdB`BnA0X)AtAw#5D3}WkjsD}&hNL$Z$HSnIml*rb9*Ftb3hKr_a*G|y;oH|)7?`o zo3Pm>NeNuit9t$3tN(j-c6ImqE4xy;WN>>rGn~i;qn7h5R;y)6Flez@Lhx@c`)7sU zGvQwu{8N80?`%II%Yuc!aR8T1dL4O#(x0T)-8HUHIOjV~*^kr!%-} z&GOET!6_~Zu3ZzX(_UFOw|U=o?CE8MS{`Fm*jkmvwa-DD6L}qVrXL4^aF_ufGM*1_!;p9kee%)9$nHfn8C+mW{ z6Pf-UiOgI%(%Lw`E}Ki_#Q{;-ogxm0?@SlX9K?*Z|~ z>@7z?uL4CFzpnu|5voyw-5k!nP~^}tMJ zd$(su^Fyg}V{m!rilrO6dV*m!%#Bg^mSWM(i^YNDXwDFenC0QdqJg;(ixm(!mf8XF!#@UgXQ@>}LRT!C4$tasEDT+aB=>+DZwspC~);CuS#xq6?dQJHDWW&(I#W<}7P zpzQHv1k1H~$$^w1XDF35L*8=T1vX8aErlhZ5OrFZZ(1A(#rlyf}?5L~Y3Qs?kLM&ctAnd);t) zU<^W(C$euWn;J=)=-WOvLS`@AD+`4%E8meWnJJI%EHnv&p*wq_k1}*QtPVSSdHoSB zOpoG3N;B=E*||&-8{dFtxYHD{A=k8=2MJ2lv~QSZsXd!{lZ4I^C;a`1A=Vf)0?x6Z z1TNOqzvTtP+i&d3GAkJy_pc^_+MmewrAB%)5JQ?jZTfbiDZz#^YV3c*Vd&3xhl^n= z(;T@ZCsL9VEy;d-fP0&Jq5DGDE3Ow^A9L+@^|=XOKWIG8Z4?ChC406c9R9u(38Z6FJiul^ixhWmkY6^9d5cI&u9?WqB{ zqOQ+GKg!0dfTtk=JaToZjj#yYo*G0+%R9R|VQ1nxU~J^5r;O`1^wjnu2L}_z0f;nQ z3oI?BLRKgDGSg>oL$gd7Rj#d5a&^JX0;*WQ1-P0xRYVAi6`Z*l*y=edkqxR>vkA*N z)g$HT?v1F&L;$n6?wToha25vk&bb*j6%z9^?&Fp6$K)`IV9 zdw_EuMv6V*O^W z0XClNkPRw#NjH=);uwWf)DY~_B>MK^bUg$WsOdsk93Y4+L}4}B#1V!J%!PGV6nJ`I z&k20Nx(DjQJp*9WoK?URC5kvaiQQmT278h4<-kYVy`B%_t{Zd~dkF?^<4U+9PEaeo z0r78@+o*2D&Y>`F{{aPSi+aoq+uCcLHmnR&FHsm ze|i)fXWh~%)T=SK1bIwgDMB)HF|g5KD%A<9YA(Za6Ua!nzsSUv(R4Pa2FRsT@Tm4K zL>`X4C`V&&JKDqX4zi)WZCK8+my|<*&29w-+SlqUoX)_eMiw=JnAt67<$^G1XhtrM z%|%&sIH`>TBONSwN)g9k3|Tl8qq4BGi2?`hYz#tRjR+Gy2KL+tu+cGA&xQeBj5&;A z88~^7j-1#ekS9C^57Ss10v_7omTF85WKqn5Da5D|(1bi3H1&;m=6qn|MF45Q5CQYB zoD%`093$WoVBkf-aB{eh4kQo(4UNdfwMOM)zMTt(1B8qGS2n!UJLU^<80*P7_Raa8&mBpVC6Y(5H|ARrU)1|rw&+n{q{h* zKbM99I@KRS>t@#i9}iTis&l8ca$S7FtJqBmw$18-<5bFpK(5Scj9 zT`&=`X$VYZ9}Xp~B2CkPvBONKX08DK14J*W0(LsJ(8nNWYSHknv)Q0xREdmc7@-YC zjAmZ|yxcHT=Qbe(>3rZa1qmf0NOk7{7q9!nZE)-;p~7|26g*vY23zN!f``?y-iJKA zI)biZ^=4K88?SFelb~WXUM%N%AIq^BmIDJ1AG#`G7B_f+ix=mVOS3R>PbrR7uEB*| zoXSyg#p(r}z{qQ|Y|R9#DhG0KD#$pXigU_S)^B`pGn`8o|ir?JuKZV-3(dcM<5^&5C{ka1Ofs9fq+0jARrJB z2nYlO0s?_Q7lHFU_IfKE$Spi@?y7LxXOJ8`d|FoFViX={vsXA7g@*y{K8JmV4X?$6 zVOH)hj1&k61Ox&C0fB%(Kp-Fx5C{ka z1Ofs9fxz2BK-~X-TkwgC1p)#Afq+0jARrJB2nYlO0s;YnfIvVX@K=EV-v4*_M=jEW z(v?!V{~zH`@goor2nYlO0s;YnfIvVXAP^7;2m}NI0)e-Uz?J2a#WTI$TJ7_BBq?B!^Ew_gwzA4^Mvn!1!}V?D^-9o_^+5S&oDw;ihn`Dcll_MB8Jn?a|hftXOlW z2SiraxP3nOWPwE$*_J={==ei-p1Ju6CMMbxZbdP&+%Ctd7+n^8M2RD&b@J4aiIbn> ziU~7oqD^u*C^xsq!|jol6)qyiL#!!Ouw~-tz4^m;qZp$(;r4i2p;oOyIoci$w}+!i zt7LIk)w=_;;Il5OoQXqEkKcaJ#N&65-?lH2%8jMvXiIA(BDcz|t?)JX^b(S}06uxA zs);m3T7q)CJsNJ8nHpklL~akawMS&U|L>3{Ez%p(AEe((zk)x-k3c{mAP^7;2m}NI z0s(=5KtLcM5D*9m1Ox(qr3jSSE!J{OJeasKaoOz_j|1vsmtMhIHAsJwUXxz&T~qPZ zie=vCz0Kv1m%BZm^t8J_d$e6bZ|r*7#ETiA2kbvbqTpYm#N$1c^sr6KPWq(NJG6Rq8aHK6PyT z-e>t5iqd0C;X{pPqBpNsMOW!W=MQ~2fAYDriHp=dZ%6OBm z5>ZS3g?sY1-Z^pa6XS*bFSG3jH#BCcQlc9;g0@H-{q4Euq#h>a=?K?xtI7 z@uqMz7=f*}aC#ivk}xPnxrL{*^@C4tTS zjUS&a)+RQEir!VzEI#PAAf$X&iR^7_yRE|ynl@fe z6x0J;It8rP;wqqV1i~X2M`n_TSAt}@Y7ulSKAYC`Pd|`9_{_x9C-Wb@ojM~2Ul>+9 zUgPJJi%qhHbOBb2Nkx{g0Cm+>zFDA3ixgEv#8SK4LM`ErP7^6hJE@cz1}S-Bv{p*@ zViOUYmm{K8fM}J@kn#JU!p@o?s;x2cnF?t$G)?HN%`olnK-sm}cyzLC>gk76_dNE14TaEgk8R?Ww{1;r-+HJvDjkixV##BPh~09D|xj zs5#Ox{=iXa)w$$wJN%+W?Z{>ehZtjOWFUEi3!PhxN|nVI(>f21r3R8&nvd0n|7A4j(r_r3P7h^6Y8f$s zZ^5=pr&$8^HPr!72dGxl%3CZwD1a)Cwg_d=<5dcj2mmv-_Ta9f>Oy?b9q(^)*$@yjfcFsA)7p^`;SPT1&0T?Hx_( ztRcWV`OuX3J{(i*ZD>vvniB=I3g+Nzy7QlT;PeZ3QgcQV*(~N!Tw3&&V1a4{VIo#I z&dCb6+Za{st$Zt%!<)Y0R^yomo+$PL`1WsVMYG-tEKsc=OvH+^bF?DXqBvt{#q<&^ zu7bHaotH8!lIhW*WR^_XiDL|n5(}sya)>YyLu}`0h}@=lqG(8Mi6Pz4ukt%Z)~7?r zlJ;2aAh1BSg)k9YOxlhiK%lz{E7k=t=cu5_E}?Nil$AJmeLmAEGw ziZ!pGE104=SlpgT4ySh~&%p+`+Y1Ywc&bS?0b*1$&1Dl%GTAmWA-)1;3)_2Kg9H*zwD><0rZx4CW}iA+1;N zn+XzKboe_J3Xajr2=t0=@(IL+M|n??~T}UX;EposyoDJ}*5beM5BT5bzrmmJ5BazIuk&yA_xRWNFZVC=U+Qo6hy9oMXZvURFZ5sFukbtl7T+Iz zzxVyxH|hJC@85kd`@ZFS$@gX77k$t8KI8ib-zR)WeIN4O>$}T$$hY739^Y=?sPB5; zfbUx0M&DJwF5e2@5?{M7=3C&K>#GAe#E(EgARrJB2nYlO0s;YnfIvVX@OOrQ!)~!z zy(D#$)J0M!NgX6DBdMLFHj-LNYQfaFXqY zjikRP>F-GTTax~Uq_2|n6_Wm%q`xBRFG>0flKuxt&yaMIq!T0^CuyFfr%C#AlKzaO zKPBl;Ncv-v{)nVMBfsmze>`VNctj4 z?;`1)B)x;Ax0CcXlHQ89s^5*tjhO7kBM9?CLNe8!(<62i!r$jlSPas=r*fNVUVgPv}hBhxZ zb2!Y*G(b!$p)KFvY5SiG#W0)(SP++Ekrvia{ukTx)S;+a8gG-iO}eCf{}O8<6zK@P zdi7smgjT&Ai7kk>wZ_`s(fuOKC1ML=@MZ!t4E4o$|KBD3Nb~%^^m8D^k3c{mAP^7; z2m}NI0s(=5KtLcM5D*9m1Ox(qH3;A>eitTAOdOb$VM6cy&krq}|dH>P7#$Dt3gmb>*l>MkZ zY8|!w&hm>tL+CsG65FRc>aEIj@(PC3zzx0dPKMs0^k8ZPlHP&jP%@Vs=uPCb*}jge zI+ylz23M_F-nlV2#YMrjYl3y!E9>SKB{l|cUgC8H>g%nybdXm+X&JSDS1@%wOP6(Z z8sr7%)}=#{lcVnmjRm@5OF8iiM3WQtsocpP#GEC3FD-;c4hFO%K_ z;*Hs95UVPqVn&A&x$Wu9urZ&C&!x~jOu?w((fM^?d?J_Z?b}=Ar$&#B!i$7>1yI{W zW@nL|svXV_8ndWqbZ=b{WuaC8iO4nP79CgQ4L0s9cLf&Cuqs|%{NP(+46%b*UT)kN zm?t`xK=?SF6Ul%3UCth-E3kByRSD?2oc{FC*zgE~uN|>i zu8ZsJ(n|{dW<`3J-!k9f3e1{iy`!e!a>j>VXMZ|N9j^)l-_t+O)%!$^%1m1}6TtH_ zD}v?>{R%W(b0XoU?WyDt46J%d*Jslsz1$LL-lH(=kUocWj@jPA z*sIUZBzKLaGD(oFXNK_;EZ64Yi?;MR`06Nq4tYhECX3MAI_<~}4{;0dHGJFxL)$6p z#(uU?TODh0TX68*iCqa|LQ^t#_PHWkOS@e_*4hf7x}C$b^>`)IpOc zf2oc5Z2diD*0*ljxzm!8#?6NCA$YZ7FZZ(1A(#rlyf~fFxR_own&{t|7))}n8%__5 zL5T81_KjszBS{l|+s8)8?1g(}p%7-}JJKaH<1}-vbMp1~kK+rhpB(rsX_HP@<-N!!%3n+02_Hbe1^b?@tV|#-I^!js+!f zv9A6tFBsl_V^@}0$=JAmH3`)IM7A$A(wl)8()?-Dw-ZeXHk46g{~HcNf3`cU8GmSw zT#^$h$%&Ta#7c7F`kY`RuK&v&?H1RKjuVb{c=!L0D&}~f^StayxhCvy+TUlJZvBL1 z(EHDCdr9xw7ieg(9%vz0ktw4({OE|8dc1UHh!`2P&T-{Sc=fSMqs4sWGpvbuV+e*f zXQoGHk5i3AZ)cjHy@)ri(DxP_#ub`5gTbiZt|+;nFs{%N{kXFKx@s~C94sz9DH}S4 z{&jJwx0oa{@x#|LpX)F{uQT+a>O77Jg1rq*^pa^DyJ&Y}Xso1XV`chj9+{6Dz4X7= zh1_(ZE6~|sRcdte1rnb4!eoPM3;ENz-YpbsE-N^=P^kCu&8q`0Y?rre(6>v}UTAwr zTvY1mqDZw}(gEZg_N2(A`e`P~8cOsfHLEX8YvsC_T*Gm2KaAANoOvLe&FD_jAwjVQJei(7;0xM1w*i|g|u@Bi>N;{KZ|>DJAag?5gw z*v2M~zo(V9Zp_937k{5?A5M6A1Fmrgg)nmZbCR#`7q$;2G<&#zZdYyW^6BK4yv#u} z2PJ(jd>lZxJ4pu`GQTuB_ATwyUBKI^!_9e3ca8qQtSW8?Z(uI;?U--q))VIwcfY@? z;BI76#lNf6-9!eso9H;l`PE3Oetqw!&X##(H;gqUtE6o5hGMTw z84de%Y^2a^Gg2M+T75No*>2KXUMcWn#~9LYcRhhyB*q&xWVV8z5ZIH>81|%sjn|(? zMsB6D;9>$X?ue?*8X{{nS6S-p0;92kQ;5i>DvJTk2{tNmi74COs8@!&`2}T2TwtOM z%lOK$MDHPD9j_PR&BjUVtjXw26%9e zkE{)ED|(0VAzbWFe<@h1FldSRrwYtj_fYh=X=oEEY+C4NNVKWw3QOim!%5hzFhm^P z?SngXaN~(riuNXQ>5OqnOFTp>!}F=>20poBETfqX(pphiMvMIctq;jAy-lepgiVe_ z$^A!TD<)z}Zby>smP|6Mn;lYf-fB#m?N-A5QP{8B+e>w;Gf-+i>62mCO1s0Y)&6#d zC4By0od18@yBk7)KtLcM5D*9m1Ox&C0fB%(Kp-Fx5C{ka-q8r){r{iX)>@=jrJqRO zlD-6A`a3Eek@iWW@J+vU(h?~w1>x&`7XPdMpZLE8-|2hGe-ysWx6eNcU*ucoUjpCZ z3;NH4ukXF;`w4t=?@PX?;7fZ)eEZ=0de`~Z!B_RdzM$_spQYl}il0<`tKv%)PgNYP zI8w2%VzlDAigguBDnb=AD}3HJyua}NtM^6kGv3F&_j}=vv$x-Sm3OH(?5*+o%m1_d zm*xLf{!;m~E%Apo1Wize(w36=bt>!dOqd(i080J z@nk(o&o!P^o`s$!PmSk%kKO&6d&2z#_gCF7xR1LZao^)U=-%T_xwp8x-HY8}cdh#Z zx83!7SKjrq>z`cDxIXFnkn48WdtAe=Yh7zyOI)(6&Q<9ubH3&rcYfdbf1J-cpLBlM zd5818&Jky?bFFi+GvussN{%-juQ-0}_@?8O9?WBWJlr|ie=58DshZ?dQD zz4o>C#rBZB#xB|3w7p{cvF)3-Q?}!_hi!*#H`&s*UU1+$?FnT4UUuEIwk z)Qyz7l2UsqwT@CZP--ou_E2gKrFK)Qn^I$x>Y`MRQmZMIrPLLa%1~+*rFK#3a!QR- zY9*!8lv+Wl5lVGZYM4^XDK$i?4odB$)G|t4PpKu8N>OStrFKy2GD;0nY7wQjQ|eMm zB`LL#QUjD~r&K?s+9=gWsa8rQC>5g=4A9shqm+W-8L0)7g25T7CQ8B3jMRKe!N82v zJW9c^j1(P(D_~GYijKk3Ca2X_4V2Z3XSdTM(ndAI#WJo@Gs;-T)oO;FWo%G0Y%HTk z&9JhJ^=gKNWn9HFEN`-mE7gquVj1hyjQ?aAYt@W5SjHMPHRJ0nV}+XWHI~t-W_*=pELSsLVi_H3#)~Xt znVNAI%UG&r+{rSQs2O*#jKylk?JVOmHRCpxu}IChm1g)aby}_H>~}MIA){|(bUUN> zGP;e?H!!-D(R&!(!sy+MZf5itqvMRuF*?R*IJSea=8rNu!{`X3cQIOK^eCglj7~E; z#OM)5FJSaAqnj8##OV2q-pS~BjJ}@HmoOThnk4o$GI|H2=Q4Vb(G84FFnSK7uVZvQ zqu~TDkvE&s*D`t*qqi}-j?r5gUCZb#j1Dq-Gox!5y@}B?8NHFwGZ=jhqc3Lk)r_9b z=nag%h|xWau4eRlMqkM2s~8<%^p%XB#^`m7u443BM!$>EYZzV0=x#<|!00YUpU>#k zj6RRiS1?*)^eRUC8GSjUeT-ho=n6)!V6>Ofos2GL^m0af7~R2WH=~y^+QsN4jCL}5 zF{2%fjxoB7(NRX*89krTHb%3K)o*1q>sQ75|K1r3XJLgvKp-Fx5C{ka1Ofs9fq+0j zARrJB2nYoJk_h1Xzsz@wMH=vb**^#V5I+I|fq+0jARrJB2nYlO0s;YnfIvVX@E1ft znNe0{sh(x^`J@`FRg!$}Xw*`zI4178{q%G9%F(#`pFOf`*OFbk7QoG2w@sEK;YheC z9BYyzK{?hQZf=jY8M0d1!)<#KBZGU!W=9gUDWAnNj zH!N7Oa%rSv_x9yC49FXXuZUb8zp>}W6|wB5bbsIOY|mO{y1mrCD#bDWk-PFA{;(Wv z#sA{5Xsaz;u+OEjFWeH0MB3$+_9%Rq9!-ung`>epxIHSjhr{qzrWCVodGh+9ffdO_ ze8G;Dn^$(Ugwj{9Xdf`4MmDCDYAf33vG}AJ9uKoGps}x2ZlynAnK>6-%d86%*T&o9aXoY~$fC!+m~H*5 zSFGsixN+s$-HBC~Uw*}=$m&>p^VptTYtQoL^tu~2rDEB5_l=uYEn9j`M^{(#<{jy= zbrF32zfAg-MS4T}gY;YYL;MH?1Ofs9fq+0jARrJB2nYlO0s;YnfIvVX@Yjt%ncZS7 z!^Dn>&2G1N@czGDy2v7ZR@x4~#E(EgARrJB2nYlO0s;YnfIvVXAP^7;2n7Dl5V*oF zS?b-@R-Xjt3M_D ziIWdc9D8Kq$SwK1KS*BCGKFOYVR1N-f%pII(r?-Q|GzUAi|Psl1Ofs9fq+0jARrJB z2nYlO0s;YnfI#4H76IP$;}0DlzxDCSNA5sTJ!@^;0@R9rm?W{Iuehih16zdWXEz z%D+_JS6=3M(zDL}y89vbGS{T*F4qF*H=Lu+3mji?48rB&M<5^&5D5I$A&{&&-{PKk zeuK~FbNeLUJlI>Eyz4~%@cn0=ykqjXGI3OqBiX&#-t=fP)0^8nnv@O2bf*?x85x>(yq1%-d4^V;RF4mVJ$N$z z!hLdBFHWY}pkG^EB7frEhr!O% zCqD+E(yEtFi?rAmritVT+vnF=zA;cL`S|ns zgO4>EB$G@N$?6k|ddbtclHdPayj1f0pW{l7x5s$i+*nm2dHk+J;~%*>rk6}JO(e_g zc}%^{?<$d;KXmlWgCCFTCDTl<v@3V$pgl3vZj&jksphWWc z{ZHi|{ivY_p_wLo=|M>FmbPyFT65 zJD5q2jmoqnf9RHplLtz~a~tBd6)1kXR{WWhADle)@#UQ>mTu_k(aWbrT=`G~UZdIM zC7?8F2L|P#iF=p=#gS$lR_y><~G7$?!da=>A_85D1TnEHP z7Xd=&!w(&qeBdy_IJ+agr*}tcASs_AnUjYf%HMgPL2_$*oGaN`B6<9SU!3^(bEFv- zCDTk3$x$8@*EopedQDu6KlCIt7SaUAvM_PVCU20(_dT9J^eI-NYlSdr3iHOSE6WJR zs^A)I+mC&gAYqUS*#;C^`1oFFFA+I$?+F5dK_q0Ch>Y->#WowMzO1Q!zSt~A(wX7J zQ13u0o9G)#s;!!o>&3%+0%E)lZkx44yryYz#nW=Fcz6c^%p`fE3f}*(k+v7!|1V8S zKbL+a{XqJz^iAm{=_}Hgq?6JYq^G5SkRF#Fl|CYUP`XFDOS)A$Al)S0D2+*@(oVQs z{0IaD0s;YnfIvVXAP^7;2m}NI0s(=5KtLd1!F%pCn9Rgv1|}C{G98nPFsa7mLQDdf zOv9uKlXqcKiOB_+oR7(Qm`IrTG4Wwifr%HBa!fp!xG`~I;>5&(3Ge;?zW=gF4gQDW zm-rC~2m}NI0s(=5KtLcM5D*9m1Ox&Cfxk%vl$r4KduOy(8YT~}pMK`#_#?NBfAkAy z9{GIJ=`TJ$`Ne0)j~<5HGmm}{Pd21R29h`QX5j!r&yM79GKWdiKq9kq)A)&};jQ?T zvzYzL^LLDY{-B{?C^fhvr#|!!2XWehaO)e+LxkDg?^si~1)o@t$Z(KBaln)Ht6Qq2 zHew(gHW@#3g1+g#Y4UTQ$R9qDKlG9O6;4e}PoF%QzwHtFA_=sv_zDYciK(pB4v^KzETdNxy`XvXgSN<2*vc{xR?CD@ z*x=O*@V*B$O!vA6nr$lR3cIF;^koP|tBNm6(3Y6WT4e)S^{P?i1Ot5+0vc6#>i|94 zKnqMot+RqC*)2&Jvg{2Z&+p40{49zxybC~m*8nLum5BHMz0yl2&;P%}o4GJgARrJB z2nYlO0s;YnfIvVXAP^7;2m}NIe|HGrE&V_5`G1e=O^bAof4y(K;zI8Ow%UW zz93o0sUv1Gl|4(Bb#)p=2Itlhn^OaI!PH1DIhf1@M>DD6L}qVrXL4^aF_ufGM*1`G zyy{49KII*O=P~PoyAzrI9f{0bInvt53h=$|#sd0gb0U1M42&QukxTaW?bR@1{@CaM zHy<>^W3ol&NIYJUg6P%-@w!}UIH}4o<`zLK@&+5T7r6q9YpqJ9&VT*sk?pBLgY#(S z46f%&E-1K-mKc0?U9~GvTWdY&E%=PGp~L837ngdANdi~Vzk1KnS&W;8{E+R`E z$x3!7;91*Z8AF|-qjz(24E$mA5|hR8HHj9Uvq=Gs4x|_3Pu6GN?n#&3fE)?p0eDmr6X_vQbDEPR*S!kE2@}g2t7Z~f*cG;gE05_a#%gm-T z&>(<&E;@xs8%p#ghl-BWv{tT*$u%4Y_h%tMhv30*qo|=&HpeeXL3fzko){Yflhn=v zy9#5Ez-8ie6C}_$k;4tZ|E_Lg=QLMf;S8(d)pZl2X{dBD{?M(MRm}||19KsMFkc@! z`xjNY0yAb<4|Eqo2bomy7nTMLkpZznbevb;11-Q;KFc+MK`FdyJ`Ty;f?^~pQmrh7`NCVPRsmA}h|6BgY z;Yon&{7d}RzSn&J?EAFu{l0`R?yIQyNyXC@hbsCi7FC?@o%Eja-UVL>T;&ax|FQhr z<;Tkply5C>D-U>n@A<0dG0y?dfM=1X8onC%ZTB(v0rxidLidHPS6nZ;KIYo*>T@l0 z1)RTge%tvO=k3lx=Vi_c$E4%Sj)xsN$1=x7Wv`cgyX@(*gJsFG%gO@wSM6W3KVd&; z-(rv2CEG7-FWH{7-E7-tYq9yQzp%b&J!*ZA^$Kgy@&;7KVwttwEmb#F!C#~Fv`i>5 znhNcfLx=!O0>;*@UEfoeM5an}rj?yNa|eK@jl+XNdf+V$S(qX9=YTWZ51gwwoT#!} z#~o@<4Zsz3eJ1)*HeLlh4GG|pt4nR9BOFRv-r3a&bFu4yv5}*mGOpXuQ`?Ii984Go zAkuIxu(X&8S)JU=OrO0C%`#wa5ZtNh!7MjICC?w)pJxL8&t1m z6P9zTN6OLN8&Qvm0A_LBHB<25AOZHyxf*!l965NFCp4N#Z%+}|&D{WeQBJ*}C)|Ln z1>e>70Ovf8M8*lVt6PsOoZ6`@Si!4+hgU&WA%cA+8fC7E;ZVPBYBtq%Yf&SoiWtGg z`psMeY&_Q?8&vL+ZYW>GF$%}=5Y96C_Tp$Bf(q1hp)3v%L>8j38g1eTLk8x;x+@Ai zJ;`hie8IX0>cTw(VAPydz!N2kI6R5nU{wZtk?`ffN87!g596*IbQXIF25#d@xFSwa zE4>1(EFw2+1scjR0)-c9+=)!2#(a4ITix<0co-_-4&X7X$@1iAuB0Xn%is#yUzBP_ zzh(R3;3J0b(kaxdF}DPHOkgQOGIKGo(O@do394!?!*UbINVmVp#1@=6r~z{66g;ZE z3z3IoFUrx_+m7~dyn}3LZyT0#>?P$8V6$6+f%dif3d75dl9?=O0x`2&&dLR0(9n!r z9Gi=>=x|aS2Sz$r@RTBs!5Fe|Dn?~tXA=bu+SwR{z}GZ~(t`}_xe;KaW2~MH1H2e> z7{ze*ksImAiA@4|!c*`tjkR#>mvy+M8dC#V6tiFoF=_-fArA*leIuSZAJ}*iKpHSa z036KaMgS?t2)G0oco8t19PXn72}D2xoTBCWw#dbNI~N#vzNL)Bw{VV`>s!hK_|(oZ z5dwZqkL6Iv960pK21-53z>*p%`oD2D@^N5P`HGFHb{4SGky0;m5H?Rnwx_|cId#Co z>$eBe{kb#@(5e0qS~nZc33EYZe6(3L1d)qlTak-_S_6zcP$?q;btbZK8VqFt+e0&e zVyKS1=7DqyEm3w^+FrWOtFI-3nD zMwQ5Dh7sCO#Ax;fz{_j91p`6|()qw;3KB|0km}9@F5W;tzy@ciaGf*-PZyoR*7>L4 zVRfwcArG&PpsQHDnH9js>)X&Is922`%X!|%a%_g>z`(mF6KekBUgKzxZDGf^ol=L{A}S*a7$paM&R03BI$jKzUvwgM}H0G-b0Sn%1N;%GKkfdxT;x>3hgI-1ohuo4K+ z$l$WFJ};=iGJt0sP7vsHWwru~fBZ$&@&a7@$>9eC(yMD%=me> zsCtOKFylAlVfHpEFyjxR0@aD^6 z>wG$P&rx7uU|Jv5Oj2=J7fi`mh&Wgr@FEUJtD^H}D6l@@MI0N{W-72a;6)rMCoKe4 z2E1re^^k~zWq}z_7ageQDzG%*^(E@^zi4xv0*izI9TIfds;so-!Wx06Q)L3X8WdO_ z1n6>1CkT5I-D)hPz$zg?Hw<)~D6Lz^jdqec!>WO&A7$fJ#F?;c2++YlP8SEGpq)9#;XdUg0mG^0`P`y zm4}ArYz1cjQ?M0W2XlX(>-6L73yYJY+fYzOx7c zpVhs03LdpLdJpn&j8>;}w2PVfZnTF36q`2I+=%65;ik7&oi^6(HL*q2gZADq1rM|L zl0CpfXN`JAg_c)Dde&~>rL#s8UO;;G7&37zF9<}q8*-?YQ~v^&8uZz-F{%~GAR`BO zB2k@>QS@i;0$w_6R zM%)lE@*+;1&asHw32eNGLpE$7*JC-)Z&(f$txKUEp5?&6yj8bj3Z5=HZEPF_9=Zb6 z1BShr+GMHCxc+zfe`=AwAw4N6(zQ~vbODg!M<5^&5C{ka1Ofs9fq+0jARrJB2nYlO z0)JfyEKsh3%~87XS-R88IZ{)rT*==})ogp#E9-!VZhPv45}x9&XHZ!Se4HB)#ZAvS z${Jvy+Z8%d#y!tkrJHY;X3I0AbODda9U1P9C$9hNEk`WUj$hT#f{ZX<$%gQ@vDev4JFb*P-N&S}gfPN6$R?@yW+O0N*+68ynQ##>b73 zP&m{a4MoCos5QQn?rd0IZ;X3<7_G|B-&6zD+Zg1_-ngW@l`tUG}g{Z zd)$SNUdvDlJk}5fMx6ZVR=9J339I zEbXLHW*DU8iP2gq-HS~`Y+jCtRso__Izz_qe+oNmf~dB}#Ahm`&CoQVvo^!DzXN60 zV&l=trc!CRq3kB|grtfoYAAN6&CQ|a77RHvCEd%25}y$R_EO?wk4zl7MWck7-eHEv z$|VGk5^=Owrfr3E!c)Jq7@woJF?lrA;w6ajdek^6m-i$Io=+RXug~*gE?}$ z+|n*L4=Rbb2To zQp<=5d<(W+I?WQOuc;1zIzY9WR^DRiK>_Sl&?g?tA3Onfd`8nF@SX!E8})UAvT#>o zFWhLi^TjI{FPvtXQC|}Ra2Eo&wJNyF;n??bxDiKN79b40b8=v;KY{1a3%x+79sgW~ z^RP%L-lj(zi}1Faig)3vfwTLbfE|e|746e3RrNJh%)D7z^QdVwLiMH*Yg$XK!D+wF z8UnnN4^1H)RNseVioFfZsX}w2fL6gAyfvKv%mb%ixRaVQ3eTF8+r`9^7QH1{pjttg zh!u`=vZA>?9#!nEd@FFKf9B>V&OGo0wE}wqTqRKNH0!Ov0@Vt_M64(~M=N42iZg~* zOfSLWD!AE5=cNn_cz6Nc@PYRrsUe0&i3QXU`j~Er7-Bm|L*zEa6GcO6OAP6TewE)T zvOXO`mbAxW2Z05uErf~KV$yaD0Rr7sSg|gEIY+&vsRnLE7iWJk(d%wb*f<4 ze)OYLs*0|_G25UkF)(1FN%7dRhp(Dmjg8!5X{0@T)UuxX%Q!HCU^YHN#q@2A_>YV> zA(e{+)H%gAELkGg*hm`-RI%P)9c(s?4ztdmb$>S`hM|###vmWV2|Iq7cKm!@xc;AG zNn50crDp#Z{2P6Lf^YvtDo#{f>ixcVSNWUe50=mKe8ZFRNbX164e;E4tMlv5t&Ue6 z?{QR?eX8tI`^)wncCYQYt;_l=>ptsj%U3{{`OkXAhwiIv@^RN*w3Tuu%IfTxKVWQC zDyURk9BYGOs@ZXI`OqAaV_`By=8NB?c!_w}GT^PX_(tRGCIoXhIod|2ihSAEE9D@2 zDP7lVO{Y`t!fJ?2M@tsPq-)YuB-%=*jC^HV6%QXLT7{Bj5Q^7LNaZMT;JVDRDCoDYEHdR+WK0pba*QjM`{WQ7t9j zMlD5e6Tsv)j3zTJ!@G%=mU-N^%w}ceOEMa-lgS^>zlz&-&A8MH$#N@e&84vebl$=kK35s+^m0 zU9%@{4bx7>r1nEY1n3gYT8Q}pi$SCdSgMT-kQNhdiJhPgrYHO%jIOD)!OG5MG91Iv zkQ{Ddy_n^zd?+_xPgK+!y-9~Kz6v&kp?K&~;0A<=>@6u(HZLmADmzYxFcaZJJ3u&R z2rJA{$ejqPq+|#qD@)B_k5wUkhgnqy209>tFUPsA^wPxAMCi>+OxE(|Kp*yg8RSDcmKe3v|c!uEbTbxdbwmqS4J+K+U9=f2lf!?Q$ zgo4$i^P%hO!Y!OgyDabB2CA1s6}Gttp##E{LU z$#!a~4iocpC}t1;Ca#z2T+}UT`pO{f8p3qgLGYVSE3$n{`>3zbUd=fu#nM9@k38dqa&gV zIu_N4FYMFPoyLVG=xkG94Z$?vtpWq~Mhy|321MUX{#FIn4P1Z-`bPOOPd?ypCjMFl zRtZe}BCYv!v(hL&%o9&MV5Xo~fwh6T2k4DX>Vei!B-&3H+U5dTK$+6GLdBl2dlH!3iLXR>9j zY}WITTT4aDwXK)P2Gq?&Z&qOb&P3}wHQMhOL~ENZ5ls*`6TU@(>AE@Mbka`khC@41 zU7N-GPc+_JO%dN-kj_EeC|%cNQ92@SCVQijEXXE^t6S?7af9rLuC=0UK-^69W@Vrt znjl^fO%OMV)-_WUO%OK|zD4OT2q!VF3fG>Lqlm)@7}2&-oQN{SW2T7r6{HiyRq1qm zrBmvnbZrwQ(h+ep*_#zubZG-ol}$Tfqik*KB(e!CX2Lfru)fkZpn`BRco>Ci8z&JC z?lcp3|;RFj^O=Xk#xq_k& zZ6hT*2sUOawkfb`f+H`eg6C9H0rXr^fwrL%1z2n*f1?6RqbaaA0HkfEL^fb=CVGbg z>j|G+8HHUF-63AAjJn{HX^tOBT&z_E04}AS%b;ADwZ(40Au;Q4htU!0G}{ zcFd@kd~I+dirx3KSk}UOp1RV5T4mXtsiC0|(?ej3$l!drxuZDYWToVGvgJGB0{0Ym z0Jkf!z<@I}aoC5_RhLcTj1^U%{V#5=(V7;{!kSg~3I!GzcvuJS-0Ds$Q7q|AMUY;A zuN&?Mn4KWnq2S?N8LieYi>Q<6hw4k5q}pEGs-w2kMfl4mPVy*ljCV$TZ4EeSAvkHC z+8Dt>sS!xD+K38#J!B@NYSZ{CqVbhlTyU0}K@TJFmkT=;IQLswUs=UYVinHLbV0BX zR~2ytd8+DeIC_L6i32xZwBcw0-r4U|;9#k*+UJACCvlm25~wh9Eo_;0z*b>r*v5x& zozjg>sv2CcKZ!^CNZR30!$70lP!y_>)oWe0vQC-Sv zRh0gC9vwBQC_LAqii&pN&3&`bT%*7lP->asfTr=(n7RegLC;{A3nV8#r05QF{*Cz z#D@M>TMUlfw{fy=*zd-}=z##6I?8nN9knbQOAQT7KJo-S?K1w+18@+c4>L%D%3wdf zIo44)^-lArSOytpzpd@zxMJV$f|_mdtyEWnSTpjdjpm%p>1S>qzx~$nM{fD~z9SR& zK0JQtNdC5mCvSe?=lkwfPrMe+v}j*@r$vOUKQy4kn&jg10E%b7bDE__4%9FRV98FO za_EEwau0sW@bt-#!J!DMo$i{D`r-nbl&gS5ihv9zM?!`2DG$f1H$$VX?a}7Ueh02U zsw$Z+O{y&`lOtLy@S|9$f_XyLD<*z8x6{_G?Q&$x{xT9_c*d*{Vdw{T2j=)KP9hjE`Rgk)6d*?`uU?e>GYvn ztpj0eH%@OOTD>M~eSK`h!-3)Wmi=(l7Bn|D=rmg_XZG#OzyCS9tW-6_@(muT&?t@5 z=YmY1ej46y1?h0-QbkQ&w$g(%Z~4w;Bu+LnO!ckUZy~iQEK>@t<_@NW@uB5i9!Dc4j^)KiF$B=^sre@!y zybrXk^{rB2Qg81Sv{B1JCtdZ@r;0Q>aWii@(_4JSqt*g;_t&22J5E3A@d9&z+}Vc!=(f7?f%E1yyBaU(;0AP6dwcGF^+cy6AS9b}LAu3vUc- zxAUPfldqDnjatihO=@<%0%v)7FtVo|9z2{u+{7PKv}+3mJ#+S+V3 z+ZW;A74T2~w7^A`Ou)BYb8U6`MO*jJpRR`73ePXF%wo^4Jin;Fr0&VO_td`R_-WOb zDjoL6JioNM{eN)!!QJ(a=FU$0p_Y7XBq`>`bJ1jaR7$}g?X`Pg^WdtjgKb+^UAtkh zZCIN%+_rRBO6^ETrNnTXl*)^vVs`m(Atz>2u`zMDEidlRFCWh3WBEc(rld?Pk;uvv zVF+yFvAmQ{$*CjR^ggIWCezBznPe=FiX`XI+w&4(27iIoSZ4WfJS)cXVsvC&E?3AT z^a)vUESB9ZXOHDZ=V)HE$bNXeg7%o0Dj=NrU2jAglM!M3)+0<(v=HZ|d{V(%imOOwV)>nN)9_kB zl2nl&&nS1r;@Td_h}khIm(%n~CYBXbdA%H|bTl4|?}R#1g)uQJ#g`9{0Q8A?wlFp# zvyG?6GU*iDD<|aAS-4izWv`TzK>g(0x%*DaMR#Ns{c2l1xMtN&8@9Gx?!R2_`LZtg z?YmEg-s?T=t#veabl5+l8cRH#ER3ac*n{k{&e(}82m6s;>JcQmpig4OwB5^+07(!? z!I7nEJ8?7}EhBeGViJs#TH>x;Iu+HW0G1iW41kbQfWMXrq-DiD1t}{kwUA<9o{Aul zASNU&nUr!`a!*0bDz-=notQiGV@X{?LW<{g31upytscc!v`-aPNy-&KmstmCN)~eH z^Ni^l0F)}E6m6}NKwGPjta%EpcP=}2M`dsLSgjVEI{#WM9-nOJ;xY*euh$V|pY z#3WG}+NnyCwtg!sx>o6id3JQFa(lgpR=OO`?d|q^1{GIFFVIxzRjtudXa*VzxzZa2 zP13fIrj(lm0vXj6%Ot@^!N`s%-6hI%ew~iEYQc5hVZ$}|T9Hp+Lk{B!G zccztbE3;eCFWOa*02Zn7t5@idMKihqW5IyQhjxuy**cuU)`Wxlvf-t}nmL3w=WsNy1inpXd=)@cw$54EDmR#LRr9>Lnpv1C^Cp$4V^*fh4JJ(0 zJnzA^)x<+gZX>X(wX0V(Mi0S20}r8_Z(gt>Xy=QHhO5%5T2BRFroT6qjqi+QmkNPi zFHAg0hemgc;9yO2_QsM0Fe^DP5Du$%(J@=jii99X9z*0r!li6(nHctZ4_;kGrj?U7 zDo7^84AD*et~R2G$>?SATkmAerg)^3b{0tzv_7VMY=-%tI(5(NgsGqG31H4GC1pat zDo_=YO;t4TQ{Q>Py{rdMZoSuAY^roLFI#3Wg7ag`pm;1dBBi2P7!imqa0EC490861M}Q;15#R`L1ULd50gk{s9f7Xu z%C0Mgh(8bsh5EvN_ypj;ZUO%9YZH3#~+=u)BTPokQ!Rr4F&qqBu&yc6fV{iCQ z!|8^{8Zr&*8m?%lbbsIdmir0!xO=NR;J&E-Z2gz&AF5B*udDB@`&HfF)V)&oP~G0T zO?6A_Y_;F4{Y>qV+S_ZxwQkpp>n+z~uDz};uAu7@=Z~CUcK(s`pz{`Iz`4LN<2dO! z=14lOcXT*xHD9lJvF4tdoi%G~7FYkG`m5E?S0Ajtxq5kZMb+O`y;60gDq0n(T2T2< zASVBC1ULdJ0`J-4^fdS3lR5C<#+a1y#WIp_ui%5jK5*tO59iT+{ZeA};D*7igB_cp ztboUUtjcb>Y3q_3u~5@&g*I;4+O-MU&Q=w&T|2n7YvWu6H^5D+*&%$p*Yg0?JOkDO<%j5TKI^>dbFt$EKnC~4j;IWeD?Qln~P zI`ITQjaWPY<-Dex zp&T@z?OH5g+5jv7!gs7fR#sK8E?9icY_dOCHz zIL;c`-fu1wo{HQGXU0KnUmp}%XRIolPKv8pu^ee5tMiIpbKZCZ9xNy4%CVn%pxiQJ z#iQ`76+BA@td~Tfgo*LNx%4cw6`%fqQcJ^7Dr{67JXVg+u&Juk8N!lAj&ey>VO!8# zFnkC|O60IB15m=GE3pJaVTpi6j8bLNIgO)ST#(Y8g~eFY=tFB3YT1&QVTo zLl>5_Xaj1U+J=rRps0!U6ZuF{Y(ys%vT6htLMvOo1PTpUGy)5ajH4fro6>wWWui@33bo0D*+zj$HfmD?GBJuPGXY`S-PT2z;&;|V z5fe8~2hwbMheW!es}70ECR5j<#P()G!vkA=FOwir(gb^3cv*Xkb?-|(j(9_{nWA20}uW_1Ss0<9-FhN zQ{M;EM?N=o@5iQ}e{kxa1HZdYU>M-~zta5$o5$0ThA;l%2yg^A0vrL307rl$z!BgG za0EC49D)B*2oxig^)?6`xLkw5cF&mAN?U#`e6IX6ub!TI`tZ~fUpV{pE8SXB0Z2Xj%%iXm4(}a?H*H39QbOFi6OM-D@lSUGUeUd6>g4BUKKv3bsV4vU^^Z)w za;PjLDUI&T7Z+79!Pob+c+8(phZsf=d!BtR!KaVCFm>eQ^oggZj~?!xdHK2011C#I zK3RJH-qMSQr=Kc<>?`p6!3rrQ?sae2{4y{a=s4Pv!@@OIdOdY<0obg9-n&ZWa;$>N=NUTe*Uu>h<8h=8{p;HIr#1# zNfyLyGavgT;Mk@leE&dk`t+Mh(kL98NnzT{f2^cs3fW9j#Kcq2D2ecfXh=DGdQwRl z7n8~KK79Va((_ZB=hvQpgD?K!2yg^A0vrL307rl$z!BgGa0EC490861N8lZSKvkv7 zUWtDyDl1(szW#qlbSiHIM}Q;15#R`L1ULd50geDifFr;W;0SO8$`Ih||1v;0$r0cP za0EC490861M}Q;15#R`L1ULd5fp;JRRh2f}|F_}(zs-fu|JxS41Dna4#1Y^Ka0EC4 z90861M}Q;15#R`L1ULd50gixz0AK$rQ1AbVUlj%_@1%I^H z?t#sNtF{idZC!QkhQYRBZPswx(qSpJBOR3z!);P3FOG`Y<->)Xm`%mT#NoEQxIe#q zIG2y*3ptsRGOrA7vHXs7c1+Hpx926o4E_SE zvCQ(}cvg(%#puYmT&|Ew=o7NySS-6+&K}E+%9r%kL^PHkZo_-9ZfFv@zdSV|CdIs1 zmbz*4x}jB@x3#Sw+@?Xt>z%l&&e6PRk^S&`1?@30RX{lLyWWU0CL_Z5tw)%oXd%u^ z`J{rk6jzbV#PU1krs1`MB&i}lo>A_K#kD<<5wl}bE~n{}Oe`y=@_IQ^>1aF_-wAc3 z3S(kciZ34?0q7I)Y+-CfW*bkBWzs3QS5C;Kvv94b%U&rbf%?h0bN8K;i|)uO`qj32 zaLuZlHf(LX+<&>;^JQJ~+jpM~z1Mr#TkB}<=&*l8HI{ffSr|*@um{;?ov{;H4)!Cx z)FViAL7&8mX}gyt0g@n)f+I`ScH(F{T1M`W#3UFewZvVybSkP#0W33$82}-r0DmnL zNXv?Q3Q|^7Y9YnIJQYD8K}<+mGAZS>7vGO_sX*r;M1keQ5)h)JR{v{RKNZT(hObgj}2^X%wU<@S0Ht#mn>+uQB;3@WaU zUZAPat6HO_&R%W-NU$m>!NHp5?2RQ0U{-QoARJcjqGPt46$wF(Jch`L zgiG1nGBND+9=y7WOe-gERFF)F8KRr`U2Q}WlhMoKx8BK`P4P%6?JSZcXnjoi*bMVO zb?Tnk2~$7W6TqBXO3H+ORiG*)o2qEwr@r%odsz>j+?Q z3I@3}p@~~mSVaY$RF$x#b>gzt?cQK>R{fc+;iGlEwU5=Va6apZ)~v7kvx<=Y=7t&f zA=?u72KS+=zO9cT8h^nY;KGfW#F<9s6lN9Y; zidH8pC3u0QSV_4RGOJaWmvUvqW;HsiOP^=eg=Tua?n9MXT#p>QOF=9r=JQgDtlimV zixDrDgK){^^-iE1w+O%hBXwE}9Hz~4qqM?+SG%jp(cIc}K_h+&&_0z0>rPSW^ZV{%h*-=qh+W?`= z(qO&31C~kAOgbsWVH8j+OsC?7EUun4i5g9#Q4`3{j_alWy*ovQAK-t{CB*kks6J6y zlVL9?M6~U~l8KXM z1rsC|T3~{C3MO>guILDEG5Nv>qaHrBw3b89Y1n0)ly@70TU&_ zkQ4XIu0c1qmM6Dr9kRZtDd%g}dR3Tbb(TT&dL<8?^j@S`H~|D(gq@)f7aMy-$un2( za!|a*OB*P!eR^IP^i_BvaghZt%robOIeMia!fCZ)F8sZd7r9Bq`EE%O4+1k;n2Vus z?6Scq8p}b!@KP^^Zlgd6aA^k+U7|X<5h1XpXfTFZVXp-?F0`r0EtXGbbqgROg0|hH z8?*_eL?Npz45`q{42_WG8$=`#ma8#kCrGcJB;T+tL;`Ivt<#KrbM=C{1fUKG_MgO5 zTwXrWG@`r^qt!&_$pT^ChCqr4&iZXO`XQ-n4J8OqD(s^ zbpNn>hw7vdtwx1X@=&F8b2)w7f-a6|*UIZ3nwFF9q!C5BG|R|3Ny%Kgkc}HcBSa(g z)$AxFlTnj&O()7X(4dUTf($bb?yh(6jZfT~{e5hF;`#rVt0!%qpL))C{>t-bo>QJb z@jT%<>N)7idvihCsuThJ_7I_rJS;=>CrT>+U~wzwCa_{iypM_Xpf5_pp1jd$l{_Uh00gyT1NE z>wi-Jz52K7zf}Kf{io|6ufMszk3T(7vEb3NiZ;u?4Da&32QaIJK$a4mK%aM_(db$;LZ zw(~9L%g*D@W6nuu-kET2b*^@XoJ*XSIIA2#bDVL!?Rd-avg5epm}AnBcO)EJ9jhH7 z#}daSj;flU)tsq$yXLK$mursK9IKhE$=4)mw$`k!3DqpAxumA5`e)T=s^6}DtNP{Y zrji8D;@4vdD55gN$}EI>2ZLqXkCSFxt=PYDW7QUB&1X zjILyKH=`>Uy`0f@MlWNujnVI+wEZ`X_A>fE7`>Fyzh-n7qkqNdD;WLnjP7Lg|6}wL zM*ou09gO}rMqke8Uog6z(LZN&8>4^5=*5iwS4LmP=$|rr5u^Ww(U&s%CyZ`o^!FM4 zZbpBP(JhSrE~DSY=znB%Go$~3(F+;<9Y!}X`tKQi38VinqZ=9hcZ|N6(cfnDMU4Ji zMlWFWUo+an=)Yog1Ec?v(QZb+&FFeYe~Zy|jQ%F0YZ?6wM!OjObw)cG{eKwkVD#4* zUBl?FGP;`4Utx3=qrc4PN=CaGUBT!&M%x)J+lP(O%sxKENM;@%WF)hWyBNug;{%Lj zw()*OGSj$|k<2p28OaP|KP7Fr+Gm=@_I!68lmFhZ1{y8PrGV*>(u3_Xo zgsdN|aoJ(edOxLBQ|eAi4Nz*FQrA*yKc!YtY9FPpq10YVT}`P1rQS=aJf&7rDo3fS zD3ztum6X~;seVeqSyl*H*7s2=O{rc=r6|=ysWD1LD3zpCm{Pkb1w%Bpb{C~!fJRE9 z6b#Qu?W7b8&Pa_?3WjE+Vw8e`8L44P!LW=}lu|G#BXtL*U`R&lc1pp3jMQzEg5emc z?UaJS7^zz+1w%1X+b9JCF;efN6b!>i-ApMMgps<5QZNJ~wUtsZ03)@9QZW1?wV6^d z_#$;9rC{hqY7?bk;6-X9rC``a>IO=|po`QHrC`WKY6GQUz(s03rC_*4>Uv7SV2ji` zO2JTz)OD1CfflK?l!9RvsWp^>K^Cb&O2H6|)M`q>0E^TBrC@kP>RL*{;EL2Wl!BoZ zsjDdk11nPRr4$USNUfw445~<7MJX6kk-CynFrXsUPbnBqk?Nxq45mo+QVNDrq(YQ} zffT7ArC=CEY6YcW5Jjq+QZR%fwVYBgfFiYwQZRfXMMt=L7(9_;102pn7icD<{E{QU z5#R`L1ULd50geDifFr;W;0SO8I077jcN_w^|8MuKv%&xT!x7*Ja0EC490861M}Q;1 z5#R`L1ULd50gk|22oyv1CR=l{y0ydQc6%1NTpo|xGc-gGiY*DmmI(eO@%3xgY#q3B z?Z&;ab=O^Y{kFjRQ25ruzI^Z2)sgh3JGV)pTzKftZR@UG^}c}(8zQ&vOcyofEx`YMZ9-3fDAX?mR|o-rq%X3}-`nq>GoP;i zAG3KLo2!95pCiB#;0SO8I0762jsQo1Bft^h2yg^A0vv&PM?kcDY|A{&F1N?+cDW&t zF#Y+{)2E-DKJoPQ(Zi(&AN7-?{jk(GU;p>^8Q1?159sX=`d5Slfk=SG2XOsg+3>i{ zbHB#}U;M)n;0SO8I0762jsQo1Bft^h2yg^A0vv(gI|6$u>ut*#?Ve>G+(+dPJ~Z4)++B!`kigUY37XMZK*D zSoUaGPTg~0>hTw+KK%U5(;q>`TQ^qtsW4?Z7tTIo#}+$vEmj#1Zj|}TvRpVvT>me& zziRUw_S82#(cpK#?p|B}&HCZGAJy%ztAKavxm}ODmN{Q?_Q5;wHr9N*My&ox_4})9 zs_v~?Q29vZWfjj?Tm`rD&+i$5qJ8m2Hs`X7y4-Nu#O?7c0}GkC|77WbhtGccBQq}+ zr=Kbc0r^$5lfI+IW2M(0(J|&PJo1m|Gg&(m4 z&X%lZx62+s%P%a_vFgNl*kh+lZ#*RU%Nt44r#^PynKvH4P`3LnMYbLv1=)>kOUFMq z^YXK#fvI#}ii=VDa$CPZbEfb4!qkD{1v73nFrGScv~+vs3q-=qp2;<;@G&<1Gf()5o5K#+^C+DNyI$GS)P2j((o~6jYC& z<>%f-;MTUf^!h1K=AJU9G6BEnSX8V`N`>?5BcO!1fh;D=fi*GO{a@KAF> z%<}gwFfg9_%%@7PzDitU8Dp9=KaA5J!gv`Q3|eq7IP@o_2k#+$%X~7vbQ^{Onr^-~ z)8jwKmZlpF49_0;`1F&y(T6gm>6W8TXb$aV`TO0-utn8{h3ZCkbu4x!yBztQ6t zXjbXS;px+p7s`3O9yzyaIiEfK=*)@Z?Du2KSkt`uVV$odD0{VIeDU$=V=oXz#`Y>& zOp@nNrgMZkUu)n>b(JWSmg_mG@HukLxPWV;r=7JGCyk|}&)tCNj*IZqoN2jN8Nf%M zv+UU5xv5mfY2Y~Z=!@H|I6~fU&5=oza}Z>8s`T-rGmkt#`ZKpPy)U{`N`R4`C8;wH zJYKr*p$leOV_-V<=ohDtpCV34!<44Z57TTlVcMzD+^NSu4gP`X5c%N)_ze=jFm>Sh z(vd%ASyn!2uKr~C$tu#HGS9`RLC=1kKwHib(k~R&WTk=I^s$o!({gT*Zow_mXR;Tr zUHr@W`zr{Zf(Fl$>IqWt%jWp=sS^2ZV%bn=feYqrH*nUBY37`nyD;z1NZ;&hI0X}2 z|JT;}Y@P!iN5g#$3*Db^x7R;g-&OY+NaP=m07rl$z!BgGa0EC49088N|7-+4P+Mo~ z^ueRO0xW!J(1peWa6wxZme*#Njyy8+^b3~DgxQzxkv=&-;{xtoj5`hEO@Hom>4|%h zyJovZn>7dL*_VBhK9>Ihr>5QPBr@6PK+a_`H@X2sVVNK9cRGMO>;h|1SK6%$yfMs4 z=KS#9U!%eN%<0pmd!D9oCv3SU8m7&fAI{^|z}d@MO{-URO&cN7=FJc5LKU!XXRK*= zLu3X*Mc8P4q==@^!8R~!ut?Fe{goQ5X^cc|u_lP3&ALF&OtO6yz`0Xy@Ua)Bj+~@X z6Kt>=YJjMqk~2SyKWGQWg2&@Qhr%MNuOBEK`aCi&U--)*S5jbp_~ZJ&qTyd{p8fEL ze>egh0geDifFr;W;0SO8I0762jsQo1Bk;~apjZL>{GF}#&W;wB%jI;t@eIS=Z{Pt} z@;CuIa#Z2>h1=f4{u|sM8_Oic+{Tnxdf*@wwFu?)1ZF>LpyU^;Vava>)z#VKR)mu`)(-tl|AkHwF?k4Z;qp$I!`~A4C&%wfeRLYAY zzSiG2Hl7e;**o{`@=0T{QPG!;?emSra(OWe38Ox_k`2b_p-69^Fv}wsntWXU+ZNbto=fIMOkN2`fFr;W;0SO8I0762jsQo1Bft^h2yg`c z+aOSs>WlF9han3P%(7qjkvz&CmOve&Cq@?IejD&ha z0YT^v_Qb^Q(1@7m9trk^yM>-`Pb3(R_`|(nyq6u~7Xm#i{P3SZ4)Obb`}(x|`{eii z!omunFBIxAd9jCCzP$ebZ__zkP>ujcfFr;W;0SO8I0762jsQo1Bft^h2yg_>8-ZH9 z1NQ&5h9A0<_4n89t!;FE*ZG2@*(u2-_%}y@Bft^h z2yg`c#~^TUW2>XNqr*Na=3^u9yFc(_yzz7@FQ)RE%gY8f53bre*tT`mwHpT8hBZ0E zZA*ux#BiIG$}bfJ@ABbzEH6fNDXG|)INY{3mW9U(vr7ZvFqFc_01G*G8_@8w-|`|% zis81rxIe#qI4h3Dvb)O*<@w_+5_Xt}grJhZMx{5!a}c+L1=c6r$CL znUbdgO&k@o%ZKyh8H2u?0hyETgmQ}EWb{^(OBb?nLp_CTQq^s0O8CHT)Fj;m;6H#d z9BgVPN;xs6hd3c+6@=mX-4*~tmI2>nY(zAmU_g)g1==NaK~UuKvfj|9mTOuBY$}-^O>5N#)8^Tpw8D732k&ZfG`F_e z58bG=ZdZB)TLxe6GPVj*u|@EuZww~T2GKzP>CtSukdZqR6R5p`9Z>+{*>ox@?$2b! zTuw@-F&BwB%A~<_m9}qAI(d#iOw?oQ`(M&oi#bE?dD@>>2g=`i^L`|Z` z$x*hD4IY^de6l3Ua70;Xd>c)e=T2bw0sa?VLLA#fOu;`P#q$Iz>;;8rHui;*hdn|F zU86{fwof$WX`^Ilv`r*qvIPk8_@FIcHp;S5p*-~*Mr64GUN1lYkFyK@;RtX9I0762 zjsQo1Bft^h2yg^A0vrL3z&jfOJpbQr|DnzEyyx8wFE$Lg|JuE|{!8^M>rU1Qwa?U6 zx{kZT&gYyrIIA6BaNJn)^O~1xlGXoF{i*6}tG-i}t^9T6Cn~S3c)MbQ{fG9$cCYQL zwp|9i#?~&hxrL_KP4Ly(*xl)Au~k4Jrw2Yko2_)@sk4tApLzbHGar6wq%i7>WhCET z!Iw?LTNV4IgwOAb1bqR&;Oh;qT0OX7aO9; z&Q4FGj>VZbPfQ(q&76f=eQ4FDo3>iky?u*ZcayH}(veS;PM?~q?%=9T8@E_jp4f~K zAvSu!XYM~)df;JN`I$GLo+`dLJ3@g~YX_~l+;OAa17%zY_N60_%sl-P^64Wn;Ko*NmX8^v1_ZAHHw;*b7rfPM&%7(`QbdGBl=;gCDodWYgqjnzT>C z5nmwE(%yu_5h47QLu)R`o}R@T(895(ZdEm zYBF`-2`Mo*cU>=qk-t?7N3JI=H1JZ|W>9*j2^$o>$8HME#v{58cz|C6ZFAe5ZnsPC z*B*Ghbl*c7RT~pi1&y8ofp!cs%GYySAyGd zS7=55%p;{kuTFpNbm@tEX?Ntaq9}W23?BPnTR1i{j++cVjWQ7bV7F3+)oY+3ElutY zk6YIe%7|1;rA1iX(i7fv>+wK98Je&!~X&bbd@ik zPA79dIg5y3A;IleEwnXvE^cWCc7SRNZM@C46>Ff(N++K!9XbiW9i2(1V9$+Jj{Jsz z*@oD7x{$B5sJ?jVl?!c)Iv4u@+$#axb{X8&VCbvC&Z%Vq!r-69L;=pSzz(9~1$_N@ zxeh040bjUJk2YqZt6+F5Hzm%Y?+Ms}aIwCBp{=QNaT61-Ln|H?jcTY~G$Ku}Q5tkv zT4@OIH5Skq`raQZR`#JdO(;$f&{D+7q;vVwOOKp+<31`*CYH-#8pWkYF9~KaDM%S2 zMfJH!5$O*HiGx`uKdM{73c)r-HSafJ?gv=X2E2kLw&03_kk^OtfYH_ zzEEThUE-+XV0J%j2B-Im=ORQHyk&nVysKN50hClT1!i+oG84CwA-o2r3}pg{3CYrb z>{?EEEnDnq3~PB!J^Ad+i_e(17nJ~-8(IT{Tp6o91u;8r)l_Mj%&SSz@q&^2nI~rD z6b4a>Ftd4Asun#QbeoH zO~GMF6L?<*F|_6;90FYK7J0MJ(}~7(SZ8NEZ(y6+s5U}%|a7%RxZ%kgq7$#Zetx$ z`TfLg#`aTdC|91d2R=UY=H2p&nf9~68qCy{L{u!*N!$nQAQ)B7jv60jV^}vM8+8Fg ztU~BRtFvU2+Dq8cQ(94$5Yb;D~v_SazmX*aF zmD@Hr>G9$CN&72L>F^Uk|wBnS@0jE`s0HHpVQl=PlHO&Ae ziK$pI-JO;DP0v)@FoSw1{if=Oj3o)KSTW1&q0G9?eKTnpU6_=28m>Atah5&^A;U-@ zD4zOj7HYC9LpTch7^dQ>=i*4mFlZZPM;*5%uQcK1>-LyB?zwo$nnGDIH*UqNSdju| zH#H8Fn>AGyZSOHdpMyP%{wT^5fM_7BpwZ?nBS7P0Aj7)Go^o)h4AZYaJpEMh+_)RN z)=%AyRr|-11Zx9p+Hk5v=4y+Yq*Gghx1Y=@Y*y?>b^|-hNd;Y@X;l`NUn-RTpil7k z$lD!XwoujWy9f`9NrgENHmSh+!MDJEhgIdbNpj_8x;ba%VLGX>s(oxH)D9E8a%EJe zc4Xs&axn~PWIbC37V#pMjS)wIoym|!8E8XuWqq+Peq7RmS zh%VceO`|}+AQauV1M^jl>&lr^m83|@b1h0~gc$dP$hyX2ogvX1Oo)oM_#K;fnT!)@KELy<~&Vk^`>)udu&mt9+&MmWrQM z9QGXX^fXL0Jkqei{r}vba}U&iq5k^1|EN1wx1jdf+Us3EaNX_lI=|-J<7{%Ablh6= zo0?D63|7xn-&ZYEeXA;4)mQP~$rMmr$<>DQS1jVcvM2k3&qztasGGGx$vWTMi^!ft9zA^?R zB2FWW{T2w_Uc||xWe?B|Je5PQ83*hEtNMAshi(+m@Yf$W;B#9MXX%#aP~O=+W}OY@ zVAa=m6mceQVh(I3PK-j;rHEPe#2l;`Y%h|zH*qMqS*W-RY7R7jK^gRbIfOL~Fp9x~ z?R^%eu&qdD-K2Kh|50k!hVsM2;x?iZ!hBfnpSRtIGtrvx#3JtQ0G8#3yM0QUQ5JxD7Bj) zUS7M-e`4*3xK-V^6h)tQ!!ws`}PqLaCY{u2fABFRxnXGqGxd zxK-ubi*coLg1B6{_B0(uJm3oiv^I+KLxy#FG>RzKO}C56>(*K)shhxJRrxJNTn^F7O}ewZa;4cJ>%y|aiDdZ950;R4-3CAJ^* zvHQ-v@%Ypu&z9bNM6+l}XT&T#+K5_|vG@TXDbe5bg_m)i4lMxoSySoTSgBv>=o7ibA<^0SB&=#VUDv%o1Llr0u zt=VZ&b=mO(+}s~5;<3{fw;NWU$oQ0eTL@xmC9(zwjrdT6z! z7hfx#IyU|BN!mM70{VRV^rXh;p(m9Rxb=@q35>{xW)A@2`oGQo6!8c&{IoOdc)`(L^IXk!)h|^Cs~)d% zRNe^{eA~87x5WS81XyUR(CF=gLzZ~BlrHOoHgJvjz6*Maxpd;=Q;&S%%<0pmd!E)b z1Ij=V+KNyl4Ci9#p-cNWRBi6=ta>Y8>@Ap0olj>KFPebipmiltouH{O=K5(Rl3)~x%udfs zsKyC6In)J5u-d6Uca<3pb+cL@LJrkZ2czmUJB+2#Wt?r;zwBdfrfe=|uGk@b%1G#i z5%>cWFgA5{wl9K%VVd)}if1#C3f`aAosFeNMP!NIj|!)r&eEK9G-uz}<`?<{aQIj# zUVPAvhoPIjaGnY$^2=mYwusriVs`5B`@oq_f8xQZ`=3u_aWo)jpM7KLl$3`l5cm%W zl}7poSVBJ>FofI4l;CFk`O@}3TuxE&DO3?98k8PTl+AsizNr|G?4dV^2;UIa<2s$(e~azJK6B z`Ix101R|Zm^V8)!R)L7JMP&A9ThVo}W}$7d(7c#I5SEWY4}xFbiZ3ZVbNW-TeNMSk zPfr?*ew*aWfCLmkM#Yp*$)5d4w%i>-uz*PRU^UKon;Mxc-Lfoe#gtZxcsc>^d`iiT z1s!A34;sDKJ;|pi9Xta7=fFYf0^1K(5e>sVV~vI>dqyuFhStkqlarX4ee$FgCPIM- z*)u|=GsAb^K{)LR`Wy6>O;<|CUoK5NaOTx}&b3*_QND(NcX|CrUvmd+!a>%fY@Z`*>WHBL&XmQw~g*~GECH` zLMM>3^uUcu4m{~Pi$2Su;fe7hJbbU&jaDX&I1vwoXWx>(vv?OsAh?x|lD#^e`fIt$ z%785Ka0)!r0*_&-zBLR_o8Dx72uE>p%4T!#Xz>HUe5D&#AF^!`u(fM`$9|P7#SD;deUDALGz^4sH$w3twIJW(bIxE$A z5vhpBZYeX25-72H8daNxnKn8lGb8gCOJ2K+cnX*Dx?0PN25q$Q2u;JFfgx>B8SI;c za#*;~_O?aKb`|kVs0obh(7h(uQpQaiXI8k;rdct&y@)45X=G2g|4N%iH=_xg2)0KX zY-Uee(SCZbMPs%X@hGS!v??1PTdxq;q}HzuH?#V25VNX%?)_!3Ewy%Sz?sz!b7`x} zZ!6+qPb#{8>zHnklIJ3$L^j6hJi+IA5R&TPiOPvCdo$P#TgU-s%H^ts+72>wL zZSS&WY_RIjyZ_leT>lUC(Yn8`6Kmh9z1(%g`OmgYWwGKX6}Q{}(tbnrwa(iduR4U9 zLiN|H9;*DgZoPkwM6qQ8!q6SvO&#EB230$uvuF0cOsZE~#&cWf%Rl8s2Fr#9<07>O z9w6!IVe1T*g^N}Bk~ZA_x2o2`)SAqr{o(#VfVx3l5;SQQ;>`lhF6JnfcLnslObs3f?M z)PyQ^N^PR&o~#{%zYq_FK+(Dijh-`)PV^kD4mgDRKnMH!d||&F6p~e*JWk8hpAA^{ ze^sna@OKM+Z4jLch5Ciy3J65@_yf!Qz5RYV-J2!9`0fcZA`tloweqnM!CXE$3}PxD z4iWPtUCRVHu|%XBsDP*&?8Snyfs)hh8j~I@_h{xeU#8shS@rW#r(*jAdHjF~w^j?C zR;l3{9GRhm{mhw~0!YI*^V7e*6ELoIv@~@LUy4 z$Qe3aB;lQ(Vk|?>F5AGFMfZrg%#sf-o}5N&qTwHS7LP1`LH5$&L!}e1vCu!-4vg^l zivd(-HP(X<*wWy`ENtc!qiq5Xtu=La0fZ26ak+gmglphk?NblmedhERs3?haya3w* z@Y4bib->rFbdSYSF$hJWX-D8+&w%|WKFk=R>G}Z4g~;fhfRk^novj9_wvgAj=Vo4+ zoH})sikTAg`_kFnKKh1t>Ubh5X!w-og@e{S0ejSJ^0CTd@=-oK&ocRlSWiBPyE%`k zM{(f~SF%|~rjyL2uypNI z5*>;X8yw3 zjZ#B7FaZ{|1didh07QgC{h^35!bdPd3lZ6XA7+5CwGZ2Gu=!;ilz5mP-5k5JfBqz64;;{UJzY_z{WQK1{N{`9A@1F z0N8}%)9M{9osXa7IvYH{9qj>~*rj3dAi_}w8; zymW%ZWcdpIw~8<5SMa*{2focyU3${B8;gI)XBy;1rEblMv+DU-9D62kGv>DsLPDe_ z1pmmpCGEdd=1Lc`kXtZ8-;n|ba3P*(ftP*)DT4$E!mv$6qOYTzCz)C&aC0ZzcqNG~ zYGl#}6lq^t$fnG2seJT2)%-x#GC}r(jN)mRO0x;4Mi!}XbOUpKgtJe;_R*r2#zkZX zronDN7kmNK4Be=oeO-uBwNARA0|gd0(+I)VCYo?cS@*HHirRZZ#1{_851m$2&5O=o zG6`o+Ks`*bF&AZV zq(O0jYP~kfi1w+(7}3iLBx0uS1YC%DwoT%R7{M5WH<~94B!>k*h#Vv_;@KH0<0|dAWVBI(jPhd6L`D+4n;!`mP2%|*D&f^y3EAmRjj9K}==a#V95X<;{ARMPd8Q*?C+dM!G P!_j$w{95w)nMVD8B#A6f literal 163840 zcmeI3&u<>bdB^#RqFzyyL@SE@+LmZ7Usl%p!bBiaqGH4?Y)Ya5!>XJ(a_gKn`|b|O z^}FxxYJX5-0#qR_sX^eJdg!4SpL{6LUIPROe8^vrOO8FZC~^#tOAqNYGy8LPC{cac z_J#44v3hr(XXe@2&+}tuXRROp;EtOxV>5_GR$^S6dTFZFntIPLrlzLer=v&5A{{5` z*r4M$9r>SDe)5dp_ou$o`)r099Gm|WZ)VK@*ZiMOUTS}JVtMB4=`W|RwZf@CPW|B- z7LHWKA7kpLXWN}yms@)mT;E|2UFV@0@5ZJVY`H%DWjf4b33E&YcYTdl6GkyKzIIJT9zfv;)@QSgAwtKxvn<~NgOLeENgjHz;I zK5_Z*_}?_BQMlZt!CMJ42fJl^Ip{QW^a^@fD;k!~aS=0IUXPc@7w6iYg@xA7=ZbjYjd-l^ z-&4&v5jH4B`0rt3M6}ffN#Z76C30?D=Ye8Z13~&Fw36+TbSbL@f)t87CA(q8C=Wi% zu7}sk4HAYd8o6;?i@R&9Twz5N+WEuvR=5Q}Fm21;Cc84mNi?7+a_lG_4a%X(xUhp! z82DsERm4F=GRmqRf6^T{b}30KCSN=--PqiWMEY^7D}Cek#{27^+_`65&BI)cx)+MY zQ@U7mSePiW$VIc-SX3GpvB>51SloXwD`N4N@Y8XjBI>doW^{))0C^Qcw5)6FyVp<5Pn&G zc7Cm&`!!iAotdTS&Bo$l{5*|Mv^(!Ew)W1~@>HgdlBQBPqs`JrhayR(M#<5onRaJ! zvGv6{sink}Cp<;v*>p2QGfR}9;w(?O=T&FfxSor$6iZDb6|)J~v*Os)b_+e4xM>v| z@OaMCPWB2dduVMjZNE|Aq!ds(lY=yNeRjb8Hd9}$HMBhoC9R>igT}fx92Nnr40LEx zMNtYw_6$Q)S3RUM2>G(7vPhERBw{>OoXX@>QDhV3fqEShZn2V$v?$8!(7_2rrHwDo zZOh9-w_@OsiUzK%Fu(Bfe*DzjyLnv9WcweAK((!S;QD4nF;qD{R?m})rb~$us@3x9 zRjNKaSIe+nk&=~$WVIo=){tCpNY?5SqyPQs6P>r-YW+w&LVVw&S9dd}d4>5lQ!bC! z9z{{oTkuOS(_iy*XZRcOOZ+eV0Ra#I0T2KI5C8!X009sH0T2KI5csAN!2AC<)w6gm z5C8!X009sH0T2KI5C8!X009sv3FPnp^Zz{mPxHT=e>5M=Tls%wE1ZD<2!H?xfB*=9 z00@8p2!H?xfB*c>)HRD`|aG_lb70Gomigvdiu-h zYprnVk5hj*+WSp}wPXKs>vC)Fg6li%q3b*}*=k;8hEVQuzG$vyWPF@n|C%8 zdq%J8`kR62I$gu{6Sl=7BaGaU73~^Bwrf~v61ct{u@Uo=fDU4z@= zcO^)|t|~1ZSGG0!!_)1~I}5G7xmx@X>{N*zE}GNEjncS?87{BK%j1i4?asnN>*sSt zyzoXmR`~C!W}FBc6eIliurVUq>VhP36R#3EH?H$Qv8#a~{SsQqc1gOFRRTc@#hsGf zuws-4pJms>Yvl$BLl%wPIIhLrwNB#5st20(6ZEKy~>{9qUQ`KGmbh+K`EG@OZxKy}2YsbBw zot|hqJ~u|bm#2sIzPL@^SY~!+KsOd? zK?MlEtUf!x*3bQ#ES1j8()4CyaWQ_L#wXgHcNbfG=WBT?Q%6ZtDV)(}X`@4tq*9~g z=+aEPv$)v$;+)h{V#*VqqVjCInW32_N>Fi@r`+?Zvus??MOliarjd%-gzH&xY-+oO z9!=b|iVb)?=V>Qt~VrWb&1jc{`85?TW_^~BpxBY@457n6w|!I ze48nk$7_$GD0@6cmZ@i-zyF__`QB9fCo{jA`QDkoJ^gQ|-<l*e#|f4s0~}ZNEZ#c55&bG-+V>edN#=T zt60qQSSk*&(i5vh%}P(mpEVPWv&@e#>gE-C58HIr4GSq;$S~HoD;gb&c|~gK^UD5@ zFNk^NN%`t2o5`ggzxTzaw=zp&;U|W7NM~hZ)43~C(cVTSAH*^))9hGY+NhP8uD;9@ z>v7df|9?g4(d+Hb#+BCIrP_KygeUDySjv*2kYCVxw@_EQ6%H;k(d19^`@swlX+gsDd`Y_Vp|xI|Rlt>qG=41V8`;KmY_l z00ck)1V8`;KwxYF`2IgOLKpx65C8!X009sH0T2KI5C8!X0D*}ofbahk?;;Ek1V8`; zKmY_l00ck)1V8`;KmY{BCV=n%VLgDp4H9x=&sSN_3idb zqkUulFBjUKD_2^NznfSCkJVb%F5bv)d2jvZoekBb(d&vayH3||{e*3?$Ot2MWJSBi zknI{)ngp(IM{LCWWLdWLtr6=QJ62?GTTyRi_3eJ9;18}U;>1eQSQziEP(w0hCCnV` zRvL178ai4z-PwwUW#iSgwZaOg+ckK<#2vBRhAJ(gm2HiFe6ihmcd@m1zUDtW@HgEp z#d%V=p!Hm%L*X{5QGE8}3+>M0V(ZCV;WOEcJ4~KkYSQ;~;D zveJ>6X2CxwrTmPKCjTfW}(bkVSz=cOGuVxiGE*p4YcJu9Y6t|z|d#))3zQaNOsR_f7^@;-_(A?hjwl zIV%c0bvovvj@DU91V8`;KmY_l00ck) z1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`; zKmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l z00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck)1V8`;KmY_l00ck) Y1V8`;KmY_l00ck)1V8`;{!a+}H^$>lrvLx| From 52f42616a29591be3fda3d2a5684de89088702a5 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 21 Oct 2020 10:09:47 +0800 Subject: [PATCH 014/201] =?UTF-8?q?=E8=BF=91=E6=9C=9Fbug=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=8C=E8=BF=81=E7=A7=BBgo-admin-core=E5=BA=93=EF=BC=8C=20?= =?UTF-8?q?=20=20Fixed=20#272=20Fixed=20#261?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- .../{ => system}/sys_config/sys_config.go | 0 app/admin/models/{ => system}/sys_config.go | 2 +- app/admin/router/sys_config.go | 8 +- app/admin/service/dto/sys_config.go | 6 +- app/admin/service/sys_config.go | 4 +- cmd/api/server.go | 17 +++- cmd/migrate/migration/init.go | 11 +-- cmd/migrate/migration/version-local/doc.go | 8 ++ .../migration/version/1599190683659_tables.go | 5 +- .../version/1599190683670_migrate.go | 3 +- .../version/1602644950000_migrate.go | 13 +-- cmd/migrate/server.go | 25 ++++-- common/dto/search.go | 2 +- common/global/adm.go | 2 +- examples/run.go | 2 + go.mod | 5 +- go.sum | 83 ++++++++++++------- pkg/cache/memory.go | 2 +- pkg/cache/memory_test.go | 2 +- pkg/cache/redis.go | 2 +- pkg/cache/redis_test.go | 2 +- pkg/cache/type.go | 2 +- template/migrate.template | 26 +++--- 24 files changed, 150 insertions(+), 85 deletions(-) rename app/admin/apis/{ => system}/sys_config/sys_config.go (100%) rename app/admin/models/{ => system}/sys_config.go (98%) create mode 100644 cmd/migrate/migration/version-local/doc.go diff --git a/.gitignore b/.gitignore index d3f12f85..4604070d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ config/settings.dev.*.yml.log temp/logs config/settings.dev.yml.log config/settings.b.dev.yml -cmd/migrate/migration/version_local/* +cmd/migrate/migration/version-local/* +!cmd/migrate/migration/version-local/doc.go diff --git a/app/admin/apis/sys_config/sys_config.go b/app/admin/apis/system/sys_config/sys_config.go similarity index 100% rename from app/admin/apis/sys_config/sys_config.go rename to app/admin/apis/system/sys_config/sys_config.go diff --git a/app/admin/models/sys_config.go b/app/admin/models/system/sys_config.go similarity index 98% rename from app/admin/models/sys_config.go rename to app/admin/models/system/sys_config.go index 4ae196de..6df7dbc1 100644 --- a/app/admin/models/sys_config.go +++ b/app/admin/models/system/sys_config.go @@ -1,4 +1,4 @@ -package models +package system import ( "gorm.io/gorm" diff --git a/app/admin/router/sys_config.go b/app/admin/router/sys_config.go index 5e3f43ec..c489d14b 100644 --- a/app/admin/router/sys_config.go +++ b/app/admin/router/sys_config.go @@ -2,9 +2,9 @@ package router import ( "github.com/gin-gonic/gin" - "go-admin/app/admin/apis/sys_config" + "go-admin/app/admin/apis/system/sys_config" "go-admin/app/admin/middleware" - "go-admin/app/admin/models" + "go-admin/app/admin/models/system" "go-admin/app/admin/service/dto" "go-admin/common/actions" jwt "go-admin/pkg/jwtauth" @@ -18,9 +18,9 @@ func init() { func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { r := v1.Group("/config").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - model := &models.SysConfig{} + model := &system.SysConfig{} r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.SysConfigSearch), func() interface{} { - list := make([]models.SysConfig, 0) + list := make([]system.SysConfig, 0) return &list })) r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.SysConfigById), nil)) diff --git a/app/admin/service/dto/sys_config.go b/app/admin/service/dto/sys_config.go index 13b736fd..77c1ca93 100644 --- a/app/admin/service/dto/sys_config.go +++ b/app/admin/service/dto/sys_config.go @@ -2,9 +2,9 @@ package dto import ( "github.com/gin-gonic/gin" + "go-admin/app/admin/models/system" "gorm.io/gorm" - "go-admin/app/admin/models" "go-admin/common/dto" "go-admin/common/log" common "go-admin/common/models" @@ -65,7 +65,7 @@ func (s *SysConfigControl) Generate() dto.Control { } func (s *SysConfigControl) GenerateM() (common.ActiveRecord, error) { - return &models.SysConfig{ + return &system.SysConfig{ Model: gorm.Model{ID: s.ID}, ConfigName: s.ConfigName, ConfigKey: s.ConfigKey, @@ -89,5 +89,5 @@ func (s *SysConfigById) Generate() dto.Control { } func (s *SysConfigById) GenerateM() (common.ActiveRecord, error) { - return &models.SysConfig{}, nil + return &system.SysConfig{}, nil } diff --git a/app/admin/service/sys_config.go b/app/admin/service/sys_config.go index 4f774493..8ab25a0c 100644 --- a/app/admin/service/sys_config.go +++ b/app/admin/service/sys_config.go @@ -1,7 +1,7 @@ package service import ( - "go-admin/app/admin/models" + "go-admin/app/admin/models/system" "go-admin/app/admin/service/dto" "go-admin/common/log" "go-admin/common/service" @@ -14,7 +14,7 @@ type SysConfig struct { // GetSysConfigByKEY 根据Key获取SysConfig func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigControl) error { var err error - var data models.SysConfig + var data system.SysConfig msgID := e.MsgID data.ConfigKey = c.ConfigKey err = e.Orm.Table(data.TableName()).Where("config_key = ?", data.ConfigKey).First(c).Error diff --git a/cmd/api/server.go b/cmd/api/server.go index 097e4cd8..4b4ba91c 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -3,7 +3,6 @@ package api import ( "context" "fmt" - "go-admin/app/admin/router" "io/ioutil" "net/http" "os" @@ -11,9 +10,12 @@ import ( "time" "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/transfer" + "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spf13/cobra" "github.com/spf13/viper" + "go-admin/app/admin/router" "go-admin/app/jobs" "go-admin/common/database" "go-admin/common/global" @@ -74,7 +76,18 @@ func run() error { } engine := global.Cfg.GetEngine() if engine == nil { - engine = gin.New() + if mode == "dev" { + r := gin.New() + //开发环境启动监控指标 + r.GET("/metrics", transfer.Handler(promhttp.Handler())) + //健康检查 + r.GET("/health", func(c *gin.Context) { + c.Status(http.StatusOK) + }) + engine = r + } else { + engine = gin.New() + } } for _, f := range AppRouters { diff --git a/cmd/migrate/migration/init.go b/cmd/migrate/migration/init.go index 2cc3f10a..54261d1e 100644 --- a/cmd/migrate/migration/init.go +++ b/cmd/migrate/migration/init.go @@ -1,14 +1,14 @@ package migration import ( - "fmt" - "github.com/spf13/cast" - "gorm.io/gorm" "log" "path/filepath" "sort" "strconv" "sync" + + "github.com/spf13/cast" + "gorm.io/gorm" ) var Migrate = &Migration{ @@ -40,11 +40,12 @@ func (e *Migration) Migrate() { for k := range e.version { versions = append(versions, k) } - sort.IntsAreSorted(versions) + if !sort.IntsAreSorted(versions) { + sort.Ints(versions) + } var err error var count int64 for _, v := range versions { - fmt.Println(v) err = e.db.Debug().Table("sys_migration").Where("version = ?", v).Count(&count).Error if err != nil { log.Fatalln(err) diff --git a/cmd/migrate/migration/version-local/doc.go b/cmd/migrate/migration/version-local/doc.go new file mode 100644 index 00000000..2cec8bc4 --- /dev/null +++ b/cmd/migrate/migration/version-local/doc.go @@ -0,0 +1,8 @@ +package version_local + +func init() { +} + +/** +开发者项目的迁移脚本放在这个目录里,init写法参考version目录里的migrate或者自动生成 +*/ diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 4e0a8673..42eeda3b 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -1,6 +1,7 @@ package version import ( + "go-admin/app/admin/models/system" "runtime" "gorm.io/gorm" @@ -20,7 +21,7 @@ func _1599190683659Tables(db *gorm.DB, version string) error { err := db.Debug().Migrator().AutoMigrate( new(models.CasbinRule), new(models.SysDept), - new(models.SysConfig), + new(system.SysConfig), new(tools.SysTables), new(tools.SysColumns), new(models.Menu), @@ -34,7 +35,7 @@ func _1599190683659Tables(db *gorm.DB, version string) error { new(models.DictData), new(models.DictType), new(models.SysJob), - new(models.SysConfig), + new(system.SysConfig), new(models.SysSetting), new(models.SysFileDir), new(models.SysFileInfo), diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index 904c5b4a..63f505cb 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -1,6 +1,7 @@ package version import ( + "go-admin/app/admin/models/system" "runtime" "time" @@ -260,7 +261,7 @@ func _1599190683670Test(db *gorm.DB, version string) error { {DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } - list4 := []models.SysConfig{ + list4 := []system.SysConfig{ {Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"}, {Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"}, {Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"}, diff --git a/cmd/migrate/migration/version/1602644950000_migrate.go b/cmd/migrate/migration/version/1602644950000_migrate.go index 3d81340d..a73d1471 100644 --- a/cmd/migrate/migration/version/1602644950000_migrate.go +++ b/cmd/migrate/migration/version/1602644950000_migrate.go @@ -2,6 +2,7 @@ package version import ( "go-admin/app/admin/models" + "go-admin/app/admin/models/system" "gorm.io/gorm" "runtime" @@ -16,14 +17,16 @@ func init() { func _1602644950000Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - err := db.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id") - if err != nil { - return err + if tx.Migrator().HasColumn(&system.SysConfig{}, "config_id") { + err := tx.Migrator().RenameColumn(&system.SysConfig{}, "config_id", "id") + if err != nil { + return err + } } list2 := []models.CasbinRule{ {PType: "p", V0: "admin", V1: "/api/v1/config", V2: "GET"}, } - err = tx.Create(list2).Error + err := tx.Create(list2).Error if err != nil { return err } @@ -34,7 +37,7 @@ func _1602644950000Test(db *gorm.DB, version string) error { return err } - return db.Create(&common.Migration{ + return tx.Create(&common.Migration{ Version: version, }).Error }) diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index 898a66ed..08850a86 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -3,24 +3,27 @@ package migrate import ( "bytes" "fmt" - tools2 "go-admin/tools" "strconv" "text/template" "time" "github.com/spf13/cobra" + "go-admin/cmd/migrate/migration" _ "go-admin/cmd/migrate/migration/version" + _ "go-admin/cmd/migrate/migration/version-local" "go-admin/common/database" "go-admin/common/global" "go-admin/common/models" "go-admin/pkg/logger" + tools2 "go-admin/tools" "go-admin/tools/config" ) var ( configYml string generate bool + goAdmin bool StartCmd = &cobra.Command{ Use: "migrate", Short: "Initialize the database", @@ -34,16 +37,18 @@ var ( func init() { StartCmd.PersistentFlags().StringVarP(&configYml, "config", "c", "config/settings.yml", "Start server with provided configuration file") StartCmd.PersistentFlags().BoolVarP(&generate, "generate", "g", false, "generate migration file") + StartCmd.PersistentFlags().BoolVarP(&goAdmin, "goAdmin", "a", false, "generate go-admin migration file") } func run() { usage := `start init` fmt.Println(usage) - //1. 读取配置 - config.Setup(configYml) - //2. 设置日志 - logger.Setup() + if !generate { + //1. 读取配置 + config.Setup(configYml) + //2. 设置日志 + logger.Setup() _ = initDB() } else { _ = genFile() @@ -79,8 +84,16 @@ func genFile() error { } m := map[string]string{} m["GenerateTime"] = strconv.FormatInt(time.Now().UnixNano()/1e6, 10) + m["Package"] = "version_local" + if goAdmin { + m["Package"] = "version" + } var b1 bytes.Buffer err = t1.Execute(&b1, m) - tools2.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go") + if goAdmin { + tools2.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go") + } else { + tools2.FileCreate(b1, "./cmd/migrate/migration/version-local/"+m["GenerateTime"]+"_migrate.go") + } return nil } diff --git a/common/dto/search.go b/common/dto/search.go index e73daccc..d0b258b0 100644 --- a/common/dto/search.go +++ b/common/dto/search.go @@ -3,7 +3,7 @@ package dto import ( "go-admin/tools/config" - "github.com/matchstalk/go-admin-core/search" + "github.com/go-admin-team/go-admin-core/search" "gorm.io/gorm" ) diff --git a/common/global/adm.go b/common/global/adm.go index 9ef4e8d7..b559381c 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -11,7 +11,7 @@ import ( const ( // go-admin Version Info - Version = "1.2.0" + Version = "1.2.1" ) var Cfg config.Conf = config.DefaultConfig() diff --git a/examples/run.go b/examples/run.go index 625d3277..a70eb989 100644 --- a/examples/run.go +++ b/examples/run.go @@ -1,3 +1,5 @@ +// +build examples + package main import ( diff --git a/go.mod b/go.mod index 4f72913e..b3ab5d41 100644 --- a/go.mod +++ b/go.mod @@ -9,16 +9,17 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 + github.com/go-admin-team/go-admin-core v1.2.1 github.com/go-redis/redis/v7 v7.4.0 github.com/go-sql-driver/mysql v1.5.0 github.com/gogf/gf v1.13.4 - github.com/google/uuid v1.1.1 + github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 - github.com/matchstalk/go-admin-core v1.2.0 github.com/matchstalk/redisqueue v1.0.3 github.com/mojocn/base64Captcha v1.3.1 github.com/mssola/user_agent v0.5.2 github.com/pkg/errors v0.9.1 + github.com/prometheus/client_golang v1.1.0 github.com/robfig/cron/v3 v3.0.1 github.com/satori/go.uuid v1.2.0 github.com/shamsher31/goimgext v1.0.0 // indirect diff --git a/go.sum b/go.sum index 8d60a14e..be45e2c7 100644 --- a/go.sum +++ b/go.sum @@ -75,14 +75,15 @@ github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= -github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= +github.com/bsm/redislock v0.6.0 h1:eAzUAcN8EN1cbJAwSRTUvORfaEe9o8GFwNkNXMecegY= +github.com/bsm/redislock v0.6.0/go.mod h1:3Kgu+cXw0JrkZ5pmY/JbcFpixGZ5M9v9G2PGWYqku+k= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= github.com/caddyserver/certmagic v0.10.6/go.mod h1:Y8jcUBctgk/IhpAzlHKfimZNyXCkfGgRTC0orl8gROQ= @@ -94,7 +95,10 @@ github.com/casbin/gorm-adapter/v3 v3.0.2/go.mod h1:mQI09sqvXfy5p6kZB5HBzZrgKWwxa github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28 h1:LdXxtjzvZYhhUaonAaAKArG3pyC67kGL3YY+6hGG8G4= github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= @@ -126,7 +130,6 @@ github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMEl github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -137,6 +140,8 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= +github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dnaeon/go-vcr v0.0.0-20180814043457-aafff18a5cc2/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= @@ -162,8 +167,9 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pFdJbAhRf7rh6YYMUdIQGyzne6zYL1tCUW8QV2B3UfY= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= @@ -181,6 +187,8 @@ github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0 h1:rdQovo0Jt github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= +github.com/go-admin-team/go-admin-core v1.2.1 h1:Ko9PSuQhi6YXA29iXYk8resTQ9iM46TjdHYZII0DZS4= +github.com/go-admin-team/go-admin-core v1.2.1/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -189,6 +197,7 @@ github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1 github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -226,6 +235,8 @@ github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8w github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v8 v8.1.0 h1:80B6xShb0y0Yq4UPo8RtClNnmhSP3Ahul+P5tolHoJ0= +github.com/go-redis/redis/v8 v8.1.0/go.mod h1:isLoQT/NFSP7V67lyvM9GmdvLdyZ7pEhsXvvyQtnQTo= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -257,15 +268,15 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= @@ -274,16 +285,18 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -339,10 +352,8 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= -github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -359,7 +370,6 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk= github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= -github.com/jackc/pgconn v1.6.1 h1:lwofaXKPbIx6qEaK8mNm7uZuOwxHw+PnAFGDsDFpkRI= github.com/jackc/pgconn v1.6.1/go.mod h1:g8mKMqmSUO6AzAvha7vy07g1rbGOlc7iF0nU0ei83hc= github.com/jackc/pgconn v1.6.4 h1:S7T6cx5o2OqmxdHaXLH1ZeD1SbI8jBznyYE9Ec0RCQ8= github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78= @@ -378,7 +388,6 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1: github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.2 h1:q1Hsy66zh4vuNsajBUF2PNqfAMMfxU5mk594lPE9vjY= github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8 h1:Q3tB+ExeflWUW7AFcAhXqk40s9mnNYLk1nOkKNZ5GnU= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= @@ -388,7 +397,6 @@ github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrU github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0= github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po= github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ= -github.com/jackc/pgtype v1.4.0 h1:pHQfb4jh9iKqHyxPthq1fr+0HwSNIl3btYPbw2m2lbM= github.com/jackc/pgtype v1.4.0/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= github.com/jackc/pgtype v1.4.2 h1:t+6LWm5eWPLX1H5Se702JSBcirq6uWa4jiG4wV1rAWY= github.com/jackc/pgtype v1.4.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= @@ -398,7 +406,6 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA= github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o= github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= -github.com/jackc/pgx/v4 v4.7.1 h1:aqUSOcStk6fik+lSE+tqfFhvt/EwT8q/oMtJbP9CjXI= github.com/jackc/pgx/v4 v4.7.1/go.mod h1:nu42q3aPjuC1M0Nak4bnoprKlXPINqopEKqbq5AZSC4= github.com/jackc/pgx/v4 v4.8.1 h1:SUbCLP2pXvf/Sr/25KsuI4aTxiFYIvpfk4l6aTSdyCw= github.com/jackc/pgx/v4 v4.8.1/go.mod h1:4HOLxrl8wToZJReD04/yB20GDwf4KBYETvlHciCnwW0= @@ -436,7 +443,6 @@ github.com/kolo/xmlrpc v0.0.0-20190717152603-07c4ee3fd181/go.mod h1:o03bZfuBwAXH github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -444,7 +450,6 @@ github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -476,8 +481,6 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN github.com/marten-seemann/chacha20 v0.2.0/go.mod h1:HSdjFau7GzYRj+ahFNwsO3ouVJr1HFkWoEwNDb4TMtE= github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= github.com/marten-seemann/qtls v0.4.1/go.mod h1:pxVXcHHw1pNIt8Qo0pwSYQEoZ8yYOOPXTCZLQQunvRc= -github.com/matchstalk/go-admin-core v1.2.0 h1:yk8bnH7dVGDgyEliG2MchSyupdh24wc0sDUrxnu8sGY= -github.com/matchstalk/go-admin-core v1.2.0/go.mod h1:iCxDnmPHR3+d/5Q+yrdt+QBXhmWhbj7+GeHcUjD9Rn8= github.com/matchstalk/redisqueue v1.0.3 h1:ZRrEhnvA6/YxLu2EbzdZYeQHQQYT8yZBAi1qv/USEQA= github.com/matchstalk/redisqueue v1.0.3/go.mod h1:5DZ3X4w9t+6Wv9vz9wmUt/i15gsOorGXRnqzGhBP6zI= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -505,6 +508,7 @@ github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71 github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/mattn/goveralls v0.0.5 h1:spfq8AyZ0cCk57Za6/juJ5btQxeE1FaEGMdfcI+XO48= github.com/mattn/goveralls v0.0.5/go.mod h1:Xg2LHi51faXLyKXwsndxiW6uxEEQT9+3sjGzzwU4xy0= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= @@ -552,19 +556,25 @@ github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/Hzq github.com/nrdcg/dnspod-go v0.4.0/go.mod h1:vZSoFSFeQVm2gWLMkyX61LZ8HI3BaqtHZWgPTGKr6KQ= github.com/nrdcg/goinwx v0.6.1/go.mod h1:XPiut7enlbEdntAqalBIqcYcTEVhpv/dKWgDCX2SwKQ= github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.1 h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4= +github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs= +github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -593,21 +603,25 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKcyumwBO6qip7RNQ5r77yrssm9bfCowcLEBcU5IA= @@ -672,8 +686,9 @@ github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= @@ -730,6 +745,8 @@ go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opentelemetry.io/otel v0.11.0 h1:IN2tzQa9Gc4ZVKnTaMbPVcHjvzOdg5n9QfnmlqiET7E= +go.opentelemetry.io/otel v0.11.0/go.mod h1:G8UCk+KooF2HLkgo8RHX9epABH/aRGYET7gQOqBVdB0= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -776,6 +793,8 @@ golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxT golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200908183739-ae8ad444f925 h1:5XVKs2rlCg8EFyRcvO8/XFwYxh1oKJO1Q3X5vttIf9c= +golang.org/x/exp v0.0.0-20200908183739-ae8ad444f925/go.mod h1:1phAWC201xIgDyaFpmDeZkgf70Q4Pd/CNqfRtVPtxNw= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= @@ -793,8 +812,9 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449 h1:xUIPaMhvROX9dhPvRCenIJtU78+lbEenGbgqB5hfHCQ= +golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -828,6 +848,7 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM= golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -873,6 +894,8 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -883,7 +906,9 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -926,8 +951,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200113040837-eac381796e91 h1:OOkytthzFBKHY5EfEgLUabprb0LtJVkQtNxAQ02+UE4= golang.org/x/tools v0.0.0-20200113040837-eac381796e91/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b h1:zSzQJAznWxAh9fZxiPy2FZo+ZZEYoYFYYDYdOrU7AaM= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -972,21 +997,18 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/AlecAivazis/survey.v1 v1.8.8 h1:5UtTowJZTz1j7NxVzDGKTz6Lm9IWm8DDF6b7a2wq9VY= gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/ffmt.v1 v1.5.6 h1:4Bu3riZp5sAIXW2T/18JM9BkwJLodurXFR0f7PXp+cw= -gopkg.in/ffmt.v1 v1.5.6/go.mod h1:LssvGOZFiBGoBcobkTqnyh+uN1VzIRoibW+c0JI/Ha4= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= @@ -1011,15 +1033,14 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/mysql v0.3.0 h1:LPEy7sEsoZHSPiUk9ySGJLEmWQfbj7MWqE4sTwG7nx4= gorm.io/driver/mysql v0.3.0/go.mod h1:A7H1JD9dKdcjeUTpTuWKEC+E1a74qzW7/zaXqKaTbfM= gorm.io/driver/mysql v0.3.2 h1:Kaa0S+IHW+4qow6dRAdekNYaKeGBboIkh44pYdLWjIE= gorm.io/driver/mysql v0.3.2/go.mod h1:jC/HyPAZJ0xqfGlOqYybd8oNPMtGrkNgvwjWuKDT7f0= -gorm.io/driver/postgres v0.2.6 h1:hoE6SzA5wKOo6AYxz2V7ooxnzD6S6ToLAHHDDawt+b0= gorm.io/driver/postgres v0.2.6/go.mod h1:AsPyuhKFOplSmQwOPsycVKbe0dRxF8v18KZ7p9i8dIs= gorm.io/driver/postgres v0.2.9 h1:oMY4f4tLEUVg3eapqHFzVEplWKy1Gj1cGBEe9wJ1yWM= gorm.io/driver/postgres v0.2.9/go.mod h1:YATpayFLKALuiVXVRNbDfoEJwECHSMYzl1SmXJ2+CIg= diff --git a/pkg/cache/memory.go b/pkg/cache/memory.go index 747748b9..09ca8a7d 100644 --- a/pkg/cache/memory.go +++ b/pkg/cache/memory.go @@ -1,7 +1,7 @@ package cache import ( - "github.com/matchstalk/go-admin-core/cache" + "github.com/go-admin-team/go-admin-core/cache" ) var MemoryAdapter Adapter diff --git a/pkg/cache/memory_test.go b/pkg/cache/memory_test.go index 6db5bced..4bde75da 100644 --- a/pkg/cache/memory_test.go +++ b/pkg/cache/memory_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/matchstalk/go-admin-core/cache" + "github.com/go-admin-team/go-admin-core/cache" ) func TestInitMemory(t *testing.T) { diff --git a/pkg/cache/redis.go b/pkg/cache/redis.go index 232ae275..9d5d84ab 100644 --- a/pkg/cache/redis.go +++ b/pkg/cache/redis.go @@ -3,8 +3,8 @@ package cache import ( "time" + "github.com/go-admin-team/go-admin-core/cache" "github.com/go-redis/redis/v7" - "github.com/matchstalk/go-admin-core/cache" "github.com/matchstalk/redisqueue" ) diff --git a/pkg/cache/redis_test.go b/pkg/cache/redis_test.go index 9459daea..5056b2e9 100644 --- a/pkg/cache/redis_test.go +++ b/pkg/cache/redis_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/matchstalk/go-admin-core/cache" + "github.com/go-admin-team/go-admin-core/cache" ) func TestInitRedis(t *testing.T) { diff --git a/pkg/cache/type.go b/pkg/cache/type.go index ffd00204..c3a4a92e 100644 --- a/pkg/cache/type.go +++ b/pkg/cache/type.go @@ -3,7 +3,7 @@ package cache import ( "time" - "github.com/matchstalk/go-admin-core/cache" + "github.com/go-admin-team/go-admin-core/cache" ) type Adapter interface { diff --git a/template/migrate.template b/template/migrate.template index 1c77103a..960de1cb 100644 --- a/template/migrate.template +++ b/template/migrate.template @@ -1,7 +1,7 @@ -package version +package {{.Package}} import ( - "go-admin/app/admin/models" + //"go-admin/app/admin/models" "gorm.io/gorm" "runtime" @@ -20,21 +20,21 @@ func _{{.GenerateTime}}Test(db *gorm.DB, version string) error { // TODO: 这里开始写入要变更的内容 // TODO: 例如 修改表字段 使用过程中请删除此段代码 - err := db.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id") - if err != nil { - return err - } + //err := tx.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id") + //if err != nil { + // return err + //} // TODO: 例如 新增表结构 使用过程中请删除此段代码 - err = db.Debug().Migrator().AutoMigrate( - new(models.CasbinRule), - ) - if err != nil { - return err - } + //err = tx.Debug().Migrator().AutoMigrate( + // new(models.CasbinRule), + // ) + //if err != nil { + // return err + //} - return db.Create(&common.Migration{ + return tx.Create(&common.Migration{ Version: version, }).Error }) From e53cc4a9b5fcb30f43f635d18d34e8b2ab6e946e Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 21 Oct 2020 15:44:39 +0800 Subject: [PATCH 015/201] version upgrade --- common/global/adm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/global/adm.go b/common/global/adm.go index b559381c..73804827 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -11,7 +11,7 @@ import ( const ( // go-admin Version Info - Version = "1.2.1" + Version = "1.2.2" ) var Cfg config.Conf = config.DefaultConfig() From e1965be2ab59c1e76e950963b11220839be43223 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 21 Oct 2020 18:03:39 +0800 Subject: [PATCH 016/201] =?UTF-8?q?=E6=80=A7=E8=83=BD=E6=8C=87=E6=A0=87?= =?UTF-8?q?=E3=80=81=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5=E3=80=81default?= =?UTF-8?q?=20log=E9=85=8D=E7=BD=AE=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/router/monitor.go | 31 +++++++++++++++++++++++++++++++ cmd/api/server.go | 20 ++++++-------------- logger/default.go | 13 +++++++++++-- 3 files changed, 48 insertions(+), 16 deletions(-) create mode 100644 app/admin/router/monitor.go diff --git a/app/admin/router/monitor.go b/app/admin/router/monitor.go new file mode 100644 index 00000000..52bb0bea --- /dev/null +++ b/app/admin/router/monitor.go @@ -0,0 +1,31 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/transfer" + "github.com/prometheus/client_golang/prometheus/promhttp" + "go-admin/common/global" + "go-admin/common/log" + "net/http" +) + +func Monitor() { + var r *gin.Engine + h := global.Cfg.GetEngine() + if h == nil { + h = gin.New() + global.Cfg.SetEngine(h) + } + switch h.(type) { + case *gin.Engine: + r = h.(*gin.Engine) + default: + log.Fatal("not support other engine") + } + //开发环境启动监控指标 + r.GET("/metrics", transfer.Handler(promhttp.Handler())) + //健康检查 + r.GET("/health", func(c *gin.Context) { + c.Status(http.StatusOK) + }) +} diff --git a/cmd/api/server.go b/cmd/api/server.go index 4b4ba91c..b0c6e349 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -10,8 +10,6 @@ import ( "time" "github.com/gin-gonic/gin" - "github.com/go-admin-team/go-admin-core/transfer" - "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -76,18 +74,12 @@ func run() error { } engine := global.Cfg.GetEngine() if engine == nil { - if mode == "dev" { - r := gin.New() - //开发环境启动监控指标 - r.GET("/metrics", transfer.Handler(promhttp.Handler())) - //健康检查 - r.GET("/health", func(c *gin.Context) { - c.Status(http.StatusOK) - }) - engine = r - } else { - engine = gin.New() - } + engine = gin.New() + } + + if mode == "dev" { + //监控 + AppRouters = append(AppRouters, router.Monitor) } for _, f := range AppRouters { diff --git a/logger/default.go b/logger/default.go index 294c049f..0614a82b 100644 --- a/logger/default.go +++ b/logger/default.go @@ -3,6 +3,7 @@ package logger import ( "context" "fmt" + "log" "os" "runtime" "sort" @@ -114,7 +115,11 @@ func (l *defaultLogger) Log(level Level, v ...interface{}) { } t := rec.Timestamp.Format("2006-01-02 15:04:05") - fmt.Printf("%s %s %v\n", t, metadata, rec.Message) + _, err := l.opts.Out.Write([]byte(fmt.Sprintf("%s %s %v\n", t, metadata, rec.Message))) + if err != nil { + log.Printf("log [Log] write error: %s \n", err.Error()) + } + //fmt.Printf("%s %s %v\n", t, metadata, rec.Message) } func (l *defaultLogger) Logf(level Level, format string, v ...interface{}) { @@ -153,7 +158,11 @@ func (l *defaultLogger) Logf(level Level, format string, v ...interface{}) { } t := rec.Timestamp.Format("2006-01-02 15:04:05") - fmt.Printf("%s %s %v\n", t, metadata, rec.Message) + //fmt.Printf("%s %s %v\n", t, metadata, rec.Message) + _, err := l.opts.Out.Write([]byte(fmt.Sprintf("%s %s %v\n", t, metadata, rec.Message))) + if err != nil { + log.Printf("log [Logf] write error: %s \n", err.Error()) + } } func (l *defaultLogger) Options() Options { From ac5b10e6c04578df23a2708a172ac6867baacd7b Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 23 Oct 2020 23:32:44 +0800 Subject: [PATCH 017/201] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=88=86=E7=B1=BB=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/syscategory/syscategory.go | 83 ----- app/admin/models/syscategory.go | 125 +------- app/admin/router/router.go | 2 - app/admin/router/sys_category.go | 31 ++ app/admin/router/syscategory.go | 26 -- app/admin/router/syscontent.go | 5 + app/admin/service/dto/sys_category.go | 107 +++++++ go-admin-ui/src/api/syscategory.js | 47 +++ go-admin-ui/src/views/syscategory/index.vue | 329 ++++++++++++++++++++ 9 files changed, 536 insertions(+), 219 deletions(-) delete mode 100644 app/admin/apis/syscategory/syscategory.go create mode 100644 app/admin/router/sys_category.go delete mode 100644 app/admin/router/syscategory.go create mode 100644 app/admin/service/dto/sys_category.go create mode 100644 go-admin-ui/src/api/syscategory.js create mode 100644 go-admin-ui/src/views/syscategory/index.vue diff --git a/app/admin/apis/syscategory/syscategory.go b/app/admin/apis/syscategory/syscategory.go deleted file mode 100644 index 03181dea..00000000 --- a/app/admin/apis/syscategory/syscategory.go +++ /dev/null @@ -1,83 +0,0 @@ -package syscategory - -import ( - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" - "go-admin/tools/app/msg" -) - -func GetSysCategoryList(c *gin.Context) { - var data models.SysCategory - var err error - var pageSize = 10 - var pageIndex = 1 - - if size := c.Request.FormValue("pageSize"); size != "" { - pageSize, err = tools.StringToInt(size) - } - if index := c.Request.FormValue("pageIndex"); index != "" { - pageIndex, err = tools.StringToInt(index) - } - - data.Name = c.Request.FormValue("name") - data.Status = c.Request.FormValue("status") - - data.DataScope = tools.GetUserIdStr(c) - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - app.PageOK(c, result, count, pageIndex, pageSize, "") -} - -func GetSysCategory(c *gin.Context) { - var data models.SysCategory - data.Id, _ = tools.StringToInt(c.Param("id")) - result, err := data.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - app.OK(c, result, "") -} - -// @Summary 添加分类 -// @Description 获取JSON -// @Tags 分类 -// @Accept application/json -// @Product application/json -// @Param data body models.SysCategory true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/syscategory [post] -func InsertSysCategory(c *gin.Context) { - var data models.SysCategory - err := c.ShouldBindJSON(&data) - data.CreateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - app.OK(c, result, "") -} - -func UpdateSysCategory(c *gin.Context) { - var data models.SysCategory - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "数据解析失败", -1) - data.UpdateBy = tools.GetUserIdStr(c) - result, err := data.Update(data.Id) - tools.HasError(err, "", -1) - - app.OK(c, result, "") -} - -func DeleteSysCategory(c *gin.Context) { - var data models.SysCategory - data.UpdateBy = tools.GetUserIdStr(c) - - IDS := tools.IdsStrToIdsIntGroup("id", c) - _, err := data.BatchDelete(IDS) - tools.HasError(err, msg.DeletedFail, 500) - app.OK(c, nil, msg.DeletedSuccess) -} diff --git a/app/admin/models/syscategory.go b/app/admin/models/syscategory.go index b277bd92..53e21846 100644 --- a/app/admin/models/syscategory.go +++ b/app/admin/models/syscategory.go @@ -1,122 +1,31 @@ package models import ( - orm "go-admin/common/global" - "go-admin/tools" + "gorm.io/gorm" + + "go-admin/common/models" ) type SysCategory struct { - Id int `json:"id" gorm:"type:int(11);primary_key;AUTO_INCREMENT"` // 分类Id - Name string `json:"name" gorm:"type:varchar(255);"` // 名称 - Img string `json:"img" gorm:"type:varchar(255);"` // 图片 - Sort string `json:"sort" gorm:"type:int(4);"` // 排序 - Status string `json:"status" gorm:"type:int(1);"` // 状态 - Remark string `json:"remark" gorm:"type:varchar(255);"` // 备注 - CreateBy string `json:"createBy" gorm:"type:varchar(64);"` // 创建者 - UpdateBy string `json:"updateBy" gorm:"type:varchar(64);"` // 更新者 - DataScope string `json:"dataScope" gorm:"-"` - Params string `json:"params" gorm:"-"` - BaseModel + gorm.Model + models.ControlBy + + Name string `json:"name" gorm:"type:varchar(255);comment:名称"` // + Img string `json:"img" gorm:"type:varchar(255);comment:图标"` // + Sort string `json:"sort" gorm:"type:int(4);comment:排序"` // + Status string `json:"status" gorm:"type:int(1);comment:状态"` // + Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // } func (SysCategory) TableName() string { - return "sys_category" + return "sys_category" } -// 创建SysCategory -func (e *SysCategory) Create() (SysCategory, error) { - var doc SysCategory - result := orm.Eloquent.Table(e.TableName()).Create(&e) - if result.Error != nil { - err := result.Error - return doc, err - } - doc = *e - return doc, nil +func (e *SysCategory) Generate() models.ActiveRecord { + o := *e + return &o } -// 获取SysCategory -func (e *SysCategory) Get() (SysCategory, error) { - var doc SysCategory - table := orm.Eloquent.Table(e.TableName()) - - if e.Id != 0 { - table = table.Where("id = ?", e.Id) - } - - if e.Name != "" { - table = table.Where("name = ?", e.Name) - } - - if e.Status != "" { - table = table.Where("status = ?", e.Status) - } - - if err := table.First(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -// 获取SysCategory带分页 -func (e *SysCategory) GetPage(pageSize int, pageIndex int) ([]SysCategory, int, error) { - var doc []SysCategory - - table := orm.Eloquent.Table(e.TableName()) - - if e.Name != "" { - table = table.Where("name = ?", e.Name) - } - - if e.Status != "" { - table = table.Where("status = ?", e.Status) - } - - // 数据权限控制(如果不需要数据权限请将此处去掉) - dataPermission := new(DataPermission) - dataPermission.UserId, _ = tools.StringToInt(e.DataScope) - table, err := dataPermission.GetDataScope(e.TableName(), table) - if err != nil { - return nil, 0, err - } - var count int64 - - if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil { - return nil, 0, err - } - //table.Where("`deleted_at` IS NULL").Count(&count) - return doc, int(count), nil -} - -// 更新SysCategory -func (e *SysCategory) Update(id int) (update SysCategory, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).First(&update).Error; err != nil { - return - } - - //参数1:是要修改的数据 - //参数2:是修改的数据 - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { - return - } - return -} - -// 删除SysCategory -func (e *SysCategory) Delete(id int) (success bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).Delete(&SysCategory{}).Error; err != nil { - success = false - return - } - success = true - return -} - -//批量删除 -func (e *SysCategory) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id in (?)", id).Delete(&SysCategory{}).Error; err != nil { - return - } - Result = true - return +func (e *SysCategory) GetId() interface{} { + return e.ID } diff --git a/app/admin/router/router.go b/app/admin/router/router.go index 925a86e6..991e2dd8 100644 --- a/app/admin/router/router.go +++ b/app/admin/router/router.go @@ -51,7 +51,5 @@ func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddle } // {{认证路由自动补充在此处请勿删除}} - registerSysContentRouter(v1, authMiddleware) - registerSysCategoryRouter(v1, authMiddleware) } diff --git a/app/admin/router/sys_category.go b/app/admin/router/sys_category.go new file mode 100644 index 00000000..3eaa0a8c --- /dev/null +++ b/app/admin/router/sys_category.go @@ -0,0 +1,31 @@ +package router + +import ( + "github.com/gin-gonic/gin" + + "go-admin/app/admin/middleware" + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + "go-admin/common/actions" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysCategoryRouter) +} + +// 需认证的路由代码 +func registerSysCategoryRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + r := v1.Group("/syscategory").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + model := &models.SysCategory{} + r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.SysCategorySearch), func() interface{} { + list := make([]models.SysCategory, 0) + return &list + })) + r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.SysCategoryById), nil)) + r.POST("", actions.CreateAction(new(dto.SysCategoryControl))) + r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.SysCategoryControl))) + r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.SysCategoryById))) + } +} diff --git a/app/admin/router/syscategory.go b/app/admin/router/syscategory.go deleted file mode 100644 index 187389b2..00000000 --- a/app/admin/router/syscategory.go +++ /dev/null @@ -1,26 +0,0 @@ -package router - -import ( - "github.com/gin-gonic/gin" - "go-admin/app/admin/apis/syscategory" - "go-admin/app/admin/middleware" - jwt "go-admin/pkg/jwtauth" -) - -// 需认证的路由代码 -func registerSysCategoryRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - - r := v1.Group("/syscategory").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - r.GET("/:id", syscategory.GetSysCategory) - r.POST("", syscategory.InsertSysCategory) - r.PUT("", syscategory.UpdateSysCategory) - r.DELETE("/:id", syscategory.DeleteSysCategory) - } - - l := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - l.GET("/syscategoryList", syscategory.GetSysCategoryList) - } - -} diff --git a/app/admin/router/syscontent.go b/app/admin/router/syscontent.go index f72488bb..12220e1e 100644 --- a/app/admin/router/syscontent.go +++ b/app/admin/router/syscontent.go @@ -7,6 +7,11 @@ import ( jwt "go-admin/pkg/jwtauth" ) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysContentRouter) +} + // 需认证的路由代码 func registerSysContentRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { diff --git a/app/admin/service/dto/sys_category.go b/app/admin/service/dto/sys_category.go new file mode 100644 index 00000000..d5076098 --- /dev/null +++ b/app/admin/service/dto/sys_category.go @@ -0,0 +1,107 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "gorm.io/gorm" + + "go-admin/app/admin/models" + "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" +) + +type SysCategorySearch struct { + dto.Pagination `search:"-"` + Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"` + + Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"` + + +} + +func (m *SysCategorySearch) GetNeedSearch() interface{} { + return *m +} + +func (m *SysCategorySearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +func (m *SysCategorySearch) Generate() dto.Index { + o := *m + return &o +} + +type SysCategoryControl struct { + + ID uint `uri:"ID" comment:"标识"` // 标识 + + Name string `json:"name" comment:"名称"` + + + Img string `json:"img" comment:"图标"` + + + Sort string `json:"sort" comment:"排序"` + + + Status string `json:"status" comment:"状态"` + + + Remark string `json:"remark" comment:"备注"` + +} + +func (s *SysCategoryControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysCategoryControl) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysCategoryControl) GenerateM() (common.ActiveRecord, error) { + return &models.SysCategory{ + + Model: gorm.Model{ID: s.ID}, + Name: s.Name, + Img: s.Img, + Sort: s.Sort, + Status: s.Status, + Remark: s.Remark, + }, nil +} + +func (s *SysCategoryControl) GetId() interface{} { + return s.ID +} + +type SysCategoryById struct { + dto.ObjectById +} + +func (s *SysCategoryById) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysCategoryById) GenerateM() (common.ActiveRecord, error) { + return &models.SysCategory{}, nil +} diff --git a/go-admin-ui/src/api/syscategory.js b/go-admin-ui/src/api/syscategory.js new file mode 100644 index 00000000..cde5aead --- /dev/null +++ b/go-admin-ui/src/api/syscategory.js @@ -0,0 +1,47 @@ +import request from '@/utils/request' + +// 查询SysCategory列表 +export function listSysCategory(query) { + return request({ + url: '/api/v1/cms', + method: 'get', + params: query + }) +} + +// 查询SysCategory详细 +export function getSysCategory (ID) { + return request({ + url: '/api/v1/cms/' + ID, + method: 'get' + }) +} + + +// 新增SysCategory +export function addSysCategory(data) { + return request({ + url: '/api/v1/cms', + method: 'post', + data: data + }) +} + +// 修改SysCategory +export function updateSysCategory(data) { + return request({ + url: '/api/v1/cms/'+data.ID, + method: 'put', + data: data + }) +} + +// 删除SysCategory +export function delSysCategory(data) { + return request({ + url: '/api/v1/cms', + method: 'delete', + data: data + }) +} + diff --git a/go-admin-ui/src/views/syscategory/index.vue b/go-admin-ui/src/views/syscategory/index.vue new file mode 100644 index 00000000..6860b271 --- /dev/null +++ b/go-admin-ui/src/views/syscategory/index.vue @@ -0,0 +1,329 @@ + + + + From 870b144557af9b8a21b60d2f247223046d51ab21 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 23 Oct 2020 23:33:57 +0800 Subject: [PATCH 018/201] =?UTF-8?q?feat=20:=20admin=20=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E6=9D=83=E9=99=90=E8=B0=83=E6=95=B4=E9=BB=98=E8=AE=A4=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/permission.go | 25 +- app/admin/models/menu.go | 11 +- .../version/1599190683670_migrate.go | 228 ------------------ 3 files changed, 24 insertions(+), 240 deletions(-) diff --git a/app/admin/middleware/permission.go b/app/admin/middleware/permission.go index a0566310..e3c2be17 100644 --- a/app/admin/middleware/permission.go +++ b/app/admin/middleware/permission.go @@ -1,7 +1,8 @@ package middleware import ( - "fmt" + "go-admin/common/log" + "go-admin/tools/app" "net/http" "github.com/gin-gonic/gin" @@ -17,16 +18,20 @@ func AuthCheckRole() gin.HandlerFunc { data, _ := c.Get(jwtauth.JwtPayloadKey) v := data.(jwtauth.MapClaims) e := mycasbin.Casbin() + var res bool + var err error + msgID := tools.GenerateMsgIDFromContext(c) //检查权限 - res, err := e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method) - tools.HasError(err, "", 500) - - fmt.Printf("%s [INFO] %s %s %s \r\n", - tools.GetCurrentTimeStr(), - c.Request.Method, - c.Request.URL.Path, - v["rolekey"], - ) + if v["rolekey"]=="admin" { + res = true + log.Infof("msgID[%s] info:%s method:%s path:%s", msgID, v["rolekey"], c.Request.Method, c.Request.URL.Path) + }else { + res, err = e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method) + if err != nil { + log.Errorf("msgID[%s] error:%s method:%s path:%s", msgID, err, c.Request.Method, c.Request.URL.Path) + app.Error(c, 500, err, "") + } + } if res { c.Next() diff --git a/app/admin/models/menu.go b/app/admin/models/menu.go index 64e0919e..667d847c 100644 --- a/app/admin/models/menu.go +++ b/app/admin/models/menu.go @@ -2,6 +2,7 @@ package models import ( "errors" + "gorm.io/gorm" orm "go-admin/common/global" "go-admin/tools" @@ -216,8 +217,14 @@ func (e *MenuRole) Get() (Menus []MenuRole, err error) { } func (e *Menu) GetByRoleName(rolename string) (Menus []Menu, err error) { - table := orm.Eloquent.Table(e.TableName()).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id") - table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", rolename) + var table *gorm.DB + if rolename == "admin" { + table = orm.Eloquent.Table(e.TableName()).Select("sys_menu.*") + table = table.Where(" menu_type in ('M','C')") + } else { + table = orm.Eloquent.Table(e.TableName()).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id") + table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", rolename) + } if err = table.Order("sort").Find(&Menus).Error; err != nil { return } diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index 63f505cb..a1756592 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -21,236 +21,8 @@ func _1599190683670Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { list1 := []models.RoleMenu{ - {RoleId: 1, MenuId: 2, RoleName: "admin"}, - {RoleId: 1, MenuId: 3, RoleName: "admin"}, - {RoleId: 1, MenuId: 43, RoleName: "admin"}, - {RoleId: 1, MenuId: 44, RoleName: "admin"}, - {RoleId: 1, MenuId: 45, RoleName: "admin"}, - {RoleId: 1, MenuId: 46, RoleName: "admin"}, - {RoleId: 1, MenuId: 51, RoleName: "admin"}, - {RoleId: 1, MenuId: 52, RoleName: "admin"}, - {RoleId: 1, MenuId: 56, RoleName: "admin"}, - {RoleId: 1, MenuId: 57, RoleName: "admin"}, - {RoleId: 1, MenuId: 58, RoleName: "admin"}, - {RoleId: 1, MenuId: 59, RoleName: "admin"}, - {RoleId: 1, MenuId: 60, RoleName: "admin"}, - {RoleId: 1, MenuId: 61, RoleName: "admin"}, - {RoleId: 1, MenuId: 62, RoleName: "admin"}, - {RoleId: 1, MenuId: 63, RoleName: "admin"}, - {RoleId: 1, MenuId: 64, RoleName: "admin"}, - {RoleId: 1, MenuId: 66, RoleName: "admin"}, - {RoleId: 1, MenuId: 67, RoleName: "admin"}, - {RoleId: 1, MenuId: 68, RoleName: "admin"}, - {RoleId: 1, MenuId: 69, RoleName: "admin"}, - {RoleId: 1, MenuId: 70, RoleName: "admin"}, - {RoleId: 1, MenuId: 71, RoleName: "admin"}, - {RoleId: 1, MenuId: 72, RoleName: "admin"}, - {RoleId: 1, MenuId: 73, RoleName: "admin"}, - {RoleId: 1, MenuId: 74, RoleName: "admin"}, - {RoleId: 1, MenuId: 75, RoleName: "admin"}, - {RoleId: 1, MenuId: 76, RoleName: "admin"}, - {RoleId: 1, MenuId: 77, RoleName: "admin"}, - {RoleId: 1, MenuId: 78, RoleName: "admin"}, - {RoleId: 1, MenuId: 79, RoleName: "admin"}, - {RoleId: 1, MenuId: 80, RoleName: "admin"}, - {RoleId: 1, MenuId: 81, RoleName: "admin"}, - {RoleId: 1, MenuId: 82, RoleName: "admin"}, - {RoleId: 1, MenuId: 83, RoleName: "admin"}, - {RoleId: 1, MenuId: 84, RoleName: "admin"}, - {RoleId: 1, MenuId: 85, RoleName: "admin"}, - {RoleId: 1, MenuId: 86, RoleName: "admin"}, - {RoleId: 1, MenuId: 87, RoleName: "admin"}, - {RoleId: 1, MenuId: 89, RoleName: "admin"}, - {RoleId: 1, MenuId: 90, RoleName: "admin"}, - {RoleId: 1, MenuId: 91, RoleName: "admin"}, - {RoleId: 1, MenuId: 92, RoleName: "admin"}, - {RoleId: 1, MenuId: 93, RoleName: "admin"}, - {RoleId: 1, MenuId: 94, RoleName: "admin"}, - {RoleId: 1, MenuId: 95, RoleName: "admin"}, - {RoleId: 1, MenuId: 96, RoleName: "admin"}, - {RoleId: 1, MenuId: 97, RoleName: "admin"}, - {RoleId: 1, MenuId: 103, RoleName: "admin"}, - {RoleId: 1, MenuId: 104, RoleName: "admin"}, - {RoleId: 1, MenuId: 105, RoleName: "admin"}, - {RoleId: 1, MenuId: 106, RoleName: "admin"}, - {RoleId: 1, MenuId: 107, RoleName: "admin"}, - {RoleId: 1, MenuId: 108, RoleName: "admin"}, - {RoleId: 1, MenuId: 109, RoleName: "admin"}, - {RoleId: 1, MenuId: 110, RoleName: "admin"}, - {RoleId: 1, MenuId: 111, RoleName: "admin"}, - {RoleId: 1, MenuId: 112, RoleName: "admin"}, - {RoleId: 1, MenuId: 113, RoleName: "admin"}, - {RoleId: 1, MenuId: 114, RoleName: "admin"}, - {RoleId: 1, MenuId: 115, RoleName: "admin"}, - {RoleId: 1, MenuId: 116, RoleName: "admin"}, - {RoleId: 1, MenuId: 117, RoleName: "admin"}, - {RoleId: 1, MenuId: 118, RoleName: "admin"}, - {RoleId: 1, MenuId: 119, RoleName: "admin"}, - {RoleId: 1, MenuId: 120, RoleName: "admin"}, - {RoleId: 1, MenuId: 121, RoleName: "admin"}, - {RoleId: 1, MenuId: 122, RoleName: "admin"}, - {RoleId: 1, MenuId: 123, RoleName: "admin"}, - {RoleId: 1, MenuId: 138, RoleName: "admin"}, - {RoleId: 1, MenuId: 142, RoleName: "admin"}, - {RoleId: 1, MenuId: 201, RoleName: "admin"}, - {RoleId: 1, MenuId: 202, RoleName: "admin"}, - {RoleId: 1, MenuId: 203, RoleName: "admin"}, - {RoleId: 1, MenuId: 204, RoleName: "admin"}, - {RoleId: 1, MenuId: 205, RoleName: "admin"}, - {RoleId: 1, MenuId: 206, RoleName: "admin"}, - {RoleId: 1, MenuId: 211, RoleName: "admin"}, - {RoleId: 1, MenuId: 212, RoleName: "admin"}, - {RoleId: 1, MenuId: 213, RoleName: "admin"}, - {RoleId: 1, MenuId: 214, RoleName: "admin"}, - {RoleId: 1, MenuId: 215, RoleName: "admin"}, - {RoleId: 1, MenuId: 216, RoleName: "admin"}, - {RoleId: 1, MenuId: 217, RoleName: "admin"}, - {RoleId: 1, MenuId: 220, RoleName: "admin"}, - {RoleId: 1, MenuId: 221, RoleName: "admin"}, - {RoleId: 1, MenuId: 222, RoleName: "admin"}, - {RoleId: 1, MenuId: 223, RoleName: "admin"}, - {RoleId: 1, MenuId: 224, RoleName: "admin"}, - {RoleId: 1, MenuId: 225, RoleName: "admin"}, - {RoleId: 1, MenuId: 226, RoleName: "admin"}, - {RoleId: 1, MenuId: 227, RoleName: "admin"}, - {RoleId: 1, MenuId: 228, RoleName: "admin"}, - {RoleId: 1, MenuId: 229, RoleName: "admin"}, - {RoleId: 1, MenuId: 230, RoleName: "admin"}, - {RoleId: 1, MenuId: 231, RoleName: "admin"}, - {RoleId: 1, MenuId: 232, RoleName: "admin"}, - {RoleId: 1, MenuId: 233, RoleName: "admin"}, - {RoleId: 1, MenuId: 234, RoleName: "admin"}, - {RoleId: 1, MenuId: 235, RoleName: "admin"}, - {RoleId: 1, MenuId: 236, RoleName: "admin"}, - {RoleId: 1, MenuId: 237, RoleName: "admin"}, - {RoleId: 1, MenuId: 238, RoleName: "admin"}, - {RoleId: 1, MenuId: 239, RoleName: "admin"}, - {RoleId: 1, MenuId: 240, RoleName: "admin"}, - {RoleId: 1, MenuId: 241, RoleName: "admin"}, - {RoleId: 1, MenuId: 242, RoleName: "admin"}, - {RoleId: 1, MenuId: 243, RoleName: "admin"}, - {RoleId: 1, MenuId: 244, RoleName: "admin"}, - {RoleId: 1, MenuId: 245, RoleName: "admin"}, - {RoleId: 1, MenuId: 246, RoleName: "admin"}, - {RoleId: 1, MenuId: 247, RoleName: "admin"}, - {RoleId: 1, MenuId: 248, RoleName: "admin"}, - {RoleId: 1, MenuId: 249, RoleName: "admin"}, - {RoleId: 1, MenuId: 250, RoleName: "admin"}, - {RoleId: 1, MenuId: 251, RoleName: "admin"}, - {RoleId: 1, MenuId: 252, RoleName: "admin"}, - {RoleId: 1, MenuId: 253, RoleName: "admin"}, - {RoleId: 1, MenuId: 254, RoleName: "admin"}, - {RoleId: 1, MenuId: 255, RoleName: "admin"}, - {RoleId: 1, MenuId: 256, RoleName: "admin"}, - {RoleId: 1, MenuId: 257, RoleName: "admin"}, - {RoleId: 1, MenuId: 258, RoleName: "admin"}, - {RoleId: 1, MenuId: 259, RoleName: "admin"}, - {RoleId: 1, MenuId: 260, RoleName: "admin"}, - {RoleId: 1, MenuId: 261, RoleName: "admin"}, - {RoleId: 1, MenuId: 262, RoleName: "admin"}, - {RoleId: 1, MenuId: 263, RoleName: "admin"}, - {RoleId: 1, MenuId: 264, RoleName: "admin"}, - {RoleId: 1, MenuId: 267, RoleName: "admin"}, - {RoleId: 1, MenuId: 269, RoleName: "admin"}, - {RoleId: 1, MenuId: 459, RoleName: "admin"}, - {RoleId: 1, MenuId: 460, RoleName: "admin"}, - {RoleId: 1, MenuId: 461, RoleName: "admin"}, - {RoleId: 1, MenuId: 462, RoleName: "admin"}, - {RoleId: 1, MenuId: 463, RoleName: "admin"}, - {RoleId: 1, MenuId: 464, RoleName: "admin"}, - {RoleId: 1, MenuId: 465, RoleName: "admin"}, - {RoleId: 1, MenuId: 466, RoleName: "admin"}, - {RoleId: 1, MenuId: 467, RoleName: "admin"}, - {RoleId: 1, MenuId: 468, RoleName: "admin"}, - {RoleId: 1, MenuId: 469, RoleName: "admin"}, - {RoleId: 1, MenuId: 470, RoleName: "admin"}, - {RoleId: 1, MenuId: 471, RoleName: "admin"}, - {RoleId: 1, MenuId: 473, RoleName: "admin"}, - {RoleId: 1, MenuId: 474, RoleName: "admin"}, - {RoleId: 1, MenuId: 475, RoleName: "admin"}, - {RoleId: 1, MenuId: 476, RoleName: "admin"}, - {RoleId: 1, MenuId: 477, RoleName: "admin"}, - {RoleId: 1, MenuId: 478, RoleName: "admin"}, - {RoleId: 1, MenuId: 479, RoleName: "admin"}, - {RoleId: 1, MenuId: 480, RoleName: "admin"}, - {RoleId: 1, MenuId: 481, RoleName: "admin"}, - {RoleId: 1, MenuId: 482, RoleName: "admin"}, - {RoleId: 1, MenuId: 483, RoleName: "admin"}, } list2 := []models.CasbinRule{ - {PType: "p", V0: "admin", V1: "/api/v1/menulist", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/menu", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/databytype/", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/menu", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/menu/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysUserList", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysUser/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysUser/", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysUser", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysUser", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysUser/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/user/profile", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/rolelist", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/role/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/role", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/role", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/role/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/configList", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/config/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/config", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/config", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/config/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/menurole", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/roleMenuTreeselect/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/menuTreeselect", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/rolemenu", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/rolemenu", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/rolemenu/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/deptList", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/dept/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/dept", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/dept", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/dept/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/datalist", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/data/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/databytype/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/data", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/data/", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/data/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/typelist", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/type/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/type", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/type", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/type/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/postlist", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/post/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/post", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/post", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/post/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/menu/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/menuids", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/loginloglist", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/loginlog/:id", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/operloglist", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/getinfo", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/roledatascope", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/roleDeptTreeselect/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/deptTree", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/configKey/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/logout", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/user/avatar", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/user/pwd", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/dict/typeoptionselect", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysjob", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysjob/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysjob", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysjob", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/sysjob", V2: "DELETE"}, - {PType: "p", V0: "admin", V1: "/api/v1/syssettingList", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/syssetting/:id", V2: "GET"}, - {PType: "p", V0: "admin", V1: "/api/v1/syssetting", V2: "POST"}, - {PType: "p", V0: "admin", V1: "/api/v1/syssetting", V2: "PUT"}, - {PType: "p", V0: "admin", V1: "/api/v1/syssetting/:id", V2: "DELETE"}, } list3 := []models.SysDept{ From c851e82762f12ed7b748eaef85d8731ac7f4e980 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 23 Oct 2020 23:34:32 +0800 Subject: [PATCH 019/201] =?UTF-8?q?docs:=E6=96=87=E6=A1=A3=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger.json | 2 +- main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/swagger.json b/docs/swagger.json index f2bfe3fb..d14e8cc4 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -6,7 +6,7 @@ "contact": {}, "license": { "name": "MIT", - "url": "https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md" + "url": "https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md" }, "version": "1.0.1" }, diff --git a/main.go b/main.go index 1ce5f4fb..b0171ce9 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,7 @@ import ( // @description 基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档 // @description 添加qq群: 74520518 进入技术交流群 请备注,谢谢! // @license.name MIT -// @license.url https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md +// @license.url https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md // @securityDefinitions.apikey Bearer // @in header From c814439f93d618c4362701c3f5b54609438cc933 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sat, 24 Oct 2020 13:14:57 +0800 Subject: [PATCH 020/201] =?UTF-8?q?feat=E2=9C=A8=20admin=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=9D=83=E9=99=90=E6=94=B9=E4=B8=BA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/menu.go | 13 +++++++++---- app/admin/models/menu.go | 8 ++++---- app/admin/models/role.go | 6 +++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/admin/apis/system/menu.go b/app/admin/apis/system/menu.go index dd01d624..abe1fa76 100644 --- a/app/admin/apis/system/menu.go +++ b/app/admin/apis/system/menu.go @@ -46,17 +46,22 @@ func GetMenu(c *gin.Context) { app.OK(c, result, "") } +// GetMenuTreeRoleselect 角色修改中的菜单列表 func GetMenuTreeRoleselect(c *gin.Context) { var Menu models.Menu var SysRole models.SysRole + id, err := tools.StringToInt(c.Param("roleId")) SysRole.RoleId = id - result, err := Menu.SetMenuLable() - tools.HasError(err, "抱歉未找到相关信息", -1) + var result *[]models.MenuLable menuIds := make([]int, 0) - if id != 0 { - menuIds, err = SysRole.GetRoleMeunId() + if tools.GetRoleName(c) != "admin" { + result, err = Menu.SetMenuLable() tools.HasError(err, "抱歉未找到相关信息", -1) + if id != 0 { + menuIds, err = SysRole.GetRoleMeunId() + tools.HasError(err, "抱歉未找到相关信息", -1) + } } app.Custum(c, gin.H{ "code": 200, diff --git a/app/admin/models/menu.go b/app/admin/models/menu.go index 667d847c..5c26633b 100644 --- a/app/admin/models/menu.go +++ b/app/admin/models/menu.go @@ -146,10 +146,10 @@ func DiguiMenu(menulist *[]Menu, menu Menu) Menu { return menu } -func (e *Menu) SetMenuLable() (m []MenuLable, err error) { +func (e *Menu) SetMenuLable() (m *[]MenuLable, err error) { menulist, err := e.Get() - m = make([]MenuLable, 0) + ml := make([]MenuLable, 0) for i := 0; i < len(menulist); i++ { if menulist[i].ParentId != 0 { continue @@ -159,9 +159,9 @@ func (e *Menu) SetMenuLable() (m []MenuLable, err error) { e.Label = menulist[i].Title menusInfo := DiguiMenuLable(&menulist, e) - m = append(m, menusInfo) + ml = append(ml, menusInfo) } - return + return &ml, err } func DiguiMenuLable(menulist *[]Menu, menu MenuLable) MenuLable { diff --git a/app/admin/models/role.go b/app/admin/models/role.go index 1088c31c..74c649b4 100644 --- a/app/admin/models/role.go +++ b/app/admin/models/role.go @@ -22,9 +22,9 @@ type SysRole struct { DataScope string `json:"dataScope" gorm:"size:128;"` BaseModel - Params string `json:"params" gorm:"-"` - MenuIds []int `json:"menuIds" gorm:"-"` - DeptIds []int `json:"deptIds" gorm:"-"` + Params string `json:"params" gorm:"-"` + MenuIds []int `json:"menuIds" gorm:"-"` + DeptIds []int `json:"deptIds" gorm:"-"` } func (SysRole) TableName() string { From a68e58f93bade5ea90fd017718525ec8258f9157 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Mon, 26 Oct 2020 15:49:14 +0800 Subject: [PATCH 021/201] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration/version/1599190683659_tables.go | 2 +- .../version/1599190683670_migrate.go | 8 +- .../version/1602644950000_migrate.go | 7 +- cmd/migrate/server.go | 6 +- cmd/version/server.go | 5 +- go-admin-ui/src/api/syscategory.js | 47 --- go-admin-ui/src/views/syscategory/index.vue | 329 ------------------ 7 files changed, 12 insertions(+), 392 deletions(-) delete mode 100644 go-admin-ui/src/api/syscategory.js delete mode 100644 go-admin-ui/src/views/syscategory/index.vue diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 42eeda3b..53bc5fda 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -1,9 +1,9 @@ package version import ( - "go-admin/app/admin/models/system" "runtime" + "go-admin/app/admin/models/system" "gorm.io/gorm" "go-admin/app/admin/models" diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index a1756592..7660403f 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -1,10 +1,10 @@ package version import ( - "go-admin/app/admin/models/system" "runtime" "time" + "go-admin/app/admin/models/system" "gorm.io/gorm" "go-admin/app/admin/models" @@ -20,10 +20,8 @@ func init() { func _1599190683670Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - list1 := []models.RoleMenu{ - } - list2 := []models.CasbinRule{ - } + list1 := []models.RoleMenu{} + list2 := []models.CasbinRule{} list3 := []models.SysDept{ {DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, diff --git a/cmd/migrate/migration/version/1602644950000_migrate.go b/cmd/migrate/migration/version/1602644950000_migrate.go index a73d1471..c2f87cee 100644 --- a/cmd/migrate/migration/version/1602644950000_migrate.go +++ b/cmd/migrate/migration/version/1602644950000_migrate.go @@ -1,11 +1,12 @@ package version import ( - "go-admin/app/admin/models" - "go-admin/app/admin/models/system" - "gorm.io/gorm" "runtime" + "gorm.io/gorm" + + "go-admin/app/admin/models" + "go-admin/app/admin/models/system" "go-admin/cmd/migrate/migration" common "go-admin/common/models" ) diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index 08850a86..a2c4ae12 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -16,7 +16,7 @@ import ( "go-admin/common/global" "go-admin/common/models" "go-admin/pkg/logger" - tools2 "go-admin/tools" + "go-admin/tools" "go-admin/tools/config" ) @@ -91,9 +91,9 @@ func genFile() error { var b1 bytes.Buffer err = t1.Execute(&b1, m) if goAdmin { - tools2.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go") + tools.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go") } else { - tools2.FileCreate(b1, "./cmd/migrate/migration/version-local/"+m["GenerateTime"]+"_migrate.go") + tools.FileCreate(b1, "./cmd/migrate/migration/version-local/"+m["GenerateTime"]+"_migrate.go") } return nil } diff --git a/cmd/version/server.go b/cmd/version/server.go index cb46e41d..1095bb1f 100644 --- a/cmd/version/server.go +++ b/cmd/version/server.go @@ -9,10 +9,7 @@ import ( ) var ( - configYml string - port string - mode string - StartCmd = &cobra.Command{ + StartCmd = &cobra.Command{ Use: "version", Short: "Get version info", Example: "go-admin version", diff --git a/go-admin-ui/src/api/syscategory.js b/go-admin-ui/src/api/syscategory.js deleted file mode 100644 index cde5aead..00000000 --- a/go-admin-ui/src/api/syscategory.js +++ /dev/null @@ -1,47 +0,0 @@ -import request from '@/utils/request' - -// 查询SysCategory列表 -export function listSysCategory(query) { - return request({ - url: '/api/v1/cms', - method: 'get', - params: query - }) -} - -// 查询SysCategory详细 -export function getSysCategory (ID) { - return request({ - url: '/api/v1/cms/' + ID, - method: 'get' - }) -} - - -// 新增SysCategory -export function addSysCategory(data) { - return request({ - url: '/api/v1/cms', - method: 'post', - data: data - }) -} - -// 修改SysCategory -export function updateSysCategory(data) { - return request({ - url: '/api/v1/cms/'+data.ID, - method: 'put', - data: data - }) -} - -// 删除SysCategory -export function delSysCategory(data) { - return request({ - url: '/api/v1/cms', - method: 'delete', - data: data - }) -} - diff --git a/go-admin-ui/src/views/syscategory/index.vue b/go-admin-ui/src/views/syscategory/index.vue deleted file mode 100644 index 6860b271..00000000 --- a/go-admin-ui/src/views/syscategory/index.vue +++ /dev/null @@ -1,329 +0,0 @@ - - - - From da4637d285125ed2b622e580ddd7e559c10e5a1e Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Mon, 26 Oct 2020 22:37:44 +0800 Subject: [PATCH 022/201] =?UTF-8?q?logger=E6=A8=A1=E5=9D=97=E7=A7=BB?= =?UTF-8?q?=E5=85=A5go-admin-core=E4=BB=93=E5=BA=93=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9log=E7=94=A8=E6=B3=95=E6=9A=82=E6=97=B6=E6=8A=98?= =?UTF-8?q?=E4=B8=AD=20fixme=EF=BC=9A=E5=90=8E=E6=9C=9F=E8=A6=81=E5=B0=BD?= =?UTF-8?q?=E5=BF=AB=E6=94=B9=E6=88=90=E7=BB=9F=E4=B8=80=E7=9A=84log?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/role.go | 8 +- app/admin/middleware/permission.go | 12 +- cmd/api/server.go | 15 +-- cmd/migrate/server.go | 2 +- common/config/config.go | 2 +- common/config/type.go | 2 +- common/database/mysql_drive.go | 17 +-- common/database/pgsql_driver.go | 11 +- common/database/sqlite3_driver.go | 19 +-- common/global/adm.go | 3 +- common/global/casbin.go | 15 +++ common/log/log.go | 2 +- debug/log/log.go | 56 --------- debug/log/options.go | 70 ----------- examples/run.go | 4 +- go.mod | 2 +- go.sum | 4 +- logger/context.go | 14 --- logger/default.go | 194 ----------------------------- logger/helper.go | 114 ----------------- logger/level.go | 140 --------------------- logger/logger.go | 43 ------- logger/logger_test.go | 18 --- logger/options.go | 58 --------- pkg/casbin/log.go | 36 ++++++ pkg/casbin/mycasbin.go | 27 ++-- pkg/logger/logger.go | 15 +-- 27 files changed, 119 insertions(+), 784 deletions(-) create mode 100644 common/global/casbin.go delete mode 100644 debug/log/log.go delete mode 100644 debug/log/options.go delete mode 100644 logger/context.go delete mode 100644 logger/default.go delete mode 100644 logger/helper.go delete mode 100644 logger/level.go delete mode 100644 logger/logger.go delete mode 100644 logger/logger_test.go delete mode 100644 logger/options.go create mode 100644 pkg/casbin/log.go diff --git a/app/admin/apis/system/role.go b/app/admin/apis/system/role.go index 8b42af29..8a97c045 100644 --- a/app/admin/apis/system/role.go +++ b/app/admin/apis/system/role.go @@ -2,9 +2,9 @@ package system import ( "github.com/gin-gonic/gin" - mycasbin "go-admin/pkg/casbin" "go-admin/app/admin/models" + "go-admin/common/global" "go-admin/tools" "go-admin/tools/app" ) @@ -88,7 +88,7 @@ func InsertRole(c *gin.Context) { tools.HasError(err, "", -1) } - _, err = mycasbin.LoadPolicy() + _, err = global.LoadPolicy() tools.HasError(err, "", -1) app.OK(c, data, "添加成功") @@ -118,7 +118,7 @@ func UpdateRole(c *gin.Context) { tools.HasError(err2, "修改失败(insert)", -1) } - _, err = mycasbin.LoadPolicy() + _, err = global.LoadPolicy() tools.HasError(err, "", -1) app.OK(c, result, "修改成功") @@ -156,7 +156,7 @@ func DeleteRole(c *gin.Context) { _, err := Role.BatchDelete(IDS) tools.HasError(err, "删除失败", -1) - _, err = mycasbin.LoadPolicy() + _, err = global.LoadPolicy() tools.HasError(err, "", -1) app.OK(c, "", "删除成功") diff --git a/app/admin/middleware/permission.go b/app/admin/middleware/permission.go index e3c2be17..6d8e3037 100644 --- a/app/admin/middleware/permission.go +++ b/app/admin/middleware/permission.go @@ -1,15 +1,15 @@ package middleware import ( - "go-admin/common/log" - "go-admin/tools/app" "net/http" "github.com/gin-gonic/gin" - mycasbin "go-admin/pkg/casbin" + "go-admin/common/global" + "go-admin/common/log" "go-admin/pkg/jwtauth" "go-admin/tools" + "go-admin/tools/app" ) //权限检查中间件 @@ -17,15 +17,15 @@ func AuthCheckRole() gin.HandlerFunc { return func(c *gin.Context) { data, _ := c.Get(jwtauth.JwtPayloadKey) v := data.(jwtauth.MapClaims) - e := mycasbin.Casbin() + e := global.CasbinEnforcer var res bool var err error msgID := tools.GenerateMsgIDFromContext(c) //检查权限 - if v["rolekey"]=="admin" { + if v["rolekey"] == "admin" { res = true log.Infof("msgID[%s] info:%s method:%s path:%s", msgID, v["rolekey"], c.Request.Method, c.Request.URL.Path) - }else { + } else { res, err = e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method) if err != nil { log.Errorf("msgID[%s] error:%s method:%s path:%s", msgID, err, c.Request.Method, c.Request.URL.Path) diff --git a/cmd/api/server.go b/cmd/api/server.go index b0c6e349..3d2a023e 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -17,6 +17,7 @@ import ( "go-admin/app/jobs" "go-admin/common/database" "go-admin/common/global" + "go-admin/common/log" mycasbin "go-admin/pkg/casbin" "go-admin/pkg/logger" "go-admin/tools" @@ -57,14 +58,14 @@ func setup() { //1. 读取配置 config.Setup(configYml) //2. 设置日志 - logger.Setup() + global.Logger, global.JobLogger, global.RequestLogger = logger.Setup() //3. 初始化数据库链接 database.Setup(config.DatabaseConfig.Driver) //4. 接口访问控制加载 - mycasbin.Setup() + global.CasbinEnforcer = mycasbin.Setup(global.Eloquent, "sys_") usageStr := `starting api server` - global.Logger.Info(usageStr) + log.Info(usageStr) } @@ -100,11 +101,11 @@ func run() error { // 服务连接 if config.SslConfig.Enable { if err := srv.ListenAndServeTLS(config.SslConfig.Pem, config.SslConfig.KeyStr); err != nil && err != http.ErrServerClosed { - global.Logger.Fatal("listen: ", err) + log.Fatal("listen: ", err) } } else { if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { - global.Logger.Fatal("listen: ", err) + log.Fatal("listen: ", err) } } }() @@ -127,9 +128,9 @@ func run() error { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() if err := srv.Shutdown(ctx); err != nil { - global.Logger.Fatal("Server Shutdown:", err) + log.Fatal("Server Shutdown:", err) } - global.Logger.Println("Server exiting") + log.Info("Server exiting") return nil } diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index a2c4ae12..a5b05435 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -48,7 +48,7 @@ func run() { //1. 读取配置 config.Setup(configYml) //2. 设置日志 - logger.Setup() + global.Logger, global.JobLogger, global.RequestLogger = logger.Setup() _ = initDB() } else { _ = genFile() diff --git a/common/config/config.go b/common/config/config.go index 4ac318dd..5222d114 100644 --- a/common/config/config.go +++ b/common/config/config.go @@ -4,7 +4,7 @@ import ( "database/sql" "net/http" - "go-admin/logger" + "github.com/go-admin-team/go-admin-core/logger" ) type Config struct { diff --git a/common/config/type.go b/common/config/type.go index 8fbed122..a8060a62 100644 --- a/common/config/type.go +++ b/common/config/type.go @@ -3,7 +3,7 @@ package config import ( "net/http" - "go-admin/logger" + "github.com/go-admin-team/go-admin-core/logger" ) type Conf interface { diff --git a/common/database/mysql_drive.go b/common/database/mysql_drive.go index 6ed0b294..c30d7a2b 100644 --- a/common/database/mysql_drive.go +++ b/common/database/mysql_drive.go @@ -2,7 +2,7 @@ package database import ( "database/sql" - "log" + . "log" "time" "gorm.io/driver/mysql" @@ -10,9 +10,10 @@ import ( "gorm.io/gorm/logger" "gorm.io/gorm/schema" + goAdminLogger "github.com/go-admin-team/go-admin-core/logger" "go-admin/common/config" "go-admin/common/global" - goAdminLogger "go-admin/logger" + "go-admin/common/log" "go-admin/tools" toolsConfig "go-admin/tools/config" ) @@ -22,10 +23,10 @@ type Mysql struct { func (e *Mysql) Setup() { global.Source = e.GetConnect() - global.Logger.Info(tools.Green(global.Source)) + log.Info(tools.Green(global.Source)) db, err := sql.Open("mysql", global.Source) if err != nil { - global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) + log.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) } global.Cfg.SetDb(&config.DBConfig{ Driver: "mysql", @@ -37,18 +38,18 @@ func (e *Mysql) Setup() { }, }) if err != nil { - global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) + log.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) } else { - global.Logger.Info(tools.Green(e.GetDriver() + " connect success !")) + log.Info(tools.Green(e.GetDriver() + " connect success !")) } if global.Eloquent.Error != nil { - global.Logger.Fatal(tools.Red(" database error :"), global.Eloquent.Error) + log.Fatal(tools.Red(" database error :"), global.Eloquent.Error) } if toolsConfig.LoggerConfig.EnabledDB { global.Eloquent.Logger = logger.New( - log.New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", log.LstdFlags), + New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", LstdFlags), logger.Config{ SlowThreshold: time.Second, Colorful: true, diff --git a/common/database/pgsql_driver.go b/common/database/pgsql_driver.go index e6b0c0bb..b1d9bead 100644 --- a/common/database/pgsql_driver.go +++ b/common/database/pgsql_driver.go @@ -2,7 +2,8 @@ package database import ( "database/sql" - "log" + "go-admin/common/log" + . "log" "time" "gorm.io/driver/postgres" @@ -10,9 +11,9 @@ import ( "gorm.io/gorm/logger" "gorm.io/gorm/schema" + goAdminLogger "github.com/go-admin-team/go-admin-core/logger" "go-admin/common/config" "go-admin/common/global" - goAdminLogger "go-admin/logger" "go-admin/tools" toolsConfig "go-admin/tools/config" ) @@ -24,7 +25,7 @@ func (e *PgSql) Setup() { var err error global.Source = e.GetConnect() - log.Println(global.Source) + log.Info(global.Source) db, err := sql.Open("postgresql", global.Source) if err != nil { global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) @@ -41,7 +42,7 @@ func (e *PgSql) Setup() { if err != nil { log.Fatalf("%s connect error %v", e.GetDriver(), err) } else { - log.Printf("%s connect success!", e.GetDriver()) + log.Infof("%s connect success!", e.GetDriver()) } if global.Eloquent.Error != nil { @@ -50,7 +51,7 @@ func (e *PgSql) Setup() { if toolsConfig.LoggerConfig.EnabledDB { global.Eloquent.Logger = logger.New( - log.New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", log.LstdFlags), + New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", LstdFlags), logger.Config{ SlowThreshold: time.Second, Colorful: true, diff --git a/common/database/sqlite3_driver.go b/common/database/sqlite3_driver.go index a02d5324..c7fb5173 100644 --- a/common/database/sqlite3_driver.go +++ b/common/database/sqlite3_driver.go @@ -4,7 +4,7 @@ package database import ( "database/sql" - "log" + . "log" "os" "time" @@ -15,6 +15,7 @@ import ( "go-admin/common/config" "go-admin/common/global" + "go-admin/common/log" "go-admin/tools" toolsConfig "go-admin/tools/config" ) @@ -26,7 +27,7 @@ func (e *SqLite) Setup() { var err error global.Source = e.GetConnect() - log.Println(global.Source) + log.Info(global.Source) db, err := sql.Open("sqlite3", global.Source) if err != nil { global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) @@ -44,7 +45,7 @@ func (e *SqLite) Setup() { if err != nil { log.Fatalf("%s connect error %v", e.GetDriver(), err) } else { - log.Printf("%s connect success!", e.GetDriver()) + log.Infof("%s connect success!", e.GetDriver()) } if global.Eloquent.Error != nil { @@ -52,11 +53,13 @@ func (e *SqLite) Setup() { } if toolsConfig.LoggerConfig.EnabledDB { - global.Eloquent.Logger = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), logger.Config{ - SlowThreshold: time.Second, - Colorful: true, - LogLevel: logger.Info, - }) + global.Eloquent.Logger = logger.New( + New(os.Stdout, "\r\n", LstdFlags), logger.Config{ + SlowThreshold: time.Second, + Colorful: true, + LogLevel: logger.Info, + }, + ) } } diff --git a/common/global/adm.go b/common/global/adm.go index 73804827..dc1a4142 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -5,8 +5,9 @@ import ( "github.com/gin-gonic/gin" "github.com/gogf/gf/os/glog" "github.com/robfig/cron/v3" - "go-admin/common/config" "gorm.io/gorm" + + "go-admin/common/config" ) const ( diff --git a/common/global/casbin.go b/common/global/casbin.go new file mode 100644 index 00000000..bbe300fe --- /dev/null +++ b/common/global/casbin.go @@ -0,0 +1,15 @@ +package global + +import ( + "github.com/casbin/casbin/v2" + "github.com/casbin/casbin/v2/log" +) + +func LoadPolicy() (*casbin.SyncedEnforcer, error) { + if err := CasbinEnforcer.LoadPolicy(); err == nil { + return CasbinEnforcer, err + } else { + log.LogPrintf("casbin rbac_model or policy init error, message: %v \r\n", err.Error()) + return nil, err + } +} diff --git a/common/log/log.go b/common/log/log.go index 42e1866d..83636e23 100644 --- a/common/log/log.go +++ b/common/log/log.go @@ -1,6 +1,6 @@ package log -import "go-admin/logger" +import "github.com/go-admin-team/go-admin-core/logger" var ( // Trace trace级日志输出 diff --git a/debug/log/log.go b/debug/log/log.go deleted file mode 100644 index dabdb899..00000000 --- a/debug/log/log.go +++ /dev/null @@ -1,56 +0,0 @@ -// Package log provides debug logging -package log - -import ( - "encoding/json" - "fmt" - "time" -) - -var ( - // Default buffer size if any - DefaultSize = 256 - // Default formatter - DefaultFormat = TextFormat -) - -// Log is debug log interface for reading and writing logs -type Log interface { - // Read reads log entries from the logger - Read(...ReadOption) ([]Record, error) - // Write writes records to log - Write(Record) error - // Stream log records - Stream() (Stream, error) -} - -// Record is log record entry -type Record struct { - // Timestamp of logged event - Timestamp time.Time `json:"timestamp"` - // Metadata to enrich log record - Metadata map[string]string `json:"metadata"` - // Value contains log entry - Message interface{} `json:"message"` -} - -// Stream returns a log stream -type Stream interface { - Chan() <-chan Record - Stop() error -} - -// Format is a function which formats the output -type FormatFunc func(Record) string - -// TextFormat returns text format -func TextFormat(r Record) string { - t := r.Timestamp.Format("2006-01-02 15:04:05") - return fmt.Sprintf("%s %v", t, r.Message) -} - -// JSONFormat is a json Format func -func JSONFormat(r Record) string { - b, _ := json.Marshal(r) - return string(b) -} diff --git a/debug/log/options.go b/debug/log/options.go deleted file mode 100644 index 63281857..00000000 --- a/debug/log/options.go +++ /dev/null @@ -1,70 +0,0 @@ -package log - -import "time" - -// Option used by the logger -type Option func(*Options) - -// Options are logger options -type Options struct { - // Name of the log - Name string - // Size is the size of ring buffer - Size int - // Format specifies the output format - Format FormatFunc -} - -// Name of the log -func Name(n string) Option { - return func(o *Options) { - o.Name = n - } -} - -// Size sets the size of the ring buffer -func Size(s int) Option { - return func(o *Options) { - o.Size = s - } -} - -func Format(f FormatFunc) Option { - return func(o *Options) { - o.Format = f - } -} - -// DefaultOptions returns default options -func DefaultOptions() Options { - return Options{ - Size: DefaultSize, - } -} - -// ReadOptions for querying the logs -type ReadOptions struct { - // Since what time in past to return the logs - Since time.Time - // Count specifies number of logs to return - Count int - // Stream requests continuous log stream - Stream bool -} - -// ReadOption used for reading the logs -type ReadOption func(*ReadOptions) - -// Since sets the time since which to return the log records -func Since(s time.Time) ReadOption { - return func(o *ReadOptions) { - o.Since = s - } -} - -// Count sets the number of log records to return -func Count(c int) ReadOption { - return func(o *ReadOptions) { - o.Count = c - } -} diff --git a/examples/run.go b/examples/run.go index a70eb989..4b062384 100644 --- a/examples/run.go +++ b/examples/run.go @@ -20,8 +20,8 @@ func main() { if err != nil { panic(err) } - mycasbin.Setup() - logger.Setup() + global.CasbinEnforcer = mycasbin.Setup(global.Eloquent, "sys_") + global.Logger, global.JobLogger, global.RequestLogger = logger.Setup() global.GinEngine = gin.Default() //router.InitRouter() log.Fatal(global.GinEngine.Run(":8000")) diff --git a/go.mod b/go.mod index b3ab5d41..c9dfb70b 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.1 + github.com/go-admin-team/go-admin-core v1.2.2-0.20201026083717-3ca6060dfd3c github.com/go-redis/redis/v7 v7.4.0 github.com/go-sql-driver/mysql v1.5.0 github.com/gogf/gf v1.13.4 diff --git a/go.sum b/go.sum index be45e2c7..138ba792 100644 --- a/go.sum +++ b/go.sum @@ -187,8 +187,8 @@ github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0 h1:rdQovo0Jt github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.1 h1:Ko9PSuQhi6YXA29iXYk8resTQ9iM46TjdHYZII0DZS4= -github.com/go-admin-team/go-admin-core v1.2.1/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk= +github.com/go-admin-team/go-admin-core v1.2.2-0.20201026083717-3ca6060dfd3c h1:Ltad1Ux6Loha/wrv/KReJevMvPChYsqCRzkVBoW3Qkk= +github.com/go-admin-team/go-admin-core v1.2.2-0.20201026083717-3ca6060dfd3c/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= diff --git a/logger/context.go b/logger/context.go deleted file mode 100644 index 6940122d..00000000 --- a/logger/context.go +++ /dev/null @@ -1,14 +0,0 @@ -package logger - -import "context" - -type loggerKey struct{} - -func FromContext(ctx context.Context) (Logger, bool) { - l, ok := ctx.Value(loggerKey{}).(Logger) - return l, ok -} - -func NewContext(ctx context.Context, l Logger) context.Context { - return context.WithValue(ctx, loggerKey{}, l) -} diff --git a/logger/default.go b/logger/default.go deleted file mode 100644 index 0614a82b..00000000 --- a/logger/default.go +++ /dev/null @@ -1,194 +0,0 @@ -package logger - -import ( - "context" - "fmt" - "log" - "os" - "runtime" - "sort" - "strings" - "sync" - "time" - - dlog "go-admin/debug/log" -) - -func init() { - lvl, err := GetLevel(os.Getenv("GO_ADMIN_LOG_LEVEL")) - if err != nil { - lvl = InfoLevel - } - - DefaultLogger = NewHelper(NewLogger(WithLevel(lvl))) -} - -type defaultLogger struct { - sync.RWMutex - opts Options -} - -// Init(opts...) should only overwrite provided options -func (l *defaultLogger) Init(opts ...Option) error { - for _, o := range opts { - o(&l.opts) - } - return nil -} - -func (l *defaultLogger) String() string { - return "default" -} - -func (l *defaultLogger) Fields(fields map[string]interface{}) Logger { - l.Lock() - l.opts.Fields = copyFields(fields) - l.Unlock() - return l -} - -func copyFields(src map[string]interface{}) map[string]interface{} { - dst := make(map[string]interface{}, len(src)) - for k, v := range src { - dst[k] = v - } - return dst -} - -// logCallerfilePath returns a package/file:line description of the caller, -// preserving only the leaf directory name and file name. -func logCallerfilePath(loggingFilePath string) string { - // To make sure we trim the path correctly on Windows too, we - // counter-intuitively need to use '/' and *not* os.PathSeparator here, - // because the path given originates from Go stdlib, specifically - // runtime.Caller() which (as of Mar/17) returns forward slashes even on - // Windows. - // - // See https://github.com/golang/go/issues/3335 - // and https://github.com/golang/go/issues/18151 - // - // for discussion on the issue on Go side. - idx := strings.LastIndexByte(loggingFilePath, '/') - if idx == -1 { - return loggingFilePath - } - idx = strings.LastIndexByte(loggingFilePath[:idx], '/') - if idx == -1 { - return loggingFilePath - } - return loggingFilePath[idx+1:] -} - -func (l *defaultLogger) Log(level Level, v ...interface{}) { - // TODO decide does we need to write message if log level not used? - if !l.opts.Level.Enabled(level) { - return - } - - l.RLock() - fields := copyFields(l.opts.Fields) - l.RUnlock() - - fields["level"] = level.String() - - if _, file, line, ok := runtime.Caller(l.opts.CallerSkipCount); ok { - fields["file"] = fmt.Sprintf("%s:%d", logCallerfilePath(file), line) - } - - rec := dlog.Record{ - Timestamp: time.Now(), - Message: fmt.Sprint(v...), - Metadata: make(map[string]string, len(fields)), - } - - keys := make([]string, 0, len(fields)) - for k, v := range fields { - keys = append(keys, k) - rec.Metadata[k] = fmt.Sprintf("%v", v) - } - - sort.Strings(keys) - metadata := "" - - for _, k := range keys { - metadata += fmt.Sprintf(" %s=%v", k, fields[k]) - } - - t := rec.Timestamp.Format("2006-01-02 15:04:05") - _, err := l.opts.Out.Write([]byte(fmt.Sprintf("%s %s %v\n", t, metadata, rec.Message))) - if err != nil { - log.Printf("log [Log] write error: %s \n", err.Error()) - } - //fmt.Printf("%s %s %v\n", t, metadata, rec.Message) -} - -func (l *defaultLogger) Logf(level Level, format string, v ...interface{}) { - // TODO decide does we need to write message if log level not used? - if level < l.opts.Level { - return - } - - l.RLock() - fields := copyFields(l.opts.Fields) - l.RUnlock() - - fields["level"] = level.String() - - if _, file, line, ok := runtime.Caller(l.opts.CallerSkipCount); ok { - fields["file"] = fmt.Sprintf("%s:%d", logCallerfilePath(file), line) - } - - rec := dlog.Record{ - Timestamp: time.Now(), - Message: fmt.Sprintf(format, v...), - Metadata: make(map[string]string, len(fields)), - } - - keys := make([]string, 0, len(fields)) - for k, v := range fields { - keys = append(keys, k) - rec.Metadata[k] = fmt.Sprintf("%v", v) - } - - sort.Strings(keys) - metadata := "" - - for _, k := range keys { - metadata += fmt.Sprintf(" %s=%v", k, fields[k]) - } - - t := rec.Timestamp.Format("2006-01-02 15:04:05") - //fmt.Printf("%s %s %v\n", t, metadata, rec.Message) - _, err := l.opts.Out.Write([]byte(fmt.Sprintf("%s %s %v\n", t, metadata, rec.Message))) - if err != nil { - log.Printf("log [Logf] write error: %s \n", err.Error()) - } -} - -func (l *defaultLogger) Options() Options { - // not guard against options Context values - l.RLock() - opts := l.opts - opts.Fields = copyFields(l.opts.Fields) - l.RUnlock() - return opts -} - -// NewLogger builds a new logger based on options -func NewLogger(opts ...Option) Logger { - // Default options - options := Options{ - Level: InfoLevel, - Fields: make(map[string]interface{}), - Out: os.Stderr, - CallerSkipCount: 2, - Context: context.Background(), - } - - l := &defaultLogger{opts: options} - if err := l.Init(opts...); err != nil { - l.Log(FatalLevel, err) - } - - return l -} diff --git a/logger/helper.go b/logger/helper.go deleted file mode 100644 index 94c2f364..00000000 --- a/logger/helper.go +++ /dev/null @@ -1,114 +0,0 @@ -package logger - -import ( - "os" -) - -type Helper struct { - Logger - fields map[string]interface{} -} - -func NewHelper(log Logger) *Helper { - return &Helper{Logger: log} -} - -func (h *Helper) Info(args ...interface{}) { - if !h.Logger.Options().Level.Enabled(InfoLevel) { - return - } - h.Logger.Fields(h.fields).Log(InfoLevel, args...) -} - -func (h *Helper) Infof(template string, args ...interface{}) { - if !h.Logger.Options().Level.Enabled(InfoLevel) { - return - } - h.Logger.Fields(h.fields).Logf(InfoLevel, template, args...) -} - -func (h *Helper) Trace(args ...interface{}) { - if !h.Logger.Options().Level.Enabled(TraceLevel) { - return - } - h.Logger.Fields(h.fields).Log(TraceLevel, args...) -} - -func (h *Helper) Tracef(template string, args ...interface{}) { - if !h.Logger.Options().Level.Enabled(TraceLevel) { - return - } - h.Logger.Fields(h.fields).Logf(TraceLevel, template, args...) -} - -func (h *Helper) Debug(args ...interface{}) { - if !h.Logger.Options().Level.Enabled(DebugLevel) { - return - } - h.Logger.Fields(h.fields).Log(DebugLevel, args...) -} - -func (h *Helper) Debugf(template string, args ...interface{}) { - if !h.Logger.Options().Level.Enabled(DebugLevel) { - return - } - h.Logger.Fields(h.fields).Logf(DebugLevel, template, args...) -} - -func (h *Helper) Warn(args ...interface{}) { - if !h.Logger.Options().Level.Enabled(WarnLevel) { - return - } - h.Logger.Fields(h.fields).Log(WarnLevel, args...) -} - -func (h *Helper) Warnf(template string, args ...interface{}) { - if !h.Logger.Options().Level.Enabled(WarnLevel) { - return - } - h.Logger.Fields(h.fields).Logf(WarnLevel, template, args...) -} - -func (h *Helper) Error(args ...interface{}) { - if !h.Logger.Options().Level.Enabled(ErrorLevel) { - return - } - h.Logger.Fields(h.fields).Log(ErrorLevel, args...) -} - -func (h *Helper) Errorf(template string, args ...interface{}) { - if !h.Logger.Options().Level.Enabled(ErrorLevel) { - return - } - h.Logger.Fields(h.fields).Logf(ErrorLevel, template, args...) -} - -func (h *Helper) Fatal(args ...interface{}) { - if !h.Logger.Options().Level.Enabled(FatalLevel) { - return - } - h.Logger.Fields(h.fields).Log(FatalLevel, args...) - os.Exit(1) -} - -func (h *Helper) Fatalf(template string, args ...interface{}) { - if !h.Logger.Options().Level.Enabled(FatalLevel) { - return - } - h.Logger.Fields(h.fields).Logf(FatalLevel, template, args...) - os.Exit(1) -} - -func (h *Helper) WithError(err error) *Helper { - fields := copyFields(h.fields) - fields["error"] = err - return &Helper{Logger: h.Logger, fields: fields} -} - -func (h *Helper) WithFields(fields map[string]interface{}) *Helper { - nfields := copyFields(fields) - for k, v := range h.fields { - nfields[k] = v - } - return &Helper{Logger: h.Logger, fields: nfields} -} diff --git a/logger/level.go b/logger/level.go deleted file mode 100644 index 14bca250..00000000 --- a/logger/level.go +++ /dev/null @@ -1,140 +0,0 @@ -package logger - -import ( - "fmt" - "os" -) - -type Level int8 - -const ( - // TraceLevel level. Designates finer-grained informational events than the Debug. - TraceLevel Level = iota - 2 - // DebugLevel level. Usually only enabled when debugging. Very verbose logging. - DebugLevel - // InfoLevel is the default logging priority. - // General operational entries about what's going on inside the application. - InfoLevel - // WarnLevel level. Non-critical entries that deserve eyes. - WarnLevel - // ErrorLevel level. Logs. Used for errors that should definitely be noted. - ErrorLevel - // FatalLevel level. Logs and then calls `logger.Exit(1)`. highest level of severity. - FatalLevel -) - -func (l Level) String() string { - switch l { - case TraceLevel: - return "trace" - case DebugLevel: - return "debug" - case InfoLevel: - return "info" - case WarnLevel: - return "warn" - case ErrorLevel: - return "error" - case FatalLevel: - return "fatal" - } - return "" -} - -// LevelForGorm 转换成gorm日志级别 -func (l Level) LevelForGorm() int { - switch l { - case FatalLevel, ErrorLevel: - return 2 - case WarnLevel: - return 3 - case InfoLevel, DebugLevel, TraceLevel: - return 4 - default: - return 1 - } -} - -// Enabled returns true if the given level is at or above this level. -func (l Level) Enabled(lvl Level) bool { - return lvl >= l -} - -// GetLevel converts a level string into a logger Level value. -// returns an error if the input string does not match known values. -func GetLevel(levelStr string) (Level, error) { - switch levelStr { - case TraceLevel.String(): - return TraceLevel, nil - case DebugLevel.String(): - return DebugLevel, nil - case InfoLevel.String(): - return InfoLevel, nil - case WarnLevel.String(): - return WarnLevel, nil - case ErrorLevel.String(): - return ErrorLevel, nil - case FatalLevel.String(): - return FatalLevel, nil - } - return InfoLevel, fmt.Errorf("Unknown Level String: '%s', defaulting to InfoLevel", levelStr) -} - -func Info(args ...interface{}) { - DefaultLogger.Log(InfoLevel, args...) -} - -func Infof(template string, args ...interface{}) { - DefaultLogger.Logf(InfoLevel, template, args...) -} - -func Trace(args ...interface{}) { - DefaultLogger.Log(TraceLevel, args...) -} - -func Tracef(template string, args ...interface{}) { - DefaultLogger.Logf(TraceLevel, template, args...) -} - -func Debug(args ...interface{}) { - DefaultLogger.Log(DebugLevel, args...) -} - -func Debugf(template string, args ...interface{}) { - DefaultLogger.Logf(DebugLevel, template, args...) -} - -func Warn(args ...interface{}) { - DefaultLogger.Log(WarnLevel, args...) -} - -func Warnf(template string, args ...interface{}) { - DefaultLogger.Logf(WarnLevel, template, args...) -} - -func Error(args ...interface{}) { - DefaultLogger.Log(ErrorLevel, args...) -} - -func Errorf(template string, args ...interface{}) { - DefaultLogger.Logf(ErrorLevel, template, args...) -} - -func Fatal(args ...interface{}) { - DefaultLogger.Log(FatalLevel, args...) - os.Exit(1) -} - -func Fatalf(template string, args ...interface{}) { - DefaultLogger.Logf(FatalLevel, template, args...) - os.Exit(1) -} - -// Returns true if the given level is at or lower the current logger level -func V(lvl Level, log Logger) bool { - l := DefaultLogger - if log != nil { - l = log - } - return l.Options().Level <= lvl -} diff --git a/logger/logger.go b/logger/logger.go deleted file mode 100644 index 627f1ba9..00000000 --- a/logger/logger.go +++ /dev/null @@ -1,43 +0,0 @@ -// Package log provides a log interface -package logger - -var ( - // Default logger - DefaultLogger Logger -) - -// Logger is a generic logging interface -type Logger interface { - // Init initialises options - Init(options ...Option) error - // The Logger options - Options() Options - // Fields set fields to always be logged - Fields(fields map[string]interface{}) Logger - // Log writes a log entry - Log(level Level, v ...interface{}) - // Logf writes a formatted log entry - Logf(level Level, format string, v ...interface{}) - // String returns the name of logger - String() string -} - -func Init(opts ...Option) error { - return DefaultLogger.Init(opts...) -} - -func Fields(fields map[string]interface{}) Logger { - return DefaultLogger.Fields(fields) -} - -func Log(level Level, v ...interface{}) { - DefaultLogger.Log(level, v...) -} - -func Logf(level Level, format string, v ...interface{}) { - DefaultLogger.Logf(level, format, v...) -} - -func String() string { - return DefaultLogger.String() -} diff --git a/logger/logger_test.go b/logger/logger_test.go deleted file mode 100644 index f36a3a3b..00000000 --- a/logger/logger_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package logger - -import ( - "testing" -) - -func TestLogger(t *testing.T) { - l := NewLogger(WithLevel(TraceLevel)) - h1 := NewHelper(l).WithFields(map[string]interface{}{"key1": "val1"}) - h1.Trace("trace_msg1") - h1.Warn("warn_msg1") - - h2 := NewHelper(l).WithFields(map[string]interface{}{"key2": "val2"}) - h2.Trace("trace_msg2") - h2.Warn("warn_msg2") - - l.Fields(map[string]interface{}{"key3": "val4"}).Log(InfoLevel, "test_msg") -} diff --git a/logger/options.go b/logger/options.go deleted file mode 100644 index d0a03302..00000000 --- a/logger/options.go +++ /dev/null @@ -1,58 +0,0 @@ -package logger - -import ( - "context" - "io" -) - -type Option func(*Options) - -type Options struct { - // The logging level the logger should log at. default is `InfoLevel` - Level Level - // fields to always be logged - Fields map[string]interface{} - // It's common to set this to a file, or leave it default which is `os.Stderr` - Out io.Writer - // Caller skip frame count for file:line info - CallerSkipCount int - // Alternative options - Context context.Context -} - -// WithFields set default fields for the logger -func WithFields(fields map[string]interface{}) Option { - return func(args *Options) { - args.Fields = fields - } -} - -// WithLevel set default level for the logger -func WithLevel(level Level) Option { - return func(args *Options) { - args.Level = level - } -} - -// WithOutput set default output writer for the logger -func WithOutput(out io.Writer) Option { - return func(args *Options) { - args.Out = out - } -} - -// WithCallerSkipCount set frame count to skip -func WithCallerSkipCount(c int) Option { - return func(args *Options) { - args.CallerSkipCount = c - } -} - -func SetOption(k, v interface{}) Option { - return func(o *Options) { - if o.Context == nil { - o.Context = context.Background() - } - o.Context = context.WithValue(o.Context, k, v) - } -} diff --git a/pkg/casbin/log.go b/pkg/casbin/log.go new file mode 100644 index 00000000..f536ecbf --- /dev/null +++ b/pkg/casbin/log.go @@ -0,0 +1,36 @@ +package mycasbin + +import ( + "sync/atomic" + + "github.com/go-admin-team/go-admin-core/logger" +) + +// Logger is the implementation for a Logger using golang log. +type Logger struct { + enable int32 +} + +func (l *Logger) EnableLog(enable bool) { + i := 0 + if enable { + i = 1 + } + atomic.StoreInt32(&(l.enable), int32(i)) +} + +func (l *Logger) IsEnabled() bool { + return atomic.LoadInt32(&(l.enable)) != 0 +} + +func (l *Logger) Print(v ...interface{}) { + if l.IsEnabled() { + logger.DefaultLogger.Log(logger.InfoLevel, v...) + } +} + +func (l *Logger) Printf(format string, v ...interface{}) { + if l.IsEnabled() { + logger.DefaultLogger.Logf(logger.InfoLevel, format, v...) + } +} diff --git a/pkg/casbin/mycasbin.go b/pkg/casbin/mycasbin.go index 622a3e69..e65c6232 100644 --- a/pkg/casbin/mycasbin.go +++ b/pkg/casbin/mycasbin.go @@ -1,14 +1,11 @@ package mycasbin import ( - "log" - "github.com/casbin/casbin/v2" + "github.com/casbin/casbin/v2/log" "github.com/casbin/casbin/v2/model" gormAdapter "github.com/casbin/gorm-adapter/v3" - _ "github.com/go-sql-driver/mysql" - - "go-admin/common/global" + "gorm.io/gorm" ) // Initialize the model from a string. @@ -26,8 +23,8 @@ e = some(where (p.eft == allow)) m = r.sub == p.sub && (keyMatch2(r.obj, p.obj) || keyMatch(r.obj, p.obj)) && (r.act == p.act || p.act == "*") ` -func Setup() { - Apter, err := gormAdapter.NewAdapterByDBUsePrefix(global.Eloquent, "sys_") +func Setup(db *gorm.DB, prefix string) *casbin.SyncedEnforcer { + Apter, err := gormAdapter.NewAdapterByDBUsePrefix(db, prefix) if err != nil { panic(err) } @@ -43,18 +40,8 @@ func Setup() { if err != nil { panic(err) } - global.CasbinEnforcer = e -} -func Casbin() *casbin.SyncedEnforcer { - return global.CasbinEnforcer -} - -func LoadPolicy() (*casbin.SyncedEnforcer, error) { - if err := global.CasbinEnforcer.LoadPolicy(); err == nil { - return global.CasbinEnforcer, err - } else { - log.Printf("casbin rbac_model or policy init error, message: %v \r\n", err.Error()) - return nil, err - } + log.SetLogger(&Logger{}) + e.EnableLog(true) + return e } diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index 7c958b7a..b39a0126 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -2,16 +2,16 @@ package logger import ( "github.com/gogf/gf/os/glog" - "go-admin/common/global" + "go-admin/tools" "go-admin/tools/config" ) -var Logger *glog.Logger -var JobLogger *glog.Logger -var RequestLogger *glog.Logger +func Setup() (*glog.Logger, *glog.Logger, *glog.Logger) { + var Logger *glog.Logger + var JobLogger *glog.Logger + var RequestLogger *glog.Logger -func Setup() { Logger = glog.New() _ = Logger.SetPath(config.LoggerConfig.Path + "/bus") Logger.SetStdoutPrint(config.LoggerConfig.EnabledBUS && config.LoggerConfig.Stdout) @@ -31,8 +31,5 @@ func Setup() { _ = RequestLogger.SetLevelStr(config.LoggerConfig.Level) Logger.Info(tools.Green("Logger init success!")) - - global.Logger = Logger.Line() - global.JobLogger = JobLogger.Line() - global.RequestLogger = RequestLogger.Line() + return Logger, JobLogger, RequestLogger } From 55112db749e96fc6d389f7b3e621f2442010d351 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 27 Oct 2020 11:23:56 +0800 Subject: [PATCH 023/201] =?UTF-8?q?refactor=F0=9F=8E=A8=20:=20=E9=92=88?= =?UTF-8?q?=E5=AF=B9=E6=95=B0=E6=8D=AE=E5=BA=93=E5=90=8D=E7=A7=B0=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=B7=BB=E5=8A=A0=E7=AC=A6=E5=8F=B7=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=20(#281)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/tools/dbtables.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/models/tools/dbtables.go b/app/admin/models/tools/dbtables.go index 0ef2a8d7..e57400d8 100644 --- a/app/admin/models/tools/dbtables.go +++ b/app/admin/models/tools/dbtables.go @@ -27,7 +27,7 @@ func (e *DBTables) GetPage(pageSize int, pageIndex int) ([]DBTables, int, error) if config2.DatabaseConfig.Driver == "mysql" { table = orm.Eloquent.Table("information_schema.tables") - table = table.Where("TABLE_NAME not in (select table_name from " + config2.GenConfig.DBName + ".sys_tables) ") + table = table.Where("TABLE_NAME not in (select table_name from `" + config2.GenConfig.DBName + "`.sys_tables) ") table = table.Where("table_schema= ? ", config2.GenConfig.DBName) if e.TableName != "" { From 199fc180b7677906c02caa20408f5b5a14e90bf0 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 27 Oct 2020 11:38:49 +0800 Subject: [PATCH 024/201] =?UTF-8?q?refactor=F0=9F=8E=A8=20=20:=20=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=99=BB=E5=BD=95=E6=97=A5=E5=BF=97=E5=92=8C=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=97=A5=E5=BF=97=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/log/loginlog.go | 134 ------- app/admin/apis/log/operlog.go | 113 ------ .../system/sys_login_log/sys_login_log.go | 192 ++++++++++ .../system/sys_opera_log/sys_opera_log.go | 192 ++++++++++ app/admin/middleware/handler/auth.go | 12 +- app/admin/middleware/logger.go | 55 +-- app/admin/models/loginlog.go | 105 ------ app/admin/models/operlog.go | 116 ------ app/admin/models/system/sys_login_log.go | 38 ++ app/admin/models/system/sys_opera_log.go | 46 +++ app/admin/router/sys_login_log.go | 25 ++ app/admin/router/sys_opera_log.go | 25 ++ app/admin/router/sysrouter.go | 24 -- app/admin/service/dto/sys_login_log.go | 110 ++++++ app/admin/service/dto/sys_opera_log.go | 124 +++++++ app/admin/service/sys_login_log.go | 110 ++++++ app/admin/service/sys_opera_log.go | 110 ++++++ .../migration/version/1599190683659_tables.go | 4 +- .../version/1599190683670_migrate.go | 16 +- .../version/1603465014697_migrate.go | 28 ++ .../version/1603516925109_migrate.go | 41 +++ go-admin-ui/src/api/syscategory.js | 47 --- go-admin-ui/src/views/syscategory/index.vue | 329 ------------------ 23 files changed, 1081 insertions(+), 915 deletions(-) delete mode 100644 app/admin/apis/log/loginlog.go delete mode 100644 app/admin/apis/log/operlog.go create mode 100644 app/admin/apis/system/sys_login_log/sys_login_log.go create mode 100644 app/admin/apis/system/sys_opera_log/sys_opera_log.go delete mode 100644 app/admin/models/loginlog.go delete mode 100644 app/admin/models/operlog.go create mode 100644 app/admin/models/system/sys_login_log.go create mode 100644 app/admin/models/system/sys_opera_log.go create mode 100644 app/admin/router/sys_login_log.go create mode 100644 app/admin/router/sys_opera_log.go create mode 100644 app/admin/service/dto/sys_login_log.go create mode 100644 app/admin/service/dto/sys_opera_log.go create mode 100644 app/admin/service/sys_login_log.go create mode 100644 app/admin/service/sys_opera_log.go create mode 100644 cmd/migrate/migration/version/1603465014697_migrate.go create mode 100644 cmd/migrate/migration/version/1603516925109_migrate.go delete mode 100644 go-admin-ui/src/api/syscategory.js delete mode 100644 go-admin-ui/src/views/syscategory/index.vue diff --git a/app/admin/apis/log/loginlog.go b/app/admin/apis/log/loginlog.go deleted file mode 100644 index 6f36f402..00000000 --- a/app/admin/apis/log/loginlog.go +++ /dev/null @@ -1,134 +0,0 @@ -package log - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" -) - -// @Summary 登录日志列表 -// @Description 获取JSON -// @Tags 登录日志 -// @Param status query string false "status" -// @Param dictCode query string false "dictCode" -// @Param dictType query string false "dictType" -// @Param pageSize query int false "页条数" -// @Param pageIndex query int false "页码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/loginloglist [get] -// @Security Bearer -func GetLoginLogList(c *gin.Context) { - var data models.LoginLog - var err error - var pageSize = 10 - var pageIndex = 1 - - size := c.Request.FormValue("pageSize") - if size != "" { - pageSize, err = tools.StringToInt(size) - } - - index := c.Request.FormValue("pageIndex") - if index != "" { - pageIndex, err = tools.StringToInt(index) - } - - data.Username = c.Request.FormValue("username") - data.Status = c.Request.FormValue("status") - data.Ipaddr = c.Request.FormValue("ipaddr") - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - var mp = make(map[string]interface{}, 3) - mp["list"] = result - mp["count"] = count - mp["pageIndex"] = pageIndex - mp["pageSize"] = pageSize - - var res app.Response - res.Data = mp - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 通过编码获取登录日志 -// @Description 获取JSON -// @Tags 登录日志 -// @Param infoId path int true "infoId" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/loginlog/{infoId} [get] -// @Security Bearer -func GetLoginLog(c *gin.Context) { - var LoginLog models.LoginLog - LoginLog.InfoId, _ = tools.StringToInt(c.Param("infoId")) - result, err := LoginLog.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 添加登录日志 -// @Description 获取JSON -// @Tags 登录日志 -// @Accept application/json -// @Product application/json -// @Param data body models.LoginLog true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/loginlog [post] -// @Security Bearer -func InsertLoginLog(c *gin.Context) { - var data models.LoginLog - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 修改登录日志 -// @Description 获取JSON -// @Tags 登录日志 -// @Accept application/json -// @Product application/json -// @Param data body models.LoginLog true "body" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/loginlog [put] -// @Security Bearer -func UpdateLoginLog(c *gin.Context) { - var data models.LoginLog - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "", -1) - result, err := data.Update(data.InfoId) - tools.HasError(err, "", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 批量删除登录日志 -// @Description 删除数据 -// @Tags 登录日志 -// @Param infoId path string true "以逗号(,)分割的infoId" -// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" -// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" -// @Router /api/v1/loginlog/{infoId} [delete] -func DeleteLoginLog(c *gin.Context) { - var data models.LoginLog - data.UpdateBy = tools.GetUserIdStr(c) - IDS := tools.IdsStrToIdsIntGroup("infoId", c) - _, err := data.BatchDelete(IDS) - tools.HasError(err, "修改失败", 500) - var res app.Response - res.Msg = "删除成功" - c.JSON(http.StatusOK, res.ReturnOK()) -} diff --git a/app/admin/apis/log/operlog.go b/app/admin/apis/log/operlog.go deleted file mode 100644 index 2e5a8dd6..00000000 --- a/app/admin/apis/log/operlog.go +++ /dev/null @@ -1,113 +0,0 @@ -package log - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" -) - -// @Summary 登录日志列表 -// @Description 获取JSON -// @Tags 登录日志 -// @Param status query string false "status" -// @Param dictCode query string false "dictCode" -// @Param dictType query string false "dictType" -// @Param pageSize query int false "页条数" -// @Param pageIndex query int false "页码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/operloglist [get] -// @Security Bearer -func GetOperLogList(c *gin.Context) { - var data models.SysOperLog - var err error - var pageSize = 10 - var pageIndex = 1 - - size := c.Request.FormValue("pageSize") - if size != "" { - pageSize, err = tools.StringToInt(size) - } - - index := c.Request.FormValue("pageIndex") - if index != "" { - pageIndex, err = tools.StringToInt(index) - } - - data.OperName = c.Request.FormValue("operName") - data.Status = c.Request.FormValue("status") - data.OperIp = c.Request.FormValue("operIp") - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - var mp = make(map[string]interface{}, 3) - mp["list"] = result - mp["count"] = count - mp["pageIndex"] = pageIndex - mp["pageSize"] = pageSize - - var res app.Response - res.Data = mp - - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 通过编码获取登录日志 -// @Description 获取JSON -// @Tags 登录日志 -// @Param infoId path int true "infoId" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/operlog/{infoId} [get] -// @Security Bearer -func GetOperLog(c *gin.Context) { - var OperLog models.SysOperLog - OperLog.OperId, _ = tools.StringToInt(c.Param("operId")) - result, err := OperLog.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 添加操作日志 -// @Description 获取JSON -// @Tags 操作日志 -// @Accept application/json -// @Product application/json -// @Param data body models.SysOperLog true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/operlog [post] -// @Security Bearer -func InsertOperLog(c *gin.Context) { - var data models.SysOperLog - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 批量删除操作日志 -// @Description 删除数据 -// @Tags 操作日志 -// @Param operId path string true "以逗号(,)分割的operId" -// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" -// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" -// @Router /api/v1/operlog/{operId} [delete] -func DeleteOperLog(c *gin.Context) { - var data models.SysOperLog - data.UpdateBy = tools.GetUserIdStr(c) - IDS := tools.IdsStrToIdsIntGroup("operId", c) - _, err := data.BatchDelete(IDS) - tools.HasError(err, "删除失败", 500) - var res app.Response - res.Msg = "删除成功" - c.JSON(http.StatusOK, res.ReturnOK()) -} diff --git a/app/admin/apis/system/sys_login_log/sys_login_log.go b/app/admin/apis/system/sys_login_log/sys_login_log.go new file mode 100644 index 00000000..bdd30bfe --- /dev/null +++ b/app/admin/apis/system/sys_login_log/sys_login_log.go @@ -0,0 +1,192 @@ +package sys_login_log + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/models/system" + + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" + + "net/http" +) + +type SysLoginLog struct { + apis.Api +} + +func (e *SysLoginLog) GetSysLoginLogList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysLoginLogSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + req := d.Generate() + + //查询列表 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]system.SysLoginLog, 0) + var count int64 + serviceStudent := service.SysLoginlog{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + err = serviceStudent.GetSysLoginlogPage(req, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") +} + +func (e *SysLoginLog) GetSysLoginLog(c *gin.Context) { + control := new(dto.SysLoginLogById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + req := control.Generate() + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object system.SysLoginLog + + serviceSysLoginLog := service.SysLoginlog{} + serviceSysLoginLog.MsgID = msgID + serviceSysLoginLog.Orm = db + err = serviceSysLoginLog.GetSysLoginlog(req, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysLoginLog) InsertSysLoginLog(c *gin.Context) { + control := new(dto.SysLoginLogControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + req := control.Generate() + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserIdUint(c)) + + serviceSysLoginLog := service.SysLoginlog{} + serviceSysLoginLog.Orm = db + serviceSysLoginLog.MsgID = msgID + err = serviceSysLoginLog.InsertSysLoginlog(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysLoginLog) UpdateSysLoginLog(c *gin.Context) { + control := new(dto.SysLoginLogControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + req := control.Generate() + //更新操作 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.SetUpdateBy(tools.GetUserIdUint(c)) + + serviceSysLoginLog := service.SysLoginlog{} + serviceSysLoginLog.Orm = db + serviceSysLoginLog.MsgID = msgID + err = serviceSysLoginLog.UpdateSysLoginlog(object) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysLoginLog) DeleteSysLoginLog(c *gin.Context) { + control := new(dto.SysLoginLogById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + req := control.Generate() + err = req.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + + // 设置编辑人 + object.SetUpdateBy(tools.GetUserIdUint(c)) + + serviceSysLoginLog := service.SysLoginlog{} + serviceSysLoginLog.Orm = db + serviceSysLoginLog.MsgID = msgID + err = serviceSysLoginLog.RemoveSysLoginlog(req, object) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "删除成功") +} diff --git a/app/admin/apis/system/sys_opera_log/sys_opera_log.go b/app/admin/apis/system/sys_opera_log/sys_opera_log.go new file mode 100644 index 00000000..0a52952d --- /dev/null +++ b/app/admin/apis/system/sys_opera_log/sys_opera_log.go @@ -0,0 +1,192 @@ +package sys_opera_log + +import ( + "github.com/gin-gonic/gin" + + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" + + "net/http" +) + +type SysOperaLog struct { + apis.Api +} + +func (e *SysOperaLog) GetSysOperaLogList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysOperaLogSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + req := d.Generate() + + //查询列表 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]system.SysOperaLog, 0) + var count int64 + serviceStudent := service.SysOperaLog{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + err = serviceStudent.GetSysOperaLogPage(req, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") +} + +func (e *SysOperaLog) GetSysOperaLog(c *gin.Context) { + control := new(dto.SysOperaLogById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + req := control.Generate() + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object system.SysOperaLog + + serviceSysOperlog := service.SysOperaLog{} + serviceSysOperlog.MsgID = msgID + serviceSysOperlog.Orm = db + err = serviceSysOperlog.GetSysOperaLog(req, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysOperaLog) InsertSysOperaLog(c *gin.Context) { + control := new(dto.SysOperaLogControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + req := control.Generate() + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserIdUint(c)) + + serviceSysOperaLog := service.SysOperaLog{} + serviceSysOperaLog.Orm = db + serviceSysOperaLog.MsgID = msgID + err = serviceSysOperaLog.InsertSysOperaLog(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysOperaLog) UpdateSysOperaLog(c *gin.Context) { + control := new(dto.SysOperaLogControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + req := control.Generate() + //更新操作 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.SetUpdateBy(tools.GetUserIdUint(c)) + + serviceSysOperaLog := service.SysOperaLog{} + serviceSysOperaLog.Orm = db + serviceSysOperaLog.MsgID = msgID + err = serviceSysOperaLog.UpdateSysOperaLog(object) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysOperaLog) DeleteSysOperaLog(c *gin.Context) { + control := new(dto.SysOperaLogById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + req := control.Generate() + err = req.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + + // 设置编辑人 + object.SetUpdateBy(tools.GetUserIdUint(c)) + + serviceSysOperaLog := service.SysOperaLog{} + serviceSysOperaLog.Orm = db + serviceSysOperaLog.MsgID = msgID + err = serviceSysOperaLog.RemoveSysOperaLog(req, object) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "删除成功") +} diff --git a/app/admin/middleware/handler/auth.go b/app/admin/middleware/handler/auth.go index f16c3511..d0b5e272 100644 --- a/app/admin/middleware/handler/auth.go +++ b/app/admin/middleware/handler/auth.go @@ -1,6 +1,8 @@ package handler import ( + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" "net/http" "github.com/gin-gonic/gin" @@ -98,7 +100,8 @@ func Authenticator(c *gin.Context) (interface{}, error) { // Write log to database func LoginLogToDB(c *gin.Context, status string, msg string, username string) { if config.LoggerConfig.EnabledDB { - var loginlog models.LoginLog + var loginlog system.SysLoginLog + serviceLoginLog :=service.SysLoginlog{} ua := user_agent.New(c.Request.UserAgent()) loginlog.Ipaddr = c.ClientIP() loginlog.Username = username @@ -112,7 +115,7 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) { loginlog.Os = ua.OS() loginlog.Msg = msg loginlog.Platform = ua.Platform() - _, _ = loginlog.Create() + _ = serviceLoginLog.InsertSysLoginlog(loginlog.Generate()) } } @@ -126,7 +129,7 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) { // @Router /logout [post] // @Security Bearer func LogOut(c *gin.Context) { - var loginlog models.LoginLog + var loginlog system.SysLoginLog ua := user_agent.New(c.Request.UserAgent()) loginlog.Ipaddr = c.ClientIP() location := tools.GetLocation(c.ClientIP()) @@ -140,7 +143,8 @@ func LogOut(c *gin.Context) { loginlog.Platform = ua.Platform() loginlog.Username = tools.GetUserName(c) loginlog.Msg = "退出成功" - loginlog.Create() + serviceLoginLog:=service.SysLoginlog{} + _ = serviceLoginLog.InsertSysLoginlog(loginlog.Generate()) c.JSON(http.StatusOK, gin.H{ "code": 200, diff --git a/app/admin/middleware/logger.go b/app/admin/middleware/logger.go index f3a621d8..98aa1d04 100644 --- a/app/admin/middleware/logger.go +++ b/app/admin/middleware/logger.go @@ -2,6 +2,8 @@ package middleware import ( "fmt" + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" "strings" "time" @@ -66,45 +68,46 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string menu.Path = reqUri menu.Action = reqMethod menuList, _ := menu.Get() - sysOperLog := models.SysOperLog{} - sysOperLog.OperIp = clientIP - sysOperLog.OperLocation = tools.GetLocation(clientIP) - sysOperLog.Status = tools.IntToString(statusCode) - sysOperLog.OperName = tools.GetUserName(c) - sysOperLog.RequestMethod = c.Request.Method - sysOperLog.OperUrl = reqUri + sysOperaLog := system.SysOperaLog{} + sysOperaLog.OperIp = clientIP + sysOperaLog.OperLocation = tools.GetLocation(clientIP) + sysOperaLog.Status = tools.IntToString(statusCode) + sysOperaLog.OperName = tools.GetUserName(c) + sysOperaLog.RequestMethod = c.Request.Method + sysOperaLog.OperUrl = reqUri if reqUri == "/login" { - sysOperLog.BusinessType = "10" - sysOperLog.Title = "用户登录" - sysOperLog.OperName = "-" + sysOperaLog.BusinessType = "10" + sysOperaLog.Title = "用户登录" + sysOperaLog.OperName = "-" } else if strings.Contains(reqUri, "/api/v1/logout") { - sysOperLog.BusinessType = "11" + sysOperaLog.BusinessType = "11" } else if strings.Contains(reqUri, "/api/v1/getCaptcha") { - sysOperLog.BusinessType = "12" - sysOperLog.Title = "验证码" + sysOperaLog.BusinessType = "12" + sysOperaLog.Title = "验证码" } else { if reqMethod == "POST" { - sysOperLog.BusinessType = "1" + sysOperaLog.BusinessType = "1" } else if reqMethod == "PUT" { - sysOperLog.BusinessType = "2" + sysOperaLog.BusinessType = "2" } else if reqMethod == "DELETE" { - sysOperLog.BusinessType = "3" + sysOperaLog.BusinessType = "3" } } - sysOperLog.Method = reqMethod + sysOperaLog.Method = reqMethod if len(menuList) > 0 { - sysOperLog.Title = menuList[0].Title + sysOperaLog.Title = menuList[0].Title } b, _ := c.Get("body") - sysOperLog.OperParam, _ = tools.StructToJsonStr(b) - sysOperLog.CreateBy = tools.GetUserName(c) - sysOperLog.OperTime = tools.GetCurrentTime() - sysOperLog.LatencyTime = (latencyTime).String() - sysOperLog.UserAgent = c.Request.UserAgent() + sysOperaLog.OperParam, _ = tools.StructToJsonStr(b) + sysOperaLog.CreateBy = tools.GetUserIdUint(c) + sysOperaLog.OperTime = tools.GetCurrentTime() + sysOperaLog.LatencyTime = (latencyTime).String() + sysOperaLog.UserAgent = c.Request.UserAgent() if c.Err() == nil { - sysOperLog.Status = "0" + sysOperaLog.Status = "0" } else { - sysOperLog.Status = "1" + sysOperaLog.Status = "1" } - _, _ = sysOperLog.Create() + serviceOperaLog:=service.SysOperaLog{} + _ = serviceOperaLog.InsertSysOperaLog(sysOperaLog.Generate()) } diff --git a/app/admin/models/loginlog.go b/app/admin/models/loginlog.go deleted file mode 100644 index af445a8a..00000000 --- a/app/admin/models/loginlog.go +++ /dev/null @@ -1,105 +0,0 @@ -package models - -import ( - "time" - - orm "go-admin/common/global" -) - -type LoginLog struct { - InfoId int `json:"infoId" gorm:"primary_key;auto_increment;"` //主键 - Username string `json:"username" gorm:"size:128;"` //用户名 - Status string `json:"status" gorm:"size:4;"` //状态 - Ipaddr string `json:"ipaddr" gorm:"size:255;"` //ip地址 - LoginLocation string `json:"loginLocation" gorm:"size:255;"` //归属地 - Browser string `json:"browser" gorm:"size:255;"` //浏览器 - Os string `json:"os" gorm:"size:255;"` //系统 - Platform string `json:"platform" gorm:"size:255;"` // 固件 - LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;"` //登录时间 - CreateBy string `json:"createBy" gorm:"size:128;"` //创建人 - UpdateBy string `json:"updateBy" gorm:"size:128;"` //更新者 - DataScope string `json:"dataScope" gorm:"-"` //数据 - Params string `json:"params" gorm:"-"` // - Remark string `json:"remark" gorm:"size:255;"` //备注 - Msg string `json:"msg" gorm:"size:255;"` - BaseModel -} - -func (LoginLog) TableName() string { - return "sys_loginlog" -} - -func (e *LoginLog) Get() (LoginLog, error) { - var doc LoginLog - - table := orm.Eloquent.Table(e.TableName()) - if e.Ipaddr != "" { - table = table.Where("ipaddr = ?", e.Ipaddr) - } - if e.InfoId != 0 { - table = table.Where("info_id = ?", e.InfoId) - } - - if err := table.First(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -func (e *LoginLog) GetPage(pageSize int, pageIndex int) ([]LoginLog, int, error) { - var doc []LoginLog - - table := orm.Eloquent.Table(e.TableName()) - if e.Ipaddr != "" { - table = table.Where("ipaddr = ?", e.Ipaddr) - } - if e.Status != "" { - table = table.Where("status = ?", e.Status) - } - if e.Username != "" { - table = table.Where("userName = ?", e.Username) - } - - var count int64 - - if err := table.Order("info_id desc").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil { - return nil, 0, err - } - //table.Where("`deleted_at` IS NULL").Count(&count) - return doc, int(count), nil -} - -func (e *LoginLog) Create() (LoginLog, error) { - var doc LoginLog - e.CreateBy = "0" - e.UpdateBy = "0" - result := orm.Eloquent.Table(e.TableName()).Create(&e) - if result.Error != nil { - err := result.Error - return doc, err - } - doc = *e - return doc, nil -} - -func (e *LoginLog) Update(id int) (update LoginLog, err error) { - - if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil { - return - } - - //参数1:是要修改的数据 - //参数2:是修改的数据 - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { - return - } - return -} - -func (e *LoginLog) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("info_id in (?)", id).Delete(&LoginLog{}).Error; err != nil { - return - } - Result = true - return -} diff --git a/app/admin/models/operlog.go b/app/admin/models/operlog.go deleted file mode 100644 index cde719af..00000000 --- a/app/admin/models/operlog.go +++ /dev/null @@ -1,116 +0,0 @@ -package models - -import ( - "time" - - orm "go-admin/common/global" -) - -//sys_operlog -type SysOperLog struct { - OperId int `json:"operId" gorm:"primary_key;AUTO_INCREMENT"` //日志编码 - Title string `json:"title" gorm:"size:255;"` //操作模块 - BusinessType string `json:"businessType" gorm:"size:128;"` //操作类型 - BusinessTypes string `json:"businessTypes" gorm:"size:128;"` - Method string `json:"method" gorm:"size:128;"` //函数 - RequestMethod string `json:"requestMethod" gorm:"size:128;"` //请求方式 - OperatorType string `json:"operatorType" gorm:"size:128;"` //操作类型 - OperName string `json:"operName" gorm:"size:128;"` //操作者 - DeptName string `json:"deptName" gorm:"size:128;"` //部门名称 - OperUrl string `json:"operUrl" gorm:"size:255;"` //访问地址 - OperIp string `json:"operIp" gorm:"size:128;"` //客户端ip - OperLocation string `json:"operLocation" gorm:"size:128;"` //访问位置 - OperParam string `json:"operParam" gorm:"size:255;"` //请求参数 - Status string `json:"status" gorm:"size:4;"` //操作状态 - OperTime time.Time `json:"operTime" gorm:"type:timestamp;"` //操作时间 - JsonResult string `json:"jsonResult" gorm:"size:255;"` //返回数据 - CreateBy string `json:"createBy" gorm:"size:128;"` //创建人 - UpdateBy string `json:"updateBy" gorm:"size:128;"` //更新者 - DataScope string `json:"dataScope" gorm:"-"` //数据 - Params string `json:"params" gorm:"-"` //参数 - Remark string `json:"remark" gorm:"size:255;"` //备注 - LatencyTime string `json:"latencyime" gorm:"size:128;"` //耗时 - UserAgent string `json:"userAgent" gorm:"size:255;"` //ua - BaseModel -} - -func (SysOperLog) TableName() string { - return "sys_operlog" -} - -func (e *SysOperLog) Get() (SysOperLog, error) { - var doc SysOperLog - - table := orm.Eloquent.Table(e.TableName()) - if e.OperIp != "" { - table = table.Where("oper_ip = ?", e.OperIp) - } - if e.OperId != 0 { - table = table.Where("oper_id = ?", e.OperId) - } - - if err := table.First(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -func (e *SysOperLog) GetPage(pageSize int, pageIndex int) ([]SysOperLog, int, error) { - var doc []SysOperLog - - table := orm.Eloquent.Table(e.TableName()) - if e.OperIp != "" { - table = table.Where("oper_ip = ?", e.OperIp) - } - if e.Status != "" { - table = table.Where("status = ?", e.Status) - } - if e.OperName != "" { - table = table.Where("oper_name = ?", e.OperName) - } - if e.BusinessType != "" { - table = table.Where("business_type = ?", e.BusinessType) - } - - var count int64 - - if err := table.Order("oper_id desc").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil { - return nil, 0, err - } - //table.Where("`deleted_at` IS NULL").Count(&count) - return doc, int(count), nil -} - -func (e *SysOperLog) Create() (SysOperLog, error) { - var doc SysOperLog - e.CreateBy = "0" - e.UpdateBy = "0" - result := orm.Eloquent.Table(e.TableName()).Create(&e) - if result.Error != nil { - err := result.Error - return doc, err - } - doc = *e - return doc, nil -} - -func (e *SysOperLog) Update(id int) (update SysOperLog, err error) { - if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil { - return - } - - //参数1:是要修改的数据 - //参数2:是修改的数据 - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { - return - } - return -} - -func (e *SysOperLog) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where(" oper_id in (?)", id).Delete(&SysOperLog{}).Error; err != nil { - return - } - Result = true - return -} diff --git a/app/admin/models/system/sys_login_log.go b/app/admin/models/system/sys_login_log.go new file mode 100644 index 00000000..f23d330b --- /dev/null +++ b/app/admin/models/system/sys_login_log.go @@ -0,0 +1,38 @@ +package system + +import ( + "gorm.io/gorm" + + "go-admin/common/models" + + "time" +) + +type SysLoginLog struct { + gorm.Model + models.ControlBy + + Username string `json:"username" gorm:"type:varchar(128);comment:用户名"` // + Status string `json:"status" gorm:"type:varchar(4);comment:状态"` // + Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"` // + LoginLocation string `json:"loginLocation" gorm:"type:varchar(255);comment:归属地"` // + Browser string `json:"browser" gorm:"type:varchar(255);comment:浏览器"` // + Os string `json:"os" gorm:"type:varchar(255);comment:系统"` // + Platform string `json:"platform" gorm:"type:varchar(255);comment:固件"` // + LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"` // + Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // + Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"` // +} + +func (SysLoginLog) TableName() string { + return "sys_login_log" +} + +func (e *SysLoginLog) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysLoginLog) GetId() interface{} { + return e.ID +} diff --git a/app/admin/models/system/sys_opera_log.go b/app/admin/models/system/sys_opera_log.go new file mode 100644 index 00000000..990e72cb --- /dev/null +++ b/app/admin/models/system/sys_opera_log.go @@ -0,0 +1,46 @@ +package system + +import ( + "gorm.io/gorm" + + "go-admin/common/models" + + "time" +) + +type SysOperaLog struct { + gorm.Model + models.ControlBy + + Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` // + BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` // + BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` // + Method string `json:"method" gorm:"type:varchar(128);comment:函数"` // + RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式"` // + OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"` // + OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"` // + DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"` // + OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"` // + OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"` // + OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"` // + OperParam string `json:"operParam" gorm:"type:varchar(255);comment:请求参数"` // + Status string `json:"status" gorm:"type:varchar(4);comment:操作状态"` // + OperTime time.Time `json:"operTime" gorm:"type:timestamp;comment:操作时间"` // + JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"` // + Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // + LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` // + UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` // +} + +func (SysOperaLog) TableName() string { + return "sys_opera_log" +} + +func (e *SysOperaLog) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysOperaLog) GetId() interface{} { + return e.ID +} diff --git a/app/admin/router/sys_login_log.go b/app/admin/router/sys_login_log.go new file mode 100644 index 00000000..bf2662d5 --- /dev/null +++ b/app/admin/router/sys_login_log.go @@ -0,0 +1,25 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/system/sys_login_log" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysLoginLogRouter) +} + +// 需认证的路由代码 +func registerSysLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &sys_login_log.SysLoginLog{} + r := v1.Group("/sys-login-log").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetSysLoginLogList) + r.GET("/:id", api.GetSysLoginLog) + r.POST("", api.InsertSysLoginLog) + r.PUT("/:id", api.UpdateSysLoginLog) + r.DELETE("", api.DeleteSysLoginLog) + } +} diff --git a/app/admin/router/sys_opera_log.go b/app/admin/router/sys_opera_log.go new file mode 100644 index 00000000..55bd8098 --- /dev/null +++ b/app/admin/router/sys_opera_log.go @@ -0,0 +1,25 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/system/sys_opera_log" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysOperaLogRouter) +} + +// 需认证的路由代码 +func registerSysOperaLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &sys_opera_log.SysOperaLog{} + r := v1.Group("/sys-opera-log").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetSysOperaLogList) + r.GET("/:id", api.GetSysOperaLog) + r.POST("", api.InsertSysOperaLog) + r.PUT("/:id", api.UpdateSysOperaLog) + r.DELETE("", api.DeleteSysOperaLog) + } +} diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sysrouter.go index 58c186a6..859bcb16 100644 --- a/app/admin/router/sysrouter.go +++ b/app/admin/router/sysrouter.go @@ -3,7 +3,6 @@ package router import ( "mime" - log2 "go-admin/app/admin/apis/log" "go-admin/app/admin/apis/monitor" "go-admin/app/admin/apis/public" "go-admin/app/admin/apis/system" @@ -112,8 +111,6 @@ func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle registerUserCenterRouter(v1, authMiddleware) registerPostRouter(v1, authMiddleware) registerMenuRouter(v1, authMiddleware) - registerLoginLogRouter(v1, authMiddleware) - registerOperLogRouter(v1, authMiddleware) } func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { @@ -127,8 +124,6 @@ func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar v1auth.POST("/logout", handler.LogOut) v1auth.GET("/menuids", system.GetMenuIDS) - - v1auth.GET("/operloglist", log2.GetOperLogList) } } @@ -142,7 +137,6 @@ func registerPageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar //v1auth.GET("/configList", system.GetConfigList) v1auth.GET("/postlist", system.GetPostList) v1auth.GET("/menulist", system.GetMenuList) - v1auth.GET("/loginloglist", log2.GetLoginLogList) } } @@ -155,24 +149,6 @@ func registerUserCenterRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMid } } -func registerOperLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - operlog := v1.Group("/operlog").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - operlog.GET("/:operId", log2.GetOperLog) - operlog.DELETE("/:operId", log2.DeleteOperLog) - } -} - -func registerLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - loginlog := v1.Group("/loginlog").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - loginlog.GET("/:infoId", log2.GetLoginLog) - loginlog.POST("", log2.InsertLoginLog) - loginlog.PUT("", log2.UpdateLoginLog) - loginlog.DELETE("/:infoId", log2.DeleteLoginLog) - } -} - func registerPostRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { post := v1.Group("/post").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { diff --git a/app/admin/service/dto/sys_login_log.go b/app/admin/service/dto/sys_login_log.go new file mode 100644 index 00000000..0c382a61 --- /dev/null +++ b/app/admin/service/dto/sys_login_log.go @@ -0,0 +1,110 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "gorm.io/gorm" + + "go-admin/app/admin/models/system" + "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" + + "time" +) + +type SysLoginLogSearch struct { + dto.Pagination `search:"-"` + Username string `form:"username" search:"type:exact;column:username;table:sys_loginlog" comment:"用户名"` + + Status string `form:"status" search:"type:exact;column:status;table:sys_loginlog" comment:"状态"` + + Ipaddr string `form:"ipaddr" search:"type:exact;column:ipaddr;table:sys_loginlog" comment:"ip地址"` + + LoginLocation string `form:"loginLocation" search:"type:exact;column:login_location;table:sys_loginlog" comment:"归属地"` +} + +func (m *SysLoginLogSearch) GetNeedSearch() interface{} { + return *m +} + +func (m *SysLoginLogSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +func (m *SysLoginLogSearch) Generate() dto.Index { + o := *m + return &o +} + +type SysLoginLogControl struct { + ID uint `uri:"ID" comment:"主键"` // 主键 + Username string `json:"username" comment:"用户名"` + Status string `json:"status" comment:"状态"` + Ipaddr string `json:"ipaddr" comment:"ip地址"` + LoginLocation string `json:"loginLocation" comment:"归属地"` + Browser string `json:"browser" comment:"浏览器"` + Os string `json:"os" comment:"系统"` + Platform string `json:"platform" comment:"固件"` + LoginTime time.Time `json:"loginTime" comment:"登录时间"` + Remark string `json:"remark" comment:"备注"` + Msg string `json:"msg" comment:"信息"` +} + +func (s *SysLoginLogControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysLoginLogControl) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysLoginLogControl) GenerateM() (common.ActiveRecord, error) { + return &system.SysLoginLog{ + + Model: gorm.Model{ID: s.ID}, + Username: s.Username, + Status: s.Status, + Ipaddr: s.Ipaddr, + LoginLocation: s.LoginLocation, + Browser: s.Browser, + Os: s.Os, + Platform: s.Platform, + LoginTime: s.LoginTime, + Remark: s.Remark, + Msg: s.Msg, + }, nil +} + +func (s *SysLoginLogControl) GetId() interface{} { + return s.ID +} + +type SysLoginLogById struct { + dto.ObjectById +} + +func (s *SysLoginLogById) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysLoginLogById) GenerateM() (common.ActiveRecord, error) { + return &system.SysLoginLog{}, nil +} diff --git a/app/admin/service/dto/sys_opera_log.go b/app/admin/service/dto/sys_opera_log.go new file mode 100644 index 00000000..a9371721 --- /dev/null +++ b/app/admin/service/dto/sys_opera_log.go @@ -0,0 +1,124 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "gorm.io/gorm" + + "go-admin/app/admin/models/system" + "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" + + "time" +) + +type SysOperaLogSearch struct { + dto.Pagination `search:"-"` + + Title string `form:"title" search:"type:contains;column:title;table:sys_operlog" comment:"操作模块"` + Method string `form:"method" search:"type:contains;column:method;table:sys_operlog" comment:"函数"` + RequestMethod string `form:"requestMethod" search:"type:contains;column:request_method;table:sys_operlog" comment:"请求方式"` + OperUrl string `form:"operUrl" search:"type:contains;column:oper_url;table:sys_operlog" comment:"访问地址"` + OperIp string `form:"operIp" search:"type:exact;column:oper_ip;table:sys_operlog" comment:"客户端ip"` +} + +func (m *SysOperaLogSearch) GetNeedSearch() interface{} { + return *m +} + +func (m *SysOperaLogSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +func (m *SysOperaLogSearch) Generate() dto.Index { + o := *m + return &o +} + +type SysOperaLogControl struct { + ID uint `uri:"ID" comment:"编码"` // 编码 + Title string `json:"title" comment:"操作模块"` + BusinessType string `json:"businessType" comment:"操作类型"` + BusinessTypes string `json:"businessTypes" comment:""` + Method string `json:"method" comment:"函数"` + RequestMethod string `json:"requestMethod" comment:"请求方式"` + OperatorType string `json:"operatorType" comment:"操作类型"` + OperName string `json:"operName" comment:"操作者"` + DeptName string `json:"deptName" comment:"部门名称"` + OperUrl string `json:"operUrl" comment:"访问地址"` + OperIp string `json:"operIp" comment:"客户端ip"` + OperLocation string `json:"operLocation" comment:"访问位置"` + OperParam string `json:"operParam" comment:"请求参数"` + Status string `json:"status" comment:"操作状态"` + OperTime time.Time `json:"operTime" comment:"操作时间"` + JsonResult string `json:"jsonResult" comment:"返回数据"` + Remark string `json:"remark" comment:"备注"` + LatencyTime string `json:"latencyTime" comment:"耗时"` + UserAgent string `json:"userAgent" comment:"ua"` +} + +func (s *SysOperaLogControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysOperaLogControl) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysOperaLogControl) GenerateM() (common.ActiveRecord, error) { + return &system.SysOperaLog{ + Model: gorm.Model{ID: s.ID}, + Title: s.Title, + BusinessType: s.BusinessType, + BusinessTypes: s.BusinessTypes, + Method: s.Method, + RequestMethod: s.RequestMethod, + OperatorType: s.OperatorType, + OperName: s.OperName, + DeptName: s.DeptName, + OperUrl: s.OperUrl, + OperIp: s.OperIp, + OperLocation: s.OperLocation, + OperParam: s.OperParam, + Status: s.Status, + OperTime: s.OperTime, + JsonResult: s.JsonResult, + Remark: s.Remark, + LatencyTime: s.LatencyTime, + UserAgent: s.UserAgent, + }, nil +} + +func (s *SysOperaLogControl) GetId() interface{} { + return s.ID +} + +type SysOperaLogById struct { + dto.ObjectById +} + +func (s *SysOperaLogById) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysOperaLogById) GenerateM() (common.ActiveRecord, error) { + return &system.SysOperaLog{}, nil +} diff --git a/app/admin/service/sys_login_log.go b/app/admin/service/sys_login_log.go new file mode 100644 index 00000000..310d2b63 --- /dev/null +++ b/app/admin/service/sys_login_log.go @@ -0,0 +1,110 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models/system" + cDto "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/common/service" + "gorm.io/gorm" +) + +type SysLoginlog struct { + service.Service +} + +// GetSysLoginlogPage 获取SysLoginlog列表 +func (e *SysLoginlog) GetSysLoginlogPage(c cDto.Index, list *[]system.SysLoginLog, count *int64) error { + var err error + var data system.SysLoginLog + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysLoginlog 获取SysLoginlog对象 +func (e *SysLoginlog) GetSysLoginlog(d cDto.Control, model *system.SysLoginLog) error { + var err error + var data system.SysLoginLog + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysLoginlog 创建SysLoginlog对象 +func (e *SysLoginlog) InsertSysLoginlog(model common.ActiveRecord) error { + var err error + var data system.SysLoginLog + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// UpdateSysLoginlog 修改SysLoginlog对象 +func (e *SysLoginlog) UpdateSysLoginlog(c common.ActiveRecord) error { + var err error + var data system.SysLoginLog + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysLoginlog 删除SysLoginlog +func (e *SysLoginlog) RemoveSysLoginlog(d cDto.Control, c common.ActiveRecord) error { + var err error + var data system.SysLoginLog + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(d.GetId()).Delete(c) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} \ No newline at end of file diff --git a/app/admin/service/sys_opera_log.go b/app/admin/service/sys_opera_log.go new file mode 100644 index 00000000..ca617c50 --- /dev/null +++ b/app/admin/service/sys_opera_log.go @@ -0,0 +1,110 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models/system" + cDto "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/common/service" + "gorm.io/gorm" +) + +type SysOperaLog struct { + service.Service +} + +// GetSysOperaLogPage 获取SysOperaLog列表 +func (e *SysOperaLog) GetSysOperaLogPage(c cDto.Index, list *[]system.SysOperaLog, count *int64) error { + var err error + var data system.SysOperaLog + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysOperaLog 获取SysOperaLog对象 +func (e *SysOperaLog) GetSysOperaLog(d cDto.Control, model *system.SysOperaLog) error { + var err error + var data system.SysOperaLog + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysOperaLog 创建SysOperaLog对象 +func (e *SysOperaLog) InsertSysOperaLog(model common.ActiveRecord) error { + var err error + var data system.SysOperaLog + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// UpdateSysOperaLog 修改SysOperaLog对象 +func (e *SysOperaLog) UpdateSysOperaLog(c common.ActiveRecord) error { + var err error + var data system.SysOperaLog + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysOperaLog 删除SysOperaLog +func (e *SysOperaLog) RemoveSysOperaLog(d cDto.Control, c common.ActiveRecord) error { + var err error + var data system.SysOperaLog + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(d.GetId()).Delete(c) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} \ No newline at end of file diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 42eeda3b..e759747a 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -25,8 +25,8 @@ func _1599190683659Tables(db *gorm.DB, version string) error { new(tools.SysTables), new(tools.SysColumns), new(models.Menu), - new(models.LoginLog), - new(models.SysOperLog), + new(system.SysLoginLog), + new(system.SysOperaLog), new(models.RoleMenu), new(models.SysRoleDept), new(models.SysUser), diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index a1756592..88354204 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -20,11 +20,6 @@ func init() { func _1599190683670Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - list1 := []models.RoleMenu{ - } - list2 := []models.CasbinRule{ - } - list3 := []models.SysDept{ {DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, {DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, @@ -109,16 +104,7 @@ func _1599190683670Test(db *gorm.DB, version string) error { {2, "函数测试", "DEFAULT", 2, "0/5 * * * * ", "ExamplesOne", "参数", 1, 1, 1, 0, "", "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ""}, } - err := tx.Create(list1).Error - if err != nil { - return err - } - err = tx.Create(list2).Error - if err != nil { - return err - } - - err = tx.Create(list3).Error + err := tx.Create(list3).Error if err != nil { return err } diff --git a/cmd/migrate/migration/version/1603465014697_migrate.go b/cmd/migrate/migration/version/1603465014697_migrate.go new file mode 100644 index 00000000..63aed144 --- /dev/null +++ b/cmd/migrate/migration/version/1603465014697_migrate.go @@ -0,0 +1,28 @@ +package version + +import ( + "go-admin/app/admin/models" + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1603465014697Test) +} + +func _1603465014697Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + err := tx.Debug().Model(&models.Menu{}).Where("path = ?", "/api/v1/syscategoryList").Update("path", "/api/v1/syscategory").Error + if err != nil { + return err + } + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/cmd/migrate/migration/version/1603516925109_migrate.go b/cmd/migrate/migration/version/1603516925109_migrate.go new file mode 100644 index 00000000..f2539cfb --- /dev/null +++ b/cmd/migrate/migration/version/1603516925109_migrate.go @@ -0,0 +1,41 @@ +package version + +import ( + "gorm.io/gorm" + + "go-admin/app/admin/models/system" + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" + + "runtime" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1603516925109Test) +} + +func _1603516925109Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + _ = tx.Migrator().RenameTable("sys_operlog", "sys_opera_log") + _ = tx.Migrator().RenameTable("sys_loginlog", "sys_login_log") + + if tx.Migrator().HasColumn(&system.SysLoginLog{}, "info_id") { + err := tx.Migrator().RenameColumn(&system.SysLoginLog{}, "info_id", "id") + if err != nil { + return err + } + } + + if tx.Migrator().HasColumn(&system.SysOperaLog{}, "oper_id") { + err := tx.Migrator().RenameColumn(&system.SysOperaLog{}, "oper_id", "id") + if err != nil { + return err + } + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/go-admin-ui/src/api/syscategory.js b/go-admin-ui/src/api/syscategory.js deleted file mode 100644 index cde5aead..00000000 --- a/go-admin-ui/src/api/syscategory.js +++ /dev/null @@ -1,47 +0,0 @@ -import request from '@/utils/request' - -// 查询SysCategory列表 -export function listSysCategory(query) { - return request({ - url: '/api/v1/cms', - method: 'get', - params: query - }) -} - -// 查询SysCategory详细 -export function getSysCategory (ID) { - return request({ - url: '/api/v1/cms/' + ID, - method: 'get' - }) -} - - -// 新增SysCategory -export function addSysCategory(data) { - return request({ - url: '/api/v1/cms', - method: 'post', - data: data - }) -} - -// 修改SysCategory -export function updateSysCategory(data) { - return request({ - url: '/api/v1/cms/'+data.ID, - method: 'put', - data: data - }) -} - -// 删除SysCategory -export function delSysCategory(data) { - return request({ - url: '/api/v1/cms', - method: 'delete', - data: data - }) -} - diff --git a/go-admin-ui/src/views/syscategory/index.vue b/go-admin-ui/src/views/syscategory/index.vue deleted file mode 100644 index 6860b271..00000000 --- a/go-admin-ui/src/views/syscategory/index.vue +++ /dev/null @@ -1,329 +0,0 @@ - - - - From 16775cee456afa4b433e825c9c4de3c77ea87892 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 27 Oct 2020 13:13:44 +0800 Subject: [PATCH 025/201] =?UTF-8?q?refactor=F0=9F=8E=A8=20:=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=A5=E5=BF=97=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E9=92=88=E5=AF=B9=E4=BB=A3=E7=A0=81=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/sys_login_log/sys_login_log.go | 20 ++++++++--------- app/admin/middleware/handler/auth.go | 8 +++---- app/admin/service/dto/sys_login_log.go | 10 ++++----- app/admin/service/dto/sys_opera_log.go | 10 ++++----- app/admin/service/sys_login_log.go | 22 +++++++++---------- 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/app/admin/apis/system/sys_login_log/sys_login_log.go b/app/admin/apis/system/sys_login_log/sys_login_log.go index bdd30bfe..253dbc16 100644 --- a/app/admin/apis/system/sys_login_log/sys_login_log.go +++ b/app/admin/apis/system/sys_login_log/sys_login_log.go @@ -38,10 +38,10 @@ func (e *SysLoginLog) GetSysLoginLogList(c *gin.Context) { list := make([]system.SysLoginLog, 0) var count int64 - serviceStudent := service.SysLoginlog{} + serviceStudent := service.SysLoginLog{} serviceStudent.MsgID = msgID serviceStudent.Orm = db - err = serviceStudent.GetSysLoginlogPage(req, &list, &count) + err = serviceStudent.GetSysLoginLogPage(req, &list, &count) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return @@ -68,10 +68,10 @@ func (e *SysLoginLog) GetSysLoginLog(c *gin.Context) { } var object system.SysLoginLog - serviceSysLoginLog := service.SysLoginlog{} + serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.MsgID = msgID serviceSysLoginLog.Orm = db - err = serviceSysLoginLog.GetSysLoginlog(req, &object) + err = serviceSysLoginLog.GetSysLoginLog(req, &object) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return @@ -105,10 +105,10 @@ func (e *SysLoginLog) InsertSysLoginLog(c *gin.Context) { // 设置创建人 object.SetCreateBy(tools.GetUserIdUint(c)) - serviceSysLoginLog := service.SysLoginlog{} + serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.Orm = db serviceSysLoginLog.MsgID = msgID - err = serviceSysLoginLog.InsertSysLoginlog(object) + err = serviceSysLoginLog.InsertSysLoginLog(object) if err != nil { log.Error(err) e.Error(c, http.StatusInternalServerError, err, "创建失败") @@ -142,10 +142,10 @@ func (e *SysLoginLog) UpdateSysLoginLog(c *gin.Context) { } object.SetUpdateBy(tools.GetUserIdUint(c)) - serviceSysLoginLog := service.SysLoginlog{} + serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.Orm = db serviceSysLoginLog.MsgID = msgID - err = serviceSysLoginLog.UpdateSysLoginlog(object) + err = serviceSysLoginLog.UpdateSysLoginLog(object) if err != nil { log.Error(err) return @@ -180,10 +180,10 @@ func (e *SysLoginLog) DeleteSysLoginLog(c *gin.Context) { // 设置编辑人 object.SetUpdateBy(tools.GetUserIdUint(c)) - serviceSysLoginLog := service.SysLoginlog{} + serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.Orm = db serviceSysLoginLog.MsgID = msgID - err = serviceSysLoginLog.RemoveSysLoginlog(req, object) + err = serviceSysLoginLog.RemoveSysLoginLog(req, object) if err != nil { log.Error(err) return diff --git a/app/admin/middleware/handler/auth.go b/app/admin/middleware/handler/auth.go index d0b5e272..f32908d4 100644 --- a/app/admin/middleware/handler/auth.go +++ b/app/admin/middleware/handler/auth.go @@ -101,7 +101,7 @@ func Authenticator(c *gin.Context) (interface{}, error) { func LoginLogToDB(c *gin.Context, status string, msg string, username string) { if config.LoggerConfig.EnabledDB { var loginlog system.SysLoginLog - serviceLoginLog :=service.SysLoginlog{} + serviceLoginLog :=service.SysLoginLog{} ua := user_agent.New(c.Request.UserAgent()) loginlog.Ipaddr = c.ClientIP() loginlog.Username = username @@ -115,7 +115,7 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) { loginlog.Os = ua.OS() loginlog.Msg = msg loginlog.Platform = ua.Platform() - _ = serviceLoginLog.InsertSysLoginlog(loginlog.Generate()) + _ = serviceLoginLog.InsertSysLoginLog(loginlog.Generate()) } } @@ -143,8 +143,8 @@ func LogOut(c *gin.Context) { loginlog.Platform = ua.Platform() loginlog.Username = tools.GetUserName(c) loginlog.Msg = "退出成功" - serviceLoginLog:=service.SysLoginlog{} - _ = serviceLoginLog.InsertSysLoginlog(loginlog.Generate()) + serviceLoginLog:=service.SysLoginLog{} + _ = serviceLoginLog.InsertSysLoginLog(loginlog.Generate()) c.JSON(http.StatusOK, gin.H{ "code": 200, diff --git a/app/admin/service/dto/sys_login_log.go b/app/admin/service/dto/sys_login_log.go index 0c382a61..ae65f75d 100644 --- a/app/admin/service/dto/sys_login_log.go +++ b/app/admin/service/dto/sys_login_log.go @@ -15,13 +15,11 @@ import ( type SysLoginLogSearch struct { dto.Pagination `search:"-"` - Username string `form:"username" search:"type:exact;column:username;table:sys_loginlog" comment:"用户名"` - Status string `form:"status" search:"type:exact;column:status;table:sys_loginlog" comment:"状态"` - - Ipaddr string `form:"ipaddr" search:"type:exact;column:ipaddr;table:sys_loginlog" comment:"ip地址"` - - LoginLocation string `form:"loginLocation" search:"type:exact;column:login_location;table:sys_loginlog" comment:"归属地"` + Username string `form:"username" search:"type:exact;column:username;table:sys_login_log" comment:"用户名"` + Status string `form:"status" search:"type:exact;column:status;table:sys_login_log" comment:"状态"` + Ipaddr string `form:"ipaddr" search:"type:exact;column:ipaddr;table:sys_login_log" comment:"ip地址"` + LoginLocation string `form:"loginLocation" search:"type:exact;column:login_location;table:sys_login_log" comment:"归属地"` } func (m *SysLoginLogSearch) GetNeedSearch() interface{} { diff --git a/app/admin/service/dto/sys_opera_log.go b/app/admin/service/dto/sys_opera_log.go index a9371721..f457522a 100644 --- a/app/admin/service/dto/sys_opera_log.go +++ b/app/admin/service/dto/sys_opera_log.go @@ -16,11 +16,11 @@ import ( type SysOperaLogSearch struct { dto.Pagination `search:"-"` - Title string `form:"title" search:"type:contains;column:title;table:sys_operlog" comment:"操作模块"` - Method string `form:"method" search:"type:contains;column:method;table:sys_operlog" comment:"函数"` - RequestMethod string `form:"requestMethod" search:"type:contains;column:request_method;table:sys_operlog" comment:"请求方式"` - OperUrl string `form:"operUrl" search:"type:contains;column:oper_url;table:sys_operlog" comment:"访问地址"` - OperIp string `form:"operIp" search:"type:exact;column:oper_ip;table:sys_operlog" comment:"客户端ip"` + Title string `form:"title" search:"type:contains;column:title;table:sys_opera_log" comment:"操作模块"` + Method string `form:"method" search:"type:contains;column:method;table:sys_opera_log" comment:"函数"` + RequestMethod string `form:"requestMethod" search:"type:contains;column:request_method;table:sys_opera_log" comment:"请求方式"` + OperUrl string `form:"operUrl" search:"type:contains;column:oper_url;table:sys_opera_log" comment:"访问地址"` + OperIp string `form:"operIp" search:"type:exact;column:oper_ip;table:sys_opera_log" comment:"客户端ip"` } func (m *SysOperaLogSearch) GetNeedSearch() interface{} { diff --git a/app/admin/service/sys_login_log.go b/app/admin/service/sys_login_log.go index 310d2b63..c3ba5fe7 100644 --- a/app/admin/service/sys_login_log.go +++ b/app/admin/service/sys_login_log.go @@ -10,12 +10,12 @@ import ( "gorm.io/gorm" ) -type SysLoginlog struct { +type SysLoginLog struct { service.Service } -// GetSysLoginlogPage 获取SysLoginlog列表 -func (e *SysLoginlog) GetSysLoginlogPage(c cDto.Index, list *[]system.SysLoginLog, count *int64) error { +// GetSysLoginLogPage 获取SysLoginLog列表 +func (e *SysLoginLog) GetSysLoginLogPage(c cDto.Index, list *[]system.SysLoginLog, count *int64) error { var err error var data system.SysLoginLog msgID := e.MsgID @@ -34,8 +34,8 @@ func (e *SysLoginlog) GetSysLoginlogPage(c cDto.Index, list *[]system.SysLoginLo return nil } -// GetSysLoginlog 获取SysLoginlog对象 -func (e *SysLoginlog) GetSysLoginlog(d cDto.Control, model *system.SysLoginLog) error { +// GetSysLoginLog 获取SysLoginLog对象 +func (e *SysLoginLog) GetSysLoginLog(d cDto.Control, model *system.SysLoginLog) error { var err error var data system.SysLoginLog msgID := e.MsgID @@ -55,8 +55,8 @@ func (e *SysLoginlog) GetSysLoginlog(d cDto.Control, model *system.SysLoginLog) return nil } -// InsertSysLoginlog 创建SysLoginlog对象 -func (e *SysLoginlog) InsertSysLoginlog(model common.ActiveRecord) error { +// InsertSysLoginLog 创建SysLoginLog对象 +func (e *SysLoginLog) InsertSysLoginLog(model common.ActiveRecord) error { var err error var data system.SysLoginLog msgID := e.MsgID @@ -70,8 +70,8 @@ func (e *SysLoginlog) InsertSysLoginlog(model common.ActiveRecord) error { return nil } -// UpdateSysLoginlog 修改SysLoginlog对象 -func (e *SysLoginlog) UpdateSysLoginlog(c common.ActiveRecord) error { +// UpdateSysLoginLog 修改SysLoginLog对象 +func (e *SysLoginLog) UpdateSysLoginLog(c common.ActiveRecord) error { var err error var data system.SysLoginLog msgID := e.MsgID @@ -89,8 +89,8 @@ func (e *SysLoginlog) UpdateSysLoginlog(c common.ActiveRecord) error { return nil } -// RemoveSysLoginlog 删除SysLoginlog -func (e *SysLoginlog) RemoveSysLoginlog(d cDto.Control, c common.ActiveRecord) error { +// RemoveSysLoginLog 删除SysLoginLog +func (e *SysLoginLog) RemoveSysLoginLog(d cDto.Control, c common.ActiveRecord) error { var err error var data system.SysLoginLog msgID := e.MsgID From 22fb2b5d0beb3e4bb5d2364b656c01d0de6834ae Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 28 Oct 2020 17:13:16 +0800 Subject: [PATCH 026/201] =?UTF-8?q?fix=F0=9F=90=9B=20:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dlog=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/handler/auth.go | 65 +++++++++++++++++----------- app/admin/middleware/logger.go | 7 +++ 2 files changed, 46 insertions(+), 26 deletions(-) diff --git a/app/admin/middleware/handler/auth.go b/app/admin/middleware/handler/auth.go index f32908d4..038109d0 100644 --- a/app/admin/middleware/handler/auth.go +++ b/app/admin/middleware/handler/auth.go @@ -3,6 +3,7 @@ package handler import ( "go-admin/app/admin/models/system" "go-admin/app/admin/service" + "go-admin/common/log" "net/http" "github.com/gin-gonic/gin" @@ -100,22 +101,28 @@ func Authenticator(c *gin.Context) (interface{}, error) { // Write log to database func LoginLogToDB(c *gin.Context, status string, msg string, username string) { if config.LoggerConfig.EnabledDB { - var loginlog system.SysLoginLog - serviceLoginLog :=service.SysLoginLog{} + var loginLog system.SysLoginLog + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Errorf("msgID[%s] 获取Orm失败, error:%s", msgID, err) + } ua := user_agent.New(c.Request.UserAgent()) - loginlog.Ipaddr = c.ClientIP() - loginlog.Username = username + loginLog.Ipaddr = c.ClientIP() + loginLog.Username = username location := tools.GetLocation(c.ClientIP()) - loginlog.LoginLocation = location - loginlog.LoginTime = tools.GetCurrentTime() - loginlog.Status = status - loginlog.Remark = c.Request.UserAgent() + loginLog.LoginLocation = location + loginLog.LoginTime = tools.GetCurrentTime() + loginLog.Status = status + loginLog.Remark = c.Request.UserAgent() browserName, browserVersion := ua.Browser() - loginlog.Browser = browserName + " " + browserVersion - loginlog.Os = ua.OS() - loginlog.Msg = msg - loginlog.Platform = ua.Platform() - _ = serviceLoginLog.InsertSysLoginLog(loginlog.Generate()) + loginLog.Browser = browserName + " " + browserVersion + loginLog.Os = ua.OS() + loginLog.Msg = msg + loginLog.Platform = ua.Platform() + serviceLoginLog := service.SysLoginLog{} + serviceLoginLog.Orm = db + _ = serviceLoginLog.InsertSysLoginLog(loginLog.Generate()) } } @@ -129,22 +136,28 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) { // @Router /logout [post] // @Security Bearer func LogOut(c *gin.Context) { - var loginlog system.SysLoginLog + var loginLog system.SysLoginLog ua := user_agent.New(c.Request.UserAgent()) - loginlog.Ipaddr = c.ClientIP() + loginLog.Ipaddr = c.ClientIP() location := tools.GetLocation(c.ClientIP()) - loginlog.LoginLocation = location - loginlog.LoginTime = tools.GetCurrentTime() - loginlog.Status = "0" - loginlog.Remark = c.Request.UserAgent() + loginLog.LoginLocation = location + loginLog.LoginTime = tools.GetCurrentTime() + loginLog.Status = "0" + loginLog.Remark = c.Request.UserAgent() browserName, browserVersion := ua.Browser() - loginlog.Browser = browserName + " " + browserVersion - loginlog.Os = ua.OS() - loginlog.Platform = ua.Platform() - loginlog.Username = tools.GetUserName(c) - loginlog.Msg = "退出成功" - serviceLoginLog:=service.SysLoginLog{} - _ = serviceLoginLog.InsertSysLoginLog(loginlog.Generate()) + loginLog.Browser = browserName + " " + browserVersion + loginLog.Os = ua.OS() + loginLog.Platform = ua.Platform() + loginLog.Username = tools.GetUserName(c) + loginLog.Msg = "退出成功" + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Errorf("msgID[%s] 获取Orm失败, error:%s", msgID, err) + } + serviceLoginLog := service.SysLoginLog{} + serviceLoginLog.Orm = db + _ = serviceLoginLog.InsertSysLoginLog(loginLog.Generate()) c.JSON(http.StatusOK, gin.H{ "code": 200, diff --git a/app/admin/middleware/logger.go b/app/admin/middleware/logger.go index 98aa1d04..7974c010 100644 --- a/app/admin/middleware/logger.go +++ b/app/admin/middleware/logger.go @@ -4,6 +4,7 @@ import ( "fmt" "go-admin/app/admin/models/system" "go-admin/app/admin/service" + "go-admin/common/log" "strings" "time" @@ -108,6 +109,12 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string } else { sysOperaLog.Status = "1" } + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err !=nil{ + log.Errorf("msgID[%s] 获取Orm失败, error:%s", msgID, err) + } serviceOperaLog:=service.SysOperaLog{} + serviceOperaLog.Orm = db _ = serviceOperaLog.InsertSysOperaLog(sysOperaLog.Generate()) } From 706c72b973b49e69d6b6eb0730f119ae854f0b34 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 29 Oct 2020 14:48:25 +0800 Subject: [PATCH 027/201] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/database/initialize.go | 1 + common/database/interface.go | 1 + common/database/mysql_drive.go | 9 ++++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/database/initialize.go b/common/database/initialize.go index f78fc0ca..f59ac3bb 100644 --- a/common/database/initialize.go +++ b/common/database/initialize.go @@ -2,6 +2,7 @@ package database +// Setup 配置数据库 func Setup(driver string) { dbType := driver if dbType == "mysql" { diff --git a/common/database/interface.go b/common/database/interface.go index 0fc32337..59c5e1ce 100644 --- a/common/database/interface.go +++ b/common/database/interface.go @@ -2,6 +2,7 @@ package database import "gorm.io/gorm" +// Database 数据库配置 type Database interface { Setup() Open(conn string, cfg *gorm.Config) (db *gorm.DB, err error) diff --git a/common/database/mysql_drive.go b/common/database/mysql_drive.go index c30d7a2b..faa4d977 100644 --- a/common/database/mysql_drive.go +++ b/common/database/mysql_drive.go @@ -5,12 +5,12 @@ import ( . "log" "time" + goAdminLogger "github.com/go-admin-team/go-admin-core/logger" "gorm.io/driver/mysql" "gorm.io/gorm" "gorm.io/gorm/logger" "gorm.io/gorm/schema" - goAdminLogger "github.com/go-admin-team/go-admin-core/logger" "go-admin/common/config" "go-admin/common/global" "go-admin/common/log" @@ -18,9 +18,11 @@ import ( toolsConfig "go-admin/tools/config" ) +// Mysql mysql配置结构体 type Mysql struct { } +// Setup 配置步骤 func (e *Mysql) Setup() { global.Source = e.GetConnect() log.Info(tools.Green(global.Source)) @@ -59,16 +61,17 @@ func (e *Mysql) Setup() { } } -// 打开数据库连接 +// Open 打开数据库连接 func (e *Mysql) Open(db *sql.DB, cfg *gorm.Config) (*gorm.DB, error) { return gorm.Open(mysql.New(mysql.Config{Conn: db}), cfg) } -// 获取数据库连接 +// GetConnect 获取数据库连接 func (e *Mysql) GetConnect() string { return toolsConfig.DatabaseConfig.Source } +// GetDriver 获取连接 func (e *Mysql) GetDriver() string { return toolsConfig.DatabaseConfig.Driver } From ccd76445f2b07213205cc47a798c40f3166a18f0 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 29 Oct 2020 19:22:23 +0800 Subject: [PATCH 028/201] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E6=94=B9=E4=B8=BAgo-admin-core=E5=BA=93=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E9=99=A4=E5=AF=B9=E5=85=B6=E4=BB=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=9A=84=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/handler/auth.go | 10 +-- app/admin/middleware/logger.go | 39 ++++++----- app/admin/models/role.go | 3 +- app/jobs/jobbase.go | 2 +- cmd/api/server.go | 4 +- cmd/migrate/server.go | 4 +- common/global/adm.go | 8 +-- common/log/log.go | 2 +- examples/run.go | 5 +- go.mod | 5 +- go.sum | 85 ++---------------------- pkg/logger/logger.go | 96 +++++++++++++++++++--------- pkg/logger/setup.go | 48 ++++++++++++++ 13 files changed, 161 insertions(+), 150 deletions(-) create mode 100644 pkg/logger/setup.go diff --git a/app/admin/middleware/handler/auth.go b/app/admin/middleware/handler/auth.go index 038109d0..3da45c81 100644 --- a/app/admin/middleware/handler/auth.go +++ b/app/admin/middleware/handler/auth.go @@ -1,9 +1,6 @@ package handler import ( - "go-admin/app/admin/models/system" - "go-admin/app/admin/service" - "go-admin/common/log" "net/http" "github.com/gin-gonic/gin" @@ -11,7 +8,10 @@ import ( "github.com/mssola/user_agent" "go-admin/app/admin/models" + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" "go-admin/common/global" + "go-admin/common/log" jwt "go-admin/pkg/jwtauth" "go-admin/tools" "go-admin/tools/config" @@ -93,12 +93,12 @@ func Authenticator(c *gin.Context) (interface{}, error) { msg = "登录失败" status = "1" LoginLogToDB(c, status, msg, username) - global.RequestLogger.Println(e.Error()) + global.RequestLogger.Error(e) } return nil, jwt.ErrFailedAuthentication } -// Write log to database +// LoginLogToDB Write log to database func LoginLogToDB(c *gin.Context, status string, msg string, username string) { if config.LoggerConfig.EnabledDB { var loginLog system.SysLoginLog diff --git a/app/admin/middleware/logger.go b/app/admin/middleware/logger.go index 7974c010..e2054f2d 100644 --- a/app/admin/middleware/logger.go +++ b/app/admin/middleware/logger.go @@ -1,22 +1,21 @@ package middleware import ( - "fmt" - "go-admin/app/admin/models/system" - "go-admin/app/admin/service" - "go-admin/common/log" "strings" "time" "github.com/gin-gonic/gin" "go-admin/app/admin/models" + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" "go-admin/common/global" + "go-admin/common/log" "go-admin/tools" - config2 "go-admin/tools/config" + "go-admin/tools/config" ) -// 日志记录到文件 +// LoggerToFile 日志记录到文件 func LoggerToFile() gin.HandlerFunc { return func(c *gin.Context) { @@ -45,25 +44,23 @@ func LoggerToFile() gin.HandlerFunc { clientIP := c.ClientIP() // 日志格式 - fmt.Printf("%s [INFO] %s %s %3d %13v %15s \r\n", - startTime.Format("2006-01-02 15:04:05"), - reqMethod, - reqUri, - statusCode, - latencyTime, - clientIP, - ) + logData := map[string]interface{}{ + "statusCode": statusCode, + "latencyTime": latencyTime, + "clientIP": clientIP, + "method": reqMethod, + "uri": reqUri, + } + log.Info(logData) + global.RequestLogger.Info(logData) - global.RequestLogger.Info(statusCode, latencyTime, clientIP, reqMethod, reqUri) - - if c.Request.Method != "GET" && c.Request.Method != "OPTIONS" && config2.LoggerConfig.EnabledDB { + if c.Request.Method != "GET" && c.Request.Method != "OPTIONS" && config.LoggerConfig.EnabledDB { SetDBOperLog(c, clientIP, statusCode, reqUri, reqMethod, latencyTime) } } } -// 写入操作日志表 -// 该方法后续即将弃用 +// SetDBOperLog 写入操作日志表 fixme 该方法后续即将弃用 func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string, reqMethod string, latencyTime time.Duration) { menu := models.Menu{} menu.Path = reqUri @@ -111,10 +108,10 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string } msgID := tools.GenerateMsgIDFromContext(c) db, err := tools.GetOrm(c) - if err !=nil{ + if err != nil { log.Errorf("msgID[%s] 获取Orm失败, error:%s", msgID, err) } - serviceOperaLog:=service.SysOperaLog{} + serviceOperaLog := service.SysOperaLog{} serviceOperaLog.Orm = db _ = serviceOperaLog.InsertSysOperaLog(sysOperaLog.Generate()) } diff --git a/app/admin/models/role.go b/app/admin/models/role.go index 74c649b4..1a0bf2db 100644 --- a/app/admin/models/role.go +++ b/app/admin/models/role.go @@ -1,7 +1,8 @@ package models import ( - "github.com/pkg/errors" + "errors" + "gorm.io/gorm" orm "go-admin/common/global" diff --git a/app/jobs/jobbase.go b/app/jobs/jobbase.go index d2e20475..56b6c5a3 100644 --- a/app/jobs/jobbase.go +++ b/app/jobs/jobbase.go @@ -41,7 +41,7 @@ func (e *ExecJob) Run() { startTime := time.Now() var obj = jobList[e.InvokeTarget] if obj == nil { - global.JobLogger.Warning(" ExecJob Run job nil", e) + global.JobLogger.Warn(" ExecJob Run job nil") return } err := CallExec(obj.(JobsExec), e.Args) diff --git a/cmd/api/server.go b/cmd/api/server.go index 3d2a023e..d26baf87 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -58,7 +58,9 @@ func setup() { //1. 读取配置 config.Setup(configYml) //2. 设置日志 - global.Logger, global.JobLogger, global.RequestLogger = logger.Setup() + global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus") + global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job") + global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request") //3. 初始化数据库链接 database.Setup(config.DatabaseConfig.Driver) //4. 接口访问控制加载 diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index a5b05435..e540bbcc 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -48,7 +48,9 @@ func run() { //1. 读取配置 config.Setup(configYml) //2. 设置日志 - global.Logger, global.JobLogger, global.RequestLogger = logger.Setup() + global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus") + global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job") + global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request") _ = initDB() } else { _ = genFile() diff --git a/common/global/adm.go b/common/global/adm.go index dc1a4142..fad74f48 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -3,11 +3,11 @@ package global import ( "github.com/casbin/casbin/v2" "github.com/gin-gonic/gin" - "github.com/gogf/gf/os/glog" "github.com/robfig/cron/v3" "gorm.io/gorm" "go-admin/common/config" + "go-admin/pkg/logger" ) const ( @@ -30,7 +30,7 @@ var ( ) var ( - Logger *glog.Logger - JobLogger *glog.Logger - RequestLogger *glog.Logger + Logger = &logger.Logger{} + JobLogger = &logger.Logger{} + RequestLogger = &logger.Logger{} ) diff --git a/common/log/log.go b/common/log/log.go index 83636e23..d5aad7eb 100644 --- a/common/log/log.go +++ b/common/log/log.go @@ -5,7 +5,7 @@ import "github.com/go-admin-team/go-admin-core/logger" var ( // Trace trace级日志输出 Trace = logger.Trace - // Trace trace级日志输出 + // Tracef trace级日志输出 Tracef = logger.Tracef // Debug debug级日志输出 Debug = logger.Debug diff --git a/examples/run.go b/examples/run.go index 4b062384..a6bbc3dc 100644 --- a/examples/run.go +++ b/examples/run.go @@ -12,6 +12,7 @@ import ( "go-admin/common/global" mycasbin "go-admin/pkg/casbin" "go-admin/pkg/logger" + "go-admin/tools/config" ) func main() { @@ -21,7 +22,9 @@ func main() { panic(err) } global.CasbinEnforcer = mycasbin.Setup(global.Eloquent, "sys_") - global.Logger, global.JobLogger, global.RequestLogger = logger.Setup() + global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus") + global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job") + global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request") global.GinEngine = gin.Default() //router.InitRouter() log.Fatal(global.GinEngine.Run(":8000")) diff --git a/go.mod b/go.mod index c9dfb70b..51315748 100644 --- a/go.mod +++ b/go.mod @@ -9,16 +9,13 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.2-0.20201026083717-3ca6060dfd3c + github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4 github.com/go-redis/redis/v7 v7.4.0 - github.com/go-sql-driver/mysql v1.5.0 - github.com/gogf/gf v1.13.4 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 github.com/matchstalk/redisqueue v1.0.3 github.com/mojocn/base64Captcha v1.3.1 github.com/mssola/user_agent v0.5.2 - github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.1.0 github.com/robfig/cron/v3 v3.0.1 github.com/satori/go.uuid v1.2.0 diff --git a/go.sum b/go.sum index 138ba792..bacba17e 100644 --- a/go.sum +++ b/go.sum @@ -28,7 +28,6 @@ github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocm github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= @@ -37,7 +36,6 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c/go.mod h1:7xhjOwRV2+0HXGmM0jxaEu+ZiXJFoVZOTfL/dmqbrD8= -github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks= @@ -49,7 +47,6 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.0/go.mod h1:zpDJeKyp9ScW4NNrbdr+Eyxvry3ilGPewKoXw3XGN1k= github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE= @@ -82,7 +79,6 @@ github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngE github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bsm/redislock v0.6.0 h1:eAzUAcN8EN1cbJAwSRTUvORfaEe9o8GFwNkNXMecegY= github.com/bsm/redislock v0.6.0/go.mod h1:3Kgu+cXw0JrkZ5pmY/JbcFpixGZ5M9v9G2PGWYqku+k= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= @@ -95,16 +91,11 @@ github.com/casbin/gorm-adapter/v3 v3.0.2/go.mod h1:mQI09sqvXfy5p6kZB5HBzZrgKWwxa github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= -github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28 h1:LdXxtjzvZYhhUaonAaAKArG3pyC67kGL3YY+6hGG8G4= -github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= -github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= @@ -128,19 +119,15 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= @@ -162,7 +149,6 @@ github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2Vvl github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -172,7 +158,6 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -183,12 +168,11 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0 h1:rdQovo0JtjoBTUQzzrTqnXxxFi4etuhvXrUZHwI9z7w= github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.2-0.20201026083717-3ca6060dfd3c h1:Ltad1Ux6Loha/wrv/KReJevMvPChYsqCRzkVBoW3Qkk= -github.com/go-admin-team/go-admin-core v1.2.2-0.20201026083717-3ca6060dfd3c/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk= +github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4 h1:H7SmWlvnE2HGoKmPlsJwTYVMBEvw/9acP2UBuNzbx1g= +github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -202,7 +186,6 @@ github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -220,7 +203,6 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -230,12 +212,9 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-redis/redis v6.15.7+incompatible h1:3skhDh95XQMpnqeqNftPkQD9jL9e5e36z/1SUm6dy1U= github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-redis/redis/v8 v8.1.0 h1:80B6xShb0y0Yq4UPo8RtClNnmhSP3Ahul+P5tolHoJ0= github.com/go-redis/redis/v8 v8.1.0/go.mod h1:isLoQT/NFSP7V67lyvM9GmdvLdyZ7pEhsXvvyQtnQTo= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -245,10 +224,7 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22 github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogf/gf v1.13.4 h1:+IWX/L/SNYjwp9C0tXABZ8vJfYaFKyx0cTAb2DE2a1Y= -github.com/gogf/gf v1.13.4/go.mod h1:dGX0/BElXDBYbdJGascqfrWScj8IMeOietDjVD6/5Fc= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -278,15 +254,12 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -300,7 +273,6 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -311,10 +283,6 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gqcn/structs v1.1.1 h1:cyzGRwfmn3d1d54fwW3KUNyG9QxR0ldIeqwFGeBt638= -github.com/gqcn/structs v1.1.1/go.mod h1:/aBhTBSsKQ2Ec9pbnYdGphtdWXHFn4KrCL0fXM/Adok= -github.com/grokify/html-strip-tags-go v0.0.0-20190921062105-daaa06bf1aaf h1:wIOAyJMMen0ELGiFzlmqxdcV1yGbkyHBAB6PolcNbLA= -github.com/grokify/html-strip-tags-go v0.0.0-20190921062105-daaa06bf1aaf/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -350,14 +318,11 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -375,7 +340,6 @@ github.com/jackc/pgconn v1.6.4 h1:S7T6cx5o2OqmxdHaXLH1ZeD1SbI8jBznyYE9Ec0RCQ8= github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= @@ -426,13 +390,9 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -448,10 +408,8 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= @@ -466,7 +424,6 @@ github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPp github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA= github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ= @@ -481,13 +438,11 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN github.com/marten-seemann/chacha20 v0.2.0/go.mod h1:HSdjFau7GzYRj+ahFNwsO3ouVJr1HFkWoEwNDb4TMtE= github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= github.com/marten-seemann/qtls v0.4.1/go.mod h1:pxVXcHHw1pNIt8Qo0pwSYQEoZ8yYOOPXTCZLQQunvRc= -github.com/matchstalk/redisqueue v1.0.3 h1:ZRrEhnvA6/YxLu2EbzdZYeQHQQYT8yZBAi1qv/USEQA= github.com/matchstalk/redisqueue v1.0.3/go.mod h1:5DZ3X4w9t+6Wv9vz9wmUt/i15gsOorGXRnqzGhBP6zI= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -501,16 +456,12 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= -github.com/mattn/goveralls v0.0.5 h1:spfq8AyZ0cCk57Za6/juJ5btQxeE1FaEGMdfcI+XO48= github.com/mattn/goveralls v0.0.5/go.mod h1:Xg2LHi51faXLyKXwsndxiW6uxEEQT9+3sjGzzwU4xy0= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= @@ -529,10 +480,8 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0= github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY= @@ -549,31 +498,26 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk= github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw= github.com/nrdcg/dnspod-go v0.4.0/go.mod h1:vZSoFSFeQVm2gWLMkyX61LZ8HI3BaqtHZWgPTGKr6KQ= github.com/nrdcg/goinwx v0.6.1/go.mod h1:XPiut7enlbEdntAqalBIqcYcTEVhpv/dKWgDCX2SwKQ= github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.1 h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4= github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs= github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -596,7 +540,6 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -633,7 +576,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ= @@ -649,18 +591,14 @@ github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w= github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -680,14 +618,12 @@ github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -705,7 +641,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE= github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY= -github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY= github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -721,10 +656,8 @@ github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8 github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.3 h1:FpNT6zq26xNpHZy08emi755QwzLPs6Pukqjlc7RfOMU= github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -745,7 +678,6 @@ go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opentelemetry.io/otel v0.11.0 h1:IN2tzQa9Gc4ZVKnTaMbPVcHjvzOdg5n9QfnmlqiET7E= go.opentelemetry.io/otel v0.11.0/go.mod h1:G8UCk+KooF2HLkgo8RHX9epABH/aRGYET7gQOqBVdB0= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -793,7 +725,6 @@ golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxT golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200908183739-ae8ad444f925 h1:5XVKs2rlCg8EFyRcvO8/XFwYxh1oKJO1Q3X5vttIf9c= golang.org/x/exp v0.0.0-20200908183739-ae8ad444f925/go.mod h1:1phAWC201xIgDyaFpmDeZkgf70Q4Pd/CNqfRtVPtxNw= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -813,7 +744,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449 h1:xUIPaMhvROX9dhPvRCenIJtU78+lbEenGbgqB5hfHCQ= golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -849,9 +779,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM= -golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -908,9 +837,8 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -1000,13 +928,11 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/AlecAivazis/survey.v1 v1.8.8 h1:5UtTowJZTz1j7NxVzDGKTz6Lm9IWm8DDF6b7a2wq9VY= gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -1019,14 +945,12 @@ gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/kyokomi/emoji.v1 v1.5.1 h1:beetH5mWDMzFznJ+Qzd5KVHp79YKhVUMcdO8LpRLeGw= gopkg.in/kyokomi/emoji.v1 v1.5.1/go.mod h1:N9AZ6hi1jHOPn34PsbpufQZUcKftSD7WgS2pgpmH4Lg= gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiVLxyifmMBrBIuCWFBPYKbRssXB9z67Hw= gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= @@ -1036,7 +960,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v0.3.0/go.mod h1:A7H1JD9dKdcjeUTpTuWKEC+E1a74qzW7/zaXqKaTbfM= gorm.io/driver/mysql v0.3.2 h1:Kaa0S+IHW+4qow6dRAdekNYaKeGBboIkh44pYdLWjIE= diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index b39a0126..452652b0 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -1,35 +1,73 @@ package logger import ( - "github.com/gogf/gf/os/glog" - - "go-admin/tools" - "go-admin/tools/config" + "github.com/go-admin-team/go-admin-core/logger" + "os" ) -func Setup() (*glog.Logger, *glog.Logger, *glog.Logger) { - var Logger *glog.Logger - var JobLogger *glog.Logger - var RequestLogger *glog.Logger - - Logger = glog.New() - _ = Logger.SetPath(config.LoggerConfig.Path + "/bus") - Logger.SetStdoutPrint(config.LoggerConfig.EnabledBUS && config.LoggerConfig.Stdout) - Logger.SetFile("bus-{Ymd}.log") - _ = Logger.SetLevelStr(config.LoggerConfig.Level) - - JobLogger = glog.New() - _ = JobLogger.SetPath(config.LoggerConfig.Path + "/job") - JobLogger.SetStdoutPrint(false) - JobLogger.SetFile("db-{Ymd}.log") - _ = JobLogger.SetLevelStr(config.LoggerConfig.Level) - - RequestLogger = glog.New() - _ = RequestLogger.SetPath(config.LoggerConfig.Path + "/request") - RequestLogger.SetStdoutPrint(false) - RequestLogger.SetFile("access-{Ymd}.log") - _ = RequestLogger.SetLevelStr(config.LoggerConfig.Level) - - Logger.Info(tools.Green("Logger init success!")) - return Logger, JobLogger, RequestLogger +// Logger 通用log个性化实现 +type Logger struct { + logger.Logger +} + +// Info info级日志输出 +func (l *Logger) Info(args ...interface{}) { + l.Log(logger.InfoLevel, args...) +} + +// Infof info级日志输出 +func (l *Logger) Infof(template string, args ...interface{}) { + l.Logf(logger.InfoLevel, template, args...) +} + +// Trace trace级日志输出 +func (l *Logger) Trace(args ...interface{}) { + l.Log(logger.InfoLevel, args...) +} + +// Tracef trace级日志输出 +func (l *Logger) Tracef(template string, args ...interface{}) { + l.Logf(logger.InfoLevel, template, args...) +} + +// Debug debug级日志输出 +func (l *Logger) Debug(args ...interface{}) { + l.Log(logger.InfoLevel, args...) +} + +// Debugf debug级日志输出 +func (l *Logger) Debugf(template string, args ...interface{}) { + l.Logf(logger.InfoLevel, template, args...) +} + +// Warn warn级日志输出 +func (l *Logger) Warn(args ...interface{}) { + l.Log(logger.InfoLevel, args...) +} + +// Warnf warn级日志输出 +func (l *Logger) Warnf(template string, args ...interface{}) { + l.Logf(logger.InfoLevel, template, args...) +} + +// Error error级日志输出 +func (l *Logger) Error(args ...interface{}) { + l.Log(logger.InfoLevel, args...) +} + +// Errorf error级日志输出 +func (l *Logger) Errorf(template string, args ...interface{}) { + l.Logf(logger.InfoLevel, template, args...) +} + +// Fatal fatal级日志输出 +func (l *Logger) Fatal(args ...interface{}) { + l.Log(logger.InfoLevel, args...) + os.Exit(1) +} + +// Fatalf fatal级日志输出 +func (l *Logger) Fatalf(template string, args ...interface{}) { + l.Logf(logger.InfoLevel, template, args...) + os.Exit(1) } diff --git a/pkg/logger/setup.go b/pkg/logger/setup.go new file mode 100644 index 00000000..fc82c700 --- /dev/null +++ b/pkg/logger/setup.go @@ -0,0 +1,48 @@ +package logger + +import ( + "path/filepath" + + "github.com/go-admin-team/go-admin-core/debug/writer" + "github.com/go-admin-team/go-admin-core/logger" + + "go-admin/common/log" +) + +//func Setup() (*glog.Logger, *glog.Logger) { +// var Logger *glog.Logger +// var JobLogger *glog.Logger +// var RequestLogger *glog.Logger +// +// Logger = glog.New() +// _ = Logger.SetPath(config.LoggerConfig.Path + "/bus") +// Logger.SetStdoutPrint(config.LoggerConfig.EnabledBUS && config.LoggerConfig.Stdout) +// Logger.SetFile("bus-{Ymd}.log") +// _ = Logger.SetLevelStr(config.LoggerConfig.Level) +// +// JobLogger = glog.New() +// _ = JobLogger.SetPath(config.LoggerConfig.Path + "/job") +// JobLogger.SetStdoutPrint(false) +// JobLogger.SetFile("db-{Ymd}.log") +// _ = JobLogger.SetLevelStr(config.LoggerConfig.Level) +// +// RequestLogger = glog.New() +// _ = RequestLogger.SetPath(config.LoggerConfig.Path + "/request") +// RequestLogger.SetStdoutPrint(false) +// RequestLogger.SetFile("access-{Ymd}.log") +// _ = RequestLogger.SetLevelStr(config.LoggerConfig.Level) +// +// Logger.Info(tools.Green("Logger init success!")) +// return Logger, JobLogger +//} + +// SetupLogger 日志 +func SetupLogger(path string, subPath string) logger.Logger { + var setLogger logger.Logger + output, err := writer.NewFileWriter(filepath.Join(path, subPath), "log") + if err != nil { + log.Fatal("request logger setup error: %s", err.Error) + } + setLogger = logger.NewHelper(logger.NewLogger(logger.WithOutput(output))) + return setLogger +} From 4b5b0507e9b6ebf3fc779d3dd8d0d20e6d12f733 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 30 Oct 2020 14:52:49 +0800 Subject: [PATCH 029/201] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=93=BE=E8=B7=AF?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA=EF=BC=8C=E7=86=9F=E6=82=89=E7=9A=84=E6=9C=8B?= =?UTF-8?q?=E5=8F=8B=E5=8F=AF=E4=BB=A5=E5=B0=86go-admin=E4=BD=9C=E4=B8=BA?= =?UTF-8?q?=E5=BE=AE=E6=9C=8D=E5=8A=A1=E7=9A=84=E7=BD=91=E5=85=B3=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=F0=9F=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/init.go | 3 ++ cmd/api/server.go | 26 ++++++++---- common/global/logo.go | 4 ++ common/middleware/trace.go | 26 ++++++++++++ go.mod | 6 +++ go.sum | 14 ++++++ static/go-admin.txt | 15 ------- tools/trace/trace.go | 82 ++++++++++++++++++++++++++++++++++++ 8 files changed, 152 insertions(+), 24 deletions(-) create mode 100644 common/global/logo.go create mode 100644 common/middleware/trace.go delete mode 100644 static/go-admin.txt create mode 100644 tools/trace/trace.go diff --git a/app/admin/middleware/init.go b/app/admin/middleware/init.go index f2a95755..4b8be88e 100644 --- a/app/admin/middleware/init.go +++ b/app/admin/middleware/init.go @@ -2,6 +2,7 @@ package middleware import ( "github.com/gin-gonic/gin" + "go-admin/common/middleware" ) func InitMiddleware(r *gin.Engine) { @@ -15,4 +16,6 @@ func InitMiddleware(r *gin.Engine) { r.Use(Options) // Secure is a middleware function that appends security r.Use(Secure) + // 链路追踪 + r.Use(middleware.Trace()) } diff --git a/cmd/api/server.go b/cmd/api/server.go index d26baf87..007a856d 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -3,7 +3,7 @@ package api import ( "context" "fmt" - "io/ioutil" + "go-admin/tools/trace" "net/http" "os" "os/signal" @@ -25,10 +25,11 @@ import ( ) var ( - configYml string - port string - mode string - StartCmd = &cobra.Command{ + configYml string + port string + mode string + traceStart bool + StartCmd = &cobra.Command{ Use: "server", Short: "Start API server", Example: "go-admin server -c config/settings.yml", @@ -48,6 +49,7 @@ func init() { StartCmd.PersistentFlags().StringVarP(&configYml, "config", "c", "config/settings.yml", "Start server with provided configuration file") StartCmd.PersistentFlags().StringVarP(&port, "port", "p", "8000", "Tcp port server listening on") StartCmd.PersistentFlags().StringVarP(&mode, "mode", "m", "dev", "server mode ; eg:dev,test,prod") + StartCmd.PersistentFlags().BoolVarP(&traceStart, "traceStart", "t", false, "start traceStart app dash") //注册路由 fixme 其他应用的路由,在本目录新建文件放在init方法 AppRouters = append(AppRouters, router.InitRouter) @@ -99,6 +101,15 @@ func run() error { }() + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + if traceStart { + //链路追踪, fixme 页面显示需要自备梯子 + trace.Start() + defer trace.Stop(ctx) + } + go func() { // 服务连接 if config.SslConfig.Enable { @@ -111,8 +122,7 @@ func run() error { } } }() - content, _ := ioutil.ReadFile("./static/go-admin.txt") - fmt.Println(tools.Red(string(content))) + fmt.Println(tools.Red(string(global.LogoContent))) tip() fmt.Println(tools.Green("Server run at:")) fmt.Printf("- Local: http://localhost:%s/ \r\n", config.ApplicationConfig.Port) @@ -127,8 +137,6 @@ func run() error { <-quit fmt.Printf("%s Shutdown Server ... \r\n", tools.GetCurrentTimeStr()) - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - defer cancel() if err := srv.Shutdown(ctx); err != nil { log.Fatal("Server Shutdown:", err) } diff --git a/common/global/logo.go b/common/global/logo.go new file mode 100644 index 00000000..e4ed4714 --- /dev/null +++ b/common/global/logo.go @@ -0,0 +1,4 @@ +package global + +// LogoContent go-admin ascii显示,减少静态文件依赖 +var LogoContent = []byte{10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 95, 95, 95, 95, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 44, 32, 32, 32, 32, 32, 32, 32, 32, 44, 39, 32, 32, 44, 32, 96, 46, 32, 32, 44, 45, 45, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 46, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 44, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 46, 39, 124, 32, 32, 32, 32, 32, 44, 45, 43, 45, 44, 46, 39, 32, 95, 32, 124, 44, 45, 45, 46, 39, 124, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 44, 10, 32, 32, 44, 45, 45, 45, 45, 46, 95, 44, 46, 32, 32, 39, 32, 32, 32, 44, 39, 92, 32, 32, 32, 44, 39, 32, 32, 46, 39, 32, 124, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 124, 32, 32, 32, 124, 32, 58, 32, 32, 44, 45, 43, 45, 46, 32, 59, 32, 32, 32, 44, 32, 124, 124, 124, 32, 32, 124, 44, 32, 32, 32, 32, 32, 32, 44, 45, 43, 45, 46, 32, 47, 32, 32, 124, 10, 32, 47, 32, 32, 32, 47, 32, 32, 39, 32, 47, 32, 47, 32, 32, 32, 47, 32, 32, 32, 124, 44, 45, 45, 45, 46, 39, 32, 32, 32, 44, 32, 44, 45, 45, 46, 45, 45, 46, 32, 32, 32, 32, 32, 32, 124, 32, 32, 32, 124, 32, 124, 32, 44, 45, 45, 46, 39, 124, 39, 32, 32, 32, 124, 32, 32, 124, 124, 96, 45, 45, 39, 95, 32, 32, 32, 32, 32, 44, 45, 45, 46, 39, 124, 39, 32, 32, 32, 124, 10, 124, 32, 32, 32, 58, 32, 32, 32, 32, 32, 124, 46, 32, 32, 32, 59, 32, 44, 46, 32, 58, 124, 32, 32, 32, 124, 32, 32, 32, 32, 124, 47, 32, 32, 32, 32, 32, 32, 32, 92, 32, 32, 32, 44, 45, 45, 46, 95, 95, 124, 32, 124, 124, 32, 32, 32, 124, 32, 32, 44, 39, 44, 32, 124, 32, 32, 124, 44, 44, 39, 32, 44, 39, 124, 32, 32, 32, 124, 32, 32, 32, 124, 32, 32, 44, 34, 39, 32, 124, 10, 124, 32, 32, 32, 124, 32, 46, 92, 32, 32, 46, 39, 32, 32, 32, 124, 32, 124, 58, 32, 58, 58, 32, 32, 32, 58, 32, 32, 46, 39, 46, 45, 45, 46, 32, 32, 46, 45, 46, 32, 124, 32, 47, 32, 32, 32, 44, 39, 32, 32, 32, 124, 124, 32, 32, 32, 124, 32, 47, 32, 32, 124, 32, 124, 45, 45, 39, 32, 39, 32, 32, 124, 32, 124, 32, 32, 32, 124, 32, 32, 32, 124, 32, 47, 32, 32, 124, 32, 124, 10, 46, 32, 32, 32, 59, 32, 39, 59, 32, 32, 124, 39, 32, 32, 32, 124, 32, 46, 59, 32, 58, 58, 32, 32, 32, 124, 46, 39, 32, 32, 32, 92, 95, 95, 92, 47, 58, 32, 46, 32, 46, 46, 32, 32, 32, 39, 32, 32, 47, 32, 32, 124, 124, 32, 32, 32, 58, 32, 124, 32, 32, 124, 32, 44, 32, 32, 32, 32, 124, 32, 32, 124, 32, 58, 32, 32, 32, 124, 32, 32, 32, 124, 32, 124, 32, 32, 124, 32, 124, 10, 39, 32, 32, 32, 46, 32, 32, 32, 46, 32, 124, 124, 32, 32, 32, 58, 32, 32, 32, 32, 124, 96, 45, 45, 45, 39, 32, 32, 32, 32, 32, 44, 34, 32, 46, 45, 45, 46, 59, 32, 124, 39, 32, 32, 32, 59, 32, 124, 58, 32, 32, 124, 124, 32, 32, 32, 58, 32, 124, 32, 32, 124, 47, 32, 32, 32, 32, 32, 39, 32, 32, 58, 32, 124, 95, 95, 32, 124, 32, 32, 32, 124, 32, 124, 32, 32, 124, 47, 10, 32, 96, 45, 45, 45, 96, 45, 39, 124, 32, 124, 32, 92, 32, 32, 32, 92, 32, 32, 47, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 47, 32, 32, 47, 32, 32, 44, 46, 32, 32, 124, 124, 32, 32, 32, 124, 32, 39, 47, 32, 32, 39, 124, 32, 32, 32, 124, 32, 124, 96, 45, 39, 32, 32, 32, 32, 32, 32, 124, 32, 32, 124, 32, 39, 46, 39, 124, 124, 32, 32, 32, 124, 32, 124, 45, 45, 39, 10, 32, 46, 39, 95, 95, 47, 92, 95, 58, 32, 124, 32, 32, 96, 45, 45, 45, 45, 39, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 32, 58, 32, 32, 32, 46, 39, 32, 32, 32, 92, 32, 32, 32, 58, 32, 32, 32, 32, 58, 124, 124, 32, 32, 32, 59, 47, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 32, 58, 32, 32, 32, 32, 59, 124, 32, 32, 32, 124, 47, 10, 32, 124, 32, 32, 32, 58, 32, 32, 32, 32, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 124, 32, 32, 44, 32, 32, 32, 32, 32, 46, 45, 46, 47, 92, 32, 32, 32, 92, 32, 32, 47, 32, 32, 39, 45, 45, 45, 39, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 124, 32, 32, 44, 32, 32, 32, 47, 32, 39, 45, 45, 45, 39, 10, 32, 32, 92, 32, 32, 32, 92, 32, 32, 47, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 96, 45, 45, 96, 45, 45, 45, 39, 32, 32, 32, 32, 32, 96, 45, 45, 45, 45, 39, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 45, 96, 45, 39, 10, 32, 32, 32, 96, 45, 45, 96, 45, 39, 10} diff --git a/common/middleware/trace.go b/common/middleware/trace.go new file mode 100644 index 00000000..99d94227 --- /dev/null +++ b/common/middleware/trace.go @@ -0,0 +1,26 @@ +package middleware + +import ( + "github.com/gin-gonic/gin" + "github.com/opentracing/opentracing-go" +) + +// Trace 链路追踪 +func Trace() gin.HandlerFunc { + return func(ctx *gin.Context) { + var sp opentracing.Span + opName := ctx.Request.URL.Path + // Attempt to join a trace by getting trace context from the headers. + wireContext, err := opentracing.GlobalTracer().Extract( + opentracing.TextMap, + opentracing.HTTPHeadersCarrier(ctx.Request.Header)) + if err != nil { + // If for whatever reason we can't join, go ahead an start a new root span. + sp = opentracing.StartSpan(opName) + } else { + sp = opentracing.StartSpan(opName, opentracing.ChildOf(wireContext)) + } + defer sp.Finish() + ctx.Next() + } +} diff --git a/go.mod b/go.mod index 51315748..319dae7c 100644 --- a/go.mod +++ b/go.mod @@ -16,12 +16,16 @@ require ( github.com/matchstalk/redisqueue v1.0.3 github.com/mojocn/base64Captcha v1.3.1 github.com/mssola/user_agent v0.5.2 + github.com/opentracing/basictracer-go v1.1.0 // indirect + github.com/opentracing/opentracing-go v1.1.0 github.com/prometheus/client_golang v1.1.0 github.com/robfig/cron/v3 v3.0.1 github.com/satori/go.uuid v1.2.0 github.com/shamsher31/goimgext v1.0.0 // indirect github.com/shamsher31/goimgtype v1.0.0 github.com/shirou/gopsutil v2.20.7+incompatible + github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect + github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect github.com/spf13/cast v1.3.1 github.com/spf13/cobra v1.0.0 github.com/spf13/viper v1.7.1 @@ -33,4 +37,6 @@ require ( gorm.io/driver/postgres v0.2.9 gorm.io/driver/sqlite v1.0.9 gorm.io/gorm v1.20.1 + sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 + sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 // indirect ) diff --git a/go.sum b/go.sum index bacba17e..cbea5c54 100644 --- a/go.sum +++ b/go.sum @@ -228,6 +228,7 @@ github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= @@ -277,6 +278,7 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -526,6 +528,9 @@ github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5X github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= +github.com/opentracing/basictracer-go v1.1.0 h1:Oa1fTSBvAl8pa3U+IJYqrKm0NALwH9OsgwOqDv4xJW0= +github.com/opentracing/basictracer-go v1.1.0/go.mod h1:V2HZueSJEp879yv285Aap1BS69fQMD+MNP1mRs6mBQc= +github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= @@ -592,7 +597,9 @@ github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJ github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -738,6 +745,7 @@ golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -778,6 +786,7 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -880,6 +889,7 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200113040837-eac381796e91/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b h1:zSzQJAznWxAh9fZxiPy2FZo+ZZEYoYFYYDYdOrU7AaM= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -987,3 +997,7 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= +sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 h1:e1sMhtVq9AfcEy8AXNb8eSg6gbzfdpYhoNqnPJa+GzI= +sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k= diff --git a/static/go-admin.txt b/static/go-admin.txt deleted file mode 100644 index 2353fcaf..00000000 --- a/static/go-admin.txt +++ /dev/null @@ -1,15 +0,0 @@ - - ____ - ,---, ,' , `. ,--, - ,---. ,---,. ,---.'| ,-+-,.' _ |,--.'| ,---, - ,----._,. ' ,'\ ,' .' | | | : ,-+-. ; , ||| |, ,-+-. / | - / / ' / / / |,---.' , ,--.--. | | | ,--.'|' | ||`--'_ ,--.'|' | -| : |. ; ,. :| | |/ \ ,--.__| || | ,', | |,,' ,'| | | ,"' | -| | .\ .' | |: :: : .'.--. .-. | / ,' || | / | |--' ' | | | | / | | -. ; '; |' | .; :: |.' \__\/: . .. ' / || : | | , | | : | | | | | -' . . || : |`---' ," .--.; |' ; |: || : | |/ ' : |__ | | | |/ - `---`-'| | \ \ / / / ,. || | '/ '| | |`-' | | '.'|| | |--' - .'__/\_: | `----' ; : .' \ : :|| ;/ ; : ;| |/ - | : : | , .-./\ \ / '---' | , / '---' - \ \ / `--`---' `----' ---`-' - `--`-' diff --git a/tools/trace/trace.go b/tools/trace/trace.go new file mode 100644 index 00000000..ea5339c0 --- /dev/null +++ b/tools/trace/trace.go @@ -0,0 +1,82 @@ +package trace + +import ( + "context" + "fmt" + "log" + "net" + "net/http" + "net/url" + "os" + "os/signal" + + "github.com/opentracing/opentracing-go" + "sourcegraph.com/sourcegraph/appdash" + appdashot "sourcegraph.com/sourcegraph/appdash/opentracing" + "sourcegraph.com/sourcegraph/appdash/traceapp" + + "go-admin/tools" +) + +var _server = &http.Server{} + +// Start 启动 +func Start() { + store := appdash.NewMemoryStore() + + // Listen on any available TCP port locally. + l, err := net.ListenTCP("tcp", &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 0}) + if err != nil { + log.Fatal(err) + } + collectorPort := l.Addr().(*net.TCPAddr).Port + collectorAdd := fmt.Sprintf(":%d", collectorPort) + + // Start an Appdash collection server that will listen for spans and + // annotations and add them to the local collector (stored in-memory). + cs := appdash.NewServer(l, appdash.NewLocalCollector(store)) + go cs.Start() + + // Print the URL at which the web UI will be running. + appdashPort := 8700 + appdashURLStr := fmt.Sprintf("http://%s:%d", tools.GetLocaHonst(), appdashPort) + appdashURL, err := url.Parse(appdashURLStr) + if err != nil { + log.Fatalf("Error parsing %s: %s", appdashURLStr, err) + } + + // Start the web UI in a separate goroutine. + tapp, err := traceapp.New(nil, appdashURL) + if err != nil { + log.Fatal(err) + } + tapp.Store = store + tapp.Queryer = store + _server.Addr = fmt.Sprintf(":%d", appdashPort) + _server.Handler = tapp + go func() { + err := _server.ListenAndServe() + if err != nil { + log.Fatalf("Trace server start error: %s", err.Error()) + } + }() + fmt.Println(tools.Green("Trace server run at:")) + fmt.Printf("- Local: %s/traces\n", fmt.Sprintf("http://localhost:%d", appdashPort)) + fmt.Printf("- Network: %s/traces\n", fmt.Sprintf("http://%s:%d", tools.GetLocaHonst(), appdashPort)) + + tracer := appdashot.NewTracer(appdash.NewRemoteCollector(collectorAdd)) + opentracing.InitGlobalTracer(tracer) +} + +// Stop 停止 +func Stop(ctx context.Context) { + quit := make(chan os.Signal) + signal.Notify(quit, os.Interrupt) + <-quit + fmt.Printf("%s Shutdown Server ... \r\n", tools.GetCurrentTimeStr()) + err := _server.Shutdown(ctx) + if err != nil { + log.Fatalf("Trace server shutdown error: %s", err.Error()) + } + log.Println("Trace server shutdown success") +} From 5e3e16025cb0d9b676e57c76f1f62a8d11789135 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 30 Oct 2020 15:40:51 +0800 Subject: [PATCH 030/201] =?UTF-8?q?=E5=8E=BB=E9=99=A4pkg/auth=E5=AF=B9tool?= =?UTF-8?q?s=E4=BE=9D=E8=B5=96=EF=BC=8C=E5=87=8F=E5=B0=91=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E5=BC=95=E7=94=A8=E5=8F=AF=E8=83=BD=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/auth.go | 11 ++++++++++- pkg/jwtauth/jwtauth.go | 17 +++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/app/admin/middleware/auth.go b/app/admin/middleware/auth.go index a7519a16..69db9511 100644 --- a/app/admin/middleware/auth.go +++ b/app/admin/middleware/auth.go @@ -8,11 +8,20 @@ import ( "go-admin/tools/config" ) +// AuthInit jwt验证new func AuthInit() (*jwt.GinJWTMiddleware, error) { + timeout := time.Hour + if config.ApplicationConfig.Mode == "dev" { + timeout = time.Duration(876010) * time.Hour + } else { + if config.JwtConfig.Timeout != 0 { + timeout = time.Duration(config.JwtConfig.Timeout) * time.Second + } + } return jwt.New(&jwt.GinJWTMiddleware{ Realm: "test zone", Key: []byte(config.ApplicationConfig.JwtSecret), - Timeout: time.Hour, + Timeout: timeout, MaxRefresh: time.Hour, PayloadFunc: handler.PayloadFunc, IdentityHandler: handler.IdentityHandler, diff --git a/pkg/jwtauth/jwtauth.go b/pkg/jwtauth/jwtauth.go index 082e9b3a..216a7f00 100644 --- a/pkg/jwtauth/jwtauth.go +++ b/pkg/jwtauth/jwtauth.go @@ -3,13 +3,13 @@ package jwtauth import ( "crypto/rsa" "errors" - "github.com/dgrijalva/jwt-go" - "github.com/gin-gonic/gin" - config2 "go-admin/tools/config" "io/ioutil" "net/http" "strings" "time" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" ) const JwtPayloadKey = "JWT_PAYLOAD" @@ -284,17 +284,6 @@ func (mw *GinJWTMiddleware) MiddlewareInit() error { mw.SigningAlgorithm = "HS256" } - mw.Timeout = time.Hour - if config2.JwtConfig.Timeout != 0 { - // TODO: token过期时长 - mw.Timeout = time.Duration(config2.JwtConfig.Timeout) * time.Second - } - - if config2.ApplicationConfig.Mode == "dev" { - // TODO: dev mode token过期时长 为 10 年 - mw.Timeout = time.Duration(876010) * time.Hour - } - if mw.TimeFunc == nil { mw.TimeFunc = time.Now } From 5078403569391b2e38542fbb23afd64586568acc Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 30 Oct 2020 17:16:47 +0800 Subject: [PATCH 031/201] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E9=93=BE?= =?UTF-8?q?=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/middleware/trace.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/middleware/trace.go b/common/middleware/trace.go index 99d94227..84a32c80 100644 --- a/common/middleware/trace.go +++ b/common/middleware/trace.go @@ -20,7 +20,8 @@ func Trace() gin.HandlerFunc { } else { sp = opentracing.StartSpan(opName, opentracing.ChildOf(wireContext)) } - defer sp.Finish() + ctx.Set("traceSpan", sp) ctx.Next() + sp.Finish() } } From 7382a44162b250fa8060daafd03557df9da40ccc Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Tue, 3 Nov 2020 11:35:14 +0800 Subject: [PATCH 032/201] =?UTF-8?q?go-admin-core=E4=BE=9D=E8=B5=961.2.2?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 49 ++++++++++++++++++------------------------------- 2 files changed, 19 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index 319dae7c..73a45432 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4 + github.com/go-admin-team/go-admin-core v1.2.2 github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 diff --git a/go.sum b/go.sum index cbea5c54..5e117084 100644 --- a/go.sum +++ b/go.sum @@ -79,7 +79,7 @@ github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngE github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bsm/redislock v0.6.0/go.mod h1:3Kgu+cXw0JrkZ5pmY/JbcFpixGZ5M9v9G2PGWYqku+k= +github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= github.com/caddyserver/certmagic v0.10.6/go.mod h1:Y8jcUBctgk/IhpAzlHKfimZNyXCkfGgRTC0orl8gROQ= @@ -92,7 +92,6 @@ github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8 github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= @@ -128,7 +127,6 @@ github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzq github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= github.com/dnaeon/go-vcr v0.0.0-20180814043457-aafff18a5cc2/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= @@ -153,9 +151,8 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pFdJbAhRf7rh6YYMUdIQGyzne6zYL1tCUW8QV2B3UfY= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= @@ -168,11 +165,12 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4 h1:H7SmWlvnE2HGoKmPlsJwTYVMBEvw/9acP2UBuNzbx1g= -github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk= +github.com/go-admin-team/go-admin-core v1.2.2 h1:TMR5ga2vTQGRMR+zZ9XrOO2Zpvl5+AOFN4bnfJfimKw= +github.com/go-admin-team/go-admin-core v1.2.2/go.mod h1:F+wumLm6Tw9Y9usOy45vdvQ9kbbCgSJKseKWzjvd/BQ= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -181,7 +179,6 @@ github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1 github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -214,8 +211,8 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-redis/redis/v8 v8.1.0/go.mod h1:isLoQT/NFSP7V67lyvM9GmdvLdyZ7pEhsXvvyQtnQTo= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -251,9 +248,8 @@ github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -261,13 +257,13 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -323,6 +319,7 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= +github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -461,6 +458,7 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/mattn/goveralls v0.0.5/go.mod h1:Xg2LHi51faXLyKXwsndxiW6uxEEQT9+3sjGzzwU4xy0= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -506,21 +504,16 @@ github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/Hzq github.com/nrdcg/dnspod-go v0.4.0/go.mod h1:vZSoFSFeQVm2gWLMkyX61LZ8HI3BaqtHZWgPTGKr6KQ= github.com/nrdcg/goinwx v0.6.1/go.mod h1:XPiut7enlbEdntAqalBIqcYcTEVhpv/dKWgDCX2SwKQ= github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -538,6 +531,7 @@ github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -576,6 +570,7 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/robinjoseph08/redisqueue/v2 v2.1.0/go.mod h1:fiNYBqIF/DqZxKvO6faLB6nkBtfJucuM+rDbFhZG1vs= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -631,7 +626,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= @@ -685,7 +679,6 @@ go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opentelemetry.io/otel v0.11.0/go.mod h1:G8UCk+KooF2HLkgo8RHX9epABH/aRGYET7gQOqBVdB0= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -703,6 +696,7 @@ golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -732,7 +726,6 @@ golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxT golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200908183739-ae8ad444f925/go.mod h1:1phAWC201xIgDyaFpmDeZkgf70Q4Pd/CNqfRtVPtxNw= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= @@ -752,7 +745,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -787,7 +779,6 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -799,6 +790,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -832,8 +824,6 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -844,10 +834,8 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -877,6 +865,7 @@ golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -890,7 +879,6 @@ golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200113040837-eac381796e91/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b h1:zSzQJAznWxAh9fZxiPy2FZo+ZZEYoYFYYDYdOrU7AaM= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -935,9 +923,9 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -970,7 +958,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v0.3.0/go.mod h1:A7H1JD9dKdcjeUTpTuWKEC+E1a74qzW7/zaXqKaTbfM= gorm.io/driver/mysql v0.3.2 h1:Kaa0S+IHW+4qow6dRAdekNYaKeGBboIkh44pYdLWjIE= gorm.io/driver/mysql v0.3.2/go.mod h1:jC/HyPAZJ0xqfGlOqYybd8oNPMtGrkNgvwjWuKDT7f0= From 411b9d338016a16363baf2e7565ff5c26a8a1ff5 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 3 Nov 2020 15:07:20 +0800 Subject: [PATCH 033/201] =?UTF-8?q?config=20=F0=9F=94=A7=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9go.mod=E7=89=88=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/{sysfiledir => sysfile}/dir.go | 2 +- .../{sysfileinfo => sysfile}/sysfileinfo.go | 2 +- app/admin/router/sysfileinfo.go | 23 +++++++++---------- go.mod | 2 +- go.sum | 18 +++++++++++++++ 5 files changed, 32 insertions(+), 15 deletions(-) rename app/admin/apis/{sysfiledir => sysfile}/dir.go (99%) rename app/admin/apis/{sysfileinfo => sysfile}/sysfileinfo.go (98%) diff --git a/app/admin/apis/sysfiledir/dir.go b/app/admin/apis/sysfile/dir.go similarity index 99% rename from app/admin/apis/sysfiledir/dir.go rename to app/admin/apis/sysfile/dir.go index fbf142be..89c114cb 100644 --- a/app/admin/apis/sysfiledir/dir.go +++ b/app/admin/apis/sysfile/dir.go @@ -1,4 +1,4 @@ -package sysfiledir +package sysfile import ( "github.com/gin-gonic/gin" diff --git a/app/admin/apis/sysfileinfo/sysfileinfo.go b/app/admin/apis/sysfile/sysfileinfo.go similarity index 98% rename from app/admin/apis/sysfileinfo/sysfileinfo.go rename to app/admin/apis/sysfile/sysfileinfo.go index 509c74a9..10ef4ce8 100644 --- a/app/admin/apis/sysfileinfo/sysfileinfo.go +++ b/app/admin/apis/sysfile/sysfileinfo.go @@ -1,4 +1,4 @@ -package sysfileinfo +package sysfile import ( "github.com/gin-gonic/gin" diff --git a/app/admin/router/sysfileinfo.go b/app/admin/router/sysfileinfo.go index b701c20f..0a684ba2 100644 --- a/app/admin/router/sysfileinfo.go +++ b/app/admin/router/sysfileinfo.go @@ -2,34 +2,33 @@ package router import ( "github.com/gin-gonic/gin" - "go-admin/app/admin/apis/sysfiledir" - "go-admin/app/admin/apis/sysfileinfo" + "go-admin/app/admin/apis/sysfile" ) // 无需认证的路由代码 func registerSysFileInfoRouter(v1 *gin.RouterGroup) { - v1.GET("/sysfileinfoList", sysfileinfo.GetSysFileInfoList) + v1.GET("/sysfileinfoList", sysfile.GetSysFileInfoList) r := v1.Group("/sysfileinfo") { - r.GET("/:id", sysfileinfo.GetSysFileInfo) - r.POST("", sysfileinfo.InsertSysFileInfo) - r.PUT("", sysfileinfo.UpdateSysFileInfo) - r.DELETE("/:id", sysfileinfo.DeleteSysFileInfo) + r.GET("/:id", sysfile.GetSysFileInfo) + r.POST("", sysfile.InsertSysFileInfo) + r.PUT("", sysfile.UpdateSysFileInfo) + r.DELETE("/:id", sysfile.DeleteSysFileInfo) } } // 无需认证的路由代码 func registerSysFileDirRouter(v1 *gin.RouterGroup) { - v1.GET("/sysfiledirList", sysfiledir.GetSysFileDirList) + v1.GET("/sysfiledirList", sysfile.GetSysFileDirList) r := v1.Group("/sysfiledir") { - r.GET("/:id", sysfiledir.GetSysFileDir) - r.POST("", sysfiledir.InsertSysFileDir) - r.PUT("", sysfiledir.UpdateSysFileDir) - r.DELETE("/:id", sysfiledir.DeleteSysFileDir) + r.GET("/:id", sysfile.GetSysFileDir) + r.POST("", sysfile.InsertSysFileDir) + r.PUT("", sysfile.UpdateSysFileDir) + r.DELETE("/:id", sysfile.DeleteSysFileDir) } } diff --git a/go.mod b/go.mod index 319dae7c..73a45432 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4 + github.com/go-admin-team/go-admin-core v1.2.2 github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 diff --git a/go.sum b/go.sum index cbea5c54..f7c50c6e 100644 --- a/go.sum +++ b/go.sum @@ -79,6 +79,7 @@ github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngE github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= github.com/bsm/redislock v0.6.0/go.mod h1:3Kgu+cXw0JrkZ5pmY/JbcFpixGZ5M9v9G2PGWYqku+k= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= @@ -153,6 +154,7 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pFdJbAhRf7rh6YYMUdIQGyzne6zYL1tCUW8QV2B3UfY= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -168,11 +170,14 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4 h1:H7SmWlvnE2HGoKmPlsJwTYVMBEvw/9acP2UBuNzbx1g= github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk= +github.com/go-admin-team/go-admin-core v1.2.2 h1:TMR5ga2vTQGRMR+zZ9XrOO2Zpvl5+AOFN4bnfJfimKw= +github.com/go-admin-team/go-admin-core v1.2.2/go.mod h1:F+wumLm6Tw9Y9usOy45vdvQ9kbbCgSJKseKWzjvd/BQ= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -214,6 +219,7 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v8 v8.1.0/go.mod h1:isLoQT/NFSP7V67lyvM9GmdvLdyZ7pEhsXvvyQtnQTo= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= @@ -251,6 +257,7 @@ github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= @@ -268,6 +275,7 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -323,6 +331,7 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= +github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -461,6 +470,7 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/mattn/goveralls v0.0.5/go.mod h1:Xg2LHi51faXLyKXwsndxiW6uxEEQT9+3sjGzzwU4xy0= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -538,6 +548,7 @@ github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -576,6 +587,7 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/robinjoseph08/redisqueue/v2 v2.1.0/go.mod h1:fiNYBqIF/DqZxKvO6faLB6nkBtfJucuM+rDbFhZG1vs= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -703,6 +715,7 @@ golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -799,6 +812,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -845,6 +859,7 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -877,6 +892,7 @@ golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -935,9 +951,11 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 17b850d0a8410c2deea4cb256e978c0e6093fbb0 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 3 Nov 2020 15:13:54 +0800 Subject: [PATCH 034/201] Update go.sum --- go.sum | 1 + 1 file changed, 1 insertion(+) diff --git a/go.sum b/go.sum index 29cb810c..8f8c2786 100644 --- a/go.sum +++ b/go.sum @@ -79,6 +79,7 @@ github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngE github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= github.com/bsm/redislock v0.6.0/go.mod h1:3Kgu+cXw0JrkZ5pmY/JbcFpixGZ5M9v9G2PGWYqku+k= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= From 2399824d35d9a21e322633508db67eb39e9e59d3 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 4 Nov 2020 11:26:41 +0800 Subject: [PATCH 035/201] =?UTF-8?q?fixme:=20=E4=BC=98=E5=8C=96=E5=88=9D?= =?UTF-8?q?=E6=AC=A1=E5=90=AF=E5=8A=A8=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/logger/setup.go | 12 ++++++++++-- tools/file.go | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pkg/logger/setup.go b/pkg/logger/setup.go index fc82c700..c1bd913b 100644 --- a/pkg/logger/setup.go +++ b/pkg/logger/setup.go @@ -1,6 +1,7 @@ package logger import ( + "go-admin/tools" "path/filepath" "github.com/go-admin-team/go-admin-core/debug/writer" @@ -39,9 +40,16 @@ import ( // SetupLogger 日志 func SetupLogger(path string, subPath string) logger.Logger { var setLogger logger.Logger - output, err := writer.NewFileWriter(filepath.Join(path, subPath), "log") + fullPath := filepath.Join(path, subPath) + if !tools.PathExist(fullPath) { + err := tools.PathCreate(fullPath) + if err != nil { + log.Fatal("create dir error: %s", err.Error()) + } + } + output, err := writer.NewFileWriter(fullPath, "log") if err != nil { - log.Fatal("request logger setup error: %s", err.Error) + log.Fatal("%s logger setup error: %s", subPath, err.Error()) } setLogger = logger.NewHelper(logger.NewLogger(logger.WithOutput(output))) return setLogger diff --git a/tools/file.go b/tools/file.go index 94309ed7..505395b1 100644 --- a/tools/file.go +++ b/tools/file.go @@ -18,6 +18,16 @@ func PathCreate(dir string) error { return os.MkdirAll(dir, os.ModePerm) } +// PathExist 判断目录是否存在 +func PathExist(addr string) bool { + s, err := os.Stat(addr) + if err != nil { + log.Println(err) + return false + } + return s.IsDir() +} + func FileCreate(content bytes.Buffer, name string) { file, err := os.Create(name) if err != nil { From 52be3f615374ed50c5f93ff47331f0080f68893a Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 12 Nov 2020 20:18:53 +0800 Subject: [PATCH 036/201] =?UTF-8?q?feat=E2=9C=A8=20oss=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/public/file.go | 168 ++++++++++----- app/admin/apis/sys_file/sys_file_dir.go | 197 +++++++++++++++++ app/admin/apis/sys_file/sys_file_info.go | 204 ++++++++++++++++++ app/admin/apis/sysfile/dir.go | 12 +- app/admin/apis/sysfile/sysfileinfo.go | 20 +- app/admin/models/filedir.go | 72 +++---- app/admin/models/sys_file_dir.go | 41 ++++ app/admin/models/sys_file_info.go | 33 +++ app/admin/models/sysfileinfo.go | 36 ++-- app/admin/router/router.go | 3 +- app/admin/router/sys_file_dir.go | 25 +++ app/admin/router/sys_file_info.go | 25 +++ app/admin/router/sysfileinfo.go | 34 --- app/admin/service/dto/sys_file_dir.go | 94 ++++++++ app/admin/service/dto/sysfileinfo.go | 104 +++++++++ app/admin/service/sys_file_dir.go | 171 +++++++++++++++ app/admin/service/sysfileinfo.go | 119 ++++++++++ .../version/1600089797118_migrate.go | 14 +- common/file_store/initialize.go | 14 ++ common/file_store/interface.go | 6 + common/file_store/oss.go | 54 +++++ go.mod | 3 +- go.sum | 57 +++++ pkg/utils/file.go | 76 ++++++- tools/int.go | 4 + 25 files changed, 1411 insertions(+), 175 deletions(-) create mode 100644 app/admin/apis/sys_file/sys_file_dir.go create mode 100644 app/admin/apis/sys_file/sys_file_info.go create mode 100644 app/admin/models/sys_file_dir.go create mode 100644 app/admin/models/sys_file_info.go create mode 100644 app/admin/router/sys_file_dir.go create mode 100644 app/admin/router/sys_file_info.go delete mode 100644 app/admin/router/sysfileinfo.go create mode 100644 app/admin/service/dto/sys_file_dir.go create mode 100644 app/admin/service/dto/sysfileinfo.go create mode 100644 app/admin/service/sys_file_dir.go create mode 100644 app/admin/service/sysfileinfo.go create mode 100644 common/file_store/initialize.go create mode 100644 common/file_store/interface.go create mode 100644 common/file_store/oss.go diff --git a/app/admin/apis/public/file.go b/app/admin/apis/public/file.go index 0068a50e..d44bc360 100644 --- a/app/admin/apis/public/file.go +++ b/app/admin/apis/public/file.go @@ -4,12 +4,13 @@ import ( "encoding/base64" "errors" "fmt" + "go-admin/common/file_store" "io/ioutil" "strings" "github.com/gin-gonic/gin" "github.com/google/uuid" - imgType "github.com/shamsher31/goimgtype" + //imgType "github.com/shamsher31/goimgtype" "go-admin/pkg/utils" "go-admin/tools" @@ -43,62 +44,133 @@ func UploadFile(c *gin.Context) { } else { switch tag { case "1": // 单图 - files, err := c.FormFile("file") - if err != nil { - app.Error(c, 200, errors.New(""), "图片不能为空") + fileResponse, done := singleFile(c, fileResponse, urlPerfix) + if done { return } - // 上传文件至指定目录 - guid := uuid.New().String() - - singleFile := "static/uploadfile/" + guid + utils.GetExt(files.Filename) - _ = c.SaveUploadedFile(files, singleFile) - fileType, _ := imgType.Get(singleFile) - fileResponse = FileResponse{ - Size: tools.GetFileSize(singleFile), - Path: singleFile, - FullPath: urlPerfix + singleFile, - Name: files.Filename, - Type: fileType, - } app.OK(c, fileResponse, "上传成功") return case "2": // 多图 - files := c.Request.MultipartForm.File["file"] - var multipartFile []FileResponse - for _, f := range files { - guid := uuid.New().String() - multipartFileName := "static/uploadfile/" + guid + utils.GetExt(f.Filename) - e := c.SaveUploadedFile(f, multipartFileName) - fileType, _ := imgType.Get(multipartFileName) - if e == nil { - multipartFile = append(multipartFile, FileResponse{ - Size: tools.GetFileSize(multipartFileName), - Path: multipartFileName, - FullPath: urlPerfix + multipartFileName, - Name: f.Filename, - Type: fileType, - }) - } - } + multipartFile := multipleFile(c, urlPerfix) app.OK(c, multipartFile, "上传成功") return case "3": // base64 - files, _ := c.GetPostForm("file") - file2list := strings.Split(files, ",") - ddd, _ := base64.StdEncoding.DecodeString(file2list[1]) - guid := uuid.New().String() - base64File := "static/uploadfile/" + guid + ".jpg" - _ = ioutil.WriteFile(base64File, ddd, 0666) - typeStr := strings.Replace(strings.Replace(file2list[0], "data:", "", -1), ";base64", "", -1) - fileResponse = FileResponse{ - Size: tools.GetFileSize(base64File), - Path: base64File, - FullPath: urlPerfix + base64File, - Name: "", - Type: typeStr, - } + fileResponse = baseImg(c, fileResponse, urlPerfix) app.OK(c, fileResponse, "上传成功") } } } + +func baseImg(c *gin.Context, fileResponse FileResponse, urlPerfix string) FileResponse { + files, _ := c.GetPostForm("file") + file2list := strings.Split(files, ",") + ddd, _ := base64.StdEncoding.DecodeString(file2list[1]) + guid := uuid.New().String() + fileName := guid + ".jpg" + base64File := "static/uploadfile/" + fileName + _ = ioutil.WriteFile(base64File, ddd, 0666) + typeStr := strings.Replace(strings.Replace(file2list[0], "data:", "", -1), ";base64", "", -1) + fileResponse = FileResponse{ + Size: tools.GetFileSize(base64File), + Path: base64File, + FullPath: urlPerfix + base64File, + Name: "", + Type: typeStr, + } + source, _ := c.GetPostForm("source") + err := thirdUpload(source, fileName, base64File) + if err != nil { + app.Error(c, 200, errors.New(""), "上传第三方失败") + return fileResponse + } + if source != "1" { + fileResponse.Path = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + fileResponse.FullPath = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + } + return fileResponse +} + +func multipleFile(c *gin.Context, urlPerfix string) []FileResponse { + files := c.Request.MultipartForm.File["file"] + source, _ := c.GetPostForm("source") + var multipartFile []FileResponse + for _, f := range files { + guid := uuid.New().String() + fileName := guid + utils.GetExt(f.Filename) + multipartFileName := "static/uploadfile/" + fileName + e := c.SaveUploadedFile(f, multipartFileName) + fileType, _ := utils.GetType(multipartFileName) + if e == nil { + err := thirdUpload(source, fileName, multipartFileName) + if err != nil { + app.Error(c, 200, errors.New(""), "上传第三方失败") + } else { + fileResponse := FileResponse{ + Size: tools.GetFileSize(multipartFileName), + Path: multipartFileName, + FullPath: urlPerfix + multipartFileName, + Name: f.Filename, + Type: fileType, + } + if source != "1" { + fileResponse.Path = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + fileResponse.FullPath = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + } + multipartFile = append(multipartFile, fileResponse) + } + } + } + return multipartFile +} + +func singleFile(c *gin.Context, fileResponse FileResponse, urlPerfix string) (FileResponse, bool) { + files, err := c.FormFile("file") + + if err != nil { + app.Error(c, 200, errors.New(""), "图片不能为空") + return FileResponse{}, true + } + // 上传文件至指定目录 + guid := uuid.New().String() + + fileName := guid + utils.GetExt(files.Filename) + singleFile := "static/uploadfile/" + fileName + _ = c.SaveUploadedFile(files, singleFile) + fileType, _ := utils.GetType(singleFile) + fileResponse = FileResponse{ + Size: tools.GetFileSize(singleFile), + Path: singleFile, + FullPath: urlPerfix + singleFile, + Name: files.Filename, + Type: fileType, + } + source, _ := c.GetPostForm("source") + err = thirdUpload(source, fileName, singleFile) + if err != nil { + app.Error(c, 200, errors.New(""), "上传第三方失败") + return FileResponse{}, true + } + fileResponse.Path = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + fileResponse.FullPath = "https://youshikeji.oss-cn-shanghai.aliyuncs.com/img/" + fileName + return fileResponse, false +} + +func thirdUpload(source string, name string, path string) error { + switch source { + case "2": + return ossUpload("img/"+name, path) + case "3": + return qiniuUpload("img/"+name, path) + } + return nil +} + +func ossUpload(name string, path string) error { + oss := file_store.ALiYunOSS{} + return oss.UpLoad(name, path) +} + +func qiniuUpload(name string, path string) error { + oss := file_store.ALiYunOSS{} + return oss.UpLoad(name, path) +} diff --git a/app/admin/apis/sys_file/sys_file_dir.go b/app/admin/apis/sys_file/sys_file_dir.go new file mode 100644 index 00000000..4f22ae85 --- /dev/null +++ b/app/admin/apis/sys_file/sys_file_dir.go @@ -0,0 +1,197 @@ +package sys_file + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/service" + common "go-admin/common/models" + "net/http" + + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + "go-admin/common/actions" + "go-admin/common/apis" + "go-admin/common/log" + "go-admin/tools" +) + +type SysFileDir struct { + apis.Api +} + +func (e *SysFileDir) GetSysFileDirList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysFileDirSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + req := d.Generate() + + //查询列表 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + var list *[]models.SysFileDirL + serviceStudent := service.SysFileDir{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + list, err = serviceStudent.SetSysFileDir(req) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, list, "查询成功") +} + +func (e *SysFileDir) GetSysFileDir(c *gin.Context) { + control := new(dto.SysFileDirById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + req := control.Generate() + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object models.SysFileDir + + serviceSysFileDir := service.SysFileDir{} + serviceSysFileDir.MsgID = msgID + serviceSysFileDir.Orm = db + err = serviceSysFileDir.GetSysFileDir(req, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysFileDir) InsertSysFileDir(c *gin.Context) { + control := new(dto.SysFileDirControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + req := control.Generate() + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserIdUint(c)) + + serviceSysFileDir := service.SysFileDir{} + serviceSysFileDir.Orm = db + serviceSysFileDir.MsgID = msgID + err = serviceSysFileDir.InsertSysFileDir(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysFileDir) UpdateSysFileDir(c *gin.Context) { + control := new(dto.SysFileDirControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + req := control.Generate() + //更新操作 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.SetUpdateBy(tools.GetUserIdUint(c)) + + //数据权限检查 + p := actions.GetPermissionFromContext(c) + + serviceSysFileDir := service.SysFileDir{} + serviceSysFileDir.Orm = db + serviceSysFileDir.MsgID = msgID + err = serviceSysFileDir.UpdateSysFileDir(object, p) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysFileDir) DeleteSysFileDir(c *gin.Context) { + control := new(dto.SysFileDirById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + req := control.Generate() + err = req.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + + // 设置编辑人 + object.SetUpdateBy(tools.GetUserIdUint(c)) + + // 数据权限检查 + p := actions.GetPermissionFromContext(c) + + serviceSysFileDir := service.SysFileDir{} + serviceSysFileDir.Orm = db + serviceSysFileDir.MsgID = msgID + err = serviceSysFileDir.RemoveSysFileDir(req, object, p) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "删除成功") +} diff --git a/app/admin/apis/sys_file/sys_file_info.go b/app/admin/apis/sys_file/sys_file_info.go new file mode 100644 index 00000000..1b2c1c51 --- /dev/null +++ b/app/admin/apis/sys_file/sys_file_info.go @@ -0,0 +1,204 @@ +package sys_file + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/service" + common "go-admin/common/models" + "net/http" + + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + "go-admin/common/actions" + "go-admin/common/apis" + "go-admin/common/log" + "go-admin/tools" +) + +type SysFileInfo struct { + apis.Api +} + +func (e *SysFileInfo) GetSysFileInfoList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysFileInfoSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + req := d.Generate() + + //查询列表 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + //数据权限检查 + p := actions.GetPermissionFromContext(c) + + list := make([]models.SysFileInfo, 0) + var count int64 + serviceStudent := service.SysFileInfo{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + err = serviceStudent.GetSysFileInfoPage(req, p, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") +} + +func (e *SysFileInfo) GetSysFileInfo(c *gin.Context) { + control := new(dto.SysFileInfoById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + req := control.Generate() + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object models.SysFileInfo + + //数据权限检查 + p := actions.GetPermissionFromContext(c) + + serviceSysFileInfo := service.SysFileInfo{} + serviceSysFileInfo.MsgID = msgID + serviceSysFileInfo.Orm = db + err = serviceSysFileInfo.GetSysFileInfo(req, p, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysFileInfo) InsertSysFileInfo(c *gin.Context) { + control := new(dto.SysFileInfoControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + req := control.Generate() + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserIdUint(c)) + + serviceSysFileInfo := service.SysFileInfo{} + serviceSysFileInfo.Orm = db + serviceSysFileInfo.MsgID = msgID + err = serviceSysFileInfo.InsertSysFileInfo(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysFileInfo) UpdateSysFileInfo(c *gin.Context) { + control := new(dto.SysFileInfoControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + req := control.Generate() + //更新操作 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.SetUpdateBy(tools.GetUserIdUint(c)) + + //数据权限检查 + p := actions.GetPermissionFromContext(c) + + serviceSysFileInfo := service.SysFileInfo{} + serviceSysFileInfo.Orm = db + serviceSysFileInfo.MsgID = msgID + err = serviceSysFileInfo.UpdateSysFileInfo(object, p) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysFileInfo) DeleteSysFileInfo(c *gin.Context) { + control := new(dto.SysFileInfoById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + req := control.Generate() + err = req.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + + // 设置编辑人 + object.SetUpdateBy(tools.GetUserIdUint(c)) + + // 数据权限检查 + p := actions.GetPermissionFromContext(c) + + serviceSysFileInfo := service.SysFileInfo{} + serviceSysFileInfo.Orm = db + serviceSysFileInfo.MsgID = msgID + err = serviceSysFileInfo.RemoveSysFileInfo(req, object, p) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "删除成功") +} diff --git a/app/admin/apis/sysfile/dir.go b/app/admin/apis/sysfile/dir.go index 89c114cb..54d10b39 100644 --- a/app/admin/apis/sysfile/dir.go +++ b/app/admin/apis/sysfile/dir.go @@ -11,18 +11,18 @@ import ( ) func GetSysFileDirList(c *gin.Context) { - var SysFileDir models.SysFileDir + var SysFileDir models.SysFileDirOld SysFileDir.Label = c.Request.FormValue("label") SysFileDir.PId, _ = tools.StringToInt(c.Request.FormValue("pid")) SysFileDir.Id, _ = tools.StringToInt(c.Request.FormValue("id")) SysFileDir.DataScope = tools.GetUserIdStr(c) - result, err := SysFileDir.SetSysFileDir() + result, err := SysFileDir.SetSysFileDirOld() tools.HasError(err, "抱歉未找到相关信息", -1) app.OK(c, result, "") } func GetSysFileDir(c *gin.Context) { - var data models.SysFileDir + var data models.SysFileDirOld data.Id, _ = tools.StringToInt(c.Param("id")) result, err := data.Get() tools.HasError(err, "抱歉未找到相关信息", -1) @@ -40,7 +40,7 @@ func GetSysFileDir(c *gin.Context) { // @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Router /api/v1/sysfiledir [post] func InsertSysFileDir(c *gin.Context) { - var data models.SysFileDir + var data models.SysFileDirOld err := c.ShouldBindJSON(&data) data.CreateBy = tools.GetUserIdStr(c) tools.HasError(err, "", 500) @@ -50,7 +50,7 @@ func InsertSysFileDir(c *gin.Context) { } func UpdateSysFileDir(c *gin.Context) { - var data models.SysFileDir + var data models.SysFileDirOld err := c.BindWith(&data, binding.JSON) tools.HasError(err, "数据解析失败", -1) data.UpdateBy = tools.GetUserIdStr(c) @@ -61,7 +61,7 @@ func UpdateSysFileDir(c *gin.Context) { } func DeleteSysFileDir(c *gin.Context) { - var data models.SysFileDir + var data models.SysFileDirOld data.UpdateBy = tools.GetUserIdStr(c) IDS := tools.IdsStrToIdsIntGroup("id", c) diff --git a/app/admin/apis/sysfile/sysfileinfo.go b/app/admin/apis/sysfile/sysfileinfo.go index 10ef4ce8..88708730 100644 --- a/app/admin/apis/sysfile/sysfileinfo.go +++ b/app/admin/apis/sysfile/sysfileinfo.go @@ -10,8 +10,8 @@ import ( "go-admin/tools/app/msg" ) -func GetSysFileInfoList(c *gin.Context) { - var data models.SysFileInfo +func GetSysFileInfoOldList(c *gin.Context) { + var data models.SysFileInfoOld var err error var pageSize = 10 var pageIndex = 1 @@ -36,8 +36,8 @@ func GetSysFileInfoList(c *gin.Context) { app.PageOK(c, result, count, pageIndex, pageSize, "") } -func GetSysFileInfo(c *gin.Context) { - var data models.SysFileInfo +func GetSysFileInfoOld(c *gin.Context) { + var data models.SysFileInfoOld data.Id, _ = tools.StringToInt(c.Param("id")) result, err := data.Get() tools.HasError(err, "抱歉未找到相关信息", -1) @@ -45,8 +45,8 @@ func GetSysFileInfo(c *gin.Context) { app.OK(c, result, "") } -func InsertSysFileInfo(c *gin.Context) { - var data models.SysFileInfo +func InsertSysFileInfoOld(c *gin.Context) { + var data models.SysFileInfoOld err := c.ShouldBindJSON(&data) data.CreateBy = tools.GetUserIdStr(c) tools.HasError(err, "", 500) @@ -55,8 +55,8 @@ func InsertSysFileInfo(c *gin.Context) { app.OK(c, result, "") } -func UpdateSysFileInfo(c *gin.Context) { - var data models.SysFileInfo +func UpdateSysFileInfoOld(c *gin.Context) { + var data models.SysFileInfoOld err := c.BindWith(&data, binding.JSON) tools.HasError(err, "数据解析失败", -1) data.UpdateBy = tools.GetUserIdStr(c) @@ -66,8 +66,8 @@ func UpdateSysFileInfo(c *gin.Context) { app.OK(c, result, "") } -func DeleteSysFileInfo(c *gin.Context) { - var data models.SysFileInfo +func DeleteSysFileInfoOld(c *gin.Context) { + var data models.SysFileInfoOld data.UpdateBy = tools.GetUserIdStr(c) IDS := tools.IdsStrToIdsIntGroup("id", c) diff --git a/app/admin/models/filedir.go b/app/admin/models/filedir.go index 2d1e243e..eb709341 100644 --- a/app/admin/models/filedir.go +++ b/app/admin/models/filedir.go @@ -5,7 +5,7 @@ import ( "go-admin/tools" ) -type SysFileDir struct { +type SysFileDirOld struct { Id int `json:"id"` Label string `json:"label" gorm:"type:varchar(255);"` // 名称 PId int `json:"pId" gorm:"type:int(11);"` // 父id @@ -13,19 +13,19 @@ type SysFileDir struct { Path string `json:"path" gorm:"size:255;"` // CreateBy string `json:"createBy" gorm:"type:varchar(128);"` // 创建人 UpdateBy string `json:"updateBy" gorm:"type:varchar(128);"` // 编辑人 - Children []SysFileDir `json:"children" gorm:"-"` + Children []SysFileDirOld `json:"children" gorm:"-"` DataScope string `json:"dataScope" gorm:"-"` Params string `json:"params" gorm:"-"` BaseModel } -func (SysFileDir) TableName() string { +func (SysFileDirOld) TableName() string { return "sys_file_dir" } -// 创建SysFileDir -func (e *SysFileDir) Create() (SysFileDir, error) { - var doc SysFileDir +// 创建SysFileDirOld +func (e *SysFileDirOld) Create() (SysFileDirOld, error) { + var doc SysFileDirOld result := orm.Eloquent.Table(e.TableName()).Create(&e) if result.Error != nil { err := result.Error @@ -34,7 +34,7 @@ func (e *SysFileDir) Create() (SysFileDir, error) { path := "/" + tools.IntToString(e.Id) if int(e.PId) != 0 { - var deptP SysFileDir + var deptP SysFileDirOld orm.Eloquent.Table(e.TableName()).Where("id = ?", e.PId).First(&deptP) path = deptP.Path + path } else { @@ -52,9 +52,9 @@ func (e *SysFileDir) Create() (SysFileDir, error) { return doc, nil } -// 获取SysFileDir -func (e *SysFileDir) Get() (SysFileDir, error) { - var doc SysFileDir +// 获取SysFileDirOld +func (e *SysFileDirOld) Get() (SysFileDirOld, error) { + var doc SysFileDirOld table := orm.Eloquent.Table(e.TableName()) if e.Id != 0 { @@ -67,19 +67,11 @@ func (e *SysFileDir) Get() (SysFileDir, error) { return doc, nil } -// 获取SysFileDir带分页 -func (e *SysFileDir) GetPage() ([]SysFileDir, int, error) { - var doc []SysFileDir +// 获取SysFileDirOld带分页 +func (e *SysFileDirOld) GetPage() ([]SysFileDirOld, int, error) { + var doc []SysFileDirOld table := orm.Eloquent.Table(e.TableName()) - - // 数据权限控制(如果不需要数据权限请将此处去掉) - //dataPermission := new(DataPermission) - //dataPermission.UserId, _ = tools.StringToInt(e.DataScope) - //table, err := dataPermission.GetDataScope(e.TableName(), table) - //if err != nil { - // return nil, 0, err - //} var count int64 if err := table.Find(&doc).Error; err != nil { @@ -89,15 +81,15 @@ func (e *SysFileDir) GetPage() ([]SysFileDir, int, error) { return doc, int(count), nil } -// 更新SysFileDir -func (e *SysFileDir) Update(id int) (update SysFileDir, err error) { +// 更新SysFileDirOld +func (e *SysFileDirOld) Update(id int) (update SysFileDirOld, err error) { if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).First(&update).Error; err != nil { return } path := "/" + tools.IntToString(e.Id) if int(e.Id) != 0 { - var deptP SysFileDir + var deptP SysFileDirOld orm.Eloquent.Table(e.TableName()).Where("id = ?", e.Id).First(&deptP) path = deptP.Path + path } else { @@ -105,21 +97,15 @@ func (e *SysFileDir) Update(id int) (update SysFileDir, err error) { } e.Path = path - //if e.Path != "" && e.Path != update.Path { - // return update, errors.New("上级不允许修改!") - //} - - //参数1:是要修改的数据 - //参数2:是修改的数据 if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { return } return } -// 删除SysFileDir -func (e *SysFileDir) Delete(id int) (success bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).Delete(&SysFileDir{}).Error; err != nil { +// 删除SysFileDirOld +func (e *SysFileDirOld) Delete(id int) (success bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).Delete(&SysFileDirOld{}).Error; err != nil { success = false return } @@ -128,47 +114,47 @@ func (e *SysFileDir) Delete(id int) (success bool, err error) { } //批量删除 -func (e *SysFileDir) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id in (?)", id).Delete(&SysFileDir{}).Error; err != nil { +func (e *SysFileDirOld) BatchDelete(id []int) (Result bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("id in (?)", id).Delete(&SysFileDirOld{}).Error; err != nil { return } Result = true return } -func (e *SysFileDir) SetSysFileDir() ([]SysFileDir, error) { +func (e *SysFileDirOld) SetSysFileDirOld() ([]SysFileDirOld, error) { list, _, err := e.GetPage() - m := make([]SysFileDir, 0) + m := make([]SysFileDirOld, 0) for i := 0; i < len(list); i++ { if list[i].PId != 0 { continue } - info := SysFileDirDigui(&list, list[i]) + info := SysFileDirOldDigui(&list, list[i]) m = append(m, info) } return m, err } -func SysFileDirDigui(deptlist *[]SysFileDir, menu SysFileDir) SysFileDir { +func SysFileDirOldDigui(deptlist *[]SysFileDirOld, menu SysFileDirOld) SysFileDirOld { list := *deptlist - min := make([]SysFileDir, 0) + min := make([]SysFileDirOld, 0) for j := 0; j < len(list); j++ { if menu.Id != list[j].PId { continue } - mi := SysFileDir{} + mi := SysFileDirOld{} mi.Id = list[j].Id mi.PId = list[j].PId mi.Label = list[j].Label mi.Sort = list[j].Sort mi.CreatedAt = list[j].CreatedAt mi.UpdatedAt = list[j].UpdatedAt - mi.Children = []SysFileDir{} - ms := SysFileDirDigui(deptlist, mi) + mi.Children = []SysFileDirOld{} + ms := SysFileDirOldDigui(deptlist, mi) min = append(min, ms) } diff --git a/app/admin/models/sys_file_dir.go b/app/admin/models/sys_file_dir.go new file mode 100644 index 00000000..457ea06b --- /dev/null +++ b/app/admin/models/sys_file_dir.go @@ -0,0 +1,41 @@ +package models + +import ( + "gorm.io/gorm" + + "go-admin/common/models" +) + +type SysFileDir struct { + gorm.Model + models.ControlBy + + Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 + PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 + Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 + Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 +} + +type SysFileDirL struct { + gorm.Model + models.ControlBy + + Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 + PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 + Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 + Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 + Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息 +} + +func (SysFileDir) TableName() string { /**/ + return "sys_file_dir" +} + +func (e *SysFileDir) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysFileDir) GetId() interface{} { + return e.ID +} diff --git a/app/admin/models/sys_file_info.go b/app/admin/models/sys_file_info.go new file mode 100644 index 00000000..cb90ac8c --- /dev/null +++ b/app/admin/models/sys_file_info.go @@ -0,0 +1,33 @@ +package models + +import ( + "gorm.io/gorm" + + "go-admin/common/models" +) + +type SysFileInfo struct { + gorm.Model + models.ControlBy + + Type string `json:"type" gorm:"type:varchar(255);comment:类型"` // + Name string `json:"name" gorm:"type:varchar(255);comment:名称"` // + Size string `json:"size" gorm:"type:int(11);comment:大小"` // + PId uint `json:"pId" gorm:"type:int(11);comment:目录"` // + Source string `json:"source" gorm:"type:varchar(255);comment:来源"` // + Url string `json:"url" gorm:"type:varchar(255);comment:地址"` // + FullUrl string `json:"fullUrl" gorm:"type:varchar(255);comment:全地址"` // +} + +func (SysFileInfo) TableName() string { + return "sys_file_info" +} + +func (e *SysFileInfo) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysFileInfo) GetId() interface{} { + return e.ID +} diff --git a/app/admin/models/sysfileinfo.go b/app/admin/models/sysfileinfo.go index e47e2573..6b7bfa80 100644 --- a/app/admin/models/sysfileinfo.go +++ b/app/admin/models/sysfileinfo.go @@ -4,7 +4,7 @@ import ( orm "go-admin/common/global" ) -type SysFileInfo struct { +type SysFileInfoOld struct { Id int `json:"id"` // id Type string `json:"type" gorm:"type:varchar(255);"` // 文件类型 Name string `json:"name" gorm:"type:varchar(255);"` // 文件名称 @@ -20,13 +20,13 @@ type SysFileInfo struct { BaseModel } -func (SysFileInfo) TableName() string { +func (SysFileInfoOld) TableName() string { return "sys_file_info" } -// 创建SysFileInfo -func (e *SysFileInfo) Create() (SysFileInfo, error) { - var doc SysFileInfo +// 创建SysFileInfoOld +func (e *SysFileInfoOld) Create() (SysFileInfoOld, error) { + var doc SysFileInfoOld result := orm.Eloquent.Table(e.TableName()).Create(&e) if result.Error != nil { err := result.Error @@ -36,9 +36,9 @@ func (e *SysFileInfo) Create() (SysFileInfo, error) { return doc, nil } -// 获取SysFileInfo -func (e *SysFileInfo) Get() (SysFileInfo, error) { - var doc SysFileInfo +// 获取SysFileInfoOld +func (e *SysFileInfoOld) Get() (SysFileInfoOld, error) { + var doc SysFileInfoOld table := orm.Eloquent.Table(e.TableName()) if e.Id != 0 { @@ -51,9 +51,9 @@ func (e *SysFileInfo) Get() (SysFileInfo, error) { return doc, nil } -// 获取SysFileInfo带分页 -func (e *SysFileInfo) GetPage(pageSize int, pageIndex int) ([]SysFileInfo, int, error) { - var doc []SysFileInfo +// 获取SysFileInfoOld带分页 +func (e *SysFileInfoOld) GetPage(pageSize int, pageIndex int) ([]SysFileInfoOld, int, error) { + var doc []SysFileInfoOld table := orm.Eloquent.Table(e.TableName()) @@ -77,8 +77,8 @@ func (e *SysFileInfo) GetPage(pageSize int, pageIndex int) ([]SysFileInfo, int, return doc, int(count), nil } -// 更新SysFileInfo -func (e *SysFileInfo) Update(id int) (update SysFileInfo, err error) { +// 更新SysFileInfoOld +func (e *SysFileInfoOld) Update(id int) (update SysFileInfoOld, err error) { if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).First(&update).Error; err != nil { return } @@ -91,9 +91,9 @@ func (e *SysFileInfo) Update(id int) (update SysFileInfo, err error) { return } -// 删除SysFileInfo -func (e *SysFileInfo) Delete(id int) (success bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).Delete(&SysFileInfo{}).Error; err != nil { +// 删除SysFileInfoOld +func (e *SysFileInfoOld) Delete(id int) (success bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).Delete(&SysFileInfoOld{}).Error; err != nil { success = false return } @@ -102,8 +102,8 @@ func (e *SysFileInfo) Delete(id int) (success bool, err error) { } //批量删除 -func (e *SysFileInfo) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id in (?)", id).Delete(&SysFileInfo{}).Error; err != nil { +func (e *SysFileInfoOld) BatchDelete(id []int) (Result bool, err error) { + if err = orm.Eloquent.Table(e.TableName()).Where("id in (?)", id).Delete(&SysFileInfoOld{}).Error; err != nil { return } Result = true diff --git a/app/admin/router/router.go b/app/admin/router/router.go index 991e2dd8..a69b59d5 100644 --- a/app/admin/router/router.go +++ b/app/admin/router/router.go @@ -35,8 +35,7 @@ func examplesNoCheckRoleRouter(r *gin.Engine) { } // {{无需认证路由自动补充在此处请勿删除}} - registerSysFileInfoRouter(v1) - registerSysFileDirRouter(v1) + //registerSysFileInfoRouter(v1) } // 需要认证的路由示例 diff --git a/app/admin/router/sys_file_dir.go b/app/admin/router/sys_file_dir.go new file mode 100644 index 00000000..45cb49e9 --- /dev/null +++ b/app/admin/router/sys_file_dir.go @@ -0,0 +1,25 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/sys_file" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysFileDirRouter) +} + +// 需认证的路由代码 +func registerSysFileDirRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &sys_file.SysFileDir{} + r := v1.Group("/sysfiledir").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetSysFileDirList) + r.GET("/:id", api.GetSysFileDir) + r.POST("", api.InsertSysFileDir) + r.PUT("/:id", api.UpdateSysFileDir) + r.DELETE("/:id", api.DeleteSysFileDir) + } +} diff --git a/app/admin/router/sys_file_info.go b/app/admin/router/sys_file_info.go new file mode 100644 index 00000000..d7409ffe --- /dev/null +++ b/app/admin/router/sys_file_info.go @@ -0,0 +1,25 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/sys_file" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysFileInfoRouter) +} + +// 需认证的路由代码 +func registerSysFileInfoRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &sys_file.SysFileInfo{} + r := v1.Group("/sysfileinfo").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetSysFileInfoList) + r.GET("/:id", api.GetSysFileInfo) + r.POST("", api.InsertSysFileInfo) + r.PUT("/:id", api.UpdateSysFileInfo) + r.DELETE("/:id", api.DeleteSysFileInfo) + } +} diff --git a/app/admin/router/sysfileinfo.go b/app/admin/router/sysfileinfo.go deleted file mode 100644 index 0a684ba2..00000000 --- a/app/admin/router/sysfileinfo.go +++ /dev/null @@ -1,34 +0,0 @@ -package router - -import ( - "github.com/gin-gonic/gin" - "go-admin/app/admin/apis/sysfile" -) - -// 无需认证的路由代码 -func registerSysFileInfoRouter(v1 *gin.RouterGroup) { - - v1.GET("/sysfileinfoList", sysfile.GetSysFileInfoList) - - r := v1.Group("/sysfileinfo") - { - r.GET("/:id", sysfile.GetSysFileInfo) - r.POST("", sysfile.InsertSysFileInfo) - r.PUT("", sysfile.UpdateSysFileInfo) - r.DELETE("/:id", sysfile.DeleteSysFileInfo) - } -} - -// 无需认证的路由代码 -func registerSysFileDirRouter(v1 *gin.RouterGroup) { - - v1.GET("/sysfiledirList", sysfile.GetSysFileDirList) - - r := v1.Group("/sysfiledir") - { - r.GET("/:id", sysfile.GetSysFileDir) - r.POST("", sysfile.InsertSysFileDir) - r.PUT("", sysfile.UpdateSysFileDir) - r.DELETE("/:id", sysfile.DeleteSysFileDir) - } -} diff --git a/app/admin/service/dto/sys_file_dir.go b/app/admin/service/dto/sys_file_dir.go new file mode 100644 index 00000000..489bde19 --- /dev/null +++ b/app/admin/service/dto/sys_file_dir.go @@ -0,0 +1,94 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "gorm.io/gorm" + + "go-admin/app/admin/models" + "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" +) + +type SysFileDirSearch struct { + dto.Pagination `search:"-"` + + ID uint `form:"ID" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"` + Label string `form:"label" search:"type:exact;column:label;table:sys_file_dir" comment:"目录名称"` + PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_dir" comment:"上级目录"` + Sort string `form:"sort" search:"type:exact;column:sort;table:sys_file_dir" comment:"排序"` + Path string `form:"path" search:"type:exact;column:path;table:sys_file_dir" comment:"路径"` +} + +func (m *SysFileDirSearch) GetNeedSearch() interface{} { + return *m +} + +func (m *SysFileDirSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +func (m *SysFileDirSearch) Generate() dto.Index { + o := *m + return &o +} + +type SysFileDirControl struct { + ID uint `uri:"ID" comment:"标识"` // 标识 + Label string `json:"label" comment:"目录名称"` + PId uint `json:"pId" comment:"上级目录"` + Sort string `json:"sort" comment:"排序"` + Path string `json:"path" comment:"路径"` +} + +func (s *SysFileDirControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysFileDirControl) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) { + return &models.SysFileDir{ + Model: gorm.Model{ID: s.ID}, + Label: s.Label, + PId: s.PId, + Sort: s.Sort, + Path: s.Path, + }, nil +} + +func (s *SysFileDirControl) GetId() interface{} { + return s.ID +} + +type SysFileDirById struct { + dto.ObjectById +} + +func (s *SysFileDirById) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysFileDirById) GenerateM() (common.ActiveRecord, error) { + return &models.SysFileDir{}, nil +} diff --git a/app/admin/service/dto/sysfileinfo.go b/app/admin/service/dto/sysfileinfo.go new file mode 100644 index 00000000..52cd7128 --- /dev/null +++ b/app/admin/service/dto/sysfileinfo.go @@ -0,0 +1,104 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "gorm.io/gorm" + + "go-admin/app/admin/models" + "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" +) + +type SysFileInfoSearch struct { + dto.Pagination `search:"-"` + ID uint `form:"ID" search:"type:exact;column:id;table:sys_file_info" comment:"标识"` + + Type string `form:"type" search:"type:exact;column:type;table:sys_file_info" comment:"类型"` + + Name string `form:"name" search:"type:exact;column:name;table:sys_file_info" comment:"名称"` + + PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_info" comment:"目录"` + + Source string `form:"source" search:"type:exact;column:source;table:sys_file_info" comment:"来源"` +} + +func (m *SysFileInfoSearch) GetNeedSearch() interface{} { + return *m +} + +func (m *SysFileInfoSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +func (m *SysFileInfoSearch) Generate() dto.Index { + o := *m + return &o +} + +type SysFileInfoControl struct { + ID uint `uri:"ID" comment:"标识"` // 标识 + Type string `json:"type" comment:"类型"` + Name string `json:"name" comment:"名称"` + Size string `json:"size" comment:"大小"` + PId uint `json:"pId" comment:"目录"` + Source string `json:"source" comment:"来源"` + Url string `json:"url" comment:"地址"` + FullUrl string `json:"fullUrl" comment:"全地址"` +} + +func (s *SysFileInfoControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysFileInfoControl) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysFileInfoControl) GenerateM() (common.ActiveRecord, error) { + return &models.SysFileInfo{ + + Model: gorm.Model{ID: s.ID}, + Type: s.Type, + Name: s.Name, + Size: s.Size, + PId: s.PId, + Source: s.Source, + Url: s.Url, + FullUrl: s.FullUrl, + }, nil +} + +func (s *SysFileInfoControl) GetId() interface{} { + return s.ID +} + +type SysFileInfoById struct { + dto.ObjectById +} + +func (s *SysFileInfoById) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysFileInfoById) GenerateM() (common.ActiveRecord, error) { + return &models.SysFileInfo{}, nil +} diff --git a/app/admin/service/sys_file_dir.go b/app/admin/service/sys_file_dir.go new file mode 100644 index 00000000..5fd0f3fc --- /dev/null +++ b/app/admin/service/sys_file_dir.go @@ -0,0 +1,171 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models" + "go-admin/common/actions" + cDto "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/common/service" + "go-admin/tools" + "gorm.io/gorm" +) + +type SysFileDir struct { + service.Service +} + +// GetSysFileDirPage 获取SysFileDir列表 +func (e *SysFileDir) GetSysFileDirPage(c cDto.Index, list *[]models.SysFileDirL) error { + var err error + var data models.SysFileDir + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + //cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list). //Limit(-1).Offset(-1). + Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysFileDir 获取SysFileDir对象 +func (e *SysFileDir) GetSysFileDir(d cDto.Control, model *models.SysFileDir) error { + var err error + var data models.SysFileDir + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysFileDir 创建SysFileDir对象 +func (e *SysFileDir) InsertSysFileDir(model common.ActiveRecord) error { + var err error + var data models.SysFileDir + msgID := e.MsgID + + db := e.Orm.Model(&data). + Create(model) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + id := model.GetId() + path := "/" + tools.UIntToString(id.(uint)) + db = e.Orm.Model(&data). + First(&data, model.GetId()) + err = db.Error + + if data.PId != 0 { + var dept models.SysFileDir + e.Orm.Model(&data).Where("id = ?", data.PId).First(&dept) + path = dept.Path + path + } else { + path = "/0" + path + } + //var mp = map[string]string{} + //mp["path"] = path + if err := e.Orm.Model(&data).Where("id = ?", data.ID).Update("path",path).Error; err != nil { + return err + } + + return nil +} + +// UpdateSysFileDir 修改SysFileDir对象 +func (e *SysFileDir) UpdateSysFileDir(c common.ActiveRecord, p *actions.DataPermission) error { + var err error + var data models.SysFileDir + msgID := e.MsgID + + db := e.Orm.Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ).Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysFileDir 删除SysFileDir +func (e *SysFileDir) RemoveSysFileDir(d cDto.Control, c common.ActiveRecord, p *actions.DataPermission) error { + var err error + var data models.SysFileDir + msgID := e.MsgID + + db := e.Orm.Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ).Where(d.GetId()).Delete(c) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} + +func (e *SysFileDir) SetSysFileDir(c cDto.Index) (*[]models.SysFileDirL, error) { + var list []models.SysFileDirL + err := e.GetSysFileDirPage(c, &list) + m := make([]models.SysFileDirL, 0) + for i := 0; i < len(list); i++ { + if list[i].PId != 0 { + continue + } + info := SysFileDirCall(&list, list[i]) + m = append(m, info) + } + return &m, err +} + +func SysFileDirCall(list *[]models.SysFileDirL, m models.SysFileDirL) models.SysFileDirL { + listGroup := *list + min := make([]models.SysFileDirL, 0) + for j := 0; j < len(listGroup); j++ { + if m.ID != listGroup[j].PId { + continue + } + mi := models.SysFileDirL{} + mi.ID = listGroup[j].ID + mi.PId = listGroup[j].PId + mi.Label = listGroup[j].Label + mi.Sort = listGroup[j].Sort + mi.CreatedAt = listGroup[j].CreatedAt + mi.UpdatedAt = listGroup[j].UpdatedAt + mi.Children = []models.SysFileDirL{} + ms := SysFileDirCall(list, mi) + min = append(min, ms) + } + m.Children = min + return m +} diff --git a/app/admin/service/sysfileinfo.go b/app/admin/service/sysfileinfo.go new file mode 100644 index 00000000..a2983471 --- /dev/null +++ b/app/admin/service/sysfileinfo.go @@ -0,0 +1,119 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models" + "go-admin/common/actions" + cDto "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/common/service" + "gorm.io/gorm" +) + +type SysFileInfo struct { + service.Service +} + +// GetSysFileInfoPage 获取SysFileInfo列表 +func (e *SysFileInfo) GetSysFileInfoPage(c cDto.Index, p *actions.DataPermission, list *[]models.SysFileInfo, count *int64) error { + var err error + var data models.SysFileInfo + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + actions.Permission(data.TableName(), p), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysFileInfo 获取SysFileInfo对象 +func (e *SysFileInfo) GetSysFileInfo(d cDto.Control, p *actions.DataPermission, model *models.SysFileInfo) error { + var err error + var data models.SysFileInfo + msgID := e.MsgID + + db := e.Orm.Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysFileInfo 创建SysFileInfo对象 +func (e *SysFileInfo) InsertSysFileInfo(model common.ActiveRecord) error { + var err error + var data models.SysFileInfo + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// UpdateSysFileInfo 修改SysFileInfo对象 +func (e *SysFileInfo) UpdateSysFileInfo(c common.ActiveRecord, p *actions.DataPermission) error { + var err error + var data models.SysFileInfo + msgID := e.MsgID + + db := e.Orm.Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ).Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysFileInfo 删除SysFileInfo +func (e *SysFileInfo) RemoveSysFileInfo(d cDto.Control, c common.ActiveRecord, p *actions.DataPermission) error { + var err error + var data models.SysFileInfo + msgID := e.MsgID + + db := e.Orm.Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ).Where(d.GetId()).Delete(c) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} \ No newline at end of file diff --git a/cmd/migrate/migration/version/1600089797118_migrate.go b/cmd/migrate/migration/version/1600089797118_migrate.go index e84b032b..12b603ba 100644 --- a/cmd/migrate/migration/version/1600089797118_migrate.go +++ b/cmd/migrate/migration/version/1600089797118_migrate.go @@ -18,12 +18,14 @@ func init() { func _1600089797118Migrate(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { f := &models.SysFileDir{ - Label: "根目录", - PId: 0, - Sort: 0, - Path: "", - CreateBy: "1", - UpdateBy: "1", + Label: "根目录", + PId: 0, + Sort: "0", + Path: "", + ControlBy: common.ControlBy{ + CreateBy: 1, + UpdateBy: 1, + }, } err := tx.Create(f).Error if err != nil { diff --git a/common/file_store/initialize.go b/common/file_store/initialize.go new file mode 100644 index 00000000..20f93911 --- /dev/null +++ b/common/file_store/initialize.go @@ -0,0 +1,14 @@ +package file_store + +type FileStore struct { + +} + +// Setup 配置数据库 +func (e *FileStore) Setup(driver string) { + //fileStoreType := driver + //if fileStoreType == "ALiYunOSS" { + // var store = new(ALiYunOSS) + // store.Setup() + //} +} diff --git a/common/file_store/interface.go b/common/file_store/interface.go new file mode 100644 index 00000000..f22f6a74 --- /dev/null +++ b/common/file_store/interface.go @@ -0,0 +1,6 @@ +package file_store + +type FileStoreType interface { + Setup() error + UpLoad(yourObjectName string, localFile string) error +} \ No newline at end of file diff --git a/common/file_store/oss.go b/common/file_store/oss.go new file mode 100644 index 00000000..b9ae6623 --- /dev/null +++ b/common/file_store/oss.go @@ -0,0 +1,54 @@ +package file_store + +import ( + "github.com/aliyun/aliyun-oss-go-sdk/oss" + "log" +) + +type ALiYunOSS struct { + Client interface{} + Endpoint string + AccessKeyId string + AccessKeySecret string + BucketName string +} + +func (e *ALiYunOSS) Setup() error { + e.AccessKeyId = "LTAI4G3S4hDLxg6Zmu4UTBwG" + e.AccessKeySecret = "C8sj70orL03bwk6wNXX0jbNjAbLCb8" + e.Endpoint = "oss-cn-shanghai.aliyuncs.com" + e.BucketName = "youshikeji" + + client, err := oss.New(e.Endpoint, e.AccessKeyId, e.AccessKeySecret) + if err != nil { + log.Println("Error:", err) + return err + } + e.Client = client + return nil +} + +// UpLoad 文件上传 +func (e *ALiYunOSS) UpLoad(yourObjectName string, localFile string) error { + err := e.Setup() + if err != nil { + log.Println("Error:", err) + return err + } + // 获取存储空间。 + bucket, err := e.Client.(*oss.Client).Bucket(e.BucketName) + if err != nil { + log.Println("Error:", err) + return err + } + + // 设置分片大小为100 KB,指定分片上传并发数为3,并开启断点续传上传。 + // 其中与objectKey是同一概念,表示断点续传上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。 + // "LocalFile"为filePath,100*1024为partSize。 + err = bucket.UploadFile(yourObjectName, localFile, 100*1024, oss.Routines(3), oss.Checkpoint(true, "")) + if err != nil { + log.Println("Error:", err) + return err + } + return nil +} diff --git a/go.mod b/go.mod index 73a45432..15683b98 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.14 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/alibaba/sentinel-golang v0.6.1 + github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5 github.com/casbin/casbin/v2 v2.11.2 github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible @@ -21,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.1.0 github.com/robfig/cron/v3 v3.0.1 github.com/satori/go.uuid v1.2.0 - github.com/shamsher31/goimgext v1.0.0 // indirect + github.com/shamsher31/goimgext v1.0.0 github.com/shamsher31/goimgtype v1.0.0 github.com/shirou/gopsutil v2.20.7+incompatible github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect diff --git a/go.sum b/go.sum index 8f8c2786..833d1ada 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,7 @@ github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocm github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= @@ -36,6 +37,7 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c/go.mod h1:7xhjOwRV2+0HXGmM0jxaEu+ZiXJFoVZOTfL/dmqbrD8= +github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks= @@ -47,6 +49,7 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.0/go.mod h1:zpDJeKyp9ScW4NNrbdr+Eyxvry3ilGPewKoXw3XGN1k= github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE= @@ -59,6 +62,7 @@ github.com/alibaba/sentinel-golang v0.6.1 h1:Pxyw2X7ryklvToF40KG9l4uuO90jRZA2MWb github.com/alibaba/sentinel-golang v0.6.1/go.mod h1:5jemKdyCQCKVf+quEia53fo9a17OSe+wnl9HX2NbNpc= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190808125512-07798873deee/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ= github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk= +github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5 h1:nWDRPCyCltiTsANwC/n3QZH7Vww33Npq9MKqlwRzI/c= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= @@ -69,6 +73,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -79,6 +84,7 @@ github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngE github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= github.com/bsm/redislock v0.6.0/go.mod h1:3Kgu+cXw0JrkZ5pmY/JbcFpixGZ5M9v9G2PGWYqku+k= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= @@ -96,6 +102,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= +github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= @@ -121,8 +128,10 @@ github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMEl github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= @@ -148,6 +157,7 @@ github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2Vvl github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -156,6 +166,7 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -167,6 +178,7 @@ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmC github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= +github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0 h1:rdQovo0JtjoBTUQzzrTqnXxxFi4etuhvXrUZHwI9z7w= github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= @@ -186,6 +198,7 @@ github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -203,6 +216,7 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -212,9 +226,11 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-redis/redis v6.15.7+incompatible h1:3skhDh95XQMpnqeqNftPkQD9jL9e5e36z/1SUm6dy1U= github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -224,6 +240,7 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22 github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -259,6 +276,7 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -273,6 +291,7 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -319,12 +338,16 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -342,6 +365,7 @@ github.com/jackc/pgconn v1.6.4 h1:S7T6cx5o2OqmxdHaXLH1ZeD1SbI8jBznyYE9Ec0RCQ8= github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= @@ -391,10 +415,13 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -410,8 +437,10 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= @@ -426,6 +455,7 @@ github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPp github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA= github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ= @@ -440,11 +470,13 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN github.com/marten-seemann/chacha20 v0.2.0/go.mod h1:HSdjFau7GzYRj+ahFNwsO3ouVJr1HFkWoEwNDb4TMtE= github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= github.com/marten-seemann/qtls v0.4.1/go.mod h1:pxVXcHHw1pNIt8Qo0pwSYQEoZ8yYOOPXTCZLQQunvRc= +github.com/matchstalk/redisqueue v1.0.3 h1:ZRrEhnvA6/YxLu2EbzdZYeQHQQYT8yZBAi1qv/USEQA= github.com/matchstalk/redisqueue v1.0.3/go.mod h1:5DZ3X4w9t+6Wv9vz9wmUt/i15gsOorGXRnqzGhBP6zI= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -462,9 +494,11 @@ github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/ github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= +github.com/mattn/goveralls v0.0.5 h1:spfq8AyZ0cCk57Za6/juJ5btQxeE1FaEGMdfcI+XO48= github.com/mattn/goveralls v0.0.5/go.mod h1:Xg2LHi51faXLyKXwsndxiW6uxEEQT9+3sjGzzwU4xy0= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= @@ -483,8 +517,10 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0= github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY= @@ -501,6 +537,7 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk= github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw= @@ -512,10 +549,12 @@ github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXW github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -542,6 +581,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -573,6 +613,7 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/robinjoseph08/redisqueue/v2 v2.1.0 h1:GactHlrxS8YSCJc4CbP1KbTObo14pieNmNWSUlquTGI= github.com/robinjoseph08/redisqueue/v2 v2.1.0/go.mod h1:fiNYBqIF/DqZxKvO6faLB6nkBtfJucuM+rDbFhZG1vs= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -594,16 +635,20 @@ github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w= github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -623,11 +668,13 @@ github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -645,6 +692,7 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE= github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY= +github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY= github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -660,8 +708,10 @@ github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8 github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.3 h1:FpNT6zq26xNpHZy08emi755QwzLPs6Pukqjlc7RfOMU= github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -747,6 +797,7 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -848,6 +899,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -932,13 +984,16 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= +gopkg.in/AlecAivazis/survey.v1 v1.8.8 h1:5UtTowJZTz1j7NxVzDGKTz6Lm9IWm8DDF6b7a2wq9VY= gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= @@ -949,12 +1004,14 @@ gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/kyokomi/emoji.v1 v1.5.1 h1:beetH5mWDMzFznJ+Qzd5KVHp79YKhVUMcdO8LpRLeGw= gopkg.in/kyokomi/emoji.v1 v1.5.1/go.mod h1:N9AZ6hi1jHOPn34PsbpufQZUcKftSD7WgS2pgpmH4Lg= gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiVLxyifmMBrBIuCWFBPYKbRssXB9z67Hw= gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= diff --git a/pkg/utils/file.go b/pkg/utils/file.go index 47c87ce6..f6be68c7 100644 --- a/pkg/utils/file.go +++ b/pkg/utils/file.go @@ -1,39 +1,45 @@ package utils import ( + "errors" "io/ioutil" + "log" "mime/multipart" + "net/http" "os" "path" + "strings" + + "github.com/shamsher31/goimgext" ) -// 获取文件大小 +// GetSize 获取文件大小 func GetSize(f multipart.File) (int, error) { content, err := ioutil.ReadAll(f) return len(content), err } -// 获取文件后缀 +// GetExt 获取文件后缀 func GetExt(fileName string) string { return path.Ext(fileName) } -//检查文件是否存在 +// CheckExist 检查文件是否存在 func CheckExist(src string) bool { _, err := os.Stat(src) return os.IsNotExist(err) } -// 检查文件权限 +// CheckPermission 检查文件权限 func CheckPermission(src string) bool { _, err := os.Stat(src) return os.IsPermission(err) } -//如果不存在则新建文件夹 +// IsNotExistMkDir 如果不存在则新建文件夹 func IsNotExistMkDir(src string) error { if exist := CheckExist(src); exist == false { if err := MkDir(src); err != nil { @@ -44,7 +50,7 @@ func IsNotExistMkDir(src string) error { return nil } -//新建文件夹 +// MkDir 新建文件夹 func MkDir(src string) error { err := os.MkdirAll(src, os.ModePerm) if err != nil { @@ -54,7 +60,7 @@ func MkDir(src string) error { return nil } -// 打开文件 +// Open 打开文件 func Open(name string, flag int, perm os.FileMode) (*os.File, error) { f, err := os.OpenFile(name, flag, perm) if err != nil { @@ -63,3 +69,59 @@ func Open(name string, flag int, perm os.FileMode) (*os.File, error) { return f, nil } + +// GetImgType 获取Img文件类型 +func GetImgType(p string) (string, error) { + file, err := os.Open(p) + + if err != nil { + log.Println(err) + os.Exit(1) + } + + buff := make([]byte, 512) + + _, err = file.Read(buff) + + if err != nil { + log.Println(err) + os.Exit(1) + } + + filetype := http.DetectContentType(buff) + + ext := imgext.Get() + + for i := 0; i < len(ext); i++ { + if strings.Contains(ext[i], filetype[6:len(filetype)]) { + return filetype, nil + } + } + + return "", errors.New("Invalid image type") +} + +// GetType 获取文件类型 +func GetType(p string) (string, error) { + file, err := os.Open(p) + + if err != nil { + log.Println(err) + os.Exit(1) + } + + buff := make([]byte, 512) + + _, err = file.Read(buff) + + if err != nil { + log.Println(err) + } + + filetype := http.DetectContentType(buff) + + //ext := GetExt(p) + //var list = strings.Split(filetype, "/") + //filetype = list[0] + "/" + ext + return filetype, nil +} diff --git a/tools/int.go b/tools/int.go index d5190563..3e5a63e4 100644 --- a/tools/int.go +++ b/tools/int.go @@ -9,6 +9,10 @@ func IntToString(e int) string { return strconv.Itoa(e) } +func UIntToString(e uint) string { + return strconv.Itoa(int(e)) +} + func Int64ToString(e int64) string { return strconv.FormatInt(e, 10) } From f1e521522a5c472cb6168175a0e683a4e0c265ab Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sat, 14 Nov 2020 00:16:50 +0800 Subject: [PATCH 037/201] =?UTF-8?q?perf=F0=9F=91=8C=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E9=80=89=E6=8B=A9=E7=BB=84=E4=BB=B6=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=BB=93=E6=9E=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 8196 bytes app/admin/service/sys_file_dir.go | 9 +++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0d9d57db1df229185084ef27c7cfe2bf2b044853 GIT binary patch literal 8196 zcmeHM-A)rh6h1>s*%pnMn1FYCW8wu82u38vq!zd!5o4@T6E(2gR#@5Y)^=;bTGJcf z!RQnCD!zcP;9KZ-&MeLTfS1O=Ofz$)yWe;AoNs1#J5wT3wSIGjXn}|mOF@sQKn``NlR7{WJa}sC4=Mgk$Lj`!HES}^3E8ZRSIY<{qUGhE zYN}A2F3nh0#j0GcysjUFgL>pd{a(%KzT|I@o#?=g`%lBrpY$E~nb#WZ&RyFGgUIoM zR#(Vgvjxbj=U&hZ2eq&tG<)Kwu1{E2*(&eOT^|ltZm%yd+N*chM~n7wZ4Ld~t9M4D zvNeBW<^J|w`}o7~Qg&CB7~7kVJq~IwrPX5=n>V?@)a`vc@$He8DJdjS_MEOs`M2U#xRAp zXa{JXO}x{UpGzG5Q6l=Qm>Z7FKL_4hbPF6kAD8GY_0Z4EcF8H}p#Tquw4aHKvq+*Y z(G%qR0JD8Z@@`2!`RqBLB(I#|8&Kv{V>{LsM^OIxMnL9wx_ST0Fqr0oDewpOcz5^! literal 0 HcmV?d00001 diff --git a/app/admin/service/sys_file_dir.go b/app/admin/service/sys_file_dir.go index 5fd0f3fc..77852f8c 100644 --- a/app/admin/service/sys_file_dir.go +++ b/app/admin/service/sys_file_dir.go @@ -84,7 +84,7 @@ func (e *SysFileDir) InsertSysFileDir(model common.ActiveRecord) error { } //var mp = map[string]string{} //mp["path"] = path - if err := e.Orm.Model(&data).Where("id = ?", data.ID).Update("path",path).Error; err != nil { + if err := e.Orm.Model(&data).Where("id = ?", data.ID).Update("path", path).Error; err != nil { return err } @@ -166,6 +166,11 @@ func SysFileDirCall(list *[]models.SysFileDirL, m models.SysFileDirL) models.Sys ms := SysFileDirCall(list, mi) min = append(min, ms) } - m.Children = min + if len(min) > 0 { + m.Children = min + } else { + m.Children = nil + } + return m } From 5714ffde7bb7268d9dc08adecb199b02a7041e06 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sat, 14 Nov 2020 01:02:02 +0800 Subject: [PATCH 038/201] =?UTF-8?q?fix=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=9D=9E=E7=AE=A1=E7=90=86=E5=91=98=E8=A7=92=E8=89=B2=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=85=8D=E7=BD=AE=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=88#292=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/menu.go | 9 ++++++--- app/admin/models/menu.go | 30 +++++++++++++++++------------- app/admin/models/role.go | 22 +++++++++++++++++++++- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/app/admin/apis/system/menu.go b/app/admin/apis/system/menu.go index abe1fa76..ffe65e03 100644 --- a/app/admin/apis/system/menu.go +++ b/app/admin/apis/system/menu.go @@ -53,10 +53,13 @@ func GetMenuTreeRoleselect(c *gin.Context) { id, err := tools.StringToInt(c.Param("roleId")) SysRole.RoleId = id + //var r *models.SysRole + r, err := SysRole.Get() + var result *[]models.MenuLable menuIds := make([]int, 0) - if tools.GetRoleName(c) != "admin" { - result, err = Menu.SetMenuLable() + if r.RoleKey != "admin" { + result, err = Menu.SetMenuLabel() tools.HasError(err, "抱歉未找到相关信息", -1) if id != 0 { menuIds, err = SysRole.GetRoleMeunId() @@ -81,7 +84,7 @@ func GetMenuTreeRoleselect(c *gin.Context) { // @Security Bearer func GetMenuTreeelect(c *gin.Context) { var data models.Menu - result, err := data.SetMenuLable() + result, err := data.SetMenuLabel() tools.HasError(err, "抱歉未找到相关信息", -1) app.OK(c, result, "") } diff --git a/app/admin/models/menu.go b/app/admin/models/menu.go index 5c26633b..a50175db 100644 --- a/app/admin/models/menu.go +++ b/app/admin/models/menu.go @@ -146,7 +146,7 @@ func DiguiMenu(menulist *[]Menu, menu Menu) Menu { return menu } -func (e *Menu) SetMenuLable() (m *[]MenuLable, err error) { +func (e *Menu) SetMenuLabel() (m *[]MenuLable, err error) { menulist, err := e.Get() ml := make([]MenuLable, 0) @@ -157,14 +157,14 @@ func (e *Menu) SetMenuLable() (m *[]MenuLable, err error) { e := MenuLable{} e.Id = menulist[i].MenuId e.Label = menulist[i].Title - menusInfo := DiguiMenuLable(&menulist, e) + menusInfo := MenuLabelCall(&menulist, e) ml = append(ml, menusInfo) } return &ml, err } -func DiguiMenuLable(menulist *[]Menu, menu MenuLable) MenuLable { +func MenuLabelCall(menulist *[]Menu, menu MenuLable) MenuLable { list := *menulist min := make([]MenuLable, 0) @@ -178,27 +178,31 @@ func DiguiMenuLable(menulist *[]Menu, menu MenuLable) MenuLable { mi.Label = list[j].Title mi.Children = []MenuLable{} if list[j].MenuType != "F" { - ms := DiguiMenuLable(menulist, mi) + ms := MenuLabelCall(menulist, mi) min = append(min, ms) } else { min = append(min, mi) } } - menu.Children = min + if len(min) > 0 { + menu.Children = min + } else { + menu.Children = nil + } return menu } -func (e *Menu) SetMenuRole(rolename string) (m []Menu, err error) { +func (e *Menu) SetMenuRole(roleName string) (m []Menu, err error) { - menulist, err := e.GetByRoleName(rolename) + menus, err := e.GetByRoleName(roleName) m = make([]Menu, 0) - for i := 0; i < len(menulist); i++ { - if menulist[i].ParentId != 0 { + for i := 0; i < len(menus); i++ { + if menus[i].ParentId != 0 { continue } - menusInfo := DiguiMenu(&menulist, menulist[i]) + menusInfo := DiguiMenu(&menus, menus[i]) m = append(m, menusInfo) } @@ -216,14 +220,14 @@ func (e *MenuRole) Get() (Menus []MenuRole, err error) { return } -func (e *Menu) GetByRoleName(rolename string) (Menus []Menu, err error) { +func (e *Menu) GetByRoleName(roleName string) (Menus []Menu, err error) { var table *gorm.DB - if rolename == "admin" { + if roleName == "admin" { table = orm.Eloquent.Table(e.TableName()).Select("sys_menu.*") table = table.Where(" menu_type in ('M','C')") } else { table = orm.Eloquent.Table(e.TableName()).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id") - table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", rolename) + table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", roleName) } if err = table.Order("sort").Find(&Menus).Error; err != nil { return diff --git a/app/admin/models/role.go b/app/admin/models/role.go index 1a0bf2db..ec125b83 100644 --- a/app/admin/models/role.go +++ b/app/admin/models/role.go @@ -88,6 +88,21 @@ func (role *SysRole) Get() (SysRole SysRole, err error) { return } +func (role *SysRole) GetOne(sysRole *SysRole) (err error) { + table := orm.Eloquent.Table("sys_role") + if role.RoleId != 0 { + table = table.Where("role_id = ?", role.RoleId) + } + if role.RoleName != "" { + table = table.Where("role_name = ?", role.RoleName) + } + if err = table.First(sysRole).Error; err != nil { + return + } + + return +} + func (role *SysRole) GetList() (SysRole []SysRole, err error) { table := orm.Eloquent.Table("sys_role") if role.RoleId != 0 { @@ -107,7 +122,12 @@ func (role *SysRole) GetList() (SysRole []SysRole, err error) { func (role *SysRole) GetRoleMeunId() ([]int, error) { menuIds := make([]int, 0) menuList := make([]MenuIdList, 0) - if err := orm.Eloquent.Table("sys_role_menu").Select("sys_role_menu.menu_id").Where("role_id = ? ", role.RoleId).Where(" sys_role_menu.menu_id not in(select sys_menu.parent_id from sys_role_menu LEFT JOIN sys_menu on sys_menu.menu_id=sys_role_menu.menu_id where role_id =? and parent_id is not null)", role.RoleId).Find(&menuList).Error; err != nil { + if err := orm.Eloquent.Table("sys_role_menu"). + Select("sys_role_menu.menu_id"). + Where("role_id = ? ", role.RoleId). + Where(" sys_role_menu.menu_id not in(select sys_menu.parent_id from sys_role_menu " + + "LEFT JOIN sys_menu on sys_menu.menu_id=sys_role_menu.menu_id where role_id =? and parent_id is not null)", role.RoleId). + Find(&menuList).Error; err != nil { return nil, err } From a06da857f32569afe402f49bac985ee93c1edd10 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sat, 14 Nov 2020 22:12:15 +0800 Subject: [PATCH 039/201] =?UTF-8?q?fix=F0=9F=90=9B=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8E=BB=E6=8E=89=E6=8E=92=E5=BA=8F=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + app/admin/models/sys_file_dir.go | 4 ++-- app/admin/service/dto/sys_file_dir.go | 6 +++--- app/admin/service/sys_file_dir.go | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 4604070d..f60c92c5 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ config/settings.dev.yml.log config/settings.b.dev.yml cmd/migrate/migration/version-local/* !cmd/migrate/migration/version-local/doc.go +*/.DS_Store diff --git a/app/admin/models/sys_file_dir.go b/app/admin/models/sys_file_dir.go index 457ea06b..1254d436 100644 --- a/app/admin/models/sys_file_dir.go +++ b/app/admin/models/sys_file_dir.go @@ -12,7 +12,7 @@ type SysFileDir struct { Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 - Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 + //Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 } @@ -22,7 +22,7 @@ type SysFileDirL struct { Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 - Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 + //Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息 } diff --git a/app/admin/service/dto/sys_file_dir.go b/app/admin/service/dto/sys_file_dir.go index 489bde19..6fbc61d3 100644 --- a/app/admin/service/dto/sys_file_dir.go +++ b/app/admin/service/dto/sys_file_dir.go @@ -17,7 +17,7 @@ type SysFileDirSearch struct { ID uint `form:"ID" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"` Label string `form:"label" search:"type:exact;column:label;table:sys_file_dir" comment:"目录名称"` PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_dir" comment:"上级目录"` - Sort string `form:"sort" search:"type:exact;column:sort;table:sys_file_dir" comment:"排序"` + //Sort string `form:"sort" search:"type:exact;column:sort;table:sys_file_dir" comment:"排序"` Path string `form:"path" search:"type:exact;column:path;table:sys_file_dir" comment:"路径"` } @@ -43,7 +43,7 @@ type SysFileDirControl struct { ID uint `uri:"ID" comment:"标识"` // 标识 Label string `json:"label" comment:"目录名称"` PId uint `json:"pId" comment:"上级目录"` - Sort string `json:"sort" comment:"排序"` + //Sort string `json:"sort" comment:"排序"` Path string `json:"path" comment:"路径"` } @@ -71,7 +71,7 @@ func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) { Model: gorm.Model{ID: s.ID}, Label: s.Label, PId: s.PId, - Sort: s.Sort, + //Sort: s.Sort, Path: s.Path, }, nil } diff --git a/app/admin/service/sys_file_dir.go b/app/admin/service/sys_file_dir.go index 77852f8c..1aef746f 100644 --- a/app/admin/service/sys_file_dir.go +++ b/app/admin/service/sys_file_dir.go @@ -159,7 +159,7 @@ func SysFileDirCall(list *[]models.SysFileDirL, m models.SysFileDirL) models.Sys mi.ID = listGroup[j].ID mi.PId = listGroup[j].PId mi.Label = listGroup[j].Label - mi.Sort = listGroup[j].Sort + //mi.Sort = listGroup[j].Sort mi.CreatedAt = listGroup[j].CreatedAt mi.UpdatedAt = listGroup[j].UpdatedAt mi.Children = []models.SysFileDirL{} From a958c879a1be250d983463c095c06b9736c2dbb9 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 22 Nov 2020 02:51:15 +0800 Subject: [PATCH 040/201] =?UTF-8?q?feat=E2=9C=A8=20=E6=B3=A8=E9=87=8ASort?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/migrate/migration/version/1600089797118_migrate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/migrate/migration/version/1600089797118_migrate.go b/cmd/migrate/migration/version/1600089797118_migrate.go index 12b603ba..d18f2c47 100644 --- a/cmd/migrate/migration/version/1600089797118_migrate.go +++ b/cmd/migrate/migration/version/1600089797118_migrate.go @@ -20,7 +20,7 @@ func _1600089797118Migrate(db *gorm.DB, version string) error { f := &models.SysFileDir{ Label: "根目录", PId: 0, - Sort: "0", + //Sort: "0", Path: "", ControlBy: common.ControlBy{ CreateBy: 1, From 93c5511b55586cacfd843680a051f2d946faf93f Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Tue, 24 Nov 2020 13:16:19 +0800 Subject: [PATCH 041/201] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E7=BC=96=E8=AF=91=EF=BC=8C=E4=BF=AE=E5=A4=8Dwindows=E4=B8=8Bgc?= =?UTF-8?q?c=E4=BE=9D=E8=B5=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/db.go | 19 ------------------- app/admin/middleware/db_other.go | 23 +++++++++++++++++++++++ app/admin/middleware/db_sqlite3.go | 28 ++++++++++++++++++++++++++++ pkg/logger/setup.go | 27 --------------------------- 4 files changed, 51 insertions(+), 46 deletions(-) create mode 100644 app/admin/middleware/db_other.go create mode 100644 app/admin/middleware/db_sqlite3.go diff --git a/app/admin/middleware/db.go b/app/admin/middleware/db.go index 1cf494d3..03f509ff 100644 --- a/app/admin/middleware/db.go +++ b/app/admin/middleware/db.go @@ -1,12 +1,6 @@ package middleware import ( - "database/sql" - "errors" - - "gorm.io/driver/mysql" - "gorm.io/driver/postgres" - "gorm.io/driver/sqlite" "gorm.io/gorm" "gorm.io/gorm/schema" @@ -18,19 +12,6 @@ import ( var WithContextDb = middleware.WithContextDb -func getGormFromDb(driver string, db *sql.DB, config *gorm.Config) (*gorm.DB, error) { - switch driver { - case "mysql": - return gorm.Open(mysql.New(mysql.Config{Conn: db}), config) - case "postgres": - return gorm.Open(postgres.New(postgres.Config{Conn: db}), config) - case "sqlite3": - return gorm.Open(sqlite.Open(global.Source), config) - default: - return nil, errors.New("not support this db driver") - } -} - func GetGormFromConfig(cfg config.Conf) map[string]*gorm.DB { gormDB := make(map[string]*gorm.DB) if cfg.GetSaas() { diff --git a/app/admin/middleware/db_other.go b/app/admin/middleware/db_other.go new file mode 100644 index 00000000..d0eacbe9 --- /dev/null +++ b/app/admin/middleware/db_other.go @@ -0,0 +1,23 @@ +// +build !sqlite3 + +package middleware + +import ( + "database/sql" + "errors" + + "gorm.io/driver/mysql" + "gorm.io/driver/postgres" + "gorm.io/gorm" +) + +func getGormFromDb(driver string, db *sql.DB, config *gorm.Config) (*gorm.DB, error) { + switch driver { + case "mysql": + return gorm.Open(mysql.New(mysql.Config{Conn: db}), config) + case "postgres": + return gorm.Open(postgres.New(postgres.Config{Conn: db}), config) + default: + return nil, errors.New("not support this db driver") + } +} diff --git a/app/admin/middleware/db_sqlite3.go b/app/admin/middleware/db_sqlite3.go new file mode 100644 index 00000000..f2e2bde0 --- /dev/null +++ b/app/admin/middleware/db_sqlite3.go @@ -0,0 +1,28 @@ +// +build sqlite3 + +package middleware + +import ( + "database/sql" + "errors" + + "gorm.io/driver/mysql" + "gorm.io/driver/postgres" + "gorm.io/driver/sqlite" + "gorm.io/gorm" + + "go-admin/common/global" +) + +func getGormFromDb(driver string, db *sql.DB, config *gorm.Config) (*gorm.DB, error) { + switch driver { + case "mysql": + return gorm.Open(mysql.New(mysql.Config{Conn: db}), config) + case "postgres": + return gorm.Open(postgres.New(postgres.Config{Conn: db}), config) + case "sqlite3": + return gorm.Open(sqlite.Open(global.Source), config) + default: + return nil, errors.New("not support this db driver") + } +} diff --git a/pkg/logger/setup.go b/pkg/logger/setup.go index c1bd913b..33990aa3 100644 --- a/pkg/logger/setup.go +++ b/pkg/logger/setup.go @@ -10,33 +10,6 @@ import ( "go-admin/common/log" ) -//func Setup() (*glog.Logger, *glog.Logger) { -// var Logger *glog.Logger -// var JobLogger *glog.Logger -// var RequestLogger *glog.Logger -// -// Logger = glog.New() -// _ = Logger.SetPath(config.LoggerConfig.Path + "/bus") -// Logger.SetStdoutPrint(config.LoggerConfig.EnabledBUS && config.LoggerConfig.Stdout) -// Logger.SetFile("bus-{Ymd}.log") -// _ = Logger.SetLevelStr(config.LoggerConfig.Level) -// -// JobLogger = glog.New() -// _ = JobLogger.SetPath(config.LoggerConfig.Path + "/job") -// JobLogger.SetStdoutPrint(false) -// JobLogger.SetFile("db-{Ymd}.log") -// _ = JobLogger.SetLevelStr(config.LoggerConfig.Level) -// -// RequestLogger = glog.New() -// _ = RequestLogger.SetPath(config.LoggerConfig.Path + "/request") -// RequestLogger.SetStdoutPrint(false) -// RequestLogger.SetFile("access-{Ymd}.log") -// _ = RequestLogger.SetLevelStr(config.LoggerConfig.Level) -// -// Logger.Info(tools.Green("Logger init success!")) -// return Logger, JobLogger -//} - // SetupLogger 日志 func SetupLogger(path string, subPath string) logger.Logger { var setLogger logger.Logger From 6b0b1bb836431ccd86162a36220a4e6531da1f0b Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 29 Nov 2020 00:19:11 +0800 Subject: [PATCH 042/201] =?UTF-8?q?fix:=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=81=9C=E7=94=A8=E7=8A=B6=E6=80=81=E8=BF=98?= =?UTF-8?q?=E8=83=BD=E7=99=BB=E9=99=86=E9=97=AE=E9=A2=98=EF=BC=88#287?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/login.go | 2 +- .../version/1606579402398_migrate.go | 37 +++++++++++++++++++ common/global/adm.go | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 cmd/migrate/migration/version/1606579402398_migrate.go diff --git a/app/admin/models/login.go b/app/admin/models/login.go index 26a4c4b8..a045976a 100644 --- a/app/admin/models/login.go +++ b/app/admin/models/login.go @@ -14,7 +14,7 @@ type Login struct { func (u *Login) GetUser() (user SysUser, role SysRole, e error) { - e = orm.Eloquent.Table("sys_user").Where("username = ? ", u.Username).Find(&user).Error + e = orm.Eloquent.Table("sys_user").Where("username = ? and status = 2", u.Username).Find(&user).Error if e != nil { return } diff --git a/cmd/migrate/migration/version/1606579402398_migrate.go b/cmd/migrate/migration/version/1606579402398_migrate.go new file mode 100644 index 00000000..bd650da1 --- /dev/null +++ b/cmd/migrate/migration/version/1606579402398_migrate.go @@ -0,0 +1,37 @@ +package version + +import ( + "go-admin/app/admin/models" + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1606579402398Test) +} + +func _1606579402398Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + dicData := models.DictData{} + err := tx.Model(&dicData).Where("dict_code = ?", 1).Update("dict_value", 2).Error + if err != nil { + return err + } + + user := models.SysUser{} + err = tx.Model(&user).Where("user_id = ?", 1).Update("status", 2).Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/common/global/adm.go b/common/global/adm.go index fad74f48..291e4fef 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -12,7 +12,7 @@ import ( const ( // go-admin Version Info - Version = "1.2.2" + Version = "1.2.3" ) var Cfg config.Conf = config.DefaultConfig() From ab547cc49bb64a41e363f49cfcc5aac8bfc5b13e Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 29 Nov 2020 00:26:17 +0800 Subject: [PATCH 043/201] =?UTF-8?q?refactor:=F0=9F=8E=A8=20=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=97=A7=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/sysfile/dir.go | 71 ----------- app/admin/apis/sysfile/sysfileinfo.go | 77 ------------ app/admin/apis/system/dict/dicttype.go | 2 +- app/admin/models/filedir.go | 163 ------------------------- app/admin/models/sys_file_dir.go | 10 +- app/admin/models/sysfileinfo.go | 111 ----------------- 6 files changed, 6 insertions(+), 428 deletions(-) delete mode 100644 app/admin/apis/sysfile/dir.go delete mode 100644 app/admin/apis/sysfile/sysfileinfo.go delete mode 100644 app/admin/models/filedir.go delete mode 100644 app/admin/models/sysfileinfo.go diff --git a/app/admin/apis/sysfile/dir.go b/app/admin/apis/sysfile/dir.go deleted file mode 100644 index 54d10b39..00000000 --- a/app/admin/apis/sysfile/dir.go +++ /dev/null @@ -1,71 +0,0 @@ -package sysfile - -import ( - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" - "go-admin/tools/app/msg" -) - -func GetSysFileDirList(c *gin.Context) { - var SysFileDir models.SysFileDirOld - SysFileDir.Label = c.Request.FormValue("label") - SysFileDir.PId, _ = tools.StringToInt(c.Request.FormValue("pid")) - SysFileDir.Id, _ = tools.StringToInt(c.Request.FormValue("id")) - SysFileDir.DataScope = tools.GetUserIdStr(c) - result, err := SysFileDir.SetSysFileDirOld() - tools.HasError(err, "抱歉未找到相关信息", -1) - app.OK(c, result, "") -} - -func GetSysFileDir(c *gin.Context) { - var data models.SysFileDirOld - data.Id, _ = tools.StringToInt(c.Param("id")) - result, err := data.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - app.OK(c, result, "") -} - -// @Summary 添加SysFileDir -// @Description 获取JSON -// @Tags SysFileDir -// @Accept application/json -// @Product application/json -// @Param data body models.SysFileDir true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/sysfiledir [post] -func InsertSysFileDir(c *gin.Context) { - var data models.SysFileDirOld - err := c.ShouldBindJSON(&data) - data.CreateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - app.OK(c, result, "") -} - -func UpdateSysFileDir(c *gin.Context) { - var data models.SysFileDirOld - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "数据解析失败", -1) - data.UpdateBy = tools.GetUserIdStr(c) - result, err := data.Update(data.Id) - tools.HasError(err, "", -1) - - app.OK(c, result, "") -} - -func DeleteSysFileDir(c *gin.Context) { - var data models.SysFileDirOld - data.UpdateBy = tools.GetUserIdStr(c) - - IDS := tools.IdsStrToIdsIntGroup("id", c) - _, err := data.BatchDelete(IDS) - tools.HasError(err, msg.DeletedFail, 500) - app.OK(c, nil, msg.DeletedSuccess) -} diff --git a/app/admin/apis/sysfile/sysfileinfo.go b/app/admin/apis/sysfile/sysfileinfo.go deleted file mode 100644 index 88708730..00000000 --- a/app/admin/apis/sysfile/sysfileinfo.go +++ /dev/null @@ -1,77 +0,0 @@ -package sysfile - -import ( - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" - "go-admin/tools/app/msg" -) - -func GetSysFileInfoOldList(c *gin.Context) { - var data models.SysFileInfoOld - var err error - var pageSize = 10 - var pageIndex = 1 - - if size := c.Request.FormValue("pageSize"); size != "" { - pageSize, err = tools.StringToInt(size) - } - tools.HasError(err, "", -1) - if index := c.Request.FormValue("pageIndex"); index != "" { - pageIndex, err = tools.StringToInt(index) - } - tools.HasError(err, "", -1) - if pid := c.Request.FormValue("pId"); pid != "" { - data.PId, err = tools.StringToInt(pid) - } - tools.HasError(err, "", -1) - - data.DataScope = tools.GetUserIdStr(c) - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - app.PageOK(c, result, count, pageIndex, pageSize, "") -} - -func GetSysFileInfoOld(c *gin.Context) { - var data models.SysFileInfoOld - data.Id, _ = tools.StringToInt(c.Param("id")) - result, err := data.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - app.OK(c, result, "") -} - -func InsertSysFileInfoOld(c *gin.Context) { - var data models.SysFileInfoOld - err := c.ShouldBindJSON(&data) - data.CreateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - app.OK(c, result, "") -} - -func UpdateSysFileInfoOld(c *gin.Context) { - var data models.SysFileInfoOld - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "数据解析失败", -1) - data.UpdateBy = tools.GetUserIdStr(c) - result, err := data.Update(data.Id) - tools.HasError(err, "", -1) - - app.OK(c, result, "") -} - -func DeleteSysFileInfoOld(c *gin.Context) { - var data models.SysFileInfoOld - data.UpdateBy = tools.GetUserIdStr(c) - - IDS := tools.IdsStrToIdsIntGroup("id", c) - _, err := data.BatchDelete(IDS) - tools.HasError(err, msg.DeletedFail, 500) - app.OK(c, nil, msg.DeletedSuccess) -} diff --git a/app/admin/apis/system/dict/dicttype.go b/app/admin/apis/system/dict/dicttype.go index bf9fe500..2a09b0e6 100644 --- a/app/admin/apis/system/dict/dicttype.go +++ b/app/admin/apis/system/dict/dicttype.go @@ -19,7 +19,7 @@ import ( // @Param dictType query string false "dictType" // @Param pageSize query int false "页条数" // @Param pageIndex query int false "页码" -// @Success 200 {object} app.PageResponse "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/dict/type/list [get] // @Security Bearer func GetDictTypeList(c *gin.Context) { diff --git a/app/admin/models/filedir.go b/app/admin/models/filedir.go deleted file mode 100644 index eb709341..00000000 --- a/app/admin/models/filedir.go +++ /dev/null @@ -1,163 +0,0 @@ -package models - -import ( - orm "go-admin/common/global" - "go-admin/tools" -) - -type SysFileDirOld struct { - Id int `json:"id"` - Label string `json:"label" gorm:"type:varchar(255);"` // 名称 - PId int `json:"pId" gorm:"type:int(11);"` // 父id - Sort int `json:"sort" gorm:""` //排序 - Path string `json:"path" gorm:"size:255;"` // - CreateBy string `json:"createBy" gorm:"type:varchar(128);"` // 创建人 - UpdateBy string `json:"updateBy" gorm:"type:varchar(128);"` // 编辑人 - Children []SysFileDirOld `json:"children" gorm:"-"` - DataScope string `json:"dataScope" gorm:"-"` - Params string `json:"params" gorm:"-"` - BaseModel -} - -func (SysFileDirOld) TableName() string { - return "sys_file_dir" -} - -// 创建SysFileDirOld -func (e *SysFileDirOld) Create() (SysFileDirOld, error) { - var doc SysFileDirOld - result := orm.Eloquent.Table(e.TableName()).Create(&e) - if result.Error != nil { - err := result.Error - return doc, err - } - - path := "/" + tools.IntToString(e.Id) - if int(e.PId) != 0 { - var deptP SysFileDirOld - orm.Eloquent.Table(e.TableName()).Where("id = ?", e.PId).First(&deptP) - path = deptP.Path + path - } else { - path = "/0" + path - } - var mp = map[string]string{} - mp["path"] = path - if err := orm.Eloquent.Table(e.TableName()).Where("id = ?", e.Id).Updates(mp).Error; err != nil { - err := result.Error - return doc, err - } - doc = *e - doc.Path = path - - return doc, nil -} - -// 获取SysFileDirOld -func (e *SysFileDirOld) Get() (SysFileDirOld, error) { - var doc SysFileDirOld - table := orm.Eloquent.Table(e.TableName()) - - if e.Id != 0 { - table = table.Where("id = ?", e.Id) - } - - if err := table.First(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -// 获取SysFileDirOld带分页 -func (e *SysFileDirOld) GetPage() ([]SysFileDirOld, int, error) { - var doc []SysFileDirOld - - table := orm.Eloquent.Table(e.TableName()) - var count int64 - - if err := table.Find(&doc).Error; err != nil { - return nil, 0, err - } - table.Where("`deleted_at` IS NULL").Count(&count) - return doc, int(count), nil -} - -// 更新SysFileDirOld -func (e *SysFileDirOld) Update(id int) (update SysFileDirOld, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).First(&update).Error; err != nil { - return - } - - path := "/" + tools.IntToString(e.Id) - if int(e.Id) != 0 { - var deptP SysFileDirOld - orm.Eloquent.Table(e.TableName()).Where("id = ?", e.Id).First(&deptP) - path = deptP.Path + path - } else { - path = "/0" + path - } - e.Path = path - - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { - return - } - return -} - -// 删除SysFileDirOld -func (e *SysFileDirOld) Delete(id int) (success bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).Delete(&SysFileDirOld{}).Error; err != nil { - success = false - return - } - success = true - return -} - -//批量删除 -func (e *SysFileDirOld) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id in (?)", id).Delete(&SysFileDirOld{}).Error; err != nil { - return - } - Result = true - return -} - -func (e *SysFileDirOld) SetSysFileDirOld() ([]SysFileDirOld, error) { - list, _, err := e.GetPage() - - m := make([]SysFileDirOld, 0) - for i := 0; i < len(list); i++ { - if list[i].PId != 0 { - continue - } - info := SysFileDirOldDigui(&list, list[i]) - - m = append(m, info) - } - return m, err -} - -func SysFileDirOldDigui(deptlist *[]SysFileDirOld, menu SysFileDirOld) SysFileDirOld { - list := *deptlist - - min := make([]SysFileDirOld, 0) - for j := 0; j < len(list); j++ { - - if menu.Id != list[j].PId { - continue - } - mi := SysFileDirOld{} - mi.Id = list[j].Id - mi.PId = list[j].PId - mi.Label = list[j].Label - mi.Sort = list[j].Sort - mi.CreatedAt = list[j].CreatedAt - mi.UpdatedAt = list[j].UpdatedAt - mi.Children = []SysFileDirOld{} - ms := SysFileDirOldDigui(deptlist, mi) - min = append(min, ms) - - } - menu.Children = min - return menu -} diff --git a/app/admin/models/sys_file_dir.go b/app/admin/models/sys_file_dir.go index 1254d436..4b167d1f 100644 --- a/app/admin/models/sys_file_dir.go +++ b/app/admin/models/sys_file_dir.go @@ -13,18 +13,18 @@ type SysFileDir struct { Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 //Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 - Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 + Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 } type SysFileDirL struct { gorm.Model models.ControlBy - Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 - PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 + Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 + PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 //Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 - Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 - Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息 + Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 + Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息 } func (SysFileDir) TableName() string { /**/ diff --git a/app/admin/models/sysfileinfo.go b/app/admin/models/sysfileinfo.go deleted file mode 100644 index 6b7bfa80..00000000 --- a/app/admin/models/sysfileinfo.go +++ /dev/null @@ -1,111 +0,0 @@ -package models - -import ( - orm "go-admin/common/global" -) - -type SysFileInfoOld struct { - Id int `json:"id"` // id - Type string `json:"type" gorm:"type:varchar(255);"` // 文件类型 - Name string `json:"name" gorm:"type:varchar(255);"` // 文件名称 - Size string `json:"size" gorm:"type:int(11);"` // 文件大小 - PId int `json:"pId" gorm:"type:int(11);"` // 目录id - Source string `json:"source" gorm:"type:varchar(255);"` // 文件源 - Url string `json:"url" gorm:"type:varchar(255);"` // 文件路径 - FullUrl string `json:"fullUrl" gorm:"type:varchar(255);"` // 文件全路径 - CreateBy string `json:"createBy" gorm:"type:varchar(128);"` // 创建人 - UpdateBy string `json:"updateBy" gorm:"type:varchar(128);"` // 编辑人 - DataScope string `json:"dataScope" gorm:"-"` - Params string `json:"params" gorm:"-"` - BaseModel -} - -func (SysFileInfoOld) TableName() string { - return "sys_file_info" -} - -// 创建SysFileInfoOld -func (e *SysFileInfoOld) Create() (SysFileInfoOld, error) { - var doc SysFileInfoOld - result := orm.Eloquent.Table(e.TableName()).Create(&e) - if result.Error != nil { - err := result.Error - return doc, err - } - doc = *e - return doc, nil -} - -// 获取SysFileInfoOld -func (e *SysFileInfoOld) Get() (SysFileInfoOld, error) { - var doc SysFileInfoOld - table := orm.Eloquent.Table(e.TableName()) - - if e.Id != 0 { - table = table.Where("id = ?", e.Id) - } - - if err := table.First(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -// 获取SysFileInfoOld带分页 -func (e *SysFileInfoOld) GetPage(pageSize int, pageIndex int) ([]SysFileInfoOld, int, error) { - var doc []SysFileInfoOld - - table := orm.Eloquent.Table(e.TableName()) - - if e.PId != 0 { - table = table.Where("p_id = ?", e.PId) - } - - // 数据权限控制(如果不需要数据权限请将此处去掉) - //dataPermission := new(DataPermission) - //dataPermission.UserId, _ = tools.StringToInt(e.DataScope) - //table, err := dataPermission.GetDataScope(e.TableName(), table) - //if err != nil { - // return nil, 0, err - //} - var count int64 - - if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil { - return nil, 0, err - } - //table.Where("`deleted_at` IS NULL").Count(&count) - return doc, int(count), nil -} - -// 更新SysFileInfoOld -func (e *SysFileInfoOld) Update(id int) (update SysFileInfoOld, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).First(&update).Error; err != nil { - return - } - - //参数1:是要修改的数据 - //参数2:是修改的数据 - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { - return - } - return -} - -// 删除SysFileInfoOld -func (e *SysFileInfoOld) Delete(id int) (success bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).Delete(&SysFileInfoOld{}).Error; err != nil { - success = false - return - } - success = true - return -} - -//批量删除 -func (e *SysFileInfoOld) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("id in (?)", id).Delete(&SysFileInfoOld{}).Error; err != nil { - return - } - Result = true - return -} From b9e9d7178b9e83b391462f537ef00ac0a26b1422 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 29 Nov 2020 00:27:52 +0800 Subject: [PATCH 044/201] =?UTF-8?q?fix:=F0=9F=90=9B=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=87=E6=A1=A3=EF=BC=8C=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=B9=8B=E5=89=8D=E5=BC=95=E7=94=A8=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=BD=93=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/docs.go | 1086 +-------------------------------------------- docs/swagger.json | 1081 +------------------------------------------- docs/swagger.yaml | 725 +----------------------------- 3 files changed, 38 insertions(+), 2854 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index e82ac1d1..fd461e25 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,6 +1,5 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by swaggo/swag at -// 2020-08-27 14:47:40.749512 +0800 CST m=+0.171410739 +// This file was generated by swaggo/swag package docs @@ -22,190 +21,13 @@ var doc = `{ "contact": {}, "license": { "name": "MIT", - "url": "https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md" + "url": "https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md" }, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { - "/api/v1/config": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "配置" - ], - "summary": "修改配置", - "parameters": [ - { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.SysConfig" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/config/{configId}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "配置" - ], - "summary": "获取配置", - "parameters": [ - { - "type": "integer", - "description": "配置编码", - "name": "configId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - }, - "delete": { - "description": "删除数据", - "tags": [ - "配置" - ], - "summary": "删除配置", - "parameters": [ - { - "type": "integer", - "description": "configId", - "name": "configId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/configKey/{configKey}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "配置" - ], - "summary": "获取配置", - "parameters": [ - { - "type": "integer", - "description": "configKey", - "name": "configKey", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/configList": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "配置" - ], - "summary": "配置列表数据", - "parameters": [ - { - "type": "string", - "description": "configKey", - "name": "configKey", - "in": "query" - }, - { - "type": "string", - "description": "configName", - "name": "configName", - "in": "query" - }, - { - "type": "string", - "description": "configType", - "name": "configType", - "in": "query" - }, - { - "type": "integer", - "description": "页条数", - "name": "pageSize", - "in": "query" - }, - { - "type": "integer", - "description": "页码", - "name": "pageIndex", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, "/api/v1/db/columns/page": { "get": { "description": "数据库表列分页列表 / database table column page list", @@ -309,7 +131,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysDept" } } @@ -344,7 +165,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysDept" } } @@ -485,7 +305,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.DictType" } } @@ -520,7 +339,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.DictType" } } @@ -697,7 +515,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.DictType" } } @@ -732,7 +549,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.DictType" } } @@ -795,7 +611,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.PageResponse" + "$ref": "#/definitions/app.Response" } } } @@ -856,187 +672,6 @@ var doc = `{ } } }, - "/api/v1/loginlog": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "登录日志" - ], - "summary": "修改登录日志", - "parameters": [ - { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.LoginLog" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "登录日志" - ], - "summary": "添加登录日志", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.LoginLog" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/loginlog/{infoId}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "登录日志" - ], - "summary": "通过编码获取登录日志", - "parameters": [ - { - "type": "integer", - "description": "infoId", - "name": "infoId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - }, - "delete": { - "description": "删除数据", - "tags": [ - "登录日志" - ], - "summary": "批量删除登录日志", - "parameters": [ - { - "type": "string", - "description": "以逗号(,)分割的infoId", - "name": "infoId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/loginloglist": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "登录日志" - ], - "summary": "登录日志列表", - "parameters": [ - { - "type": "string", - "description": "status", - "name": "status", - "in": "query" - }, - { - "type": "string", - "description": "dictCode", - "name": "dictCode", - "in": "query" - }, - { - "type": "string", - "description": "dictType", - "name": "dictType", - "in": "query" - }, - { - "type": "integer", - "description": "页条数", - "name": "pageSize", - "in": "query" - }, - { - "type": "integer", - "description": "页码", - "name": "pageIndex", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, "/api/v1/menu": { "get": { "security": [ @@ -1162,7 +797,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.Menu" } } @@ -1318,154 +952,6 @@ var doc = `{ } } }, - "/api/v1/operlog": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "操作日志" - ], - "summary": "添加操作日志", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.SysOperLog" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/operlog/{infoId}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "登录日志" - ], - "summary": "通过编码获取登录日志", - "parameters": [ - { - "type": "integer", - "description": "infoId", - "name": "infoId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/operlog/{operId}": { - "delete": { - "description": "删除数据", - "tags": [ - "操作日志" - ], - "summary": "批量删除操作日志", - "parameters": [ - { - "type": "string", - "description": "以逗号(,)分割的operId", - "name": "operId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/operloglist": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "登录日志" - ], - "summary": "登录日志列表", - "parameters": [ - { - "type": "string", - "description": "status", - "name": "status", - "in": "query" - }, - { - "type": "string", - "description": "dictCode", - "name": "dictCode", - "in": "query" - }, - { - "type": "string", - "description": "dictType", - "name": "dictType", - "in": "query" - }, - { - "type": "integer", - "description": "页条数", - "name": "pageSize", - "in": "query" - }, - { - "type": "integer", - "description": "页码", - "name": "pageIndex", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, "/api/v1/post": { "get": { "security": [ @@ -1534,7 +1020,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.Post" } } @@ -1571,7 +1056,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.Post" } } @@ -1728,7 +1212,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysRole" } } @@ -1758,7 +1241,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysRole" } } @@ -1971,7 +1453,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/tools.SysTables" } } @@ -2146,7 +1627,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysUser" } } @@ -2222,38 +1702,6 @@ var doc = `{ } } }, - "/api/v1/syscategory": { - "post": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "分类" - ], - "summary": "添加分类", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.SysCategory" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, "/api/v1/syscontent": { "post": { "description": "获取JSON", @@ -2271,7 +1719,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysContent" } } @@ -2286,38 +1733,6 @@ var doc = `{ } } }, - "/api/v1/sysfiledir": { - "post": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "SysFileDir" - ], - "summary": "添加SysFileDir", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.SysFileDir" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, "/api/v1/system/setting": { "post": { "description": "获取JSON", @@ -2332,7 +1747,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysUser" } } @@ -2364,7 +1778,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysUser" } } @@ -2468,7 +1881,6 @@ var doc = `{ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.Login" } } @@ -2504,157 +1916,9 @@ var doc = `{ } } } - }, - "/sd/cpu": { - "get": { - "description": "CPU 使用量 DiskCheck checks the disk usage.", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "CPU 使用量", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } - }, - "/sd/disk": { - "get": { - "description": "服务器硬盘使用量 DiskCheck checks the disk usage.", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "服务器硬盘使用量", - "responses": { - "200": { - "description": "OK - Free space: 16321MB (15GB) / 51200MB (50GB) | Used: 31%", - "schema": { - "type": "string" - } - }, - "429": { - "description": "WARNING", - "schema": { - "type": "string" - } - }, - "500": { - "description": "CRITICAL", - "schema": { - "type": "string" - } - } - } - } - }, - "/sd/health": { - "get": { - "description": "健康状况", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "健康状况 HealthCheck shows OK as the ping-pong result.", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } - }, - "/sd/os": { - "get": { - "description": "Os", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "OS", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } - }, - "/sd/ram": { - "get": { - "description": "内存使用量 RAMCheck checks the disk usage.", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "内存使用量", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } } }, "definitions": { - "app.Page": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "list": { - "type": "object" - }, - "pageIndex": { - "type": "integer" - }, - "pageSize": { - "type": "integer" - } - } - }, - "app.PageResponse": { - "type": "object", - "properties": { - "code": { - "description": "代码", - "type": "integer", - "example": 200 - }, - "data": { - "description": "数据集", - "type": "object", - "$ref": "#/definitions/app.Page" - }, - "msg": { - "description": "消息", - "type": "string" - } - } - }, "app.Response": { "type": "object", "properties": { @@ -2670,6 +1934,9 @@ var doc = `{ "msg": { "description": "消息", "type": "string" + }, + "requestId": { + "type": "string" } } }, @@ -2743,78 +2010,6 @@ var doc = `{ } } }, - "models.LoginLog": { - "type": "object", - "properties": { - "browser": { - "description": "浏览器", - "type": "string" - }, - "createBy": { - "description": "创建人", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "description": "数据", - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "infoId": { - "description": "主键", - "type": "integer" - }, - "ipaddr": { - "description": "ip地址", - "type": "string" - }, - "loginLocation": { - "description": "归属地", - "type": "string" - }, - "loginTime": { - "description": "登录时间", - "type": "string" - }, - "msg": { - "type": "string" - }, - "os": { - "description": "系统", - "type": "string" - }, - "params": { - "type": "string" - }, - "platform": { - "description": "固件", - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "username": { - "description": "用户名", - "type": "string" - } - } - }, "models.Menu": { "type": "object", "properties": { @@ -2951,108 +2146,6 @@ var doc = `{ } } }, - "models.SysCategory": { - "type": "object", - "properties": { - "createBy": { - "description": "创建者", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "id": { - "description": "分类Id", - "type": "integer" - }, - "img": { - "description": "图片", - "type": "string" - }, - "name": { - "description": "名称", - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "sort": { - "description": "排序", - "type": "string" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.SysConfig": { - "type": "object", - "properties": { - "configId": { - "description": "编码", - "type": "integer" - }, - "configKey": { - "description": "参数键名", - "type": "string" - }, - "configName": { - "description": "参数名称", - "type": "string" - }, - "configType": { - "description": "是否系统内置", - "type": "string" - }, - "configValue": { - "description": "参数键值", - "type": "string" - }, - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, "models.SysContent": { "type": "object", "properties": { @@ -3180,163 +2273,6 @@ var doc = `{ } } }, - "models.SysFileDir": { - "type": "object", - "properties": { - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/models.SysFileDir" - } - }, - "createBy": { - "description": "创建人", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "label": { - "description": "名称", - "type": "string" - }, - "pId": { - "description": "父id", - "type": "integer" - }, - "params": { - "type": "string" - }, - "path": { - "type": "string" - }, - "sort": { - "description": "排序", - "type": "integer" - }, - "updateBy": { - "description": "编辑人", - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.SysOperLog": { - "type": "object", - "properties": { - "businessType": { - "description": "操作类型", - "type": "string" - }, - "businessTypes": { - "type": "string" - }, - "createBy": { - "description": "创建人", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "description": "数据", - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "deptName": { - "description": "部门名称", - "type": "string" - }, - "jsonResult": { - "description": "返回数据", - "type": "string" - }, - "latencyime": { - "description": "耗时", - "type": "string" - }, - "method": { - "description": "函数", - "type": "string" - }, - "operId": { - "description": "日志编码", - "type": "integer" - }, - "operIp": { - "description": "客户端ip", - "type": "string" - }, - "operLocation": { - "description": "访问位置", - "type": "string" - }, - "operName": { - "description": "操作者", - "type": "string" - }, - "operParam": { - "description": "请求参数", - "type": "string" - }, - "operTime": { - "description": "操作时间", - "type": "string" - }, - "operUrl": { - "description": "访问地址", - "type": "string" - }, - "operatorType": { - "description": "操作类型", - "type": "string" - }, - "params": { - "description": "参数", - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "requestMethod": { - "description": "请求方式", - "type": "string" - }, - "status": { - "description": "操作状态", - "type": "string" - }, - "title": { - "description": "操作模块", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "userAgent": { - "description": "ua", - "type": "string" - } - } - }, "models.SysRole": { "type": "object", "properties": { @@ -3665,6 +2601,15 @@ var doc = `{ "description": "功能名称", "type": "string" }, + "isActions": { + "type": "integer" + }, + "isAuth": { + "type": "integer" + }, + "isDataScope": { + "type": "integer" + }, "isLogicalDelete": { "type": "string" }, @@ -3686,7 +2631,6 @@ var doc = `{ "type": "string" }, "params": { - "type": "object", "$ref": "#/definitions/tools.Params" }, "pkColumn": { diff --git a/docs/swagger.json b/docs/swagger.json index d14e8cc4..a973b906 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -11,183 +11,6 @@ "version": "1.0.1" }, "paths": { - "/api/v1/config": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "配置" - ], - "summary": "修改配置", - "parameters": [ - { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.SysConfig" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/config/{configId}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "配置" - ], - "summary": "获取配置", - "parameters": [ - { - "type": "integer", - "description": "配置编码", - "name": "configId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - }, - "delete": { - "description": "删除数据", - "tags": [ - "配置" - ], - "summary": "删除配置", - "parameters": [ - { - "type": "integer", - "description": "configId", - "name": "configId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/configKey/{configKey}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "配置" - ], - "summary": "获取配置", - "parameters": [ - { - "type": "integer", - "description": "configKey", - "name": "configKey", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/configList": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "配置" - ], - "summary": "配置列表数据", - "parameters": [ - { - "type": "string", - "description": "configKey", - "name": "configKey", - "in": "query" - }, - { - "type": "string", - "description": "configName", - "name": "configName", - "in": "query" - }, - { - "type": "string", - "description": "configType", - "name": "configType", - "in": "query" - }, - { - "type": "integer", - "description": "页条数", - "name": "pageSize", - "in": "query" - }, - { - "type": "integer", - "description": "页码", - "name": "pageIndex", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, "/api/v1/db/columns/page": { "get": { "description": "数据库表列分页列表 / database table column page list", @@ -291,7 +114,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysDept" } } @@ -326,7 +148,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysDept" } } @@ -467,7 +288,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.DictType" } } @@ -502,7 +322,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.DictType" } } @@ -679,7 +498,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.DictType" } } @@ -714,7 +532,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.DictType" } } @@ -777,7 +594,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.PageResponse" + "$ref": "#/definitions/app.Response" } } } @@ -838,187 +655,6 @@ } } }, - "/api/v1/loginlog": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "登录日志" - ], - "summary": "修改登录日志", - "parameters": [ - { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.LoginLog" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "登录日志" - ], - "summary": "添加登录日志", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.LoginLog" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/loginlog/{infoId}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "登录日志" - ], - "summary": "通过编码获取登录日志", - "parameters": [ - { - "type": "integer", - "description": "infoId", - "name": "infoId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - }, - "delete": { - "description": "删除数据", - "tags": [ - "登录日志" - ], - "summary": "批量删除登录日志", - "parameters": [ - { - "type": "string", - "description": "以逗号(,)分割的infoId", - "name": "infoId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/loginloglist": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "登录日志" - ], - "summary": "登录日志列表", - "parameters": [ - { - "type": "string", - "description": "status", - "name": "status", - "in": "query" - }, - { - "type": "string", - "description": "dictCode", - "name": "dictCode", - "in": "query" - }, - { - "type": "string", - "description": "dictType", - "name": "dictType", - "in": "query" - }, - { - "type": "integer", - "description": "页条数", - "name": "pageSize", - "in": "query" - }, - { - "type": "integer", - "description": "页码", - "name": "pageIndex", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, "/api/v1/menu": { "get": { "security": [ @@ -1144,7 +780,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.Menu" } } @@ -1300,154 +935,6 @@ } } }, - "/api/v1/operlog": { - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "操作日志" - ], - "summary": "添加操作日志", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.SysOperLog" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/operlog/{infoId}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "登录日志" - ], - "summary": "通过编码获取登录日志", - "parameters": [ - { - "type": "integer", - "description": "infoId", - "name": "infoId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/operlog/{operId}": { - "delete": { - "description": "删除数据", - "tags": [ - "操作日志" - ], - "summary": "批量删除操作日志", - "parameters": [ - { - "type": "string", - "description": "以逗号(,)分割的operId", - "name": "operId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/operloglist": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "登录日志" - ], - "summary": "登录日志列表", - "parameters": [ - { - "type": "string", - "description": "status", - "name": "status", - "in": "query" - }, - { - "type": "string", - "description": "dictCode", - "name": "dictCode", - "in": "query" - }, - { - "type": "string", - "description": "dictType", - "name": "dictType", - "in": "query" - }, - { - "type": "integer", - "description": "页条数", - "name": "pageSize", - "in": "query" - }, - { - "type": "integer", - "description": "页码", - "name": "pageIndex", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, "/api/v1/post": { "get": { "security": [ @@ -1516,7 +1003,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.Post" } } @@ -1553,7 +1039,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.Post" } } @@ -1710,7 +1195,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysRole" } } @@ -1740,7 +1224,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysRole" } } @@ -1953,7 +1436,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/tools.SysTables" } } @@ -2128,7 +1610,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysUser" } } @@ -2204,38 +1685,6 @@ } } }, - "/api/v1/syscategory": { - "post": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "分类" - ], - "summary": "添加分类", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.SysCategory" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, "/api/v1/syscontent": { "post": { "description": "获取JSON", @@ -2253,7 +1702,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysContent" } } @@ -2268,38 +1716,6 @@ } } }, - "/api/v1/sysfiledir": { - "post": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "SysFileDir" - ], - "summary": "添加SysFileDir", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/models.SysFileDir" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, "/api/v1/system/setting": { "post": { "description": "获取JSON", @@ -2314,7 +1730,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysUser" } } @@ -2346,7 +1761,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.SysUser" } } @@ -2450,7 +1864,6 @@ "in": "body", "required": true, "schema": { - "type": "object", "$ref": "#/definitions/models.Login" } } @@ -2486,157 +1899,9 @@ } } } - }, - "/sd/cpu": { - "get": { - "description": "CPU 使用量 DiskCheck checks the disk usage.", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "CPU 使用量", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } - }, - "/sd/disk": { - "get": { - "description": "服务器硬盘使用量 DiskCheck checks the disk usage.", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "服务器硬盘使用量", - "responses": { - "200": { - "description": "OK - Free space: 16321MB (15GB) / 51200MB (50GB) | Used: 31%", - "schema": { - "type": "string" - } - }, - "429": { - "description": "WARNING", - "schema": { - "type": "string" - } - }, - "500": { - "description": "CRITICAL", - "schema": { - "type": "string" - } - } - } - } - }, - "/sd/health": { - "get": { - "description": "健康状况", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "健康状况 HealthCheck shows OK as the ping-pong result.", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } - }, - "/sd/os": { - "get": { - "description": "Os", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "OS", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } - }, - "/sd/ram": { - "get": { - "description": "内存使用量 RAMCheck checks the disk usage.", - "consumes": [ - "text/html" - ], - "produces": [ - "text/html" - ], - "summary": "内存使用量", - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "string" - } - } - } - } } }, "definitions": { - "app.Page": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "list": { - "type": "object" - }, - "pageIndex": { - "type": "integer" - }, - "pageSize": { - "type": "integer" - } - } - }, - "app.PageResponse": { - "type": "object", - "properties": { - "code": { - "description": "代码", - "type": "integer", - "example": 200 - }, - "data": { - "description": "数据集", - "type": "object", - "$ref": "#/definitions/app.Page" - }, - "msg": { - "description": "消息", - "type": "string" - } - } - }, "app.Response": { "type": "object", "properties": { @@ -2652,6 +1917,9 @@ "msg": { "description": "消息", "type": "string" + }, + "requestId": { + "type": "string" } } }, @@ -2725,78 +1993,6 @@ } } }, - "models.LoginLog": { - "type": "object", - "properties": { - "browser": { - "description": "浏览器", - "type": "string" - }, - "createBy": { - "description": "创建人", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "description": "数据", - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "infoId": { - "description": "主键", - "type": "integer" - }, - "ipaddr": { - "description": "ip地址", - "type": "string" - }, - "loginLocation": { - "description": "归属地", - "type": "string" - }, - "loginTime": { - "description": "登录时间", - "type": "string" - }, - "msg": { - "type": "string" - }, - "os": { - "description": "系统", - "type": "string" - }, - "params": { - "type": "string" - }, - "platform": { - "description": "固件", - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "username": { - "description": "用户名", - "type": "string" - } - } - }, "models.Menu": { "type": "object", "properties": { @@ -2933,108 +2129,6 @@ } } }, - "models.SysCategory": { - "type": "object", - "properties": { - "createBy": { - "description": "创建者", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "id": { - "description": "分类Id", - "type": "integer" - }, - "img": { - "description": "图片", - "type": "string" - }, - "name": { - "description": "名称", - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "sort": { - "description": "排序", - "type": "string" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.SysConfig": { - "type": "object", - "properties": { - "configId": { - "description": "编码", - "type": "integer" - }, - "configKey": { - "description": "参数键名", - "type": "string" - }, - "configName": { - "description": "参数名称", - "type": "string" - }, - "configType": { - "description": "是否系统内置", - "type": "string" - }, - "configValue": { - "description": "参数键值", - "type": "string" - }, - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, "models.SysContent": { "type": "object", "properties": { @@ -3162,163 +2256,6 @@ } } }, - "models.SysFileDir": { - "type": "object", - "properties": { - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/models.SysFileDir" - } - }, - "createBy": { - "description": "创建人", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "label": { - "description": "名称", - "type": "string" - }, - "pId": { - "description": "父id", - "type": "integer" - }, - "params": { - "type": "string" - }, - "path": { - "type": "string" - }, - "sort": { - "description": "排序", - "type": "integer" - }, - "updateBy": { - "description": "编辑人", - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.SysOperLog": { - "type": "object", - "properties": { - "businessType": { - "description": "操作类型", - "type": "string" - }, - "businessTypes": { - "type": "string" - }, - "createBy": { - "description": "创建人", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "description": "数据", - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "deptName": { - "description": "部门名称", - "type": "string" - }, - "jsonResult": { - "description": "返回数据", - "type": "string" - }, - "latencyime": { - "description": "耗时", - "type": "string" - }, - "method": { - "description": "函数", - "type": "string" - }, - "operId": { - "description": "日志编码", - "type": "integer" - }, - "operIp": { - "description": "客户端ip", - "type": "string" - }, - "operLocation": { - "description": "访问位置", - "type": "string" - }, - "operName": { - "description": "操作者", - "type": "string" - }, - "operParam": { - "description": "请求参数", - "type": "string" - }, - "operTime": { - "description": "操作时间", - "type": "string" - }, - "operUrl": { - "description": "访问地址", - "type": "string" - }, - "operatorType": { - "description": "操作类型", - "type": "string" - }, - "params": { - "description": "参数", - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "requestMethod": { - "description": "请求方式", - "type": "string" - }, - "status": { - "description": "操作状态", - "type": "string" - }, - "title": { - "description": "操作模块", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "userAgent": { - "description": "ua", - "type": "string" - } - } - }, "models.SysRole": { "type": "object", "properties": { @@ -3647,6 +2584,15 @@ "description": "功能名称", "type": "string" }, + "isActions": { + "type": "integer" + }, + "isAuth": { + "type": "integer" + }, + "isDataScope": { + "type": "integer" + }, "isLogicalDelete": { "type": "string" }, @@ -3668,7 +2614,6 @@ "type": "string" }, "params": { - "type": "object", "$ref": "#/definitions/tools.Params" }, "pkColumn": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index f1d0542e..0ef911f3 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,29 +1,4 @@ definitions: - app.Page: - properties: - count: - type: integer - list: - type: object - pageIndex: - type: integer - pageSize: - type: integer - type: object - app.PageResponse: - properties: - code: - description: 代码 - example: 200 - type: integer - data: - $ref: '#/definitions/app.Page' - description: 数据集 - type: object - msg: - description: 消息 - type: string - type: object app.Response: properties: code: @@ -36,6 +11,8 @@ definitions: msg: description: 消息 type: string + requestId: + type: string type: object models.DictType: properties: @@ -86,58 +63,6 @@ definitions: - username - uuid type: object - models.LoginLog: - properties: - browser: - description: 浏览器 - type: string - createBy: - description: 创建人 - type: string - createdAt: - type: string - dataScope: - description: 数据 - type: string - deletedAt: - type: string - infoId: - description: 主键 - type: integer - ipaddr: - description: ip地址 - type: string - loginLocation: - description: 归属地 - type: string - loginTime: - description: 登录时间 - type: string - msg: - type: string - os: - description: 系统 - type: string - params: - type: string - platform: - description: 固件 - type: string - remark: - description: 备注 - type: string - status: - description: 状态 - type: string - updateBy: - description: 更新者 - type: string - updatedAt: - type: string - username: - description: 用户名 - type: string - type: object models.Menu: properties: action: @@ -230,78 +155,6 @@ definitions: updatedAt: type: string type: object - models.SysCategory: - properties: - createBy: - description: 创建者 - type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: - type: string - id: - description: 分类Id - type: integer - img: - description: 图片 - type: string - name: - description: 名称 - type: string - params: - type: string - remark: - description: 备注 - type: string - sort: - description: 排序 - type: string - status: - description: 状态 - type: string - updateBy: - description: 更新者 - type: string - updatedAt: - type: string - type: object - models.SysConfig: - properties: - configId: - description: 编码 - type: integer - configKey: - description: 参数键名 - type: string - configName: - description: 参数名称 - type: string - configType: - description: 是否系统内置 - type: string - configValue: - description: 参数键值 - type: string - createBy: - type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: - type: string - params: - type: string - remark: - description: 备注 - type: string - updateBy: - type: string - updatedAt: - type: string - type: object models.SysContent: properties: cateId: @@ -392,119 +245,6 @@ definitions: updatedAt: type: string type: object - models.SysFileDir: - properties: - children: - items: - $ref: '#/definitions/models.SysFileDir' - type: array - createBy: - description: 创建人 - type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: - type: string - id: - type: integer - label: - description: 名称 - type: string - pId: - description: 父id - type: integer - params: - type: string - path: - type: string - sort: - description: 排序 - type: integer - updateBy: - description: 编辑人 - type: string - updatedAt: - type: string - type: object - models.SysOperLog: - properties: - businessType: - description: 操作类型 - type: string - businessTypes: - type: string - createBy: - description: 创建人 - type: string - createdAt: - type: string - dataScope: - description: 数据 - type: string - deletedAt: - type: string - deptName: - description: 部门名称 - type: string - jsonResult: - description: 返回数据 - type: string - latencyime: - description: 耗时 - type: string - method: - description: 函数 - type: string - operId: - description: 日志编码 - type: integer - operIp: - description: 客户端ip - type: string - operLocation: - description: 访问位置 - type: string - operName: - description: 操作者 - type: string - operParam: - description: 请求参数 - type: string - operTime: - description: 操作时间 - type: string - operUrl: - description: 访问地址 - type: string - operatorType: - description: 操作类型 - type: string - params: - description: 参数 - type: string - remark: - description: 备注 - type: string - requestMethod: - description: 请求方式 - type: string - status: - description: 操作状态 - type: string - title: - description: 操作模块 - type: string - updateBy: - description: 更新者 - type: string - updatedAt: - type: string - userAgent: - description: ua - type: string - type: object models.SysRole: properties: admin: @@ -729,6 +469,12 @@ definitions: functionName: description: 功能名称 type: string + isActions: + type: integer + isAuth: + type: integer + isDataScope: + type: integer isLogicalDelete: type: string logicalDelete: @@ -745,7 +491,6 @@ definitions: type: string params: $ref: '#/definitions/tools.Params' - type: object pkColumn: type: string pkGoField: @@ -785,121 +530,10 @@ info: 添加qq群: 74520518 进入技术交流群 请备注,谢谢! license: name: MIT - url: https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md + url: https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md title: go-admin API version: 1.0.1 paths: - /api/v1/config: - put: - consumes: - - application/json - description: 获取JSON - parameters: - - description: body - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.SysConfig' - type: object - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - security: - - Bearer: [] - summary: 修改配置 - tags: - - 配置 - /api/v1/config/{configId}: - delete: - description: 删除数据 - parameters: - - description: configId - in: path - name: configId - required: true - type: integer - responses: - "200": - description: '{"code": -1, "message": "删除失败"}' - schema: - type: string - summary: 删除配置 - tags: - - 配置 - get: - description: 获取JSON - parameters: - - description: 配置编码 - in: path - name: configId - required: true - type: integer - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 获取配置 - tags: - - 配置 - /api/v1/configKey/{configKey}: - get: - description: 获取JSON - parameters: - - description: configKey - in: path - name: configKey - required: true - type: integer - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 获取配置 - tags: - - 配置 - /api/v1/configList: - get: - description: 获取JSON - parameters: - - description: configKey - in: query - name: configKey - type: string - - description: configName - in: query - name: configName - type: string - - description: configType - in: query - name: configType - type: string - - description: 页条数 - in: query - name: pageSize - type: integer - - description: 页码 - in: query - name: pageIndex - type: integer - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 配置列表数据 - tags: - - 配置 /api/v1/db/columns/page: get: description: 数据库表列分页列表 / database table column page list @@ -960,7 +594,6 @@ paths: required: true schema: $ref: '#/definitions/models.SysDept' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -987,7 +620,6 @@ paths: required: true schema: $ref: '#/definitions/models.SysDept' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1075,7 +707,6 @@ paths: required: true schema: $ref: '#/definitions/models.DictType' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1097,7 +728,6 @@ paths: required: true schema: $ref: '#/definitions/models.DictType' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1208,7 +838,6 @@ paths: required: true schema: $ref: '#/definitions/models.DictType' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1230,7 +859,6 @@ paths: required: true schema: $ref: '#/definitions/models.DictType' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1304,126 +932,12 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.PageResponse' + $ref: '#/definitions/app.Response' security: - Bearer: [] summary: 字典类型列表数据 tags: - 字典类型 - /api/v1/loginlog: - post: - consumes: - - application/json - description: 获取JSON - parameters: - - description: data - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.LoginLog' - type: object - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - security: - - Bearer: [] - summary: 添加登录日志 - tags: - - 登录日志 - put: - consumes: - - application/json - description: 获取JSON - parameters: - - description: body - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.LoginLog' - type: object - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - security: - - Bearer: [] - summary: 修改登录日志 - tags: - - 登录日志 - /api/v1/loginlog/{infoId}: - delete: - description: 删除数据 - parameters: - - description: 以逗号(,)分割的infoId - in: path - name: infoId - required: true - type: string - responses: - "200": - description: '{"code": -1, "message": "删除失败"}' - schema: - type: string - summary: 批量删除登录日志 - tags: - - 登录日志 - get: - description: 获取JSON - parameters: - - description: infoId - in: path - name: infoId - required: true - type: integer - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 通过编码获取登录日志 - tags: - - 登录日志 - /api/v1/loginloglist: - get: - description: 获取JSON - parameters: - - description: status - in: query - name: status - type: string - - description: dictCode - in: query - name: dictCode - type: string - - description: dictType - in: query - name: dictType - type: string - - description: 页条数 - in: query - name: pageSize - type: integer - - description: 页码 - in: query - name: pageIndex - type: integer - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 登录日志列表 - tags: - - 登录日志 /api/v1/menu: get: description: 获取JSON @@ -1519,7 +1033,6 @@ paths: required: true schema: $ref: '#/definitions/models.Menu' - type: object responses: "200": description: '{"code": -1, "message": "修改失败"}' @@ -1601,99 +1114,6 @@ paths: summary: 根据角色名称获取菜单列表数据(左菜单使用) tags: - 菜单 - /api/v1/operlog: - post: - consumes: - - application/json - description: 获取JSON - parameters: - - description: data - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.SysOperLog' - type: object - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - security: - - Bearer: [] - summary: 添加操作日志 - tags: - - 操作日志 - /api/v1/operlog/{infoId}: - get: - description: 获取JSON - parameters: - - description: infoId - in: path - name: infoId - required: true - type: integer - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 通过编码获取登录日志 - tags: - - 登录日志 - /api/v1/operlog/{operId}: - delete: - description: 删除数据 - parameters: - - description: 以逗号(,)分割的operId - in: path - name: operId - required: true - type: string - responses: - "200": - description: '{"code": -1, "message": "删除失败"}' - schema: - type: string - summary: 批量删除操作日志 - tags: - - 操作日志 - /api/v1/operloglist: - get: - description: 获取JSON - parameters: - - description: status - in: query - name: status - type: string - - description: dictCode - in: query - name: dictCode - type: string - - description: dictType - in: query - name: dictType - type: string - - description: 页条数 - in: query - name: pageSize - type: integer - - description: 页码 - in: query - name: pageIndex - type: integer - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 登录日志列表 - tags: - - 登录日志 /api/v1/post: get: description: 获取JSON @@ -1735,7 +1155,6 @@ paths: required: true schema: $ref: '#/definitions/models.Post' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1758,7 +1177,6 @@ paths: required: true schema: $ref: '#/definitions/models.Post' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1861,7 +1279,6 @@ paths: required: true schema: $ref: '#/definitions/models.SysRole' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1881,7 +1298,6 @@ paths: required: true schema: $ref: '#/definitions/models.SysRole' - type: object responses: "200": description: '{"code": -1, "message": "修改失败"}' @@ -2033,7 +1449,6 @@ paths: required: true schema: $ref: '#/definitions/tools.SysTables' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -2127,7 +1542,6 @@ paths: required: true schema: $ref: '#/definitions/models.SysUser' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -2173,27 +1587,6 @@ paths: summary: 列表用户信息数据 tags: - 用户 - /api/v1/syscategory: - post: - consumes: - - application/json - description: 获取JSON - parameters: - - description: data - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.SysCategory' - type: object - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - summary: 添加分类 - tags: - - 分类 /api/v1/syscontent: post: consumes: @@ -2206,7 +1599,6 @@ paths: required: true schema: $ref: '#/definitions/models.SysContent' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -2215,27 +1607,6 @@ paths: summary: 添加内容管理 tags: - 内容管理 - /api/v1/sysfiledir: - post: - consumes: - - application/json - description: 获取JSON - parameters: - - description: data - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.SysFileDir' - type: object - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - summary: 添加SysFileDir - tags: - - SysFileDir /api/v1/system/setting: post: description: 获取JSON @@ -2246,7 +1617,6 @@ paths: required: true schema: $ref: '#/definitions/models.SysUser' - type: object responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -2283,7 +1653,6 @@ paths: required: true schema: $ref: '#/definitions/models.SysUser' - type: object responses: "200": description: '{"code": -1, "message": "修改失败"}' @@ -2342,7 +1711,6 @@ paths: required: true schema: $ref: '#/definitions/models.Login' - type: object responses: "200": description: '{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": @@ -2364,79 +1732,6 @@ paths: security: - Bearer: [] summary: 退出登录 - /sd/cpu: - get: - consumes: - - text/html - description: CPU 使用量 DiskCheck checks the disk usage. - produces: - - text/html - responses: - "200": - description: OK - schema: - type: string - summary: CPU 使用量 - /sd/disk: - get: - consumes: - - text/html - description: 服务器硬盘使用量 DiskCheck checks the disk usage. - produces: - - text/html - responses: - "200": - description: 'OK - Free space: 16321MB (15GB) / 51200MB (50GB) | Used: 31%' - schema: - type: string - "429": - description: WARNING - schema: - type: string - "500": - description: CRITICAL - schema: - type: string - summary: 服务器硬盘使用量 - /sd/health: - get: - consumes: - - text/html - description: 健康状况 - produces: - - text/html - responses: - "200": - description: OK - schema: - type: string - summary: 健康状况 HealthCheck shows OK as the ping-pong result. - /sd/os: - get: - consumes: - - text/html - description: Os - produces: - - text/html - responses: - "200": - description: OK - schema: - type: string - summary: OS - /sd/ram: - get: - consumes: - - text/html - description: 内存使用量 RAMCheck checks the disk usage. - produces: - - text/html - responses: - "200": - description: OK - schema: - type: string - summary: 内存使用量 securityDefinitions: Bearer: in: header From 83529dd6f577778fc70211600cff25e9bab0ac10 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 29 Nov 2020 01:05:43 +0800 Subject: [PATCH 045/201] =?UTF-8?q?fix:=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98=E5=92=8C=E7=8A=B6=E6=80=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98=EF=BC=88#225=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/dept.go | 1 + .../version/1606582844753_migrate.go | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 cmd/migrate/migration/version/1606582844753_migrate.go diff --git a/app/admin/models/dept.go b/app/admin/models/dept.go index 7820ed5c..cb756989 100644 --- a/app/admin/models/dept.go +++ b/app/admin/models/dept.go @@ -167,6 +167,7 @@ func Digui(deptlist *[]SysDept, menu SysDept) SysDept { mi.Phone = list[j].Phone mi.Email = list[j].Email mi.Status = list[j].Status + mi.CreatedAt = list[j].CreatedAt mi.Children = []SysDept{} ms := Digui(deptlist, mi) min = append(min, ms) diff --git a/cmd/migrate/migration/version/1606582844753_migrate.go b/cmd/migrate/migration/version/1606582844753_migrate.go new file mode 100644 index 00000000..5158cb34 --- /dev/null +++ b/cmd/migrate/migration/version/1606582844753_migrate.go @@ -0,0 +1,32 @@ +package version + +import ( + "go-admin/app/admin/models" + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1606582844753Test) +} + +func _1606582844753Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + + dicData := models.SysDept{} + err := tx.Model(&dicData).Where("status = ?", 0).Update("status", 2).Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} From ddb3a45e1a12e72208d995ff8d545bb1253f41f5 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 29 Nov 2020 01:37:32 +0800 Subject: [PATCH 046/201] =?UTF-8?q?fix:=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=AD=97=E5=85=B8=E7=8A=B6=E6=80=81=E7=9A=84=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=88#251=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/dictdata.go | 2 + .../version/1599190683670_migrate.go | 98 +++++++++---------- .../version/1606579402398_migrate.go | 6 ++ .../version/1606582844753_migrate.go | 10 +- 4 files changed, 65 insertions(+), 51 deletions(-) diff --git a/app/admin/models/dictdata.go b/app/admin/models/dictdata.go index 29a0f034..60d6f4f0 100644 --- a/app/admin/models/dictdata.go +++ b/app/admin/models/dictdata.go @@ -88,6 +88,8 @@ func (e *DictData) Get() ([]DictData, error) { table = table.Where("dict_type = ?", e.DictType) } + table = table.Where("status = ?", 2) + if err := table.Order("dict_sort").Find(&doc).Error; err != nil { return doc, err } diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index 82711794..07f0d8b3 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -21,10 +21,10 @@ func _1599190683670Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { list3 := []models.SysDept{ - {DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 8, ParentId: 1, DeptPath: "/0/1/8", DeptName: "运维部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 9, ParentId: 1, DeptPath: "/0/1/9", DeptName: "客服部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 8, ParentId: 1, DeptPath: "/0/1/8", DeptName: "运维部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 9, ParentId: 1, DeptPath: "/0/1/9", DeptName: "客服部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, {DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } @@ -35,26 +35,26 @@ func _1599190683670Test(db *gorm.DB, version string) error { } list5 := []models.Post{ - {PostId: 1, PostName: "首席执行官", PostCode: "CEO", Sort: 0, Status: "0", Remark: "首席执行官", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {PostId: 2, PostName: "首席技术执行官", PostCode: "CTO", Sort: 2, Status: "0", Remark: "首席技术执行官", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {PostId: 3, PostName: "首席运营官", PostCode: "COO", Sort: 3, Status: "0", Remark: "测试工程师", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {PostId: 1, PostName: "首席执行官", PostCode: "CEO", Sort: 0, Status: "2", Remark: "首席执行官", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {PostId: 2, PostName: "首席技术执行官", PostCode: "CTO", Sort: 2, Status: "2", Remark: "首席技术执行官", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {PostId: 3, PostName: "首席运营官", PostCode: "COO", Sort: 3, Status: "2", Remark: "测试工程师", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } list6 := []models.SysRole{ - {1, "系统管理员", "0", "admin", 1, "", "1", "", "", true, "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, "", []int{}, []int{}}, + {1, "系统管理员", "2", "admin", 1, "", "1", "", "", true, "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, "", []int{}, []int{}}, } list7 := []models.DictType{ - {DictId: 1, DictName: "系统开关", DictType: "sys_normal_disable", Status: "0", CreateBy: "1", UpdateBy: "1", Remark: "系统开关列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 2, DictName: "用户性别", DictType: "sys_user_sex", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "用户性别列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 3, DictName: "菜单状态", DictType: "sys_show_hide", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "菜单状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 4, DictName: "系统是否", DictType: "sys_yes_no", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "系统是否列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 5, DictName: "任务状态", DictType: "sys_job_status", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "任务状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 6, DictName: "任务分组", DictType: "sys_job_group", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "任务分组列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 7, DictName: "通知类型", DictType: "sys_notice_type", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "通知类型列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 8, DictName: "系统状态", DictType: "sys_common_status", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "登录状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 9, DictName: "操作类型", DictType: "sys_oper_type", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "操作类型列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictId: 10, DictName: "通知状态", DictType: "sys_notice_status", Status: "0", CreateBy: "1", UpdateBy: "", Remark: "通知状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 1, DictName: "系统开关", DictType: "sys_normal_disable", Status: "2", CreateBy: "1", UpdateBy: "1", Remark: "系统开关列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 2, DictName: "用户性别", DictType: "sys_user_sex", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "用户性别列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 3, DictName: "菜单状态", DictType: "sys_show_hide", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "菜单状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 4, DictName: "系统是否", DictType: "sys_yes_no", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "系统是否列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 5, DictName: "任务状态", DictType: "sys_job_status", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "任务状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 6, DictName: "任务分组", DictType: "sys_job_group", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "任务分组列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 7, DictName: "通知类型", DictType: "sys_notice_type", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "通知类型列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 8, DictName: "系统状态", DictType: "sys_common_status", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "登录状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 9, DictName: "操作类型", DictType: "sys_oper_type", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "操作类型列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictId: 10, DictName: "通知状态", DictType: "sys_notice_status", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "通知状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } list8 := []models.SysUser{ @@ -62,37 +62,37 @@ func _1599190683670Test(db *gorm.DB, version string) error { } list9 := []models.DictData{ - {DictCode: 1, DictSort: 0, DictLabel: "正常", DictValue: "0", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统正常", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 2, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统停用", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 3, DictSort: 0, DictLabel: "男", DictValue: "0", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别男", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 4, DictSort: 0, DictLabel: "女", DictValue: "1", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别女", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 5, DictSort: 0, DictLabel: "未知", DictValue: "2", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别未知", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 6, DictSort: 0, DictLabel: "显示", DictValue: "0", DictType: "sys_show_hide", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "显示菜单", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 7, DictSort: 0, DictLabel: "隐藏", DictValue: "1", DictType: "sys_show_hide", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "隐藏菜单", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 8, DictSort: 0, DictLabel: "是", DictValue: "Y", DictType: "sys_yes_no", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统默认是", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 9, DictSort: 0, DictLabel: "否", DictValue: "N", DictType: "sys_yes_no", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统默认否", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 10, DictSort: 0, DictLabel: "正常", DictValue: "2", DictType: "sys_job_status", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "正常状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 11, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_job_status", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "停用状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 12, DictSort: 0, DictLabel: "默认", DictValue: "DEFAULT", DictType: "sys_job_group", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "默认分组", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 13, DictSort: 0, DictLabel: "系统", DictValue: "SYSTEM", DictType: "sys_job_group", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统分组", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 14, DictSort: 0, DictLabel: "通知", DictValue: "1", DictType: "sys_notice_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "通知", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 15, DictSort: 0, DictLabel: "公告", DictValue: "2", DictType: "sys_notice_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "公告", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 16, DictSort: 0, DictLabel: "正常", DictValue: "0", DictType: "sys_common_status", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "正常状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 17, DictSort: 0, DictLabel: "关闭", DictValue: "1", DictType: "sys_common_status", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "关闭状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 18, DictSort: 0, DictLabel: "新增", DictValue: "1", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "新增操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 19, DictSort: 0, DictLabel: "修改", DictValue: "2", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "修改操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 20, DictSort: 0, DictLabel: "删除", DictValue: "3", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "删除操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 21, DictSort: 0, DictLabel: "授权", DictValue: "4", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "授权操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 22, DictSort: 0, DictLabel: "导出", DictValue: "5", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "导出操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 23, DictSort: 0, DictLabel: "导入", DictValue: "6", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "导入操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 24, DictSort: 0, DictLabel: "强退", DictValue: "7", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "强退操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 25, DictSort: 0, DictLabel: "生成代码", DictValue: "8", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "生成操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 26, DictSort: 0, DictLabel: "清空数据", DictValue: "9", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "清空操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 27, DictSort: 0, DictLabel: "成功", DictValue: "0", DictType: "sys_notice_status", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "成功状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 28, DictSort: 0, DictLabel: "失败", DictValue: "1", DictType: "sys_notice_status", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "", Remark: "失败状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 29, DictSort: 0, DictLabel: "登录", DictValue: "10", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "登录操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 30, DictSort: 0, DictLabel: "退出", DictValue: "11", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DictCode: 31, DictSort: 0, DictLabel: "获取验证码", DictValue: "12", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "0", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "获取验证码", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 1, DictSort: 0, DictLabel: "正常", DictValue: "2", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统正常", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 2, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统停用", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 3, DictSort: 0, DictLabel: "男", DictValue: "0", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别男", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 4, DictSort: 0, DictLabel: "女", DictValue: "1", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别女", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 5, DictSort: 0, DictLabel: "未知", DictValue: "2", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别未知", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 6, DictSort: 0, DictLabel: "显示", DictValue: "0", DictType: "sys_show_hide", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "显示菜单", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 7, DictSort: 0, DictLabel: "隐藏", DictValue: "1", DictType: "sys_show_hide", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "隐藏菜单", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 8, DictSort: 0, DictLabel: "是", DictValue: "Y", DictType: "sys_yes_no", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统默认是", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 9, DictSort: 0, DictLabel: "否", DictValue: "N", DictType: "sys_yes_no", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统默认否", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 10, DictSort: 0, DictLabel: "正常", DictValue: "2", DictType: "sys_job_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "正常状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 11, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_job_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "停用状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 12, DictSort: 0, DictLabel: "默认", DictValue: "DEFAULT", DictType: "sys_job_group", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "默认分组", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 13, DictSort: 0, DictLabel: "系统", DictValue: "SYSTEM", DictType: "sys_job_group", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统分组", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 14, DictSort: 0, DictLabel: "通知", DictValue: "1", DictType: "sys_notice_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "通知", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 15, DictSort: 0, DictLabel: "公告", DictValue: "2", DictType: "sys_notice_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "公告", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 16, DictSort: 0, DictLabel: "正常", DictValue: "0", DictType: "sys_common_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "正常状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 17, DictSort: 0, DictLabel: "关闭", DictValue: "1", DictType: "sys_common_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "关闭状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 18, DictSort: 0, DictLabel: "新增", DictValue: "1", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "新增操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 19, DictSort: 0, DictLabel: "修改", DictValue: "2", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "修改操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 20, DictSort: 0, DictLabel: "删除", DictValue: "3", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "删除操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 21, DictSort: 0, DictLabel: "授权", DictValue: "4", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "授权操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 22, DictSort: 0, DictLabel: "导出", DictValue: "5", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "导出操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 23, DictSort: 0, DictLabel: "导入", DictValue: "6", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "导入操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 24, DictSort: 0, DictLabel: "强退", DictValue: "7", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "强退操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 25, DictSort: 0, DictLabel: "生成代码", DictValue: "8", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "生成操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 26, DictSort: 0, DictLabel: "清空数据", DictValue: "9", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "清空操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 27, DictSort: 0, DictLabel: "成功", DictValue: "0", DictType: "sys_notice_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "成功状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 28, DictSort: 0, DictLabel: "失败", DictValue: "1", DictType: "sys_notice_status", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "失败状态", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 29, DictSort: 0, DictLabel: "登录", DictValue: "10", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "登录操作", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 30, DictSort: 0, DictLabel: "退出", DictValue: "11", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DictCode: 31, DictSort: 0, DictLabel: "获取验证码", DictValue: "12", DictType: "sys_oper_type", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "1", Remark: "获取验证码", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } list10 := []models.SysSetting{ diff --git a/cmd/migrate/migration/version/1606579402398_migrate.go b/cmd/migrate/migration/version/1606579402398_migrate.go index bd650da1..845c1f90 100644 --- a/cmd/migrate/migration/version/1606579402398_migrate.go +++ b/cmd/migrate/migration/version/1606579402398_migrate.go @@ -24,6 +24,12 @@ func _1606579402398Test(db *gorm.DB, version string) error { return err } + dicType := models.DictType{} + err = tx.Model(&dicType).Where("status = ?", 0).Update("status", 2).Error + if err != nil { + return err + } + user := models.SysUser{} err = tx.Model(&user).Where("user_id = ?", 1).Update("status", 2).Error if err != nil { diff --git a/cmd/migrate/migration/version/1606582844753_migrate.go b/cmd/migrate/migration/version/1606582844753_migrate.go index 5158cb34..e99d360a 100644 --- a/cmd/migrate/migration/version/1606582844753_migrate.go +++ b/cmd/migrate/migration/version/1606582844753_migrate.go @@ -19,8 +19,14 @@ func _1606582844753Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - dicData := models.SysDept{} - err := tx.Model(&dicData).Where("status = ?", 0).Update("status", 2).Error + dept := models.SysDept{} + err := tx.Model(&dept).Where("status = ?", 0).Update("status", 2).Error + if err != nil { + return err + } + + dictData := models.DictData{} + err = tx.Model(&dictData).Where("status = ?", 0).Update("status", 2).Error if err != nil { return err } From 2790abf1ade607d7f7fe38e1bebb138349af6cd0 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 2 Dec 2020 21:11:53 +0800 Subject: [PATCH 047/201] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcache=E5=8C=85?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 3 +-- go.sum | 43 +++++++++-------------------------- pkg/cache/redis.go | 2 +- template/v3/model.go.template | 2 +- 4 files changed, 14 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index 15683b98..47e5105e 100644 --- a/go.mod +++ b/go.mod @@ -14,16 +14,15 @@ require ( github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 - github.com/matchstalk/redisqueue v1.0.3 github.com/mojocn/base64Captcha v1.3.1 github.com/mssola/user_agent v0.5.2 github.com/opentracing/basictracer-go v1.1.0 // indirect github.com/opentracing/opentracing-go v1.1.0 github.com/prometheus/client_golang v1.1.0 github.com/robfig/cron/v3 v3.0.1 + github.com/robinjoseph08/redisqueue/v2 v2.1.0 github.com/satori/go.uuid v1.2.0 github.com/shamsher31/goimgext v1.0.0 - github.com/shamsher31/goimgtype v1.0.0 github.com/shirou/gopsutil v2.20.7+incompatible github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect diff --git a/go.sum b/go.sum index 833d1ada..00a60892 100644 --- a/go.sum +++ b/go.sum @@ -13,7 +13,6 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/AlecAivazis/survey/v2 v2.0.5/go.mod h1:WYBhg6f0y/fNYUuesWQc0PKbJcEliGcYHB9sNT3Bg74= github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= @@ -86,7 +85,6 @@ github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= -github.com/bsm/redislock v0.6.0/go.mod h1:3Kgu+cXw0JrkZ5pmY/JbcFpixGZ5M9v9G2PGWYqku+k= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= github.com/caddyserver/certmagic v0.10.6/go.mod h1:Y8jcUBctgk/IhpAzlHKfimZNyXCkfGgRTC0orl8gROQ= @@ -126,6 +124,7 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= @@ -177,13 +176,10 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f h1:8l4Aw3Jmx0pLKYMkY+1b6yBPgE+rzRtA5T3vqFyI2Z8= github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= -github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0 h1:rdQovo0JtjoBTUQzzrTqnXxxFi4etuhvXrUZHwI9z7w= -github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4 h1:H7SmWlvnE2HGoKmPlsJwTYVMBEvw/9acP2UBuNzbx1g= -github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk= github.com/go-admin-team/go-admin-core v1.2.2 h1:TMR5ga2vTQGRMR+zZ9XrOO2Zpvl5+AOFN4bnfJfimKw= github.com/go-admin-team/go-admin-core v1.2.2/go.mod h1:F+wumLm6Tw9Y9usOy45vdvQ9kbbCgSJKseKWzjvd/BQ= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= @@ -226,8 +222,6 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-redis/redis v6.15.7+incompatible h1:3skhDh95XQMpnqeqNftPkQD9jL9e5e36z/1SUm6dy1U= -github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= @@ -344,7 +338,6 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= @@ -435,7 +428,6 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= @@ -470,8 +462,6 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN github.com/marten-seemann/chacha20 v0.2.0/go.mod h1:HSdjFau7GzYRj+ahFNwsO3ouVJr1HFkWoEwNDb4TMtE= github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI= github.com/marten-seemann/qtls v0.4.1/go.mod h1:pxVXcHHw1pNIt8Qo0pwSYQEoZ8yYOOPXTCZLQQunvRc= -github.com/matchstalk/redisqueue v1.0.3 h1:ZRrEhnvA6/YxLu2EbzdZYeQHQQYT8yZBAi1qv/USEQA= -github.com/matchstalk/redisqueue v1.0.3/go.mod h1:5DZ3X4w9t+6Wv9vz9wmUt/i15gsOorGXRnqzGhBP6zI= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -493,9 +483,8 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= -github.com/mattn/goveralls v0.0.5 h1:spfq8AyZ0cCk57Za6/juJ5btQxeE1FaEGMdfcI+XO48= -github.com/mattn/goveralls v0.0.5/go.mod h1:Xg2LHi51faXLyKXwsndxiW6uxEEQT9+3sjGzzwU4xy0= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= @@ -548,14 +537,11 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= -github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= @@ -573,6 +559,7 @@ github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -620,6 +607,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ= @@ -629,15 +617,15 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shamsher31/goimgext v1.0.0 h1:wFKf9GeeE0Xr6UQtliaPgYYgTju2izobM7XpCEgUCC8= github.com/shamsher31/goimgext v1.0.0/go.mod h1:rYLKgXuTGBIaH49z+jUVSWz7gUWIZmqvYUsdvJbNNOc= -github.com/shamsher31/goimgtype v1.0.0 h1:7nmPz5GEb01sjFUojCbZJcBI68A8tmLXoCFbb5I34u4= -github.com/shamsher31/goimgtype v1.0.0/go.mod h1:OZm3NZQDbK0ezlk9IV5oq3cWQwjF1oVSxKNx19bkf64= github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w= github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= @@ -707,9 +695,8 @@ github.com/unrolled/secure v1.0.8 h1:JaMvKbe4CRt8oyxVXn+xY+6jlqd7pyJNSVkmsBxxQsM github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8p0BXDPI= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.3 h1:FpNT6zq26xNpHZy08emi755QwzLPs6Pukqjlc7RfOMU= -github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= @@ -757,7 +744,6 @@ golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -866,7 +852,6 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -881,14 +866,12 @@ golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -933,7 +916,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200113040837-eac381796e91/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b h1:zSzQJAznWxAh9fZxiPy2FZo+ZZEYoYFYYDYdOrU7AaM= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -981,11 +963,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/AlecAivazis/survey.v1 v1.8.5 h1:QoEEmn/d5BbuPIL2qvXwzJdttFFhRQFkaq+tEKb7SMI= gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= -gopkg.in/AlecAivazis/survey.v1 v1.8.8 h1:5UtTowJZTz1j7NxVzDGKTz6Lm9IWm8DDF6b7a2wq9VY= -gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/cache/redis.go b/pkg/cache/redis.go index 9d5d84ab..0af1738c 100644 --- a/pkg/cache/redis.go +++ b/pkg/cache/redis.go @@ -5,7 +5,7 @@ import ( "github.com/go-admin-team/go-admin-core/cache" "github.com/go-redis/redis/v7" - "github.com/matchstalk/redisqueue" + "github.com/robinjoseph08/redisqueue/v2" ) var RedisAdapter Adapter diff --git a/template/v3/model.go.template b/template/v3/model.go.template index 80d5f8c9..913fb1cb 100644 --- a/template/v3/model.go.template +++ b/template/v3/model.go.template @@ -19,7 +19,7 @@ type {{.ClassName}} struct { {{- else if eq .GoField "CreateBy" -}} {{- else if eq .GoField "UpdateBy" -}} {{- else }} - {{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};comment:{{- if eq .ColumnComment "" -}}{{.GoField}}{{- else -}}{{.ColumnComment}}{{end -}}"` // {{end -}} + {{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};comment:{{- if eq .ColumnComment "" -}}{{.GoField}}{{- else -}}{{.ColumnComment}}{{end -}}"` {{end -}} {{- end }} } From 5f873914e0c7faa80c7d026cab0d5707d11bd571 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Tue, 8 Dec 2020 20:28:26 +0800 Subject: [PATCH 048/201] =?UTF-8?q?config=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/api/server.go | 17 ++--- go.mod | 2 +- go.sum | 36 +++++++++- main.go | 64 ------------------ pkg/table/analysis.go | 15 +++++ tools/config/application.go | 18 +---- tools/config/config.go | 129 +++++++++++++++++++----------------- tools/config/database.go | 11 --- tools/config/gen.go | 9 --- tools/config/jwt.go | 11 --- tools/config/logger.go | 14 ---- tools/config/ssl.go | 11 --- tools/env.go | 4 ++ tools/trace/trace.go | 1 - 14 files changed, 134 insertions(+), 208 deletions(-) diff --git a/cmd/api/server.go b/cmd/api/server.go index 007a856d..0ca01337 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -11,8 +11,6 @@ import ( "github.com/gin-gonic/gin" "github.com/spf13/cobra" - "github.com/spf13/viper" - "go-admin/app/admin/router" "go-admin/app/jobs" "go-admin/common/database" @@ -59,6 +57,7 @@ func setup() { //1. 读取配置 config.Setup(configYml) + go config.Watch() //2. 设置日志 global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus") global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job") @@ -74,7 +73,9 @@ func setup() { } func run() error { - if viper.GetString("settings.application.mode") == string(tools.ModeProd) { + defer config.Stop() + + if config.ApplicationConfig.Mode == tools.ModeProd.String() { gin.SetMode(gin.ReleaseMode) } engine := global.Cfg.GetEngine() @@ -92,7 +93,7 @@ func run() error { } srv := &http.Server{ - Addr: config.ApplicationConfig.Host + ":" + config.ApplicationConfig.Port, + Addr: fmt.Sprintf("%s:%d", config.ApplicationConfig.Host, config.ApplicationConfig.Port), Handler: global.Cfg.GetEngine(), } go func() { @@ -125,11 +126,11 @@ func run() error { fmt.Println(tools.Red(string(global.LogoContent))) tip() fmt.Println(tools.Green("Server run at:")) - fmt.Printf("- Local: http://localhost:%s/ \r\n", config.ApplicationConfig.Port) - fmt.Printf("- Network: http://%s:%s/ \r\n", tools.GetLocaHonst(), config.ApplicationConfig.Port) + fmt.Printf("- Local: http://localhost:%d/ \r\n", config.ApplicationConfig.Port) + fmt.Printf("- Network: http://%s:%d/ \r\n", tools.GetLocaHonst(), config.ApplicationConfig.Port) fmt.Println(tools.Green("Swagger run at:")) - fmt.Printf("- Local: http://localhost:%s/swagger/index.html \r\n", config.ApplicationConfig.Port) - fmt.Printf("- Network: http://%s:%s/swagger/index.html \r\n", tools.GetLocaHonst(), config.ApplicationConfig.Port) + fmt.Printf("- Local: http://localhost:%d/swagger/index.html \r\n", config.ApplicationConfig.Port) + fmt.Printf("- Network: http://%s:%d/swagger/index.html \r\n", tools.GetLocaHonst(), config.ApplicationConfig.Port) fmt.Printf("%s Enter Control + C Shutdown Server \r\n", tools.GetCurrentTimeStr()) // 等待中断信号以优雅地关闭服务器(设置 5 秒的超时时间) quit := make(chan os.Signal) diff --git a/go.mod b/go.mod index 47e5105e..d80cd3c2 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.2 + github.com/go-admin-team/go-admin-core v1.2.3-0.20201208071849-612a1666b9cc github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 diff --git a/go.sum b/go.sum index 00a60892..7b679505 100644 --- a/go.sum +++ b/go.sum @@ -79,9 +79,11 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= @@ -100,6 +102,8 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= @@ -150,7 +154,10 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/ef-ds/deque v1.0.4-0.20190904040645-54cb57c252a1/go.mod h1:HvODWzv6Y6kBf3Ah2WzN1bHjDUezGLaAhwuWVwfpEJs= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= @@ -164,6 +171,7 @@ github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pF github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= @@ -180,8 +188,8 @@ github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f h1:8l4Aw3Jmx github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.2 h1:TMR5ga2vTQGRMR+zZ9XrOO2Zpvl5+AOFN4bnfJfimKw= -github.com/go-admin-team/go-admin-core v1.2.2/go.mod h1:F+wumLm6Tw9Y9usOy45vdvQ9kbbCgSJKseKWzjvd/BQ= +github.com/go-admin-team/go-admin-core v1.2.3-0.20201208071849-612a1666b9cc h1:YBC0JH9g2GAQP7ods+LHLYMJb+UtCoxiOoaS5J7cBt0= +github.com/go-admin-team/go-admin-core v1.2.3-0.20201208071849-612a1666b9cc/go.mod h1:6uyaucbKIaL5KoGcYZVDgfMwJupT4lUWksgxST33TWs= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -264,6 +272,9 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -272,6 +283,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -426,6 +439,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= @@ -490,9 +504,11 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= +github.com/micro/go-micro/v2 v2.9.1 h1:+S9koIrNWARjpP6k2TZ7kt0uC9zUJtNXzIdZTZRms7Q= github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.27 h1:aEH/kqUzUxGJ/UHcEKdJY+ugH6WEzsEBBSPa8zuy1aM= github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -556,8 +572,10 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ= +github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= @@ -824,11 +842,13 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -947,6 +967,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -955,7 +977,12 @@ google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc/examples v0.0.0-20201207231033-bce1fdfad97e/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -963,6 +990,11 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/AlecAivazis/survey.v1 v1.8.5 h1:QoEEmn/d5BbuPIL2qvXwzJdttFFhRQFkaq+tEKb7SMI= gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/main.go b/main.go index b0171ce9..b6d72c56 100644 --- a/main.go +++ b/main.go @@ -4,70 +4,6 @@ import ( "go-admin/cmd" ) -// @title go-admin API -// @version 1.0.1 -// @description 基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档 -// @description 添加qq群: 74520518 进入技术交流群 请备注,谢谢! -// @license.name MIT -// @license.url https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md - -// @securityDefinitions.apikey Bearer -// @in header -// @name Authorization - -//func main() { -// configName := "settings" -// -// -// config.InitConfig(configName) -// -// gin.SetMode(gin.DebugMode) -// log.Println(config.DatabaseConfig.Port) -// -// err := gorm.AutoMigrate(orm.Eloquent) -// if err != nil { -// log.Fatalln("数据库初始化失败 err: %v", err) -// } -// -// if config.ApplicationConfig.IsInit { -// if err := models.InitDb(); err != nil { -// log.Fatal("数据库基础数据初始化失败!") -// } else { -// config.SetApplicationIsInit() -// } -// } -// -// r := router.InitRouter() -// -// defer orm.Eloquent.Close() -// -// srv := &http.Server{ -// Addr: config.ApplicationConfig.Host + ":" + config.ApplicationConfig.Port, -// Handler: r, -// } -// -// go func() { -// // 服务连接 -// if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { -// log.Fatalf("listen: %s\n", err) -// } -// }() -// log.Println("Server Run ", config.ApplicationConfig.Host+":"+config.ApplicationConfig.Port) -// log.Println("Enter Control + C Shutdown Server") -// // 等待中断信号以优雅地关闭服务器(设置 5 秒的超时时间) -// quit := make(chan os.Signal) -// signal.Notify(quit, os.Interrupt) -// <-quit -// log.Println("Shutdown Server ...") -// -// ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) -// defer cancel() -// if err := srv.Shutdown(ctx); err != nil { -// log.Fatal("Server Shutdown:", err) -// } -// log.Println("Server exiting") -//} - func main() { cmd.Execute() } diff --git a/pkg/table/analysis.go b/pkg/table/analysis.go index 2813e628..cd556fd8 100644 --- a/pkg/table/analysis.go +++ b/pkg/table/analysis.go @@ -1,8 +1,11 @@ package table import ( + "fmt" "hash/crc32" "strconv" + + "gorm.io/gorm" ) // Crc32Hash 用于32张分表 @@ -22,3 +25,15 @@ func Crc8Hash(src string) string { sum := crc32.ChecksumIEEE([]byte(src)) % 8 return strconv.Itoa(int(sum)) } + +// e.g. DB.Scopes(DynamicTable(Crc32Hash, "test", "小圈圈")).Find(&tests) +// DynamicTable 设置动态表名scope params: f 分表计算函数 baseTable 基础表名 fieldValue 参与分表字段 +func DynamicTable(f func(string) string, baseTable, fieldValue string) func(db *gorm.DB) *gorm.DB { + return func(db *gorm.DB) *gorm.DB { + return db.Table(fmt.Sprintf("%s_%s", baseTable, f(fieldValue))) + } +} + +func CreateSubTable(f func(string) string) { + +} diff --git a/tools/config/application.go b/tools/config/application.go index 1d829d5b..af1402e2 100644 --- a/tools/config/application.go +++ b/tools/config/application.go @@ -1,12 +1,10 @@ package config -import "github.com/spf13/viper" - type Application struct { ReadTimeout int WriterTimeout int Host string - Port string + Port int64 Name string JwtSecret string Mode string @@ -14,18 +12,4 @@ type Application struct { EnableDP bool } -func InitApplication(cfg *viper.Viper) *Application { - return &Application{ - ReadTimeout: cfg.GetInt("readTimeout"), - WriterTimeout: cfg.GetInt("writerTimeout"), - Host: cfg.GetString("host"), - Port: cfg.GetString("port"), - Name: cfg.GetString("name"), - JwtSecret: cfg.GetString("jwtSecret"), - Mode: cfg.GetString("mode"), - DemoMsg: cfg.GetString("demoMsg"), - EnableDP: cfg.GetBool("enabledp"), - } -} - var ApplicationConfig = new(Application) diff --git a/tools/config/config.go b/tools/config/config.go index 62c6b928..ca081c9e 100644 --- a/tools/config/config.go +++ b/tools/config/config.go @@ -2,83 +2,94 @@ package config import ( "fmt" - "io/ioutil" + "github.com/go-admin-team/go-admin-core/config" + "github.com/go-admin-team/go-admin-core/config/source/file" "log" - "os" - "strings" - - "github.com/spf13/viper" ) -// 数据库配置项 -var cfgDatabase *viper.Viper +var ( + ExtendConfig interface{} +) -// 应用配置项 -var cfgApplication *viper.Viper +// Settings 兼容原先的配置结构 +type Settings struct { + Settings Config `yaml:"settings"` +} -// Token配置项 -var cfgJwt *viper.Viper +// Config 配置集合 +type Config struct { + Application *Application `yaml:"application"` + Ssl *Ssl `yaml:"ssl"` + Logger *Logger `yaml:"logger"` + Jwt *Jwt `yaml:"jwt"` + Database *Database `yaml:"database"` + Gen *Gen `yaml:"gen"` + Extend interface{} `yaml:"extend"` +} -// Log配置项 -var cfgLogger *viper.Viper +var ( + _watch config.Watcher + _cfg *Settings +) -// Ssl配置项 非必须 -var cfgSsl *viper.Viper - -// 代码生成配置项 非必须 -var cfgGen *viper.Viper - -//载入配置文件 +// Setup 载入配置文件 func Setup(path string) { - viper.SetConfigFile(path) - content, err := ioutil.ReadFile(path) + c, err := config.NewConfig() if err != nil { - log.Fatal(fmt.Sprintf("Read config file fail: %s", err.Error())) + log.Fatal(fmt.Sprintf("New config object fail: %s", err.Error())) } - - //Replace environment variables - err = viper.ReadConfig(strings.NewReader(os.ExpandEnv(string(content)))) + err = c.Load( + file.NewSource( + file.WithPath(path), + ), + ) if err != nil { - log.Fatal(fmt.Sprintf("Parse config file fail: %s", err.Error())) + log.Fatal(fmt.Sprintf("Load config source fail: %s", err.Error())) } - cfgDatabase = viper.Sub("settings.database") - if cfgDatabase == nil { - panic("No found settings.database in the configuration") + _cfg = &Settings{Config{ + Application: ApplicationConfig, + Ssl: SslConfig, + Logger: LoggerConfig, + Jwt: JwtConfig, + Database: DatabaseConfig, + Gen: GenConfig, + Extend: ExtendConfig, + }} + err = c.Scan(_cfg) + if err != nil { + log.Fatal(fmt.Sprintf("Scan config fail: %s", err.Error())) } - DatabaseConfig = InitDatabase(cfgDatabase) - cfgApplication = viper.Sub("settings.application") - if cfgApplication == nil { - panic("No found settings.application in the configuration") + _watch, err = c.Watch() + if err != nil { + log.Fatal(fmt.Sprintf("Watch config source fail: %s", err.Error())) } - ApplicationConfig = InitApplication(cfgApplication) +} - cfgJwt = viper.Sub("settings.jwt") - if cfgJwt == nil { - panic("No found settings.jwt in the configuration") +// Watch 配置监听, 重载时报错,不影响运行 +func Watch() { + for { + v, err := _watch.Next() + if err != nil { + if err.Error() != "watch stopped" { + log.Println(fmt.Sprintf("Next config fail: %s", err.Error())) + } + break + } + err = v.Scan(_cfg) + if err != nil { + log.Println(fmt.Sprintf("Scan config fail: %s", err.Error())) + break + } + fmt.Println(DatabaseConfig) } - JwtConfig = InitJwt(cfgJwt) +} - cfgLogger = viper.Sub("settings.logger") - if cfgLogger == nil { - panic("No found settings.logger in the configuration") - } - LoggerConfig = InitLog(cfgLogger) - - cfgSsl = viper.Sub("settings.ssl") - if cfgSsl == nil { - // Ssl不是系统强制要求的配置,默认可以不用配置,将设置为关闭状态 - fmt.Println("warning config not found settings.ssl in the configuration") - SslConfig = new(Ssl) - SslConfig.Enable = false - } else { - SslConfig = InitSsl(cfgSsl) - } - - cfgGen = viper.Sub("settings.gen") - if cfgGen == nil { - panic("No found settings.gen") +// Stop 停止监听 +func Stop() { + err := _watch.Stop() + if err != nil { + log.Println(err) } - GenConfig = InitGen(cfgGen) } diff --git a/tools/config/database.go b/tools/config/database.go index 80d2d6e9..0de8f4f6 100644 --- a/tools/config/database.go +++ b/tools/config/database.go @@ -1,19 +1,8 @@ package config -import "github.com/spf13/viper" - type Database struct { Driver string Source string } -func InitDatabase(cfg *viper.Viper) *Database { - - db := &Database{ - Driver: cfg.GetString("driver"), - Source: cfg.GetString("source"), - } - return db -} - var DatabaseConfig = new(Database) diff --git a/tools/config/gen.go b/tools/config/gen.go index dc7c7aa8..0a95003e 100644 --- a/tools/config/gen.go +++ b/tools/config/gen.go @@ -1,17 +1,8 @@ package config -import "github.com/spf13/viper" - type Gen struct { DBName string FrontPath string } -func InitGen(cfg *viper.Viper) *Gen { - return &Gen{ - DBName: cfg.GetString("dbname"), - FrontPath: cfg.GetString("frontpath"), - } -} - var GenConfig = new(Gen) diff --git a/tools/config/jwt.go b/tools/config/jwt.go index 3636e1ed..811a30e0 100644 --- a/tools/config/jwt.go +++ b/tools/config/jwt.go @@ -1,19 +1,8 @@ package config -import ( - "github.com/spf13/viper" -) - type Jwt struct { Secret string Timeout int64 } -func InitJwt(cfg *viper.Viper) *Jwt { - return &Jwt{ - Secret: cfg.GetString("secret"), - Timeout: cfg.GetInt64("timeout"), - } -} - var JwtConfig = new(Jwt) diff --git a/tools/config/logger.go b/tools/config/logger.go index 0479d2a0..ec08f69b 100644 --- a/tools/config/logger.go +++ b/tools/config/logger.go @@ -1,7 +1,5 @@ package config -import "github.com/spf13/viper" - type Logger struct { Path string Level string @@ -12,16 +10,4 @@ type Logger struct { EnabledJOB bool `default:"false"` } -func InitLog(cfg *viper.Viper) *Logger { - return &Logger{ - Path: cfg.GetString("path"), - Level: cfg.GetString("level"), - Stdout: cfg.GetBool("stdout"), - EnabledBUS: cfg.GetBool("enabledbus"), - EnabledREQ: cfg.GetBool("enabledreq"), - EnabledDB: cfg.GetBool("enableddb"), - EnabledJOB: cfg.GetBool("enabledjob"), - } -} - var LoggerConfig = new(Logger) diff --git a/tools/config/ssl.go b/tools/config/ssl.go index 22a4342c..0f4a8286 100644 --- a/tools/config/ssl.go +++ b/tools/config/ssl.go @@ -1,7 +1,5 @@ package config -import "github.com/spf13/viper" - type Ssl struct { KeyStr string Pem string @@ -9,13 +7,4 @@ type Ssl struct { Domain string } -func InitSsl(cfg *viper.Viper) *Ssl { - return &Ssl{ - KeyStr: cfg.GetString("key"), - Pem: cfg.GetString("pem"), - Enable: cfg.GetBool("enable"), - Domain: cfg.GetString("domain"), - } -} - var SslConfig = new(Ssl) diff --git a/tools/env.go b/tools/env.go index a6677b5a..612ff821 100644 --- a/tools/env.go +++ b/tools/env.go @@ -11,3 +11,7 @@ const ( Mysql = "mysql" //mysql数据库标识 Sqlite = "sqlite3" //sqlite ) + +func (e Mode) String() string { + return string(e) +} diff --git a/tools/trace/trace.go b/tools/trace/trace.go index ea5339c0..3f1d0d04 100644 --- a/tools/trace/trace.go +++ b/tools/trace/trace.go @@ -72,7 +72,6 @@ func Start() { func Stop(ctx context.Context) { quit := make(chan os.Signal) signal.Notify(quit, os.Interrupt) - <-quit fmt.Printf("%s Shutdown Server ... \r\n", tools.GetCurrentTimeStr()) err := _server.Shutdown(ctx) if err != nil { From 0c170fe1c686af95567fc9ae5101c298ba91b038 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 10 Dec 2020 10:24:06 +0800 Subject: [PATCH 049/201] =?UTF-8?q?config=20setup=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=8F=90=E5=88=B0=E5=A4=96=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/api/server.go | 6 ++++-- cmd/config/server.go | 3 ++- cmd/migrate/server.go | 3 ++- tools/config/config.go | 8 +++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cmd/api/server.go b/cmd/api/server.go index 0ca01337..55bdffda 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -3,14 +3,15 @@ package api import ( "context" "fmt" - "go-admin/tools/trace" "net/http" "os" "os/signal" "time" "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/config/source/file" "github.com/spf13/cobra" + "go-admin/app/admin/router" "go-admin/app/jobs" "go-admin/common/database" @@ -20,6 +21,7 @@ import ( "go-admin/pkg/logger" "go-admin/tools" "go-admin/tools/config" + "go-admin/tools/trace" ) var ( @@ -56,7 +58,7 @@ func init() { func setup() { //1. 读取配置 - config.Setup(configYml) + config.Setup(file.NewSource, file.WithPath(configYml)) go config.Watch() //2. 设置日志 global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus") diff --git a/cmd/config/server.go b/cmd/config/server.go index 8cae4cac..f23cba39 100644 --- a/cmd/config/server.go +++ b/cmd/config/server.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" + "github.com/go-admin-team/go-admin-core/config/source/file" "github.com/spf13/cobra" "go-admin/tools/config" @@ -27,7 +28,7 @@ func init() { } func run() { - config.Setup(configYml) + config.Setup(file.NewSource, file.WithPath(configYml)) application, errs := json.MarshalIndent(config.ApplicationConfig, "", " ") //转换成JSON返回的是byte[] if errs != nil { diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index e540bbcc..0cd27d5f 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -7,6 +7,7 @@ import ( "text/template" "time" + "github.com/go-admin-team/go-admin-core/config/source/file" "github.com/spf13/cobra" "go-admin/cmd/migrate/migration" @@ -46,7 +47,7 @@ func run() { if !generate { //1. 读取配置 - config.Setup(configYml) + config.Setup(file.NewSource, file.WithPath(configYml)) //2. 设置日志 global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus") global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job") diff --git a/tools/config/config.go b/tools/config/config.go index ca081c9e..6edee1f7 100644 --- a/tools/config/config.go +++ b/tools/config/config.go @@ -3,7 +3,7 @@ package config import ( "fmt" "github.com/go-admin-team/go-admin-core/config" - "github.com/go-admin-team/go-admin-core/config/source/file" + "github.com/go-admin-team/go-admin-core/config/source" "log" ) @@ -33,15 +33,13 @@ var ( ) // Setup 载入配置文件 -func Setup(path string) { +func Setup(f func(opts ...source.Option) source.Source, options ...source.Option) { c, err := config.NewConfig() if err != nil { log.Fatal(fmt.Sprintf("New config object fail: %s", err.Error())) } err = c.Load( - file.NewSource( - file.WithPath(path), - ), + f(options...), ) if err != nil { log.Fatal(fmt.Sprintf("Load config source fail: %s", err.Error())) From 9731b7baaf78c5107dfd49d03ddc95fc18d7d6e1 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 10 Dec 2020 10:45:14 +0800 Subject: [PATCH 050/201] =?UTF-8?q?=E6=95=B4=E5=90=88=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 3 +- go.sum | 99 ++-------------------------------------------------------- 2 files changed, 4 insertions(+), 98 deletions(-) diff --git a/go.mod b/go.mod index d80cd3c2..1b20b694 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.3-0.20201208071849-612a1666b9cc + github.com/go-admin-team/go-admin-core v1.2.3-0.20201210023904-78651a3281e8 github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 @@ -28,7 +28,6 @@ require ( github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect github.com/spf13/cast v1.3.1 github.com/spf13/cobra v1.0.0 - github.com/spf13/viper v1.7.1 github.com/swaggo/gin-swagger v1.2.0 github.com/swaggo/swag v1.6.7 github.com/unrolled/secure v1.0.8 diff --git a/go.sum b/go.sum index 7b679505..9b02aec5 100644 --- a/go.sum +++ b/go.sum @@ -8,7 +8,6 @@ cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= @@ -36,7 +35,6 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c/go.mod h1:7xhjOwRV2+0HXGmM0jxaEu+ZiXJFoVZOTfL/dmqbrD8= -github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks= @@ -48,7 +46,6 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.0/go.mod h1:zpDJeKyp9ScW4NNrbdr+Eyxvry3ilGPewKoXw3XGN1k= github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE= @@ -72,7 +69,6 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -81,11 +77,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= @@ -103,8 +96,6 @@ github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wX github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= @@ -118,7 +109,6 @@ github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kw github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.18+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.25+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -128,13 +118,10 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= @@ -157,13 +144,11 @@ github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3 github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -173,7 +158,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -184,25 +168,22 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f h1:8l4Aw3Jmx0pLKYMkY+1b6yBPgE+rzRtA5T3vqFyI2Z8= github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.3-0.20201208071849-612a1666b9cc h1:YBC0JH9g2GAQP7ods+LHLYMJb+UtCoxiOoaS5J7cBt0= -github.com/go-admin-team/go-admin-core v1.2.3-0.20201208071849-612a1666b9cc/go.mod h1:6uyaucbKIaL5KoGcYZVDgfMwJupT4lUWksgxST33TWs= +github.com/go-admin-team/go-admin-core v1.2.3-0.20201210023904-78651a3281e8 h1:1Qd6lUtgEVuRFBZk0WomsyEtmRRB95ozE1YPTxuWrGg= +github.com/go-admin-team/go-admin-core v1.2.3-0.20201210023904-78651a3281e8/go.mod h1:BQP3Eiyc9C0JJOiGjr8NoCKVUlO/kgSCT5B54BhesjY= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -220,7 +201,6 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -232,7 +212,6 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -242,7 +221,6 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22 github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -270,7 +248,6 @@ github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= @@ -281,9 +258,7 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -298,7 +273,6 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -317,9 +291,7 @@ github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -329,7 +301,6 @@ github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjh github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= @@ -339,21 +310,17 @@ github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -371,7 +338,6 @@ github.com/jackc/pgconn v1.6.4 h1:S7T6cx5o2OqmxdHaXLH1ZeD1SbI8jBznyYE9Ec0RCQ8= github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= @@ -421,13 +387,10 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -439,14 +402,11 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= @@ -461,14 +421,11 @@ github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPp github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA= github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ= github.com/lucas-clemente/quic-go v0.14.1/go.mod h1:Vn3/Fb0/77b02SGhQk36KzOUmXgVpFfizUfW5WMaqyU= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= @@ -480,7 +437,6 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -497,21 +453,16 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= -github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= -github.com/micro/go-micro/v2 v2.9.1 h1:+S9koIrNWARjpP6k2TZ7kt0uC9zUJtNXzIdZTZRms7Q= github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.27 h1:aEH/kqUzUxGJ/UHcEKdJY+ugH6WEzsEBBSPa8zuy1aM= github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaCv4AyBgu5ALFM0+tSuHrBh6v692nyQe3ikrq0= @@ -519,13 +470,10 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0= github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY= @@ -542,7 +490,6 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk= github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw= @@ -553,10 +500,8 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -572,21 +517,16 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ= -github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -618,14 +558,12 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= -github.com/robinjoseph08/redisqueue/v2 v2.1.0 h1:GactHlrxS8YSCJc4CbP1KbTObo14pieNmNWSUlquTGI= github.com/robinjoseph08/redisqueue/v2 v2.1.0/go.mod h1:fiNYBqIF/DqZxKvO6faLB6nkBtfJucuM+rDbFhZG1vs= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ= @@ -639,51 +577,37 @@ github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w= github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= -github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= github.com/swaggo/gin-swagger v1.2.0 h1:YskZXEiv51fjOMTsXrOetAjrMDfFaXD79PEoQBOe2W0= github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI= @@ -698,7 +622,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE= github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY= -github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY= github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -713,10 +636,8 @@ github.com/unrolled/secure v1.0.8 h1:JaMvKbe4CRt8oyxVXn+xY+6jlqd7pyJNSVkmsBxxQsM github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8p0BXDPI= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -750,6 +671,7 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -781,7 +703,6 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -801,7 +722,6 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -848,7 +768,6 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -931,7 +850,6 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -950,7 +868,6 @@ google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEt google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -965,7 +882,6 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -981,30 +897,25 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc/examples v0.0.0-20201207231033-bce1fdfad97e/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/AlecAivazis/survey.v1 v1.8.5 h1:QoEEmn/d5BbuPIL2qvXwzJdttFFhRQFkaq+tEKb7SMI= gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= @@ -1013,16 +924,12 @@ gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdOD gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/kyokomi/emoji.v1 v1.5.1 h1:beetH5mWDMzFznJ+Qzd5KVHp79YKhVUMcdO8LpRLeGw= gopkg.in/kyokomi/emoji.v1 v1.5.1/go.mod h1:N9AZ6hi1jHOPn34PsbpufQZUcKftSD7WgS2pgpmH4Lg= gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiVLxyifmMBrBIuCWFBPYKbRssXB9z67Hw= gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= From d9347de392e87ac2e3bb04d3ef12b27903815eed Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 10 Dec 2020 17:55:33 +0800 Subject: [PATCH 051/201] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=BA=93=E7=9B=AE=E5=BD=95=20=E6=9B=B4=E6=96=B0gorm=E5=88=B0?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/router/monitor.go | 10 +-- common/dto/search.go | 6 +- go.mod | 10 +-- go.sum | 117 +++++++++++++++++++++++++----------- 4 files changed, 96 insertions(+), 47 deletions(-) diff --git a/app/admin/router/monitor.go b/app/admin/router/monitor.go index 52bb0bea..467cd20d 100644 --- a/app/admin/router/monitor.go +++ b/app/admin/router/monitor.go @@ -1,12 +1,14 @@ package router import ( - "github.com/gin-gonic/gin" - "github.com/go-admin-team/go-admin-core/transfer" - "github.com/prometheus/client_golang/prometheus/promhttp" + "net/http" + "go-admin/common/global" "go-admin/common/log" - "net/http" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/tools/transfer" + "github.com/prometheus/client_golang/prometheus/promhttp" ) func Monitor() { diff --git a/common/dto/search.go b/common/dto/search.go index d0b258b0..f7f561be 100644 --- a/common/dto/search.go +++ b/common/dto/search.go @@ -1,10 +1,10 @@ package dto import ( - "go-admin/tools/config" - - "github.com/go-admin-team/go-admin-core/search" + "github.com/go-admin-team/go-admin-core/tools/search" "gorm.io/gorm" + + "go-admin/tools/config" ) type GeneralDelDto struct { diff --git a/go.mod b/go.mod index 1b20b694..98df6dd0 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.3-0.20201210023904-78651a3281e8 + github.com/go-admin-team/go-admin-core v1.2.3-0.20201210093034-494ea754da74 github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 @@ -32,10 +32,10 @@ require ( github.com/swaggo/swag v1.6.7 github.com/unrolled/secure v1.0.8 golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a - gorm.io/driver/mysql v0.3.2 - gorm.io/driver/postgres v0.2.9 - gorm.io/driver/sqlite v1.0.9 - gorm.io/gorm v1.20.1 + gorm.io/driver/mysql v1.0.4-0.20201206014609-ae5fd10184f6 + gorm.io/driver/postgres v1.0.6-0.20201208020313-1ed927cfab53 + gorm.io/driver/sqlite v1.1.5-0.20201206014648-c84401fbe3ba + gorm.io/gorm v1.20.8 sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 // indirect ) diff --git a/go.sum b/go.sum index 9b02aec5..be48dfc1 100644 --- a/go.sum +++ b/go.sum @@ -35,10 +35,10 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c/go.mod h1:7xhjOwRV2+0HXGmM0jxaEu+ZiXJFoVZOTfL/dmqbrD8= +github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks= -github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -46,6 +46,7 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.0/go.mod h1:zpDJeKyp9ScW4NNrbdr+Eyxvry3ilGPewKoXw3XGN1k= github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE= @@ -60,7 +61,6 @@ github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190808125512-07798873deee/go.mod github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5 h1:nWDRPCyCltiTsANwC/n3QZH7Vww33Npq9MKqlwRzI/c= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= -github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -69,6 +69,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -78,7 +79,9 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= @@ -95,7 +98,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= @@ -118,10 +121,13 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= @@ -141,14 +147,13 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/ef-ds/deque v1.0.4-0.20190904040645-54cb57c252a1/go.mod h1:HvODWzv6Y6kBf3Ah2WzN1bHjDUezGLaAhwuWVwfpEJs= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -158,6 +163,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -168,11 +174,12 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f h1:8l4Aw3Jmx0pLKYMkY+1b6yBPgE+rzRtA5T3vqFyI2Z8= github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.3-0.20201210023904-78651a3281e8 h1:1Qd6lUtgEVuRFBZk0WomsyEtmRRB95ozE1YPTxuWrGg= -github.com/go-admin-team/go-admin-core v1.2.3-0.20201210023904-78651a3281e8/go.mod h1:BQP3Eiyc9C0JJOiGjr8NoCKVUlO/kgSCT5B54BhesjY= +github.com/go-admin-team/go-admin-core v1.2.3-0.20201210093034-494ea754da74 h1:AtnaaomXjFEEl5hOuA86mHBoTWuVZypK8dVe4CoBabk= +github.com/go-admin-team/go-admin-core v1.2.3-0.20201210093034-494ea754da74/go.mod h1:EsJra0ae2d6rsV2lqSf4srzyFTW4OV2ME7UXXVbYE3s= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -184,6 +191,7 @@ github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -201,6 +209,7 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -212,6 +221,7 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -221,6 +231,7 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22 github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -259,6 +270,7 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -273,6 +285,7 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -315,12 +328,15 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -334,10 +350,11 @@ github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5 github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= github.com/jackc/pgconn v1.6.1/go.mod h1:g8mKMqmSUO6AzAvha7vy07g1rbGOlc7iF0nU0ei83hc= -github.com/jackc/pgconn v1.6.4 h1:S7T6cx5o2OqmxdHaXLH1ZeD1SbI8jBznyYE9Ec0RCQ8= -github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78= +github.com/jackc/pgconn v1.8.0 h1:FmjZ0rOyXTr1wfWs45i4a9vjnjWUAGpMuQLD9OSs+lw= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= @@ -350,6 +367,8 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1: github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.2 h1:q1Hsy66zh4vuNsajBUF2PNqfAMMfxU5mk594lPE9vjY= github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.0.6 h1:b1105ZGEMFe7aCvrT1Cca3VoVb4ZFMaFJLJcg/3zD+8= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= @@ -360,8 +379,8 @@ github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4 github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po= github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ= github.com/jackc/pgtype v1.4.0/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= -github.com/jackc/pgtype v1.4.2 h1:t+6LWm5eWPLX1H5Se702JSBcirq6uWa4jiG4wV1rAWY= -github.com/jackc/pgtype v1.4.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= +github.com/jackc/pgtype v1.6.2 h1:b3pDeuhbbzBYcg5kwNmNDun4pFUD/0AAr1kLXZLeNt8= +github.com/jackc/pgtype v1.6.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= @@ -369,12 +388,13 @@ github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXg github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o= github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= github.com/jackc/pgx/v4 v4.7.1/go.mod h1:nu42q3aPjuC1M0Nak4bnoprKlXPINqopEKqbq5AZSC4= -github.com/jackc/pgx/v4 v4.8.1 h1:SUbCLP2pXvf/Sr/25KsuI4aTxiFYIvpfk4l6aTSdyCw= -github.com/jackc/pgx/v4 v4.8.1/go.mod h1:4HOLxrl8wToZJReD04/yB20GDwf4KBYETvlHciCnwW0= +github.com/jackc/pgx/v4 v4.10.0 h1:xXTl+lSiF1eFQ4U7vUL493n/1q8ZhSDP962rSKhgRZo= +github.com/jackc/pgx/v4 v4.10.0/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -387,10 +407,13 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -402,11 +425,14 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= @@ -421,6 +447,7 @@ github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPp github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA= github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ= @@ -437,6 +464,7 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -450,12 +478,14 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= -github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= +github.com/mattn/go-sqlite3 v1.14.5 h1:1IdxlwTNazvbKJQSxoJ5/9ECbEeaTTyeU7sEAZ5KKTQ= +github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= @@ -472,8 +502,10 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0= github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY= @@ -490,6 +522,7 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk= github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw= @@ -500,8 +533,10 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -520,6 +555,7 @@ github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -527,6 +563,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -558,12 +595,14 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/robinjoseph08/redisqueue/v2 v2.1.0 h1:GactHlrxS8YSCJc4CbP1KbTObo14pieNmNWSUlquTGI= github.com/robinjoseph08/redisqueue/v2 v2.1.0/go.mod h1:fiNYBqIF/DqZxKvO6faLB6nkBtfJucuM+rDbFhZG1vs= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ= @@ -577,16 +616,23 @@ github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w= github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -602,11 +648,13 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= github.com/swaggo/gin-swagger v1.2.0 h1:YskZXEiv51fjOMTsXrOetAjrMDfFaXD79PEoQBOe2W0= @@ -622,6 +670,7 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE= github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY= +github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY= github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -636,8 +685,10 @@ github.com/unrolled/secure v1.0.8 h1:JaMvKbe4CRt8oyxVXn+xY+6jlqd7pyJNSVkmsBxxQsM github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8p0BXDPI= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -671,7 +722,6 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= -go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -708,6 +758,8 @@ golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMx golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6 h1:nfeHNc1nAqecKCy2FCy4HY+soOOe5sDLJ/gZLbx6GYI= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -722,8 +774,8 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -752,17 +804,14 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191027093000-83d349e8ac1a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -884,7 +933,6 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -893,11 +941,8 @@ google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc/examples v0.0.0-20201207231033-bce1fdfad97e/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -906,16 +951,18 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/AlecAivazis/survey.v1 v1.8.5 h1:QoEEmn/d5BbuPIL2qvXwzJdttFFhRQFkaq+tEKb7SMI= gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= @@ -924,12 +971,14 @@ gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdOD gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/kyokomi/emoji.v1 v1.5.1 h1:beetH5mWDMzFznJ+Qzd5KVHp79YKhVUMcdO8LpRLeGw= gopkg.in/kyokomi/emoji.v1 v1.5.1/go.mod h1:N9AZ6hi1jHOPn34PsbpufQZUcKftSD7WgS2pgpmH4Lg= gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiVLxyifmMBrBIuCWFBPYKbRssXB9z67Hw= gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= @@ -940,21 +989,19 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gorm.io/driver/mysql v0.3.0/go.mod h1:A7H1JD9dKdcjeUTpTuWKEC+E1a74qzW7/zaXqKaTbfM= -gorm.io/driver/mysql v0.3.2 h1:Kaa0S+IHW+4qow6dRAdekNYaKeGBboIkh44pYdLWjIE= -gorm.io/driver/mysql v0.3.2/go.mod h1:jC/HyPAZJ0xqfGlOqYybd8oNPMtGrkNgvwjWuKDT7f0= +gorm.io/driver/mysql v1.0.4-0.20201206014609-ae5fd10184f6 h1:GTZ4w9Fx9LTCtaUq7RDX6a1PSmo7BEwD3H1A8n365YI= +gorm.io/driver/mysql v1.0.4-0.20201206014609-ae5fd10184f6/go.mod h1:2r8kyPBl12K36bLBN+vsYYHXRQcNmR+gNHOnSNVqLJs= gorm.io/driver/postgres v0.2.6/go.mod h1:AsPyuhKFOplSmQwOPsycVKbe0dRxF8v18KZ7p9i8dIs= -gorm.io/driver/postgres v0.2.9 h1:oMY4f4tLEUVg3eapqHFzVEplWKy1Gj1cGBEe9wJ1yWM= -gorm.io/driver/postgres v0.2.9/go.mod h1:YATpayFLKALuiVXVRNbDfoEJwECHSMYzl1SmXJ2+CIg= -gorm.io/driver/sqlite v1.0.9 h1:rqOPFRPY3U5fL5AZSDVa9Np+XpkUbxLVmvpG+i1VHjg= -gorm.io/driver/sqlite v1.0.9/go.mod h1:xkm8/CEmA3yc4zRd0pdCqm43BjO8Hm6avfTpxWb/7c4= +gorm.io/driver/postgres v1.0.6-0.20201208020313-1ed927cfab53 h1:akdlzUX42w3fucnmRQXa76vjh5tJDC4Ur6VUoGULu4s= +gorm.io/driver/postgres v1.0.6-0.20201208020313-1ed927cfab53/go.mod h1:VoA/W0CQ3ZgsKxbrSSTqpUROHGLyHs6NcgWBarc2GU4= +gorm.io/driver/sqlite v1.1.5-0.20201206014648-c84401fbe3ba h1:fQaYq+ZqofXtk6EIMRj6R+arzZ1a+P4l6qZAdpNLjCE= +gorm.io/driver/sqlite v1.1.5-0.20201206014648-c84401fbe3ba/go.mod h1:77oQ9J0MEOMY8ctRKoP0t3//37Hrjy2rNADq8E+KhaI= gorm.io/driver/sqlserver v0.2.4 h1:AGofGL/TfzTZotzIHlaLISfxEKJpzj0ATbtXJW+ga1A= gorm.io/driver/sqlserver v0.2.4/go.mod h1:TcPfkdce5b8qlCMgyUeUdm7HQa1ZzWUuxzI+odcueLA= -gorm.io/gorm v0.2.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v0.2.19/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v0.2.23/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= -gorm.io/gorm v0.2.36/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= -gorm.io/gorm v1.20.1 h1:+hOwlHDqvqmBIMflemMVPLJH7tZYK4RxFDBHEfJTup0= -gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.20.8 h1:iToaOdZgjNvlc44NFkxfLa3U9q63qwaxt0FdNCiwOMs= +gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From da96902ca454e0efc0c205cd4fb130ba62010a83 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Sun, 20 Dec 2020 19:45:04 +0800 Subject: [PATCH 052/201] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=A8=A1=E5=BC=8F=EF=BC=9A=20=E5=8D=95?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E5=9C=A8=E5=86=85=E5=AE=B9=E4=B8=AD?= =?UTF-8?q?=E5=8C=BA=E5=88=86=EF=BC=8C=E6=96=B9=E4=BE=BF=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E5=90=84=E7=A7=8D=E6=97=A5=E5=BF=97=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 64 ++------------------------------------------- pkg/logger/setup.go | 16 +++++------- 3 files changed, 10 insertions(+), 72 deletions(-) diff --git a/go.mod b/go.mod index 98df6dd0..fce79ee4 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.3-0.20201210093034-494ea754da74 + github.com/go-admin-team/go-admin-core v1.2.3-0.20201220113221-2cfd5dffb397 github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 diff --git a/go.sum b/go.sum index be48dfc1..9ebdda74 100644 --- a/go.sum +++ b/go.sum @@ -35,7 +35,6 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c/go.mod h1:7xhjOwRV2+0HXGmM0jxaEu+ZiXJFoVZOTfL/dmqbrD8= -github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks= @@ -46,7 +45,6 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.0/go.mod h1:zpDJeKyp9ScW4NNrbdr+Eyxvry3ilGPewKoXw3XGN1k= github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE= @@ -69,7 +67,6 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -79,9 +76,7 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= -github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= @@ -98,7 +93,6 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= -github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= @@ -121,13 +115,10 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= @@ -153,7 +144,6 @@ github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2Vvl github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -163,7 +153,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -174,12 +163,11 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f h1:8l4Aw3Jmx0pLKYMkY+1b6yBPgE+rzRtA5T3vqFyI2Z8= github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.3-0.20201210093034-494ea754da74 h1:AtnaaomXjFEEl5hOuA86mHBoTWuVZypK8dVe4CoBabk= -github.com/go-admin-team/go-admin-core v1.2.3-0.20201210093034-494ea754da74/go.mod h1:EsJra0ae2d6rsV2lqSf4srzyFTW4OV2ME7UXXVbYE3s= +github.com/go-admin-team/go-admin-core v1.2.3-0.20201220113221-2cfd5dffb397 h1:UoEF/o3iL/KQkMnvIQT4u7IhHjG51vxb7gXJVJY1dCU= +github.com/go-admin-team/go-admin-core v1.2.3-0.20201220113221-2cfd5dffb397/go.mod h1:EsJra0ae2d6rsV2lqSf4srzyFTW4OV2ME7UXXVbYE3s= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -191,7 +179,6 @@ github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -209,7 +196,6 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -221,7 +207,6 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= -github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -231,7 +216,6 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22 github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= -github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -270,7 +254,6 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -285,7 +268,6 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -328,15 +310,12 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -354,7 +333,6 @@ github.com/jackc/pgconn v1.8.0 h1:FmjZ0rOyXTr1wfWs45i4a9vjnjWUAGpMuQLD9OSs+lw= github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= @@ -365,7 +343,6 @@ github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.0.2 h1:q1Hsy66zh4vuNsajBUF2PNqfAMMfxU5mk594lPE9vjY= github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.6 h1:b1105ZGEMFe7aCvrT1Cca3VoVb4ZFMaFJLJcg/3zD+8= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= @@ -407,13 +384,10 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -425,14 +399,11 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= @@ -447,7 +418,6 @@ github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPp github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA= github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ= @@ -464,7 +434,6 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -481,11 +450,9 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-sqlite3 v1.14.5 h1:1IdxlwTNazvbKJQSxoJ5/9ECbEeaTTyeU7sEAZ5KKTQ= github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= -github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= @@ -502,10 +469,8 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0= github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY= @@ -522,7 +487,6 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk= github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw= @@ -533,10 +497,8 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -555,7 +517,6 @@ github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -563,7 +524,6 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -595,14 +555,12 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= -github.com/robinjoseph08/redisqueue/v2 v2.1.0 h1:GactHlrxS8YSCJc4CbP1KbTObo14pieNmNWSUlquTGI= github.com/robinjoseph08/redisqueue/v2 v2.1.0/go.mod h1:fiNYBqIF/DqZxKvO6faLB6nkBtfJucuM+rDbFhZG1vs= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ= @@ -616,23 +574,17 @@ github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w= github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -648,13 +600,11 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= github.com/swaggo/gin-swagger v1.2.0 h1:YskZXEiv51fjOMTsXrOetAjrMDfFaXD79PEoQBOe2W0= @@ -670,7 +620,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE= github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY= -github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY= github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -685,10 +634,8 @@ github.com/unrolled/secure v1.0.8 h1:JaMvKbe4CRt8oyxVXn+xY+6jlqd7pyJNSVkmsBxxQsM github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8p0BXDPI= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -756,7 +703,6 @@ golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm0 golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20201208152932-35266b937fa6 h1:nfeHNc1nAqecKCy2FCy4HY+soOOe5sDLJ/gZLbx6GYI= golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -774,7 +720,6 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -953,16 +898,13 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/AlecAivazis/survey.v1 v1.8.5 h1:QoEEmn/d5BbuPIL2qvXwzJdttFFhRQFkaq+tEKb7SMI= gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= @@ -971,14 +913,12 @@ gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdOD gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/kyokomi/emoji.v1 v1.5.1 h1:beetH5mWDMzFznJ+Qzd5KVHp79YKhVUMcdO8LpRLeGw= gopkg.in/kyokomi/emoji.v1 v1.5.1/go.mod h1:N9AZ6hi1jHOPn34PsbpufQZUcKftSD7WgS2pgpmH4Lg= gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiVLxyifmMBrBIuCWFBPYKbRssXB9z67Hw= gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= diff --git a/pkg/logger/setup.go b/pkg/logger/setup.go index 33990aa3..2ff45d1d 100644 --- a/pkg/logger/setup.go +++ b/pkg/logger/setup.go @@ -1,28 +1,26 @@ package logger import ( - "go-admin/tools" - "path/filepath" - "github.com/go-admin-team/go-admin-core/debug/writer" "github.com/go-admin-team/go-admin-core/logger" "go-admin/common/log" + "go-admin/tools" ) // SetupLogger 日志 -func SetupLogger(path string, subPath string) logger.Logger { +func SetupLogger(path string, prefix string) logger.Logger { var setLogger logger.Logger - fullPath := filepath.Join(path, subPath) - if !tools.PathExist(fullPath) { - err := tools.PathCreate(fullPath) + prefix = "[" + prefix + "] " + if !tools.PathExist(path) { + err := tools.PathCreate(path) if err != nil { log.Fatal("create dir error: %s", err.Error()) } } - output, err := writer.NewFileWriter(fullPath, "log") + output, err := writer.NewFileWriter(path, prefix, "log") if err != nil { - log.Fatal("%s logger setup error: %s", subPath, err.Error()) + log.Fatal("%s logger setup error: %s", prefix, err.Error()) } setLogger = logger.NewHelper(logger.NewLogger(logger.WithOutput(output))) return setLogger From d5a94b8dc0698cad2edac00e3f6f11e9c32f7c9e Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 21 Dec 2020 16:45:53 +0800 Subject: [PATCH 053/201] =?UTF-8?q?fix=F0=9F=90=9B=20=EF=BC=9A=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91=E6=97=A0=E6=95=88?= =?UTF-8?q?(#293)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/settings.go | 1 + app/admin/models/system.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/admin/apis/system/settings.go b/app/admin/apis/system/settings.go index 12335f55..176cfb60 100644 --- a/app/admin/apis/system/settings.go +++ b/app/admin/apis/system/settings.go @@ -49,6 +49,7 @@ func CreateSetting(c *gin.Context) { var sModel models.SysSetting sModel.Logo = s.Logo sModel.Name = s.Name + sModel.SettingsId = s.SettingsId a, e := sModel.Update() if e != nil { diff --git a/app/admin/models/system.go b/app/admin/models/system.go index ec94125f..f2a2d3b8 100644 --- a/app/admin/models/system.go +++ b/app/admin/models/system.go @@ -27,7 +27,7 @@ func (s *SysSetting) Get() (create SysSetting, err error) { //修改 func (s *SysSetting) Update() (update SysSetting, err error) { - if err = orm.Eloquent.Table("sys_setting").Model(&update).Updates(&s).Error; err != nil { + if err = orm.Eloquent.Table("sys_setting").Model(&update).Where("settings_id = ?", s.SettingsId).Updates(&s).Error; err != nil { return } return @@ -36,4 +36,5 @@ func (s *SysSetting) Update() (update SysSetting, err error) { type ResponseSystemConfig struct { Name string `json:"name" binding:"required"` // 名称 Logo string `json:"logo" binding:"required"` // 头像 + SettingsId int `json:"settings_id" binding:"required"` // 头像 } From 37a2c585e1a23be27ea03333d7e00701983286e9 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 21 Dec 2020 22:01:03 +0800 Subject: [PATCH 054/201] =?UTF-8?q?refactor=F0=9F=8E=A8=20:=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E8=BF=87=E6=97=B6=E7=9A=84=E6=96=87=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/sysfile/dir.go | 71 ------------------------ app/admin/apis/sysfile/sysfileinfo.go | 77 --------------------------- 2 files changed, 148 deletions(-) delete mode 100644 app/admin/apis/sysfile/dir.go delete mode 100644 app/admin/apis/sysfile/sysfileinfo.go diff --git a/app/admin/apis/sysfile/dir.go b/app/admin/apis/sysfile/dir.go deleted file mode 100644 index 54d10b39..00000000 --- a/app/admin/apis/sysfile/dir.go +++ /dev/null @@ -1,71 +0,0 @@ -package sysfile - -import ( - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" - "go-admin/tools/app/msg" -) - -func GetSysFileDirList(c *gin.Context) { - var SysFileDir models.SysFileDirOld - SysFileDir.Label = c.Request.FormValue("label") - SysFileDir.PId, _ = tools.StringToInt(c.Request.FormValue("pid")) - SysFileDir.Id, _ = tools.StringToInt(c.Request.FormValue("id")) - SysFileDir.DataScope = tools.GetUserIdStr(c) - result, err := SysFileDir.SetSysFileDirOld() - tools.HasError(err, "抱歉未找到相关信息", -1) - app.OK(c, result, "") -} - -func GetSysFileDir(c *gin.Context) { - var data models.SysFileDirOld - data.Id, _ = tools.StringToInt(c.Param("id")) - result, err := data.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - app.OK(c, result, "") -} - -// @Summary 添加SysFileDir -// @Description 获取JSON -// @Tags SysFileDir -// @Accept application/json -// @Product application/json -// @Param data body models.SysFileDir true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/sysfiledir [post] -func InsertSysFileDir(c *gin.Context) { - var data models.SysFileDirOld - err := c.ShouldBindJSON(&data) - data.CreateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - app.OK(c, result, "") -} - -func UpdateSysFileDir(c *gin.Context) { - var data models.SysFileDirOld - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "数据解析失败", -1) - data.UpdateBy = tools.GetUserIdStr(c) - result, err := data.Update(data.Id) - tools.HasError(err, "", -1) - - app.OK(c, result, "") -} - -func DeleteSysFileDir(c *gin.Context) { - var data models.SysFileDirOld - data.UpdateBy = tools.GetUserIdStr(c) - - IDS := tools.IdsStrToIdsIntGroup("id", c) - _, err := data.BatchDelete(IDS) - tools.HasError(err, msg.DeletedFail, 500) - app.OK(c, nil, msg.DeletedSuccess) -} diff --git a/app/admin/apis/sysfile/sysfileinfo.go b/app/admin/apis/sysfile/sysfileinfo.go deleted file mode 100644 index 88708730..00000000 --- a/app/admin/apis/sysfile/sysfileinfo.go +++ /dev/null @@ -1,77 +0,0 @@ -package sysfile - -import ( - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" - "go-admin/tools/app/msg" -) - -func GetSysFileInfoOldList(c *gin.Context) { - var data models.SysFileInfoOld - var err error - var pageSize = 10 - var pageIndex = 1 - - if size := c.Request.FormValue("pageSize"); size != "" { - pageSize, err = tools.StringToInt(size) - } - tools.HasError(err, "", -1) - if index := c.Request.FormValue("pageIndex"); index != "" { - pageIndex, err = tools.StringToInt(index) - } - tools.HasError(err, "", -1) - if pid := c.Request.FormValue("pId"); pid != "" { - data.PId, err = tools.StringToInt(pid) - } - tools.HasError(err, "", -1) - - data.DataScope = tools.GetUserIdStr(c) - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - app.PageOK(c, result, count, pageIndex, pageSize, "") -} - -func GetSysFileInfoOld(c *gin.Context) { - var data models.SysFileInfoOld - data.Id, _ = tools.StringToInt(c.Param("id")) - result, err := data.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - app.OK(c, result, "") -} - -func InsertSysFileInfoOld(c *gin.Context) { - var data models.SysFileInfoOld - err := c.ShouldBindJSON(&data) - data.CreateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - app.OK(c, result, "") -} - -func UpdateSysFileInfoOld(c *gin.Context) { - var data models.SysFileInfoOld - err := c.BindWith(&data, binding.JSON) - tools.HasError(err, "数据解析失败", -1) - data.UpdateBy = tools.GetUserIdStr(c) - result, err := data.Update(data.Id) - tools.HasError(err, "", -1) - - app.OK(c, result, "") -} - -func DeleteSysFileInfoOld(c *gin.Context) { - var data models.SysFileInfoOld - data.UpdateBy = tools.GetUserIdStr(c) - - IDS := tools.IdsStrToIdsIntGroup("id", c) - _, err := data.BatchDelete(IDS) - tools.HasError(err, msg.DeletedFail, 500) - app.OK(c, nil, msg.DeletedSuccess) -} From 746123c88807a4e8a43a5f3825ea5dafb9f6492b Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 21 Dec 2020 22:02:40 +0800 Subject: [PATCH 055/201] =?UTF-8?q?refactor=F0=9F=8E=A8=20=EF=BC=9A=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E6=93=8D=E4=BD=9C=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/sys_file/sys_file_info.go | 83 +++++++------- app/admin/models/sys_file_info.go | 10 +- app/admin/service/dto/sysfileinfo.go | 104 +++++------------- app/admin/service/sysfileinfo.go | 45 +++++--- .../version/1599190683670_migrate.go | 6 +- common/actions/create.go | 2 +- common/actions/delete.go | 2 +- common/actions/update.go | 2 +- common/dto/search.go | 10 +- common/models/by.go | 21 +++- common/models/type.go | 4 +- tools/user.go | 8 -- 12 files changed, 128 insertions(+), 169 deletions(-) diff --git a/app/admin/apis/sys_file/sys_file_info.go b/app/admin/apis/sys_file/sys_file_info.go index 1b2c1c51..341f19d4 100644 --- a/app/admin/apis/sys_file/sys_file_info.go +++ b/app/admin/apis/sys_file/sys_file_info.go @@ -3,7 +3,7 @@ package sys_file import ( "github.com/gin-gonic/gin" "go-admin/app/admin/service" - common "go-admin/common/models" + "go-admin/tools/app" "net/http" "go-admin/app/admin/models" @@ -20,19 +20,16 @@ type SysFileInfo struct { func (e *SysFileInfo) GetSysFileInfoList(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) - d := new(dto.SysFileInfoSearch) + search := new(dto.SysFileInfoSearch) db, err := tools.GetOrm(c) if err != nil { log.Error(err) return } - - req := d.Generate() - - //查询列表 - err = req.Bind(c) + err = c.ShouldBind(search) if err != nil { - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") return } @@ -44,13 +41,13 @@ func (e *SysFileInfo) GetSysFileInfoList(c *gin.Context) { serviceStudent := service.SysFileInfo{} serviceStudent.MsgID = msgID serviceStudent.Orm = db - err = serviceStudent.GetSysFileInfoPage(req, p, &list, &count) + err = serviceStudent.GetSysFileInfoPage(search, p, &list, &count) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return } - e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") + e.PageOK(c, list, int(count), search.PageIndex, search.PageSize, "查询成功") } func (e *SysFileInfo) GetSysFileInfo(c *gin.Context) { @@ -63,12 +60,13 @@ func (e *SysFileInfo) GetSysFileInfo(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //查看详情 - req := control.Generate() - err = req.Bind(c) + err = c.ShouldBindUri(control) if err != nil { - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") return } + var object models.SysFileInfo //数据权限检查 @@ -77,7 +75,7 @@ func (e *SysFileInfo) GetSysFileInfo(c *gin.Context) { serviceSysFileInfo := service.SysFileInfo{} serviceSysFileInfo.MsgID = msgID serviceSysFileInfo.Orm = db - err = serviceSysFileInfo.GetSysFileInfo(req, p, &object) + err = serviceSysFileInfo.GetSysFileInfo(control, p, &object) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return @@ -96,32 +94,32 @@ func (e *SysFileInfo) InsertSysFileInfo(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //新增操作 - req := control.Generate() - err = req.Bind(c) + err = c.ShouldBindUri(control) if err != nil { - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() + err = c.ShouldBind(control) if err != nil { - e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") return } // 设置创建人 - object.SetCreateBy(tools.GetUserIdUint(c)) + control.CreateBy = tools.GetUserId(c) serviceSysFileInfo := service.SysFileInfo{} serviceSysFileInfo.Orm = db serviceSysFileInfo.MsgID = msgID - err = serviceSysFileInfo.InsertSysFileInfo(object) + err = serviceSysFileInfo.InsertSysFileInfo(control) if err != nil { log.Error(err) e.Error(c, http.StatusInternalServerError, err, "创建失败") return } - e.OK(c, object.GetId(), "创建成功") + e.OK(c, control.ID, "创建成功") } func (e *SysFileInfo) UpdateSysFileInfo(c *gin.Context) { @@ -133,20 +131,20 @@ func (e *SysFileInfo) UpdateSysFileInfo(c *gin.Context) { } msgID := tools.GenerateMsgIDFromContext(c) - req := control.Generate() - //更新操作 - err = req.Bind(c) + err = c.ShouldBindUri(control) if err != nil { - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() + err = c.ShouldBind(control) if err != nil { - e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") return } - object.SetUpdateBy(tools.GetUserIdUint(c)) + // 设置创建人 + control.UpdateBy = tools.GetUserId(c) //数据权限检查 p := actions.GetPermissionFromContext(c) @@ -154,12 +152,12 @@ func (e *SysFileInfo) UpdateSysFileInfo(c *gin.Context) { serviceSysFileInfo := service.SysFileInfo{} serviceSysFileInfo.Orm = db serviceSysFileInfo.MsgID = msgID - err = serviceSysFileInfo.UpdateSysFileInfo(object, p) + err = serviceSysFileInfo.UpdateSysFileInfo(control, p) if err != nil { log.Error(err) return } - e.OK(c, object.GetId(), "更新成功") + e.OK(c, control.ID, "更新成功") } func (e *SysFileInfo) DeleteSysFileInfo(c *gin.Context) { @@ -172,22 +170,21 @@ func (e *SysFileInfo) DeleteSysFileInfo(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //删除操作 - req := control.Generate() - err = req.Bind(c) + err = c.ShouldBindUri(control) if err != nil { - log.Errorf("MsgID[%s] Bind error: %s", msgID, err) - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() + err = c.ShouldBind(control) if err != nil { - e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) + app.Error(c, 422, err, "参数验证失败") return } // 设置编辑人 - object.SetUpdateBy(tools.GetUserIdUint(c)) + control.UpdateBy = tools.GetUserId(c) // 数据权限检查 p := actions.GetPermissionFromContext(c) @@ -195,10 +192,10 @@ func (e *SysFileInfo) DeleteSysFileInfo(c *gin.Context) { serviceSysFileInfo := service.SysFileInfo{} serviceSysFileInfo.Orm = db serviceSysFileInfo.MsgID = msgID - err = serviceSysFileInfo.RemoveSysFileInfo(req, object, p) + err = serviceSysFileInfo.RemoveSysFileInfo(control, p) if err != nil { log.Error(err) return } - e.OK(c, object.GetId(), "删除成功") + e.OK(c, control.Id, "删除成功") } diff --git a/app/admin/models/sys_file_info.go b/app/admin/models/sys_file_info.go index cb90ac8c..e0f4b08b 100644 --- a/app/admin/models/sys_file_info.go +++ b/app/admin/models/sys_file_info.go @@ -1,22 +1,20 @@ package models import ( - "gorm.io/gorm" - "go-admin/common/models" ) type SysFileInfo struct { - gorm.Model - models.ControlBy - + models.Model Type string `json:"type" gorm:"type:varchar(255);comment:类型"` // Name string `json:"name" gorm:"type:varchar(255);comment:名称"` // Size string `json:"size" gorm:"type:int(11);comment:大小"` // - PId uint `json:"pId" gorm:"type:int(11);comment:目录"` // + PId int `json:"pId" gorm:"type:int(11);comment:目录"` // Source string `json:"source" gorm:"type:varchar(255);comment:来源"` // Url string `json:"url" gorm:"type:varchar(255);comment:地址"` // FullUrl string `json:"fullUrl" gorm:"type:varchar(255);comment:全地址"` // + models.ControlBy + models.ModelTime } func (SysFileInfo) TableName() string { diff --git a/app/admin/service/dto/sysfileinfo.go b/app/admin/service/dto/sysfileinfo.go index 52cd7128..b25d484b 100644 --- a/app/admin/service/dto/sysfileinfo.go +++ b/app/admin/service/dto/sysfileinfo.go @@ -1,104 +1,52 @@ package dto import ( - "github.com/gin-gonic/gin" - "gorm.io/gorm" - "go-admin/app/admin/models" "go-admin/common/dto" - "go-admin/common/log" common "go-admin/common/models" - "go-admin/tools" ) type SysFileInfoSearch struct { dto.Pagination `search:"-"` - ID uint `form:"ID" search:"type:exact;column:id;table:sys_file_info" comment:"标识"` - - Type string `form:"type" search:"type:exact;column:type;table:sys_file_info" comment:"类型"` - - Name string `form:"name" search:"type:exact;column:name;table:sys_file_info" comment:"名称"` - - PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_info" comment:"目录"` - - Source string `form:"source" search:"type:exact;column:source;table:sys_file_info" comment:"来源"` + ID int `form:"ID" search:"type:exact;column:id;table:sys_file_info" comment:"标识"` + Type string `form:"type" search:"type:exact;column:type;table:sys_file_info" comment:"类型"` + Name string `form:"name" search:"type:exact;column:name;table:sys_file_info" comment:"名称"` + PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_info" comment:"目录"` + Source string `form:"source" search:"type:exact;column:source;table:sys_file_info" comment:"来源"` } func (m *SysFileInfoSearch) GetNeedSearch() interface{} { return *m } -func (m *SysFileInfoSearch) Bind(ctx *gin.Context) error { - msgID := tools.GenerateMsgIDFromContext(ctx) - err := ctx.ShouldBind(m) - if err != nil { - log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) - } - return err -} - -func (m *SysFileInfoSearch) Generate() dto.Index { - o := *m - return &o -} - type SysFileInfoControl struct { - ID uint `uri:"ID" comment:"标识"` // 标识 - Type string `json:"type" comment:"类型"` - Name string `json:"name" comment:"名称"` - Size string `json:"size" comment:"大小"` - PId uint `json:"pId" comment:"目录"` - Source string `json:"source" comment:"来源"` - Url string `json:"url" comment:"地址"` - FullUrl string `json:"fullUrl" comment:"全地址"` + ID int `uri:"id" comment:"标识"` // 标识 + Type string `json:"type" comment:"类型"` + Name string `json:"name" comment:"名称"` + Size string `json:"size" comment:"大小"` + PId int `json:"pId" comment:"目录"` + Source string `json:"source" comment:"来源"` + Url string `json:"url" comment:"地址"` + FullUrl string `json:"fullUrl" comment:"全地址"` + CreateBy int `json:"-"` + UpdateBy int `json:"-"` } -func (s *SysFileInfoControl) Bind(ctx *gin.Context) error { - msgID := tools.GenerateMsgIDFromContext(ctx) - err := ctx.ShouldBindUri(s) - if err != nil { - log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) - return err - } - err = ctx.ShouldBind(s) - if err != nil { - log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) - } - return err -} - -func (s *SysFileInfoControl) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysFileInfoControl) GenerateM() (common.ActiveRecord, error) { +func (s *SysFileInfoControl) Generate() (*models.SysFileInfo, error) { return &models.SysFileInfo{ - - Model: gorm.Model{ID: s.ID}, - Type: s.Type, - Name: s.Name, - Size: s.Size, - PId: s.PId, - Source: s.Source, - Url: s.Url, - FullUrl: s.FullUrl, + Model: common.Model{ID: s.ID}, + Type: s.Type, + Name: s.Name, + Size: s.Size, + PId: s.PId, + Source: s.Source, + Url: s.Url, + FullUrl: s.FullUrl, + ControlBy: common.ControlBy{CreateBy: s.CreateBy, UpdateBy: s.UpdateBy}, }, nil } -func (s *SysFileInfoControl) GetId() interface{} { - return s.ID -} - type SysFileInfoById struct { dto.ObjectById -} - -func (s *SysFileInfoById) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysFileInfoById) GenerateM() (common.ActiveRecord, error) { - return &models.SysFileInfo{}, nil + UpdateBy int `json:"-"` } diff --git a/app/admin/service/sysfileinfo.go b/app/admin/service/sysfileinfo.go index a2983471..140cd5e3 100644 --- a/app/admin/service/sysfileinfo.go +++ b/app/admin/service/sysfileinfo.go @@ -3,10 +3,10 @@ package service import ( "errors" "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" "go-admin/common/actions" cDto "go-admin/common/dto" "go-admin/common/log" - common "go-admin/common/models" "go-admin/common/service" "gorm.io/gorm" ) @@ -16,7 +16,7 @@ type SysFileInfo struct { } // GetSysFileInfoPage 获取SysFileInfo列表 -func (e *SysFileInfo) GetSysFileInfoPage(c cDto.Index, p *actions.DataPermission, list *[]models.SysFileInfo, count *int64) error { +func (e *SysFileInfo) GetSysFileInfoPage(c *dto.SysFileInfoSearch, p *actions.DataPermission, list *[]models.SysFileInfo, count *int64) error { var err error var data models.SysFileInfo msgID := e.MsgID @@ -37,7 +37,7 @@ func (e *SysFileInfo) GetSysFileInfoPage(c cDto.Index, p *actions.DataPermission } // GetSysFileInfo 获取SysFileInfo对象 -func (e *SysFileInfo) GetSysFileInfo(d cDto.Control, p *actions.DataPermission, model *models.SysFileInfo) error { +func (e *SysFileInfo) GetSysFileInfo(d *dto.SysFileInfoById, p *actions.DataPermission, model *models.SysFileInfo) error { var err error var data models.SysFileInfo msgID := e.MsgID @@ -61,13 +61,19 @@ func (e *SysFileInfo) GetSysFileInfo(d cDto.Control, p *actions.DataPermission, } // InsertSysFileInfo 创建SysFileInfo对象 -func (e *SysFileInfo) InsertSysFileInfo(model common.ActiveRecord) error { +func (e *SysFileInfo) InsertSysFileInfo(model *dto.SysFileInfoControl) error { var err error - var data models.SysFileInfo + var data *models.SysFileInfo msgID := e.MsgID + data, err = model.Generate() + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + err = e.Orm.Model(&data). - Create(model).Error + Create(data).Error if err != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) return err @@ -76,20 +82,25 @@ func (e *SysFileInfo) InsertSysFileInfo(model common.ActiveRecord) error { } // UpdateSysFileInfo 修改SysFileInfo对象 -func (e *SysFileInfo) UpdateSysFileInfo(c common.ActiveRecord, p *actions.DataPermission) error { +func (e *SysFileInfo) UpdateSysFileInfo(c *dto.SysFileInfoControl, p *actions.DataPermission) error { var err error - var data models.SysFileInfo + var data *models.SysFileInfo msgID := e.MsgID - db := e.Orm.Model(&data). - Scopes( - actions.Permission(data.TableName(), p), - ).Where(c.GetId()).Updates(c) - if db.Error != nil { + data, err = c.Generate() + if err != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) return err } - if db.RowsAffected == 0 { + err = e.Orm.Debug().Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ).Where("id = ?", c.ID).Updates(&data).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if err == gorm.ErrRecordNotFound { return errors.New("无权更新该数据") } @@ -97,7 +108,7 @@ func (e *SysFileInfo) UpdateSysFileInfo(c common.ActiveRecord, p *actions.DataPe } // RemoveSysFileInfo 删除SysFileInfo -func (e *SysFileInfo) RemoveSysFileInfo(d cDto.Control, c common.ActiveRecord, p *actions.DataPermission) error { +func (e *SysFileInfo) RemoveSysFileInfo(d *dto.SysFileInfoById, p *actions.DataPermission) error { var err error var data models.SysFileInfo msgID := e.MsgID @@ -105,7 +116,7 @@ func (e *SysFileInfo) RemoveSysFileInfo(d cDto.Control, c common.ActiveRecord, p db := e.Orm.Model(&data). Scopes( actions.Permission(data.TableName(), p), - ).Where(d.GetId()).Delete(c) + ).Where(d.GetId()).Delete(&data) if db.Error != nil { err = db.Error log.Errorf("MsgID[%s] Delete error: %s", msgID, err) @@ -116,4 +127,4 @@ func (e *SysFileInfo) RemoveSysFileInfo(d cDto.Control, c common.ActiveRecord, p return err } return nil -} \ No newline at end of file +} diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index 82711794..3f7dbfda 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -29,9 +29,9 @@ func _1599190683670Test(db *gorm.DB, version string) error { } list4 := []system.SysConfig{ - {Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"}, - {Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"}, - {Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"}, + {Model: common.Model{ID: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: nil}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"}, + {Model: common.Model{ID: 2}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: nil}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"}, + {Model: common.Model{ID: 3}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: nil}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"}, } list5 := []models.Post{ diff --git a/common/actions/create.go b/common/actions/create.go index 89110626..b7bb2931 100644 --- a/common/actions/create.go +++ b/common/actions/create.go @@ -35,7 +35,7 @@ func CreateAction(control dto.Control) gin.HandlerFunc { app.Error(c, http.StatusInternalServerError, err, "模型生成失败") return } - object.SetCreateBy(tools.GetUserIdUint(c)) + object.SetCreateBy(tools.GetUserId(c)) err = db.WithContext(c).Create(object).Error if err != nil { log.Errorf("MsgID[%s] Create error: %s", msgID, err) diff --git a/common/actions/delete.go b/common/actions/delete.go index f8c3a5fa..e055b60d 100644 --- a/common/actions/delete.go +++ b/common/actions/delete.go @@ -37,7 +37,7 @@ func DeleteAction(control dto.Control) gin.HandlerFunc { return } - object.SetUpdateBy(tools.GetUserIdUint(c)) + object.SetUpdateBy(tools.GetUserId(c)) //数据权限检查 p := GetPermissionFromContext(c) diff --git a/common/actions/update.go b/common/actions/update.go index ac788c88..74d46623 100644 --- a/common/actions/update.go +++ b/common/actions/update.go @@ -35,7 +35,7 @@ func UpdateAction(control dto.Control) gin.HandlerFunc { app.Error(c, http.StatusInternalServerError, err, "模型生成失败") return } - object.SetUpdateBy(tools.GetUserIdUint(c)) + object.SetUpdateBy(tools.GetUserId(c)) //数据权限检查 p := GetPermissionFromContext(c) diff --git a/common/dto/search.go b/common/dto/search.go index d0b258b0..658e00b1 100644 --- a/common/dto/search.go +++ b/common/dto/search.go @@ -8,12 +8,12 @@ import ( ) type GeneralDelDto struct { - Id uint `uri:"id" json:"id" validate:"required"` - Ids []uint `json:"ids"` + Id int `uri:"id" json:"id" validate:"required"` + Ids []int `json:"ids"` } -func (g GeneralDelDto) GetIds() []uint { - ids := make([]uint, 0) +func (g GeneralDelDto) GetIds() []int { + ids := make([]int, 0) if g.Id != 0 { ids = append(ids, g.Id) } @@ -36,7 +36,7 @@ func (g GeneralDelDto) GetIds() []uint { } type GeneralGetDto struct { - Id uint `uri:"id" json:"id" validate:"required"` + Id int `uri:"id" json:"id" validate:"required"` } func MakeCondition(q interface{}) func(db *gorm.DB) *gorm.DB { diff --git a/common/models/by.go b/common/models/by.go index 1bf7de87..89ad0abb 100644 --- a/common/models/by.go +++ b/common/models/by.go @@ -1,14 +1,27 @@ package models +import "time" + type ControlBy struct { - CreateBy uint `gorm:"index;comment:'创建者'"` - UpdateBy uint `gorm:"index;comment:'更新者'"` + CreateBy int `gorm:"index;comment:'创建者'"` + UpdateBy int `gorm:"index;comment:'更新者'"` } -func (e *ControlBy) SetCreateBy(createBy uint) { +func (e *ControlBy) SetCreateBy(createBy int) { e.CreateBy = createBy } -func (e *ControlBy) SetUpdateBy(updateBy uint) { +func (e *ControlBy) SetUpdateBy(updateBy int) { e.UpdateBy = updateBy } + + +type Model struct { + ID int `gorm:"primaryKey;autoIncrement;comment:'主键编码'"` +} + +type ModelTime struct { + CreatedAt time.Time `gorm:"comment:'创建时间'"` + UpdatedAt time.Time `gorm:"comment:'最后更新时间'"` + DeletedAt *time.Time `gorm:"index;comment:'删除时间'"` +} diff --git a/common/models/type.go b/common/models/type.go index 23f3a0d1..2087d556 100644 --- a/common/models/type.go +++ b/common/models/type.go @@ -4,8 +4,8 @@ import "gorm.io/gorm/schema" type ActiveRecord interface { schema.Tabler - SetCreateBy(createBy uint) - SetUpdateBy(updateBy uint) + SetCreateBy(createBy int) + SetUpdateBy(updateBy int) Generate() ActiveRecord GetId() interface{} } diff --git a/tools/user.go b/tools/user.go index d9a4c015..5d4e7780 100644 --- a/tools/user.go +++ b/tools/user.go @@ -17,14 +17,6 @@ func ExtractClaims(c *gin.Context) jwt.MapClaims { return claims.(jwt.MapClaims) } -func GetUserIdUint(c *gin.Context) uint { - data := ExtractClaims(c) - if data["identity"] != nil { - return uint((data["identity"]).(float64)) - } - fmt.Println(GetCurrentTimeStr() + " [WARING] " + c.Request.Method + " " + c.Request.URL.Path + " GetUserId 缺少identity") - return 0 -} func GetUserId(c *gin.Context) int { data := ExtractClaims(c) From ab7c34f817c8d245155486eea6412443c85dd248 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 21 Dec 2020 22:03:12 +0800 Subject: [PATCH 056/201] =?UTF-8?q?refactor=F0=9F=8E=A8=20=EF=BC=9A=20?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98id=20=E7=B1=BB=E5=9E=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/logger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/middleware/logger.go b/app/admin/middleware/logger.go index e2054f2d..6dc46dba 100644 --- a/app/admin/middleware/logger.go +++ b/app/admin/middleware/logger.go @@ -97,7 +97,7 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string } b, _ := c.Get("body") sysOperaLog.OperParam, _ = tools.StructToJsonStr(b) - sysOperaLog.CreateBy = tools.GetUserIdUint(c) + sysOperaLog.CreateBy = tools.GetUserId(c) sysOperaLog.OperTime = tools.GetCurrentTime() sysOperaLog.LatencyTime = (latencyTime).String() sysOperaLog.UserAgent = c.Request.UserAgent() From 46ea5f18aaac23406d7f9d2e4531efb308807bee Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 21 Dec 2020 22:04:20 +0800 Subject: [PATCH 057/201] =?UTF-8?q?refactor=F0=9F=8E=A8=20=EF=BC=9A=20uint?= =?UTF-8?q?=20=E8=B0=83=E6=95=B4=E4=B8=BA=20int?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/sys_file/sys_file_dir.go | 79 +++++++------------ .../system/sys_login_log/sys_login_log.go | 6 +- .../system/sys_opera_log/sys_opera_log.go | 6 +- app/admin/models/sys_file_dir.go | 24 +++--- app/admin/models/syscategory.go | 20 +++-- app/admin/models/sysjob.go | 6 +- app/admin/models/system/sys_config.go | 7 +- app/admin/models/system/sys_login_log.go | 8 +- app/admin/models/system/sys_opera_log.go | 8 +- app/admin/service/dto/sys_category.go | 75 ++++++++---------- app/admin/service/dto/sys_config.go | 6 +- app/admin/service/dto/sys_file_dir.go | 13 +-- app/admin/service/dto/sys_login_log.go | 7 +- app/admin/service/dto/sys_opera_log.go | 6 +- app/admin/service/dto/sysjob.go | 4 +- app/admin/service/sys_file_dir.go | 20 +++-- app/jobs/jobbase.go | 2 +- 17 files changed, 125 insertions(+), 172 deletions(-) diff --git a/app/admin/apis/sys_file/sys_file_dir.go b/app/admin/apis/sys_file/sys_file_dir.go index 4f22ae85..f9f74260 100644 --- a/app/admin/apis/sys_file/sys_file_dir.go +++ b/app/admin/apis/sys_file/sys_file_dir.go @@ -3,7 +3,6 @@ package sys_file import ( "github.com/gin-gonic/gin" "go-admin/app/admin/service" - common "go-admin/common/models" "net/http" "go-admin/app/admin/models" @@ -20,27 +19,23 @@ type SysFileDir struct { func (e *SysFileDir) GetSysFileDirList(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) - d := new(dto.SysFileDirSearch) + search := new(dto.SysFileDirSearch) db, err := tools.GetOrm(c) if err != nil { log.Error(err) return } - req := d.Generate() - - //查询列表 - err = req.Bind(c) + err = c.ShouldBind(search) if err != nil { - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") - return + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) } var list *[]models.SysFileDirL serviceStudent := service.SysFileDir{} serviceStudent.MsgID = msgID serviceStudent.Orm = db - list, err = serviceStudent.SetSysFileDir(req) + list, err = serviceStudent.SetSysFileDir(search) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return @@ -59,18 +54,17 @@ func (e *SysFileDir) GetSysFileDir(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //查看详情 - req := control.Generate() - err = req.Bind(c) + err = c.ShouldBindUri(control) if err != nil { - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") - return + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) } + var object models.SysFileDir serviceSysFileDir := service.SysFileDir{} serviceSysFileDir.MsgID = msgID serviceSysFileDir.Orm = db - err = serviceSysFileDir.GetSysFileDir(req, &object) + err = serviceSysFileDir.GetSysFileDir(control, &object) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return @@ -89,32 +83,28 @@ func (e *SysFileDir) InsertSysFileDir(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //新增操作 - req := control.Generate() - err = req.Bind(c) + err = c.ShouldBindUri(control) if err != nil { - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") - return + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) } - var object common.ActiveRecord - object, err = req.GenerateM() + err = c.ShouldBind(control) if err != nil { - e.Error(c, http.StatusInternalServerError, err, "模型生成失败") - return + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) } // 设置创建人 - object.SetCreateBy(tools.GetUserIdUint(c)) + control.CreateBy = tools.GetUserId(c) serviceSysFileDir := service.SysFileDir{} serviceSysFileDir.Orm = db serviceSysFileDir.MsgID = msgID - err = serviceSysFileDir.InsertSysFileDir(object) + err = serviceSysFileDir.InsertSysFileDir(control) if err != nil { log.Error(err) e.Error(c, http.StatusInternalServerError, err, "创建失败") return } - e.OK(c, object.GetId(), "创建成功") + e.OK(c, control.ID, "创建成功") } func (e *SysFileDir) UpdateSysFileDir(c *gin.Context) { @@ -126,20 +116,16 @@ func (e *SysFileDir) UpdateSysFileDir(c *gin.Context) { } msgID := tools.GenerateMsgIDFromContext(c) - req := control.Generate() - //更新操作 - err = req.Bind(c) + err = c.ShouldBindUri(control) if err != nil { - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") - return + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) } - var object common.ActiveRecord - object, err = req.GenerateM() + err = c.ShouldBind(control) if err != nil { - e.Error(c, http.StatusInternalServerError, err, "模型生成失败") - return + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) } - object.SetUpdateBy(tools.GetUserIdUint(c)) + // 设置创建人 + control.UpdateBy = tools.GetUserId(c) //数据权限检查 p := actions.GetPermissionFromContext(c) @@ -147,12 +133,12 @@ func (e *SysFileDir) UpdateSysFileDir(c *gin.Context) { serviceSysFileDir := service.SysFileDir{} serviceSysFileDir.Orm = db serviceSysFileDir.MsgID = msgID - err = serviceSysFileDir.UpdateSysFileDir(object, p) + err = serviceSysFileDir.UpdateSysFileDir(control, p) if err != nil { log.Error(err) return } - e.OK(c, object.GetId(), "更新成功") + e.OK(c, control.ID, "更新成功") } func (e *SysFileDir) DeleteSysFileDir(c *gin.Context) { @@ -165,22 +151,17 @@ func (e *SysFileDir) DeleteSysFileDir(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //删除操作 - req := control.Generate() - err = req.Bind(c) + err = c.ShouldBindUri(control) if err != nil { - log.Errorf("MsgID[%s] Bind error: %s", msgID, err) - e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") - return + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) } - var object common.ActiveRecord - object, err = req.GenerateM() + err = c.ShouldBind(control) if err != nil { - e.Error(c, http.StatusInternalServerError, err, "模型生成失败") - return + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) } // 设置编辑人 - object.SetUpdateBy(tools.GetUserIdUint(c)) + control.UpdateBy = tools.GetUserId(c) // 数据权限检查 p := actions.GetPermissionFromContext(c) @@ -188,10 +169,10 @@ func (e *SysFileDir) DeleteSysFileDir(c *gin.Context) { serviceSysFileDir := service.SysFileDir{} serviceSysFileDir.Orm = db serviceSysFileDir.MsgID = msgID - err = serviceSysFileDir.RemoveSysFileDir(req, object, p) + err = serviceSysFileDir.RemoveSysFileDir(control, p) if err != nil { log.Error(err) return } - e.OK(c, object.GetId(), "删除成功") + e.OK(c, control.Id, "删除成功") } diff --git a/app/admin/apis/system/sys_login_log/sys_login_log.go b/app/admin/apis/system/sys_login_log/sys_login_log.go index 253dbc16..44d6952c 100644 --- a/app/admin/apis/system/sys_login_log/sys_login_log.go +++ b/app/admin/apis/system/sys_login_log/sys_login_log.go @@ -103,7 +103,7 @@ func (e *SysLoginLog) InsertSysLoginLog(c *gin.Context) { return } // 设置创建人 - object.SetCreateBy(tools.GetUserIdUint(c)) + object.SetCreateBy(tools.GetUserId(c)) serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.Orm = db @@ -140,7 +140,7 @@ func (e *SysLoginLog) UpdateSysLoginLog(c *gin.Context) { e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return } - object.SetUpdateBy(tools.GetUserIdUint(c)) + object.SetUpdateBy(tools.GetUserId(c)) serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.Orm = db @@ -178,7 +178,7 @@ func (e *SysLoginLog) DeleteSysLoginLog(c *gin.Context) { } // 设置编辑人 - object.SetUpdateBy(tools.GetUserIdUint(c)) + object.SetUpdateBy(tools.GetUserId(c)) serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.Orm = db diff --git a/app/admin/apis/system/sys_opera_log/sys_opera_log.go b/app/admin/apis/system/sys_opera_log/sys_opera_log.go index 0a52952d..47c6b110 100644 --- a/app/admin/apis/system/sys_opera_log/sys_opera_log.go +++ b/app/admin/apis/system/sys_opera_log/sys_opera_log.go @@ -103,7 +103,7 @@ func (e *SysOperaLog) InsertSysOperaLog(c *gin.Context) { return } // 设置创建人 - object.SetCreateBy(tools.GetUserIdUint(c)) + object.SetCreateBy(tools.GetUserId(c)) serviceSysOperaLog := service.SysOperaLog{} serviceSysOperaLog.Orm = db @@ -140,7 +140,7 @@ func (e *SysOperaLog) UpdateSysOperaLog(c *gin.Context) { e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return } - object.SetUpdateBy(tools.GetUserIdUint(c)) + object.SetUpdateBy(tools.GetUserId(c)) serviceSysOperaLog := service.SysOperaLog{} serviceSysOperaLog.Orm = db @@ -178,7 +178,7 @@ func (e *SysOperaLog) DeleteSysOperaLog(c *gin.Context) { } // 设置编辑人 - object.SetUpdateBy(tools.GetUserIdUint(c)) + object.SetUpdateBy(tools.GetUserId(c)) serviceSysOperaLog := service.SysOperaLog{} serviceSysOperaLog.Orm = db diff --git a/app/admin/models/sys_file_dir.go b/app/admin/models/sys_file_dir.go index 457ea06b..b2290bce 100644 --- a/app/admin/models/sys_file_dir.go +++ b/app/admin/models/sys_file_dir.go @@ -1,30 +1,28 @@ package models import ( - "gorm.io/gorm" - "go-admin/common/models" ) type SysFileDir struct { - gorm.Model - models.ControlBy - + models.Model Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 - PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 + PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 + models.ControlBy + models.ModelTime } type SysFileDirL struct { - gorm.Model + models.Model + Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 + PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 + Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 + Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 models.ControlBy - - Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 - PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 - Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 - Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 - Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息 + models.ModelTime + Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息 } func (SysFileDir) TableName() string { /**/ diff --git a/app/admin/models/syscategory.go b/app/admin/models/syscategory.go index 53e21846..44363584 100644 --- a/app/admin/models/syscategory.go +++ b/app/admin/models/syscategory.go @@ -1,24 +1,22 @@ package models import ( - "gorm.io/gorm" - "go-admin/common/models" ) type SysCategory struct { - gorm.Model - models.ControlBy - - Name string `json:"name" gorm:"type:varchar(255);comment:名称"` // - Img string `json:"img" gorm:"type:varchar(255);comment:图标"` // - Sort string `json:"sort" gorm:"type:int(4);comment:排序"` // - Status string `json:"status" gorm:"type:int(1);comment:状态"` // - Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // + models.Model + Name string `json:"name" gorm:"type:varchar(255);comment:名称"` // + Img string `json:"img" gorm:"type:varchar(255);comment:图标"` // + Sort string `json:"sort" gorm:"type:int(4);comment:排序"` // + Status string `json:"status" gorm:"type:int(1);comment:状态"` // + Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // + models.ControlBy + models.ModelTime } func (SysCategory) TableName() string { - return "sys_category" + return "sys_category" } func (e *SysCategory) Generate() models.ActiveRecord { diff --git a/app/admin/models/sysjob.go b/app/admin/models/sysjob.go index 635d54b1..3997b094 100644 --- a/app/admin/models/sysjob.go +++ b/app/admin/models/sysjob.go @@ -9,7 +9,7 @@ import ( ) type SysJob struct { - JobId uint `json:"jobId" gorm:"primary_key;AUTO_INCREMENT"` // 编码 + JobId int `json:"jobId" gorm:"primary_key;AUTO_INCREMENT"` // 编码 JobName string `json:"jobName" gorm:"size:255;"` // 名称 JobGroup string `json:"jobGroup" gorm:"size:255;"` // 任务分组 JobType int `json:"jobType" gorm:"size:1;"` // 任务类型 @@ -40,11 +40,11 @@ func (e *SysJob) GetId() interface{} { return e.JobId } -func (e *SysJob) SetCreateBy(createBy uint) { +func (e *SysJob) SetCreateBy(createBy int) { e.CreateBy = strconv.Itoa(int(createBy)) } -func (e *SysJob) SetUpdateBy(updateBy uint) { +func (e *SysJob) SetUpdateBy(updateBy int) { e.UpdateBy = strconv.Itoa(int(updateBy)) } diff --git a/app/admin/models/system/sys_config.go b/app/admin/models/system/sys_config.go index 6df7dbc1..b6f8e822 100644 --- a/app/admin/models/system/sys_config.go +++ b/app/admin/models/system/sys_config.go @@ -1,19 +1,18 @@ package system import ( - "gorm.io/gorm" - "go-admin/common/models" ) type SysConfig struct { - gorm.Model - models.ControlBy + models.Model ConfigName string `json:"configName" gorm:"type:varchar(128);comment:ConfigName"` // ConfigKey string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"` // ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"` // ConfigType string `json:"configType" gorm:"type:varchar(64);comment:ConfigType"` // Remark string `json:"remark" gorm:"type:varchar(128);comment:Remark"` // + models.ControlBy + models.ModelTime } func (SysConfig) TableName() string { diff --git a/app/admin/models/system/sys_login_log.go b/app/admin/models/system/sys_login_log.go index f23d330b..85719bb9 100644 --- a/app/admin/models/system/sys_login_log.go +++ b/app/admin/models/system/sys_login_log.go @@ -1,17 +1,13 @@ package system import ( - "gorm.io/gorm" - "go-admin/common/models" "time" ) type SysLoginLog struct { - gorm.Model - models.ControlBy - + models.Model Username string `json:"username" gorm:"type:varchar(128);comment:用户名"` // Status string `json:"status" gorm:"type:varchar(4);comment:状态"` // Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"` // @@ -22,6 +18,8 @@ type SysLoginLog struct { LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"` // Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"` // + models.ControlBy + models.ModelTime } func (SysLoginLog) TableName() string { diff --git a/app/admin/models/system/sys_opera_log.go b/app/admin/models/system/sys_opera_log.go index 990e72cb..5029a2e5 100644 --- a/app/admin/models/system/sys_opera_log.go +++ b/app/admin/models/system/sys_opera_log.go @@ -1,17 +1,13 @@ package system import ( - "gorm.io/gorm" - "go-admin/common/models" "time" ) type SysOperaLog struct { - gorm.Model - models.ControlBy - + models.Model Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` // BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` // BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` // @@ -30,6 +26,8 @@ type SysOperaLog struct { Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` // UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` // + models.ControlBy + models.ModelTime } func (SysOperaLog) TableName() string { diff --git a/app/admin/service/dto/sys_category.go b/app/admin/service/dto/sys_category.go index d5076098..398ddae5 100644 --- a/app/admin/service/dto/sys_category.go +++ b/app/admin/service/dto/sys_category.go @@ -2,8 +2,6 @@ package dto import ( "github.com/gin-gonic/gin" - "gorm.io/gorm" - "go-admin/app/admin/models" "go-admin/common/dto" "go-admin/common/log" @@ -12,12 +10,10 @@ import ( ) type SysCategorySearch struct { - dto.Pagination `search:"-"` - Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"` + dto.Pagination `search:"-"` + Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"` - Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"` - - + Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"` } func (m *SysCategorySearch) GetNeedSearch() interface{} { @@ -25,12 +21,12 @@ func (m *SysCategorySearch) GetNeedSearch() interface{} { } func (m *SysCategorySearch) Bind(ctx *gin.Context) error { - msgID := tools.GenerateMsgIDFromContext(ctx) - err := ctx.ShouldBind(m) - if err != nil { - log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) - } - return err + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err } func (m *SysCategorySearch) Generate() dto.Index { @@ -39,37 +35,31 @@ func (m *SysCategorySearch) Generate() dto.Index { } type SysCategoryControl struct { - - ID uint `uri:"ID" comment:"标识"` // 标识 + ID int `uri:"ID" comment:"标识"` // 标识 - Name string `json:"name" comment:"名称"` - + Name string `json:"name" comment:"名称"` - Img string `json:"img" comment:"图标"` - + Img string `json:"img" comment:"图标"` - Sort string `json:"sort" comment:"排序"` - + Sort string `json:"sort" comment:"排序"` - Status string `json:"status" comment:"状态"` - + Status string `json:"status" comment:"状态"` - Remark string `json:"remark" comment:"备注"` - + Remark string `json:"remark" comment:"备注"` } func (s *SysCategoryControl) Bind(ctx *gin.Context) error { - msgID := tools.GenerateMsgIDFromContext(ctx) - err := ctx.ShouldBindUri(s) - if err != nil { - log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) - return err - } - err = ctx.ShouldBind(s) - if err != nil { - log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) - } - return err + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err } func (s *SysCategoryControl) Generate() dto.Control { @@ -79,13 +69,12 @@ func (s *SysCategoryControl) Generate() dto.Control { func (s *SysCategoryControl) GenerateM() (common.ActiveRecord, error) { return &models.SysCategory{ - - Model: gorm.Model{ID: s.ID}, - Name: s.Name, - Img: s.Img, - Sort: s.Sort, - Status: s.Status, - Remark: s.Remark, + Model: common.Model{ID: s.ID}, + Name: s.Name, + Img: s.Img, + Sort: s.Sort, + Status: s.Status, + Remark: s.Remark, }, nil } diff --git a/app/admin/service/dto/sys_config.go b/app/admin/service/dto/sys_config.go index 77c1ca93..dc62286e 100644 --- a/app/admin/service/dto/sys_config.go +++ b/app/admin/service/dto/sys_config.go @@ -3,8 +3,6 @@ package dto import ( "github.com/gin-gonic/gin" "go-admin/app/admin/models/system" - "gorm.io/gorm" - "go-admin/common/dto" "go-admin/common/log" common "go-admin/common/models" @@ -37,7 +35,7 @@ func (m *SysConfigSearch) Generate() dto.Index { } type SysConfigControl struct { - ID uint `uri:"ID" comment:"编码"` // 编码 + ID int `uri:"ID" comment:"编码"` // 编码 ConfigName string `json:"configName" comment:""` ConfigKey string `json:"configKey" comment:""` ConfigValue string `json:"configValue" comment:""` @@ -66,7 +64,7 @@ func (s *SysConfigControl) Generate() dto.Control { func (s *SysConfigControl) GenerateM() (common.ActiveRecord, error) { return &system.SysConfig{ - Model: gorm.Model{ID: s.ID}, + Model: common.Model{ID: s.ID}, ConfigName: s.ConfigName, ConfigKey: s.ConfigKey, ConfigValue: s.ConfigValue, diff --git a/app/admin/service/dto/sys_file_dir.go b/app/admin/service/dto/sys_file_dir.go index 489bde19..132e42b9 100644 --- a/app/admin/service/dto/sys_file_dir.go +++ b/app/admin/service/dto/sys_file_dir.go @@ -2,8 +2,6 @@ package dto import ( "github.com/gin-gonic/gin" - "gorm.io/gorm" - "go-admin/app/admin/models" "go-admin/common/dto" "go-admin/common/log" @@ -14,7 +12,7 @@ import ( type SysFileDirSearch struct { dto.Pagination `search:"-"` - ID uint `form:"ID" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"` + ID int `form:"ID" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"` Label string `form:"label" search:"type:exact;column:label;table:sys_file_dir" comment:"目录名称"` PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_dir" comment:"上级目录"` Sort string `form:"sort" search:"type:exact;column:sort;table:sys_file_dir" comment:"排序"` @@ -40,11 +38,13 @@ func (m *SysFileDirSearch) Generate() dto.Index { } type SysFileDirControl struct { - ID uint `uri:"ID" comment:"标识"` // 标识 + ID int `uri:"ID" comment:"标识"` // 标识 Label string `json:"label" comment:"目录名称"` - PId uint `json:"pId" comment:"上级目录"` + PId int `json:"pId" comment:"上级目录"` Sort string `json:"sort" comment:"排序"` Path string `json:"path" comment:"路径"` + CreateBy int `json:"-"` + UpdateBy int `json:"-"` } func (s *SysFileDirControl) Bind(ctx *gin.Context) error { @@ -68,7 +68,7 @@ func (s *SysFileDirControl) Generate() dto.Control { func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) { return &models.SysFileDir{ - Model: gorm.Model{ID: s.ID}, + Model: common.Model{ID: s.ID}, Label: s.Label, PId: s.PId, Sort: s.Sort, @@ -82,6 +82,7 @@ func (s *SysFileDirControl) GetId() interface{} { type SysFileDirById struct { dto.ObjectById + UpdateBy int `json:"-"` } func (s *SysFileDirById) Generate() dto.Control { diff --git a/app/admin/service/dto/sys_login_log.go b/app/admin/service/dto/sys_login_log.go index ae65f75d..2723eee5 100644 --- a/app/admin/service/dto/sys_login_log.go +++ b/app/admin/service/dto/sys_login_log.go @@ -2,8 +2,6 @@ package dto import ( "github.com/gin-gonic/gin" - "gorm.io/gorm" - "go-admin/app/admin/models/system" "go-admin/common/dto" "go-admin/common/log" @@ -41,7 +39,7 @@ func (m *SysLoginLogSearch) Generate() dto.Index { } type SysLoginLogControl struct { - ID uint `uri:"ID" comment:"主键"` // 主键 + ID int `uri:"ID" comment:"主键"` // 主键 Username string `json:"username" comment:"用户名"` Status string `json:"status" comment:"状态"` Ipaddr string `json:"ipaddr" comment:"ip地址"` @@ -75,8 +73,7 @@ func (s *SysLoginLogControl) Generate() dto.Control { func (s *SysLoginLogControl) GenerateM() (common.ActiveRecord, error) { return &system.SysLoginLog{ - - Model: gorm.Model{ID: s.ID}, + Model: common.Model{ID: s.ID}, Username: s.Username, Status: s.Status, Ipaddr: s.Ipaddr, diff --git a/app/admin/service/dto/sys_opera_log.go b/app/admin/service/dto/sys_opera_log.go index f457522a..2fdf531c 100644 --- a/app/admin/service/dto/sys_opera_log.go +++ b/app/admin/service/dto/sys_opera_log.go @@ -2,8 +2,6 @@ package dto import ( "github.com/gin-gonic/gin" - "gorm.io/gorm" - "go-admin/app/admin/models/system" "go-admin/common/dto" "go-admin/common/log" @@ -42,7 +40,7 @@ func (m *SysOperaLogSearch) Generate() dto.Index { } type SysOperaLogControl struct { - ID uint `uri:"ID" comment:"编码"` // 编码 + ID int `uri:"ID" comment:"编码"` // 编码 Title string `json:"title" comment:"操作模块"` BusinessType string `json:"businessType" comment:"操作类型"` BusinessTypes string `json:"businessTypes" comment:""` @@ -84,7 +82,7 @@ func (s *SysOperaLogControl) Generate() dto.Control { func (s *SysOperaLogControl) GenerateM() (common.ActiveRecord, error) { return &system.SysOperaLog{ - Model: gorm.Model{ID: s.ID}, + Model: common.Model{ID: s.ID}, Title: s.Title, BusinessType: s.BusinessType, BusinessTypes: s.BusinessTypes, diff --git a/app/admin/service/dto/sysjob.go b/app/admin/service/dto/sysjob.go index 7ae6fd95..32d29ba6 100644 --- a/app/admin/service/dto/sysjob.go +++ b/app/admin/service/dto/sysjob.go @@ -37,7 +37,7 @@ func (m *SysJobSearch) Generate() dto.Index { } type SysJobControl struct { - JobId uint `json:"jobId"` + JobId int `json:"jobId"` JobName string `json:"jobName" validate:"required"` // 名称 JobGroup string `json:"jobGroup"` // 任务分组 JobType int `json:"jobType"` // 任务类型 @@ -93,7 +93,7 @@ func (s *SysJobById) GenerateM() (common.ActiveRecord, error) { } type SysJobItem struct { - JobId uint `json:"jobId"` + JobId int `json:"jobId"` JobName string `json:"jobName" validate:"required"` // 名称 JobGroup string `json:"jobGroup"` // 任务分组 JobType int `json:"jobType"` // 任务类型 diff --git a/app/admin/service/sys_file_dir.go b/app/admin/service/sys_file_dir.go index 5fd0f3fc..1fc7e858 100644 --- a/app/admin/service/sys_file_dir.go +++ b/app/admin/service/sys_file_dir.go @@ -3,10 +3,10 @@ package service import ( "errors" "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" "go-admin/common/actions" cDto "go-admin/common/dto" "go-admin/common/log" - common "go-admin/common/models" "go-admin/common/service" "go-admin/tools" "gorm.io/gorm" @@ -17,7 +17,7 @@ type SysFileDir struct { } // GetSysFileDirPage 获取SysFileDir列表 -func (e *SysFileDir) GetSysFileDirPage(c cDto.Index, list *[]models.SysFileDirL) error { +func (e *SysFileDir) GetSysFileDirPage(c *dto.SysFileDirSearch, list *[]models.SysFileDirL) error { var err error var data models.SysFileDir msgID := e.MsgID @@ -25,7 +25,6 @@ func (e *SysFileDir) GetSysFileDirPage(c cDto.Index, list *[]models.SysFileDirL) err = e.Orm.Model(&data). Scopes( cDto.MakeCondition(c.GetNeedSearch()), - //cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), ). Find(list). //Limit(-1).Offset(-1). Error @@ -58,7 +57,7 @@ func (e *SysFileDir) GetSysFileDir(d cDto.Control, model *models.SysFileDir) err } // InsertSysFileDir 创建SysFileDir对象 -func (e *SysFileDir) InsertSysFileDir(model common.ActiveRecord) error { +func (e *SysFileDir) InsertSysFileDir(model *dto.SysFileDirControl) error { var err error var data models.SysFileDir msgID := e.MsgID @@ -70,7 +69,7 @@ func (e *SysFileDir) InsertSysFileDir(model common.ActiveRecord) error { return err } id := model.GetId() - path := "/" + tools.UIntToString(id.(uint)) + path := "/" + tools.IntToString(id.(int)) db = e.Orm.Model(&data). First(&data, model.GetId()) err = db.Error @@ -92,7 +91,7 @@ func (e *SysFileDir) InsertSysFileDir(model common.ActiveRecord) error { } // UpdateSysFileDir 修改SysFileDir对象 -func (e *SysFileDir) UpdateSysFileDir(c common.ActiveRecord, p *actions.DataPermission) error { +func (e *SysFileDir) UpdateSysFileDir(c *dto.SysFileDirControl, p *actions.DataPermission) error { var err error var data models.SysFileDir msgID := e.MsgID @@ -100,20 +99,19 @@ func (e *SysFileDir) UpdateSysFileDir(c common.ActiveRecord, p *actions.DataPerm db := e.Orm.Model(&data). Scopes( actions.Permission(data.TableName(), p), - ).Where(c.GetId()).Updates(c) + ).Where(c.ID).Updates(c) if db.Error != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) return err } if db.RowsAffected == 0 { return errors.New("无权更新该数据") - } return nil } // RemoveSysFileDir 删除SysFileDir -func (e *SysFileDir) RemoveSysFileDir(d cDto.Control, c common.ActiveRecord, p *actions.DataPermission) error { +func (e *SysFileDir) RemoveSysFileDir(d *dto.SysFileDirById, p *actions.DataPermission) error { var err error var data models.SysFileDir msgID := e.MsgID @@ -121,7 +119,7 @@ func (e *SysFileDir) RemoveSysFileDir(d cDto.Control, c common.ActiveRecord, p * db := e.Orm.Model(&data). Scopes( actions.Permission(data.TableName(), p), - ).Where(d.GetId()).Delete(c) + ).Where(d.Id).Delete(&data) if db.Error != nil { err = db.Error log.Errorf("MsgID[%s] Delete error: %s", msgID, err) @@ -134,7 +132,7 @@ func (e *SysFileDir) RemoveSysFileDir(d cDto.Control, c common.ActiveRecord, p * return nil } -func (e *SysFileDir) SetSysFileDir(c cDto.Index) (*[]models.SysFileDirL, error) { +func (e *SysFileDir) SetSysFileDir(c *dto.SysFileDirSearch) (*[]models.SysFileDirL, error) { var list []models.SysFileDirL err := e.GetSysFileDirPage(c, &list) m := make([]models.SysFileDirL, 0) diff --git a/app/jobs/jobbase.go b/app/jobs/jobbase.go index 56b6c5a3..4e8f5461 100644 --- a/app/jobs/jobbase.go +++ b/app/jobs/jobbase.go @@ -22,7 +22,7 @@ var lock sync.Mutex type JobCore struct { InvokeTarget string Name string - JobId uint + JobId int EntryId int CronExpression string Args string From eaa135e2ad90a5e7819477b2a5beacfcbf3dc469 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 21 Dec 2020 22:04:46 +0800 Subject: [PATCH 058/201] =?UTF-8?q?refactor=F0=9F=8E=A8=20=EF=BC=9A=20?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/v3/dto.go.template | 2 +- template/v3/no_actions/apis.go.template | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/template/v3/dto.go.template b/template/v3/dto.go.template index 33b2c54b..5287afce 100644 --- a/template/v3/dto.go.template +++ b/template/v3/dto.go.template @@ -45,7 +45,7 @@ type {{.ClassName}}Control struct { {{ range .Columns -}} {{$x := .Pk}} {{- if ($x) }} - {{.GoField}} uint `uri:"{{.JsonField}}" comment:"{{.ColumnComment}}"` // {{.ColumnComment}} + {{.GoField}} {{.GoType}} `uri:"{{.JsonField}}" comment:"{{.ColumnComment}}"` // {{.ColumnComment}} {{- else if eq .GoField "CreatedAt" -}} {{- else if eq .GoField "UpdatedAt" -}} {{- else if eq .GoField "DeletedAt" -}} diff --git a/template/v3/no_actions/apis.go.template b/template/v3/no_actions/apis.go.template index 3966ab35..70437f5d 100644 --- a/template/v3/no_actions/apis.go.template +++ b/template/v3/no_actions/apis.go.template @@ -109,7 +109,7 @@ func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) { return } // 设置创建人 - object.SetCreateBy(tools.GetUserIdUint(c)) + object.SetCreateBy(tools.GetUserId(c)) service{{.ClassName}} := service.{{.ClassName}}{} service{{.ClassName}}.Orm = db @@ -146,7 +146,7 @@ func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) { e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return } - object.SetUpdateBy(tools.GetUserIdUint(c)) + object.SetUpdateBy(tools.GetUserId(c)) //数据权限检查 p := actions.GetPermissionFromContext(c) @@ -187,7 +187,7 @@ func (e *{{.ClassName}}) Delete{{.ClassName}}(c *gin.Context) { } // 设置编辑人 - object.SetUpdateBy(tools.GetUserIdUint(c)) + object.SetUpdateBy(tools.GetUserId(c)) // 数据权限检查 p := actions.GetPermissionFromContext(c) From 2c3dda58b40e10e0398bb7dd73c45767a8f7c2b6 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 21 Dec 2020 22:28:40 +0800 Subject: [PATCH 059/201] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4604070d..569f1a2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea .vscode +*/.DS_Store static/uploadfile main.exe go-admin From 17032f29a0f766facaf6c8bc627efe14c5503748 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 23 Dec 2020 20:27:18 +0800 Subject: [PATCH 060/201] =?UTF-8?q?=E6=94=AF=E6=8C=81drone=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=BA=BF=EF=BC=8C=E5=8F=91=E5=B8=83=E5=88=B0k8s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 11 +++---- scripts/.drone.yml | 25 +++++++++++++++ scripts/k8s/deploy.yml | 70 +++++++++++++++++++++++++++++++++++++++++ scripts/k8s/prerun.sh | 3 ++ scripts/k8s/storage.yml | 13 ++++++++ 5 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 scripts/.drone.yml create mode 100644 scripts/k8s/deploy.yml create mode 100644 scripts/k8s/prerun.sh create mode 100644 scripts/k8s/storage.yml diff --git a/Dockerfile b/Dockerfile index 94dc8c03..6ff1570b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ +FROM registry.cn-shanghai.aliyuncs.com/lwmeng/golang:alpine as builder -FROM golang:alpine as builder - -MAINTAINER xxx +MAINTAINER lwnmengjing ENV GOPROXY https://goproxy.cn/ @@ -9,21 +8,19 @@ WORKDIR /go/release RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories RUN apk update && apk add tzdata -COPY ./go.mod ./go.mod +COPY go.mod ./go.mod RUN go mod download COPY . . RUN pwd && ls RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o go-admin . -FROM alpine +FROM registry.cn-shanghai.aliyuncs.com/lwmeng/alpine COPY --from=builder /go/release/go-admin / -COPY --from=builder /go/release/config/ /config/ COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /etc/localtime EXPOSE 8000 CMD ["/go-admin","server","-c", "/config/settings.yml"] - diff --git a/scripts/.drone.yml b/scripts/.drone.yml new file mode 100644 index 00000000..0bbe6bd3 --- /dev/null +++ b/scripts/.drone.yml @@ -0,0 +1,25 @@ +kind: pipeline +type: kubernetes +name: drone +steps: + - name: cmd + image: alpine + commands: + - sed -i 's/DRONE_COMMIT/${DRONE_COMMIT}/g' scripts/k8s/deploy.yml + - name: docker + image: plugins/docker + settings: + username: + from_secret: username + password: + from_secret: password + repo: registry.cn-shanghai.aliyuncs.com/go-admin-team/go-admin + tags: v1.2.2 + registry: registry.cn-shanghai.aliyuncs.com + - name: dron8s + image: bh90210/dron8s:latest + settings: + yaml: + - ./scripts/k8s/deploy.yml + kubeconfig: + from_secret: kubeconfig diff --git a/scripts/k8s/deploy.yml b/scripts/k8s/deploy.yml new file mode 100644 index 00000000..f69d7e42 --- /dev/null +++ b/scripts/k8s/deploy.yml @@ -0,0 +1,70 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: go-admin + namespace: go-admin + labels: + app: go-admin + service: go-admin +spec: + ports: + - port: 8000 + name: http + protocol: TCP + selector: + app: go-admin +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: go-admin-go-admin + namespace: go-admin + labels: + account: go-admin +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: go-admin-v1 + namespace: go-admin + labels: + app: go-admin + version: v1 +spec: + replicas: 1 + selector: + matchLabels: + app: go-admin + version: v1 + template: + metadata: + labels: + app: go-admin + version: v1 + spec: + serviceAccountName: go-admin-go-admin + containers: + - name: go-admin + image: registry.cn-shanghai.aliyuncs.com/go-admin-team/go-admin:v1.2.2 + ports: + - containerPort: 8000 + volumeMounts: + - name: go-admin + mountPath: /temp + - name: go-admin + mountPath: /static + - name: go-admin-config + mountPath: /config/ + readOnly: true + env: + - name: COMMIT_TAG + value: "DRONE_COMMIT" + volumes: + - name: go-admin + persistentVolumeClaim: + claimName: go-admin + - name: go-admin-config + configMap: + name: settings-admin +--- diff --git a/scripts/k8s/prerun.sh b/scripts/k8s/prerun.sh new file mode 100644 index 00000000..f7bb046e --- /dev/null +++ b/scripts/k8s/prerun.sh @@ -0,0 +1,3 @@ +#!/bin/bash +kubectl create ns go-admin +kubectl create configmap settings-admin --from-file=../../config/settings.yml -n go-admin diff --git a/scripts/k8s/storage.yml b/scripts/k8s/storage.yml new file mode 100644 index 00000000..2866a90e --- /dev/null +++ b/scripts/k8s/storage.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: go-admin + namespace: go-admin +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: "1Mi" + volumeName: + storageClassName: nfs-csi \ No newline at end of file From e1f15bcff1f1ae8c12ee003d39ce724ac3ad1edf Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 11 Jan 2021 09:34:53 +0800 Subject: [PATCH 061/201] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9Elog?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/apis/api.go | 25 ++++++++++++++++++++++--- tools/app/return.go | 32 +++++++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/common/apis/api.go b/common/apis/api.go index 59ffbe62..66de1a9d 100644 --- a/common/apis/api.go +++ b/common/apis/api.go @@ -1,7 +1,9 @@ package apis import ( + "encoding/json" "github.com/gin-gonic/gin" + "go-admin/common/log" "gorm.io/gorm" "net/http" @@ -27,7 +29,9 @@ func (e *Api) Error(c *gin.Context, code int, err error, msg string) { res.Msg = msg } res.RequestId = tools.GenerateMsgIDFromContext(c) - c.AbortWithStatusJSON(http.StatusOK, res.ReturnError(code)) + Return := res.ReturnError(code) + setResult(c, Return, res.RequestId, code) + c.AbortWithStatusJSON(http.StatusOK, Return) } // OK 通常成功数据处理 @@ -38,7 +42,9 @@ func (e *Api) OK(c *gin.Context, data interface{}, msg string) { res.Msg = msg } res.RequestId = tools.GenerateMsgIDFromContext(c) - c.AbortWithStatusJSON(http.StatusOK, res.ReturnOK()) + Return := res.ReturnOK() + setResult(c, Return, res.RequestId, 200) + c.AbortWithStatusJSON(http.StatusOK, Return) } // PageOK 分页数据处理 @@ -53,5 +59,18 @@ func (e *Api) PageOK(c *gin.Context, result interface{}, count int, pageIndex in // Custom 兼容函数 func (e *Api) Custom(c *gin.Context, data gin.H) { - c.AbortWithStatusJSON(http.StatusOK, data) + msgID := tools.GenerateMsgIDFromContext(c) + Return := data + setResult(c, Return, msgID, 200) + c.AbortWithStatusJSON(http.StatusOK, Return) +} + +func setResult(c *gin.Context, Return interface{}, msgID string, status int) { + var jsonStr []byte + jsonStr, err := json.Marshal(Return) + if err != nil { + log.Debugf("MsgID[%s] setResult error: %#v", msgID, err.Error()) + } + c.Set("result", string(jsonStr)) + c.Set("status", status) } diff --git a/tools/app/return.go b/tools/app/return.go index 94a05a4c..bd92e256 100644 --- a/tools/app/return.go +++ b/tools/app/return.go @@ -1,6 +1,8 @@ package app import ( + "encoding/json" + "go-admin/common/log" "net/http" "github.com/gin-gonic/gin" @@ -10,6 +12,7 @@ import ( // 失败数据处理 func Error(c *gin.Context, code int, err error, msg string) { + msgID := tools.GenerateMsgIDFromContext(c) var res Response if err != nil { res.Msg = err.Error() @@ -18,18 +21,33 @@ func Error(c *gin.Context, code int, err error, msg string) { res.Msg = msg } res.RequestId = tools.GenerateMsgIDFromContext(c) - c.AbortWithStatusJSON(http.StatusOK, res.ReturnError(code)) + Return := res.ReturnError(code) + var jsonStr []byte + jsonStr, err = json.Marshal(Return) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + c.Set("result",string(jsonStr)) + c.AbortWithStatusJSON(http.StatusOK, Return) } // 通常成功数据处理 func OK(c *gin.Context, data interface{}, msg string) { + msgID := tools.GenerateMsgIDFromContext(c) var res Response res.Data = data if msg != "" { res.Msg = msg } res.RequestId = tools.GenerateMsgIDFromContext(c) - c.AbortWithStatusJSON(http.StatusOK, res.ReturnOK()) + Return := res.ReturnOK() + var jsonStr []byte + jsonStr, err := json.Marshal(Return) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + c.Set("result",string(jsonStr)) + c.AbortWithStatusJSON(http.StatusOK, Return) } // 分页数据处理 @@ -44,5 +62,13 @@ func PageOK(c *gin.Context, result interface{}, count int, pageIndex int, pageSi // 兼容函数 func Custum(c *gin.Context, data gin.H) { - c.AbortWithStatusJSON(http.StatusOK, data) + msgID := tools.GenerateMsgIDFromContext(c) + Return := data + var jsonStr []byte + jsonStr, err := json.Marshal(Return) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + c.Set("result",string(jsonStr)) + c.AbortWithStatusJSON(http.StatusOK, Return) } From 0db58170ee988270f584ac509cf0f228d782c4df Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 11 Jan 2021 16:26:12 +0800 Subject: [PATCH 062/201] =?UTF-8?q?perf=F0=9F=91=8C=20:=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E5=8A=9F=E8=83=BD=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apis/system/sys_config/sys_config.go | 201 +++++++++++++++++- app/admin/router/sys_config.go | 22 +- app/admin/service/dto/sys_config.go | 94 +++++--- app/admin/service/sys_config.go | 99 +++++++++ 4 files changed, 366 insertions(+), 50 deletions(-) diff --git a/app/admin/apis/system/sys_config/sys_config.go b/app/admin/apis/system/sys_config/sys_config.go index 1b9c4a5d..27e95e53 100644 --- a/app/admin/apis/system/sys_config/sys_config.go +++ b/app/admin/apis/system/sys_config/sys_config.go @@ -2,7 +2,9 @@ package sys_config import ( "github.com/gin-gonic/gin" + "net/http" + "go-admin/app/admin/models/system" "go-admin/app/admin/service" "go-admin/app/admin/service/dto" "go-admin/common/apis" @@ -15,6 +17,202 @@ type SysConfig struct { apis.Api } +func (e *SysConfig) GetSysConfigList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysConfigSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + + //查询列表 + err = d.Bind(c) + if err != nil { + log.Errorf("msgID[%s] 参数验证失败, error:%s", msgID, err) + app.Error(c, 500, err, "参数验证失败") + return + } + + list := make([]system.SysConfig, 0) + var count int64 + serviceStudent := service.SysConfig{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + err = serviceStudent.GetSysConfigPage(d, &list, &count) + if err != nil { + log.Errorf("msgID[%s] GetSysConfigPage 查询失败, error:%s", msgID, err) + app.Error(c, 500, err, "查询失败") + return + } + e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") +} + +func (e *SysConfig) GetSysConfig(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + control := new(dto.SysConfigById) + db, err := tools.GetOrm(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "Orm获取失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + //查看详情 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + var object system.SysConfig + + serviceSysLoginLog := service.SysConfig{} + serviceSysLoginLog.MsgID = msgID + serviceSysLoginLog.Orm = db + err = serviceSysLoginLog.GetSysConfig(control, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysConfig) InsertSysConfig(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + control := new(dto.SysConfigControl) + db, err := tools.GetOrm(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "Orm获取失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + + //新增操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserId(c)) + + serviceSysLoginLog := service.SysConfig{} + serviceSysLoginLog.Orm = db + serviceSysLoginLog.MsgID = msgID + err = serviceSysLoginLog.InsertSysConfig(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysConfig) UpdateSysConfig(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + control := new(dto.SysConfigControl) + db, err := tools.GetOrm(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "Orm获取失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + + //更新操作 + err = control.Bind(c) + + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + object.SetUpdateBy(tools.GetUserId(c)) + + serviceSysLoginLog := service.SysConfig{} + serviceSysLoginLog.Orm = db + serviceSysLoginLog.MsgID = msgID + err = serviceSysLoginLog.UpdateSysConfig(object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "更新失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysConfig) DeleteSysConfig(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + control := new(dto.SysConfigById) + db, err := tools.GetOrm(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "Orm获取失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + + //删除操作 + err = control.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + object, err := control.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + + // 设置编辑人 + object.SetUpdateBy(tools.GetUserId(c)) + + serviceSysLoginLog := service.SysConfig{} + serviceSysLoginLog.Orm = db + serviceSysLoginLog.MsgID = msgID + err = serviceSysLoginLog.RemoveSysConfig(control, object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "删除失败") + log.Errorf("msgID[%s] Orm获取失败, error:%s", msgID, err) + app.Error(c, 500, err, "Orm获取失败") + return + } + e.OK(c, object.GetId(), "删除成功") +} + // GetSysConfigByKEYForService 根据Key获取SysConfig的Service func (e *SysConfig) GetSysConfigByKEYForService(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) @@ -25,7 +223,7 @@ func (e *SysConfig) GetSysConfigByKEYForService(c *gin.Context) { return } var v dto.SysConfigControl - err = c.Bind(&v) + err = v.Bind(c) if err != nil { log.Errorf("msgID[%s] 参数验证错误, error:%s", msgID, err) app.Error(c, 422, err, "参数验证失败") @@ -36,6 +234,7 @@ func (e *SysConfig) GetSysConfigByKEYForService(c *gin.Context) { s.Orm = db err = s.GetSysConfigByKEY(&v) if err != nil { + log.Errorf("msgID[%s] 通过Key获取配置失败, error:%s", msgID, err) app.Error(c, 500, err, "") return } diff --git a/app/admin/router/sys_config.go b/app/admin/router/sys_config.go index c489d14b..e869a2cd 100644 --- a/app/admin/router/sys_config.go +++ b/app/admin/router/sys_config.go @@ -4,9 +4,6 @@ import ( "github.com/gin-gonic/gin" "go-admin/app/admin/apis/system/sys_config" "go-admin/app/admin/middleware" - "go-admin/app/admin/models/system" - "go-admin/app/admin/service/dto" - "go-admin/common/actions" jwt "go-admin/pkg/jwtauth" ) @@ -18,20 +15,17 @@ func init() { func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { r := v1.Group("/config").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - model := &system.SysConfig{} - r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.SysConfigSearch), func() interface{} { - list := make([]system.SysConfig, 0) - return &list - })) - r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.SysConfigById), nil)) - r.POST("", actions.CreateAction(new(dto.SysConfigControl))) - r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.SysConfigControl))) - r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.SysConfigById))) + api := &sys_config.SysConfig{} + r.GET("", api.GetSysConfigList) + r.GET("/:id", api.GetSysConfig) + r.POST("", api.InsertSysConfig) + r.PUT("/:id", api.UpdateSysConfig) + r.DELETE("/:id", api.DeleteSysConfig) } r1 := v1.Group("/configKey").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - model := &sys_config.SysConfig{} - r1.POST("", model.GetSysConfigByKEYForService) + api := &sys_config.SysConfig{} + r1.POST("", api.GetSysConfigByKEYForService) } } diff --git a/app/admin/service/dto/sys_config.go b/app/admin/service/dto/sys_config.go index dc62286e..1cb69e4d 100644 --- a/app/admin/service/dto/sys_config.go +++ b/app/admin/service/dto/sys_config.go @@ -1,7 +1,9 @@ package dto import ( + "encoding/json" "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" "go-admin/app/admin/models/system" "go-admin/common/dto" "go-admin/common/log" @@ -9,6 +11,7 @@ import ( "go-admin/tools" ) +// SysConfigSearch 列表或者搜索使用结构体 type SysConfigSearch struct { dto.Pagination `search:"-"` ConfigName string `form:"configName" search:"type:exact;column:config_name;table:sys_config" comment:""` @@ -20,6 +23,7 @@ func (m *SysConfigSearch) GetNeedSearch() interface{} { return *m } +// Bind 映射上下文中的结构体数据 func (m *SysConfigSearch) Bind(ctx *gin.Context) error { msgID := tools.GenerateMsgIDFromContext(ctx) err := ctx.ShouldBind(m) @@ -29,11 +33,7 @@ func (m *SysConfigSearch) Bind(ctx *gin.Context) error { return err } -func (m *SysConfigSearch) Generate() dto.Index { - o := *m - return &o -} - +// SysConfigControl 增、改使用的结构体 type SysConfigControl struct { ID int `uri:"ID" comment:"编码"` // 编码 ConfigName string `json:"configName" comment:""` @@ -43,7 +43,60 @@ type SysConfigControl struct { Remark string `json:"remark" comment:""` } +// Bind 映射上下文中的结构体数据 func (s *SysConfigControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBindBodyWith(s, binding.JSON) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + var jsonStr []byte + jsonStr, err = json.Marshal(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + ctx.Set("body", string(jsonStr)) + return err +} + +// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型 +func (s *SysConfigControl) Generate() (*system.SysConfig, error) { + return &system.SysConfig{ + Model: common.Model{ID: s.ID}, + ConfigName: s.ConfigName, + ConfigKey: s.ConfigKey, + ConfigValue: s.ConfigValue, + ConfigType: s.ConfigType, + Remark: s.Remark, + }, nil +} + +// GetId 获取数据对应的ID +func (s *SysConfigControl) GetId() interface{} { + return s.ID +} + +// SysConfigById 获取单个或者删除的结构体 +type SysConfigById struct { + Id int `uri:"id"` + Ids []int `json:"ids"` +} + +func (s *SysConfigById) Generate() *SysConfigById { + cp := *s + return &cp +} + +func (s *SysConfigById) GetId() interface{} { + return s.Id +} + +func (s *SysConfigById) Bind(ctx *gin.Context) error { msgID := tools.GenerateMsgIDFromContext(ctx) err := ctx.ShouldBindUri(s) if err != nil { @@ -57,35 +110,6 @@ func (s *SysConfigControl) Bind(ctx *gin.Context) error { return err } -func (s *SysConfigControl) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysConfigControl) GenerateM() (common.ActiveRecord, error) { - return &system.SysConfig{ - Model: common.Model{ID: s.ID}, - ConfigName: s.ConfigName, - ConfigKey: s.ConfigKey, - ConfigValue: s.ConfigValue, - ConfigType: s.ConfigType, - Remark: s.Remark, - }, nil -} - -func (s *SysConfigControl) GetId() interface{} { - return s.ID -} - -type SysConfigById struct { - dto.ObjectById -} - -func (s *SysConfigById) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysConfigById) GenerateM() (common.ActiveRecord, error) { +func (s *SysConfigById) GenerateM() (*system.SysConfig, error) { return &system.SysConfig{}, nil } diff --git a/app/admin/service/sys_config.go b/app/admin/service/sys_config.go index 8ab25a0c..acdbb6c8 100644 --- a/app/admin/service/sys_config.go +++ b/app/admin/service/sys_config.go @@ -1,16 +1,115 @@ package service import ( + "errors" "go-admin/app/admin/models/system" "go-admin/app/admin/service/dto" + cDto "go-admin/common/dto" "go-admin/common/log" "go-admin/common/service" + "gorm.io/gorm" ) type SysConfig struct { service.Service } + +// GetSysConfigPage 获取SysConfig列表 +func (e *SysConfig) GetSysConfigPage(c *dto.SysConfigSearch, list *[]system.SysConfig, count *int64) error { + var err error + var data system.SysConfig + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysConfig 获取SysConfig对象 +func (e *SysConfig) GetSysConfig(d *dto.SysConfigById, model *system.SysConfig) error { + var err error + var data system.SysConfig + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysConfig 创建SysConfig对象 +func (e *SysConfig) InsertSysConfig(model *system.SysConfig) error { + var err error + var data system.SysConfig + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// UpdateSysConfig 修改SysConfig对象 +func (e *SysConfig) UpdateSysConfig(c *system.SysConfig) error { + var err error + var data system.SysConfig + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysConfig 删除SysConfig +func (e *SysConfig) RemoveSysConfig(d *dto.SysConfigById,c *system.SysConfig) error { + var err error + var data system.SysConfig + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(d.GetId()).Delete(c) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} + // GetSysConfigByKEY 根据Key获取SysConfig func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigControl) error { var err error From abe9c42aff17c6a3df44d116592d78507ae6c4b2 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 11 Jan 2021 16:27:07 +0800 Subject: [PATCH 063/201] =?UTF-8?q?perf=F0=9F=91=8C=20:=20=E7=99=BB?= =?UTF-8?q?=E9=99=86=E6=97=A5=E5=BF=97=E5=92=8C=E6=93=8D=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/sys_login_log/sys_login_log.go | 34 +++++-------- .../system/sys_opera_log/sys_opera_log.go | 42 +++++----------- app/admin/service/dto/sys_login_log.go | 48 +++++++++++-------- app/admin/service/dto/sys_opera_log.go | 44 ++++++++++------- app/admin/service/sys_login_log.go | 7 +-- app/admin/service/sys_opera_log.go | 17 ++++--- 6 files changed, 90 insertions(+), 102 deletions(-) diff --git a/app/admin/apis/system/sys_login_log/sys_login_log.go b/app/admin/apis/system/sys_login_log/sys_login_log.go index 44d6952c..67e47e40 100644 --- a/app/admin/apis/system/sys_login_log/sys_login_log.go +++ b/app/admin/apis/system/sys_login_log/sys_login_log.go @@ -8,7 +8,6 @@ import ( "go-admin/app/admin/service/dto" "go-admin/common/apis" "go-admin/common/log" - common "go-admin/common/models" "go-admin/tools" "net/http" @@ -27,10 +26,8 @@ func (e *SysLoginLog) GetSysLoginLogList(c *gin.Context) { return } - req := d.Generate() - //查询列表 - err = req.Bind(c) + err = d.Bind(c) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return @@ -41,13 +38,13 @@ func (e *SysLoginLog) GetSysLoginLogList(c *gin.Context) { serviceStudent := service.SysLoginLog{} serviceStudent.MsgID = msgID serviceStudent.Orm = db - err = serviceStudent.GetSysLoginLogPage(req, &list, &count) + err = serviceStudent.GetSysLoginLogPage(d, &list, &count) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return } - e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") + e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") } func (e *SysLoginLog) GetSysLoginLog(c *gin.Context) { @@ -60,8 +57,7 @@ func (e *SysLoginLog) GetSysLoginLog(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //查看详情 - req := control.Generate() - err = req.Bind(c) + err = control.Bind(c) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return @@ -71,7 +67,7 @@ func (e *SysLoginLog) GetSysLoginLog(c *gin.Context) { serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.MsgID = msgID serviceSysLoginLog.Orm = db - err = serviceSysLoginLog.GetSysLoginLog(req, &object) + err = serviceSysLoginLog.GetSysLoginLog(control, &object) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return @@ -90,14 +86,12 @@ func (e *SysLoginLog) InsertSysLoginLog(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //新增操作 - req := control.Generate() - err = req.Bind(c) + err = control.Bind(c) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() + object, err := control.Generate() if err != nil { e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return @@ -127,15 +121,13 @@ func (e *SysLoginLog) UpdateSysLoginLog(c *gin.Context) { } msgID := tools.GenerateMsgIDFromContext(c) - req := control.Generate() //更新操作 - err = req.Bind(c) + err = control.Bind(c) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() + object, err := control.Generate() if err != nil { e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return @@ -163,15 +155,13 @@ func (e *SysLoginLog) DeleteSysLoginLog(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //删除操作 - req := control.Generate() - err = req.Bind(c) + err = control.Bind(c) if err != nil { log.Errorf("MsgID[%s] Bind error: %s", msgID, err) e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() + object, err := control.GenerateM() if err != nil { e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return @@ -183,7 +173,7 @@ func (e *SysLoginLog) DeleteSysLoginLog(c *gin.Context) { serviceSysLoginLog := service.SysLoginLog{} serviceSysLoginLog.Orm = db serviceSysLoginLog.MsgID = msgID - err = serviceSysLoginLog.RemoveSysLoginLog(req, object) + err = serviceSysLoginLog.RemoveSysLoginLog(control, object) if err != nil { log.Error(err) return diff --git a/app/admin/apis/system/sys_opera_log/sys_opera_log.go b/app/admin/apis/system/sys_opera_log/sys_opera_log.go index 47c6b110..31229d2b 100644 --- a/app/admin/apis/system/sys_opera_log/sys_opera_log.go +++ b/app/admin/apis/system/sys_opera_log/sys_opera_log.go @@ -8,7 +8,6 @@ import ( "go-admin/app/admin/service/dto" "go-admin/common/apis" "go-admin/common/log" - common "go-admin/common/models" "go-admin/tools" "net/http" @@ -27,10 +26,8 @@ func (e *SysOperaLog) GetSysOperaLogList(c *gin.Context) { return } - req := d.Generate() - //查询列表 - err = req.Bind(c) + err = d.Bind(c) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return @@ -41,13 +38,13 @@ func (e *SysOperaLog) GetSysOperaLogList(c *gin.Context) { serviceStudent := service.SysOperaLog{} serviceStudent.MsgID = msgID serviceStudent.Orm = db - err = serviceStudent.GetSysOperaLogPage(req, &list, &count) + err = serviceStudent.GetSysOperaLogPage(d, &list, &count) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return } - e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") + e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") } func (e *SysOperaLog) GetSysOperaLog(c *gin.Context) { @@ -60,8 +57,7 @@ func (e *SysOperaLog) GetSysOperaLog(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //查看详情 - req := control.Generate() - err = req.Bind(c) + err = control.Bind(c) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return @@ -71,7 +67,7 @@ func (e *SysOperaLog) GetSysOperaLog(c *gin.Context) { serviceSysOperlog := service.SysOperaLog{} serviceSysOperlog.MsgID = msgID serviceSysOperlog.Orm = db - err = serviceSysOperlog.GetSysOperaLog(req, &object) + err = serviceSysOperlog.GetSysOperaLog(control, &object) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return @@ -90,14 +86,12 @@ func (e *SysOperaLog) InsertSysOperaLog(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //新增操作 - req := control.Generate() - err = req.Bind(c) + err = control.Bind(c) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() + object, err := control.Generate() if err != nil { e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return @@ -127,15 +121,13 @@ func (e *SysOperaLog) UpdateSysOperaLog(c *gin.Context) { } msgID := tools.GenerateMsgIDFromContext(c) - req := control.Generate() //更新操作 - err = req.Bind(c) + err = control.Bind(c) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() + object, err := control.Generate() if err != nil { e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return @@ -163,30 +155,20 @@ func (e *SysOperaLog) DeleteSysOperaLog(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) //删除操作 - req := control.Generate() - err = req.Bind(c) + err = control.Bind(c) if err != nil { log.Errorf("MsgID[%s] Bind error: %s", msgID, err) e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") return } - var object common.ActiveRecord - object, err = req.GenerateM() - if err != nil { - e.Error(c, http.StatusInternalServerError, err, "模型生成失败") - return - } - - // 设置编辑人 - object.SetUpdateBy(tools.GetUserId(c)) serviceSysOperaLog := service.SysOperaLog{} serviceSysOperaLog.Orm = db serviceSysOperaLog.MsgID = msgID - err = serviceSysOperaLog.RemoveSysOperaLog(req, object) + err = serviceSysOperaLog.RemoveSysOperaLog(control) if err != nil { log.Error(err) return } - e.OK(c, object.GetId(), "删除成功") + e.OK(c, control.GetId(), "删除成功") } diff --git a/app/admin/service/dto/sys_login_log.go b/app/admin/service/dto/sys_login_log.go index 2723eee5..e9ad0576 100644 --- a/app/admin/service/dto/sys_login_log.go +++ b/app/admin/service/dto/sys_login_log.go @@ -13,11 +13,10 @@ import ( type SysLoginLogSearch struct { dto.Pagination `search:"-"` - - Username string `form:"username" search:"type:exact;column:username;table:sys_login_log" comment:"用户名"` - Status string `form:"status" search:"type:exact;column:status;table:sys_login_log" comment:"状态"` - Ipaddr string `form:"ipaddr" search:"type:exact;column:ipaddr;table:sys_login_log" comment:"ip地址"` - LoginLocation string `form:"loginLocation" search:"type:exact;column:login_location;table:sys_login_log" comment:"归属地"` + Username string `form:"username" search:"type:exact;column:username;table:sys_login_log" comment:"用户名"` + Status string `form:"status" search:"type:exact;column:status;table:sys_login_log" comment:"状态"` + Ipaddr string `form:"ipaddr" search:"type:exact;column:ipaddr;table:sys_login_log" comment:"ip地址"` + LoginLocation string `form:"loginLocation" search:"type:exact;column:login_location;table:sys_login_log" comment:"归属地"` } func (m *SysLoginLogSearch) GetNeedSearch() interface{} { @@ -33,13 +32,8 @@ func (m *SysLoginLogSearch) Bind(ctx *gin.Context) error { return err } -func (m *SysLoginLogSearch) Generate() dto.Index { - o := *m - return &o -} - type SysLoginLogControl struct { - ID int `uri:"ID" comment:"主键"` // 主键 + ID int `uri:"ID" comment:"主键"` // 主键 Username string `json:"username" comment:"用户名"` Status string `json:"status" comment:"状态"` Ipaddr string `json:"ipaddr" comment:"ip地址"` @@ -66,12 +60,7 @@ func (s *SysLoginLogControl) Bind(ctx *gin.Context) error { return err } -func (s *SysLoginLogControl) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysLoginLogControl) GenerateM() (common.ActiveRecord, error) { +func (s *SysLoginLogControl) Generate() (*system.SysLoginLog, error) { return &system.SysLoginLog{ Model: common.Model{ID: s.ID}, Username: s.Username, @@ -92,14 +81,33 @@ func (s *SysLoginLogControl) GetId() interface{} { } type SysLoginLogById struct { - dto.ObjectById + Id int `uri:"id"` + Ids []int `json:"ids"` } -func (s *SysLoginLogById) Generate() dto.Control { +func (s *SysLoginLogById) GetId() interface{} { + return s.Id +} + +func (s *SysLoginLogById) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysLoginLogById) Generate() *SysLoginLogById { cp := *s return &cp } -func (s *SysLoginLogById) GenerateM() (common.ActiveRecord, error) { +func (s *SysLoginLogById) GenerateM() (*system.SysLoginLog, error) { return &system.SysLoginLog{}, nil } diff --git a/app/admin/service/dto/sys_opera_log.go b/app/admin/service/dto/sys_opera_log.go index 2fdf531c..34155b2f 100644 --- a/app/admin/service/dto/sys_opera_log.go +++ b/app/admin/service/dto/sys_opera_log.go @@ -34,13 +34,8 @@ func (m *SysOperaLogSearch) Bind(ctx *gin.Context) error { return err } -func (m *SysOperaLogSearch) Generate() dto.Index { - o := *m - return &o -} - type SysOperaLogControl struct { - ID int `uri:"ID" comment:"编码"` // 编码 + ID int `uri:"ID" comment:"编码"` // 编码 Title string `json:"title" comment:"操作模块"` BusinessType string `json:"businessType" comment:"操作类型"` BusinessTypes string `json:"businessTypes" comment:""` @@ -75,12 +70,7 @@ func (s *SysOperaLogControl) Bind(ctx *gin.Context) error { return err } -func (s *SysOperaLogControl) Generate() dto.Control { - cp := *s - return &cp -} - -func (s *SysOperaLogControl) GenerateM() (common.ActiveRecord, error) { +func (s *SysOperaLogControl) Generate() (*system.SysOperaLog, error) { return &system.SysOperaLog{ Model: common.Model{ID: s.ID}, Title: s.Title, @@ -109,14 +99,32 @@ func (s *SysOperaLogControl) GetId() interface{} { } type SysOperaLogById struct { - dto.ObjectById + Id int `uri:"id"` + Ids []int `json:"ids"` } -func (s *SysOperaLogById) Generate() dto.Control { - cp := *s - return &cp +func (s *SysOperaLogById) GetId() interface{} { + if len(s.Ids) > 0 { + s.Ids = append(s.Ids, s.Id) + return s.Ids + } + return s.Id } -func (s *SysOperaLogById) GenerateM() (common.ActiveRecord, error) { - return &system.SysOperaLog{}, nil +func (s *SysOperaLogById) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysOperaLogById) SetUpdateBy(id int) { + } diff --git a/app/admin/service/sys_login_log.go b/app/admin/service/sys_login_log.go index c3ba5fe7..dc6ccd62 100644 --- a/app/admin/service/sys_login_log.go +++ b/app/admin/service/sys_login_log.go @@ -3,6 +3,7 @@ package service import ( "errors" "go-admin/app/admin/models/system" + "go-admin/app/admin/service/dto" cDto "go-admin/common/dto" "go-admin/common/log" common "go-admin/common/models" @@ -15,7 +16,7 @@ type SysLoginLog struct { } // GetSysLoginLogPage 获取SysLoginLog列表 -func (e *SysLoginLog) GetSysLoginLogPage(c cDto.Index, list *[]system.SysLoginLog, count *int64) error { +func (e *SysLoginLog) GetSysLoginLogPage(c *dto.SysLoginLogSearch, list *[]system.SysLoginLog, count *int64) error { var err error var data system.SysLoginLog msgID := e.MsgID @@ -35,7 +36,7 @@ func (e *SysLoginLog) GetSysLoginLogPage(c cDto.Index, list *[]system.SysLoginLo } // GetSysLoginLog 获取SysLoginLog对象 -func (e *SysLoginLog) GetSysLoginLog(d cDto.Control, model *system.SysLoginLog) error { +func (e *SysLoginLog) GetSysLoginLog(d *dto.SysLoginLogById, model *system.SysLoginLog) error { var err error var data system.SysLoginLog msgID := e.MsgID @@ -90,7 +91,7 @@ func (e *SysLoginLog) UpdateSysLoginLog(c common.ActiveRecord) error { } // RemoveSysLoginLog 删除SysLoginLog -func (e *SysLoginLog) RemoveSysLoginLog(d cDto.Control, c common.ActiveRecord) error { +func (e *SysLoginLog) RemoveSysLoginLog(d *dto.SysLoginLogById, c common.ActiveRecord) error { var err error var data system.SysLoginLog msgID := e.MsgID diff --git a/app/admin/service/sys_opera_log.go b/app/admin/service/sys_opera_log.go index ca617c50..7bcd9997 100644 --- a/app/admin/service/sys_opera_log.go +++ b/app/admin/service/sys_opera_log.go @@ -3,9 +3,9 @@ package service import ( "errors" "go-admin/app/admin/models/system" + "go-admin/app/admin/service/dto" cDto "go-admin/common/dto" "go-admin/common/log" - common "go-admin/common/models" "go-admin/common/service" "gorm.io/gorm" ) @@ -15,7 +15,7 @@ type SysOperaLog struct { } // GetSysOperaLogPage 获取SysOperaLog列表 -func (e *SysOperaLog) GetSysOperaLogPage(c cDto.Index, list *[]system.SysOperaLog, count *int64) error { +func (e *SysOperaLog) GetSysOperaLogPage(c *dto.SysOperaLogSearch, list *[]system.SysOperaLog, count *int64) error { var err error var data system.SysOperaLog msgID := e.MsgID @@ -35,7 +35,7 @@ func (e *SysOperaLog) GetSysOperaLogPage(c cDto.Index, list *[]system.SysOperaLo } // GetSysOperaLog 获取SysOperaLog对象 -func (e *SysOperaLog) GetSysOperaLog(d cDto.Control, model *system.SysOperaLog) error { +func (e *SysOperaLog) GetSysOperaLog(d *dto.SysOperaLogById, model *system.SysOperaLog) error { var err error var data system.SysOperaLog msgID := e.MsgID @@ -56,7 +56,7 @@ func (e *SysOperaLog) GetSysOperaLog(d cDto.Control, model *system.SysOperaLog) } // InsertSysOperaLog 创建SysOperaLog对象 -func (e *SysOperaLog) InsertSysOperaLog(model common.ActiveRecord) error { +func (e *SysOperaLog) InsertSysOperaLog(model *system.SysOperaLog) error { var err error var data system.SysOperaLog msgID := e.MsgID @@ -71,7 +71,7 @@ func (e *SysOperaLog) InsertSysOperaLog(model common.ActiveRecord) error { } // UpdateSysOperaLog 修改SysOperaLog对象 -func (e *SysOperaLog) UpdateSysOperaLog(c common.ActiveRecord) error { +func (e *SysOperaLog) UpdateSysOperaLog(c *system.SysOperaLog) error { var err error var data system.SysOperaLog msgID := e.MsgID @@ -90,13 +90,12 @@ func (e *SysOperaLog) UpdateSysOperaLog(c common.ActiveRecord) error { } // RemoveSysOperaLog 删除SysOperaLog -func (e *SysOperaLog) RemoveSysOperaLog(d cDto.Control, c common.ActiveRecord) error { +func (e *SysOperaLog) RemoveSysOperaLog(d *dto.SysOperaLogById) error { var err error var data system.SysOperaLog msgID := e.MsgID - db := e.Orm.Model(&data). - Where(d.GetId()).Delete(c) + db := e.Orm.Model(&data).Delete(&data, d.GetId()) if db.Error != nil { err = db.Error log.Errorf("MsgID[%s] Delete error: %s", msgID, err) @@ -107,4 +106,4 @@ func (e *SysOperaLog) RemoveSysOperaLog(d cDto.Control, c common.ActiveRecord) e return err } return nil -} \ No newline at end of file +} From 98d30f64f6a1fb7f9096e542faf87a36be5af111 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 11 Jan 2021 16:27:36 +0800 Subject: [PATCH 064/201] =?UTF-8?q?perf=F0=9F=91=8C=20:=20logger=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=A0=E5=85=A5=E4=BC=A0=E5=87=BA=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/logger.go | 51 ++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/app/admin/middleware/logger.go b/app/admin/middleware/logger.go index 6dc46dba..5e93e6e4 100644 --- a/app/admin/middleware/logger.go +++ b/app/admin/middleware/logger.go @@ -1,6 +1,7 @@ package middleware import ( + "fmt" "strings" "time" @@ -9,7 +10,6 @@ import ( "go-admin/app/admin/models" "go-admin/app/admin/models/system" "go-admin/app/admin/service" - "go-admin/common/global" "go-admin/common/log" "go-admin/tools" "go-admin/tools/config" @@ -17,32 +17,42 @@ import ( // LoggerToFile 日志记录到文件 func LoggerToFile() gin.HandlerFunc { - return func(c *gin.Context) { // 开始时间 startTime := time.Now() - // 处理请求 c.Next() - // 结束时间 - endTime := time.Now() + bd, bl := c.Get("body") + var body = "" + if bl { + body = bd.(string) + } - // 执行时间 - latencyTime := endTime.Sub(startTime) + rt, bl := c.Get("result") + var result = "" + if bl { + result = rt.(string) + } + + st, bl := c.Get("status") + var statusBus = 0 + if bl { + statusBus = st.(int) + } // 请求方式 reqMethod := c.Request.Method - // 请求路由 reqUri := c.Request.RequestURI - // 状态码 statusCode := c.Writer.Status() - // 请求IP clientIP := c.ClientIP() - + // 结束时间 + endTime := time.Now() + // 执行时间 + latencyTime := endTime.Sub(startTime) // 日志格式 logData := map[string]interface{}{ "statusCode": statusCode, @@ -52,16 +62,14 @@ func LoggerToFile() gin.HandlerFunc { "uri": reqUri, } log.Info(logData) - global.RequestLogger.Info(logData) - if c.Request.Method != "GET" && c.Request.Method != "OPTIONS" && config.LoggerConfig.EnabledDB { - SetDBOperLog(c, clientIP, statusCode, reqUri, reqMethod, latencyTime) + SetDBOperLog(c, clientIP, statusCode, reqUri, reqMethod, latencyTime, body, result, statusBus) } } } // SetDBOperLog 写入操作日志表 fixme 该方法后续即将弃用 -func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string, reqMethod string, latencyTime time.Duration) { +func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string, reqMethod string, latencyTime time.Duration, body string, result string, status int) { menu := models.Menu{} menu.Path = reqUri menu.Action = reqMethod @@ -73,6 +81,7 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string sysOperaLog.OperName = tools.GetUserName(c) sysOperaLog.RequestMethod = c.Request.Method sysOperaLog.OperUrl = reqUri + sysOperaLog.OperParam = body if reqUri == "/login" { sysOperaLog.BusinessType = "10" sysOperaLog.Title = "用户登录" @@ -95,14 +104,14 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string if len(menuList) > 0 { sysOperaLog.Title = menuList[0].Title } - b, _ := c.Get("body") - sysOperaLog.OperParam, _ = tools.StructToJsonStr(b) sysOperaLog.CreateBy = tools.GetUserId(c) sysOperaLog.OperTime = tools.GetCurrentTime() - sysOperaLog.LatencyTime = (latencyTime).String() + sysOperaLog.LatencyTime = fmt.Sprintf("%v", latencyTime) + + sysOperaLog.JsonResult = result sysOperaLog.UserAgent = c.Request.UserAgent() - if c.Err() == nil { - sysOperaLog.Status = "0" + if status == 200 { + sysOperaLog.Status = "2" } else { sysOperaLog.Status = "1" } @@ -113,5 +122,5 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string } serviceOperaLog := service.SysOperaLog{} serviceOperaLog.Orm = db - _ = serviceOperaLog.InsertSysOperaLog(sysOperaLog.Generate()) + _ = serviceOperaLog.InsertSysOperaLog(&sysOperaLog) } From a7dafceb5b4880cc001583b63eac8cdec62d584d Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 11 Jan 2021 21:29:57 +0800 Subject: [PATCH 065/201] =?UTF-8?q?perf=F0=9F=91=8C=20:=20=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/settings.go | 87 +++++++++++++++++++--------- app/admin/service/dto/sys_setting.go | 87 ++++++++++++++++++++++++++++ app/admin/service/sys_setting.go | 53 +++++++++++++++++ 3 files changed, 199 insertions(+), 28 deletions(-) create mode 100644 app/admin/service/dto/sys_setting.go create mode 100644 app/admin/service/sys_setting.go diff --git a/app/admin/apis/system/settings.go b/app/admin/apis/system/settings.go index 176cfb60..7972e286 100644 --- a/app/admin/apis/system/settings.go +++ b/app/admin/apis/system/settings.go @@ -1,35 +1,55 @@ package system import ( - "errors" "fmt" + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + "net/http" "strings" "github.com/gin-gonic/gin" "go-admin/app/admin/models" "go-admin/tools" - "go-admin/tools/app" ) +type SysSetting struct { + apis.Api +} + // @Summary 查询系统信息 // @Description 获取JSON // @Tags 系统信息 // @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Router /api/v1/setting [get] -func GetSetting(c *gin.Context) { - var s models.SysSetting - r, e := s.Get() +func (e *SysSetting) GetSetting(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } - if r.Logo != "" { - if !strings.HasPrefix(r.Logo, "http") { - r.Logo = fmt.Sprintf("http://%s/%s", c.Request.Host, r.Logo) + sysSettingService := service.SysSetting{} + sysSettingService.MsgID=msgID + sysSettingService.Orm=db + var model = models.SysSetting{} + err = sysSettingService.GetSysSetting(&model) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + if model.Logo != "" { + if !strings.HasPrefix(model.Logo, "http") { + model.Logo = fmt.Sprintf("http://%s/%s", c.Request.Host, model.Logo) } } - tools.HasError(e, "查询失败", 500) - app.OK(c, r, "查询成功") + e.OK(c, model, "查询成功") } // @Summary 更新或提交系统信息 @@ -39,30 +59,41 @@ func GetSetting(c *gin.Context) { // @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Router /api/v1/system/setting [post] -func CreateSetting(c *gin.Context) { - var s models.ResponseSystemConfig - if err := c.ShouldBind(&s); err != nil { - app.Error(c, 200, errors.New("缺少必要参数"), "") +func (e *SysSetting) CreateOrUpdateSetting(c *gin.Context) { + control := new(dto.SysSettingControl) + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) return } - var sModel models.SysSetting - sModel.Logo = s.Logo - sModel.Name = s.Name - sModel.SettingsId = s.SettingsId - - a, e := sModel.Update() - if e != nil { - app.Error(c, 200, e, "") + //更新操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") return } - if a.Logo != "" { - if !strings.HasPrefix(a.Logo, "http") { - a.Logo = fmt.Sprintf("http://%s/%s", c.Request.Host, a.Logo) + sysSettingService := service.SysSetting{} + sysSettingService.MsgID=msgID + sysSettingService.Orm=db + err = sysSettingService.UpdateSysSetting(object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "更新失败") + return + } + + + if object.Logo != "" { + if !strings.HasPrefix(object.Logo, "http") { + object.Logo = fmt.Sprintf("http://%s/%s", c.Request.Host, object.Logo) } } - - app.OK(c, a, "提交成功") - + e.OK(c, object, "提交成功") } diff --git a/app/admin/service/dto/sys_setting.go b/app/admin/service/dto/sys_setting.go new file mode 100644 index 00000000..272b4cd1 --- /dev/null +++ b/app/admin/service/dto/sys_setting.go @@ -0,0 +1,87 @@ +package dto + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + "go-admin/app/admin/models" + "go-admin/common/log" + "go-admin/tools" +) + +// SysConfigControl 增、改使用的结构体 +type SysSettingControl struct { + SettingsId int `json:"settings_id" binding:"required"` // 头像 + Name string `json:"name" binding:"required"` // 名称 + Logo string `json:"logo" binding:"required"` // 头像 +} + +// Bind 映射上下文中的结构体数据 +func (s *SysSettingControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + + err := ctx.ShouldBind(s) + if err != nil { + log.Errorf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + return err + } + + err = ctx.ShouldBindUri(s) + if err != nil { + log.Errorf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + var jsonStr []byte + jsonStr, err = json.Marshal(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + ctx.Set("body", string(jsonStr)) + return err +} + +// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型 +func (s *SysSettingControl) Generate() (*models.SysSetting, error) { + return &models.SysSetting{ + SettingsId: s.SettingsId, + Name: s.Name, + Logo: s.Logo, + }, nil +} + +// GetId 获取数据对应的ID +func (s *SysSettingControl) GetId() interface{} { + return s.SettingsId +} + +// SysConfigById 获取单个或者删除的结构体 +type SysSettingById struct { + Id int `uri:"id"` + Ids []int `json:"ids"` +} + +func (s *SysSettingById) Generate() *SysSettingById { + cp := *s + return &cp +} + +func (s *SysSettingById) GetId() interface{} { + return s.Id +} + +func (s *SysSettingById) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysSettingById) GenerateM() (*models.SysSetting, error) { + return &models.SysSetting{}, nil +} diff --git a/app/admin/service/sys_setting.go b/app/admin/service/sys_setting.go new file mode 100644 index 00000000..e0adb464 --- /dev/null +++ b/app/admin/service/sys_setting.go @@ -0,0 +1,53 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models" + "go-admin/common/log" + "go-admin/common/service" + "gorm.io/gorm" +) + +type SysSetting struct { + service.Service +} + +// GetSysSetting 获取SysSetting对象 +func (e *SysSetting) GetSysSetting(model *models.SysSetting) error { + var err error + var data models.SysSetting + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// UpdateSysSetting 修改SysSetting对象 +func (e *SysSetting) UpdateSysSetting(c *models.SysSetting) error { + var err error + var data models.SysSetting + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} From 82a09c4abd00b9cf935d5a7c25700775c3bd9383 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 11 Jan 2021 21:31:03 +0800 Subject: [PATCH 066/201] =?UTF-8?q?perf=F0=9F=91=8C=20:=20=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/system.go | 11 ++++++++--- app/admin/router/sysrouter.go | 5 +++-- .../migration/version/1599190683670_migrate.go | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/admin/models/system.go b/app/admin/models/system.go index f2a2d3b8..77525c92 100644 --- a/app/admin/models/system.go +++ b/app/admin/models/system.go @@ -2,19 +2,24 @@ package models import ( orm "go-admin/common/global" + "go-admin/common/models" ) type SysSetting struct { SettingsId int `json:"settings_id" gorm:"primary_key;AUTO_INCREMENT"` Name string `json:"name" gorm:"type:varchar(256);"` Logo string `json:"logo" gorm:"type:varchar(256);"` - BaseModel + models.ModelTime } func (SysSetting) TableName() string { return "sys_setting" } +func (s *SysSetting) GetId() interface{} { + return s.SettingsId +} + //查询 func (s *SysSetting) Get() (create SysSetting, err error) { result := orm.Eloquent.Table("sys_setting").First(&create) @@ -34,7 +39,7 @@ func (s *SysSetting) Update() (update SysSetting, err error) { } type ResponseSystemConfig struct { - Name string `json:"name" binding:"required"` // 名称 - Logo string `json:"logo" binding:"required"` // 头像 + Name string `json:"name" binding:"required"` // 名称 + Logo string `json:"logo" binding:"required"` // 头像 SettingsId int `json:"settings_id" binding:"required"` // 头像 } diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sysrouter.go index 859bcb16..9e68d750 100644 --- a/app/admin/router/sysrouter.go +++ b/app/admin/router/sysrouter.go @@ -219,10 +219,11 @@ func registerDeptRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar } } func registerSysSettingRouter(v1 *gin.RouterGroup) { + api := system.SysSetting{} setting := v1.Group("/setting") { - setting.GET("", system.GetSetting) - setting.POST("", system.CreateSetting) + setting.GET("", api.GetSetting) + setting.POST("", api.CreateOrUpdateSetting) setting.GET("/serverInfo", monitor.ServerInfo) } } diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index f1a472b0..f81afa71 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -96,7 +96,7 @@ func _1599190683670Test(db *gorm.DB, version string) error { } list10 := []models.SysSetting{ - {1, "go-admin管理系统", "https://gitee.com/mydearzwj/image/raw/master/img/go-admin.png", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {1, "go-admin管理系统", "https://gitee.com/mydearzwj/image/raw/master/img/go-admin.png", common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } list11 := []models.SysJob{ From 72d92b5232015a73835396f776480ae41cff0876 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Mon, 11 Jan 2021 21:38:55 +0800 Subject: [PATCH 067/201] Update 1606582844753_migrate.go --- .../migration/version/1606582844753_migrate.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/migrate/migration/version/1606582844753_migrate.go b/cmd/migrate/migration/version/1606582844753_migrate.go index e99d360a..103ebe96 100644 --- a/cmd/migrate/migration/version/1606582844753_migrate.go +++ b/cmd/migrate/migration/version/1606582844753_migrate.go @@ -18,7 +18,6 @@ func init() { func _1606582844753Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - dept := models.SysDept{} err := tx.Model(&dept).Where("status = ?", 0).Update("status", 2).Error if err != nil { @@ -30,6 +29,18 @@ func _1606582844753Test(db *gorm.DB, version string) error { if err != nil { return err } + sql1 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `create_by`, `update_by`, `is_frame`, `created_at`, `updated_at`, `deleted_at`) VALUES (522, 'SysContentCreate', '新增', 'form', 'syscontent/create', '/0/498/522', 'C', '', 'syscontent:syscontent:add', 498, 0, '', '/syscontent/create.vue', 0, '1', '1', '1', '1', '2020-11-08 17:00:35.259', '2020-11-12 22:55:50.739', NULL);" + sql2 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `create_by`, `update_by`, `is_frame`, `created_at`, `updated_at`, `deleted_at`) VALUES (523, 'SysContentEdit', '编辑', 'edit', 'syscontent/edit:id', '/0/498/523', 'C', '', 'syscontent:syscontent:edit', 498, 0, '', '/syscontent/edit.vue', 0, '1', '1', '1', '1', '2020-11-12 22:53:42.643', '2020-11-12 22:54:56.852', NULL);" + + err = tx.Exec(sql1).Error + if err != nil { + return err + } + + err = tx.Exec(sql2).Error + if err != nil { + return err + } return tx.Create(&common.Migration{ Version: version, From 249567d61de296aa3d1b71e92ebb5deb95520aa6 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 12 Jan 2021 13:21:07 +0800 Subject: [PATCH 068/201] =?UTF-8?q?feat=E2=9C=A8=20:=20=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=95=B0=E6=8D=AE=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../version/1599190683670_migrate.go | 2 +- .../version/1610427732413_migrate.go | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 cmd/migrate/migration/version/1610427732413_migrate.go diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index f81afa71..91aa1e68 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -58,7 +58,7 @@ func _1599190683670Test(db *gorm.DB, version string) error { } list8 := []models.SysUser{ - {models.SysUserId{1}, models.LoginM{models.UserName{"admin"}, models.PassWord{"$2a$10$cKFFTCzGOvaIHHJY2K45Zuwt8TD6oPzYi4s5MzYIBAWCLL6ZhouP2"}}, models.SysUserB{"zhangwj", "13818888888", 1, "", "", "0", "1@qq.com", 1, 1, "1", "1", "", "0", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, "", ""}}, + {models.SysUserId{1}, models.LoginM{models.UserName{"admin"}, models.PassWord{"$2a$10$cKFFTCzGOvaIHHJY2K45Zuwt8TD6oPzYi4s5MzYIBAWCLL6ZhouP2"}}, models.SysUserB{"zhangwj", "13818888888", 1, "", "", "0", "1@qq.com", 1, 1, "1", "1", "", "2", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, "", ""}}, } list9 := []models.DictData{ diff --git a/cmd/migrate/migration/version/1610427732413_migrate.go b/cmd/migrate/migration/version/1610427732413_migrate.go new file mode 100644 index 00000000..bf14a189 --- /dev/null +++ b/cmd/migrate/migration/version/1610427732413_migrate.go @@ -0,0 +1,32 @@ +package version + +import ( + "go-admin/app/admin/models" + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1610427732413Test) +} + +func _1610427732413Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + // TODO: 这里开始写入要变更的内容 + user := models.SysUser{} + err := tx.Model(&user).Where("status = ?", 0).Update("status", 2).Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} From 305326d9ea2247f2f4dba66bdc2ab1a1a05eee56 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 12 Jan 2021 13:21:38 +0800 Subject: [PATCH 069/201] =?UTF-8?q?feat=E2=9C=A8=20:=20=E7=99=BB=E9=99=86?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=95=B0=E6=8D=AE=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/handler/auth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/middleware/handler/auth.go b/app/admin/middleware/handler/auth.go index 3da45c81..741735f3 100644 --- a/app/admin/middleware/handler/auth.go +++ b/app/admin/middleware/handler/auth.go @@ -61,7 +61,7 @@ func IdentityHandler(c *gin.Context) interface{} { // @Router /login [post] func Authenticator(c *gin.Context) (interface{}, error) { var loginVals models.Login - var status = "0" + var status = "2" var msg = "登录成功" var username = "" @@ -142,7 +142,7 @@ func LogOut(c *gin.Context) { location := tools.GetLocation(c.ClientIP()) loginLog.LoginLocation = location loginLog.LoginTime = tools.GetCurrentTime() - loginLog.Status = "0" + loginLog.Status = "2" loginLog.Remark = c.Request.UserAgent() browserName, browserVersion := ua.Browser() loginLog.Browser = browserName + " " + browserVersion From f768d69defc7929abd521ea578c52e72e4105b24 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 12 Jan 2021 13:22:03 +0800 Subject: [PATCH 070/201] =?UTF-8?q?feat=E2=9C=A8=20:=20=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=9D=83=E9=99=90=E7=9A=84=E6=8E=A5=E5=8F=A3=E4=BD=BF=E7=94=A8?= =?UTF-8?q?log=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/permission.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/admin/middleware/permission.go b/app/admin/middleware/permission.go index 6d8e3037..81d21684 100644 --- a/app/admin/middleware/permission.go +++ b/app/admin/middleware/permission.go @@ -28,14 +28,17 @@ func AuthCheckRole() gin.HandlerFunc { } else { res, err = e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method) if err != nil { - log.Errorf("msgID[%s] error:%s method:%s path:%s", msgID, err, c.Request.Method, c.Request.URL.Path) + log.Errorf("msgID[%s] AuthCheckRole error:%s method:%s path:%s", msgID, err, c.Request.Method, c.Request.URL.Path) app.Error(c, 500, err, "") + return } } if res { + log.Infof("msgID[%s] isTrue: %v role: %s method: %s path: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path) c.Next() } else { + log.Warnf("msgID[%s] isTrue: %v role: %s method: %s path: %s message: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path,"当前请求是没有接口权限的,请管理员确认!") c.JSON(http.StatusOK, gin.H{ "code": 403, "msg": "对不起,您没有该接口访问权限,请联系管理员", From c0f6fb6b4108d859b8df4eaf4737fec26f2d60a3 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 14 Jan 2021 16:03:13 +0800 Subject: [PATCH 071/201] =?UTF-8?q?feat=E2=9C=A8=20:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=97=A0=E6=9D=83=E9=99=90log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/permission.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/middleware/permission.go b/app/admin/middleware/permission.go index 81d21684..8a5a138c 100644 --- a/app/admin/middleware/permission.go +++ b/app/admin/middleware/permission.go @@ -38,7 +38,7 @@ func AuthCheckRole() gin.HandlerFunc { log.Infof("msgID[%s] isTrue: %v role: %s method: %s path: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path) c.Next() } else { - log.Warnf("msgID[%s] isTrue: %v role: %s method: %s path: %s message: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path,"当前请求是没有接口权限的,请管理员确认!") + log.Warnf("msgID[%s] isTrue: %v role: %s method: %s path: %s message: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path,"当前request无权限,请管理员确认!") c.JSON(http.StatusOK, gin.H{ "code": 403, "msg": "对不起,您没有该接口访问权限,请联系管理员", From 677e54631a1212b19f2c5707f14776e8d63429ba Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Thu, 14 Jan 2021 22:41:49 +0800 Subject: [PATCH 072/201] =?UTF-8?q?perf=F0=9F=91=8C=20:=20=E6=A8=A1?= =?UTF-8?q?=E7=89=88=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v4/actions/router_check_role.go.template | 31 ++ .../actions/router_no_check_role.go.template | 30 ++ template/v4/dto.go.template | 123 +++++ template/v4/js.go.template | 47 ++ template/v4/model.go.template | 37 ++ template/v4/no_actions/apis.go.template | 189 +++++++ .../no_actions/router_check_role.go.template | 25 + .../router_no_check_role.go.template | 24 + template/v4/no_actions/service.go.template | 119 +++++ template/v4/vue.go.template | 470 ++++++++++++++++++ 10 files changed, 1095 insertions(+) create mode 100644 template/v4/actions/router_check_role.go.template create mode 100644 template/v4/actions/router_no_check_role.go.template create mode 100644 template/v4/dto.go.template create mode 100644 template/v4/js.go.template create mode 100644 template/v4/model.go.template create mode 100644 template/v4/no_actions/apis.go.template create mode 100644 template/v4/no_actions/router_check_role.go.template create mode 100644 template/v4/no_actions/router_no_check_role.go.template create mode 100644 template/v4/no_actions/service.go.template create mode 100644 template/v4/vue.go.template diff --git a/template/v4/actions/router_check_role.go.template b/template/v4/actions/router_check_role.go.template new file mode 100644 index 00000000..88451bd2 --- /dev/null +++ b/template/v4/actions/router_check_role.go.template @@ -0,0 +1,31 @@ +package router + +import ( + "github.com/gin-gonic/gin" + + "go-admin/app/admin/middleware" + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + "go-admin/common/actions" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, register{{.ClassName}}Router) +} + +// 需认证的路由代码 +func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + r := v1.Group("/{{.ModuleName}}").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + model := &models.{{.ClassName}}{} + r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.{{.ClassName}}Search), func() interface{} { + list := make([]models.{{.ClassName}}, 0) + return &list + })) + r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.{{.ClassName}}ById), nil)) + r.POST("", actions.CreateAction(new(dto.{{.ClassName}}Control))) + r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.{{.ClassName}}Control))) + r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.{{.ClassName}}ById))) + } +} diff --git a/template/v4/actions/router_no_check_role.go.template b/template/v4/actions/router_no_check_role.go.template new file mode 100644 index 00000000..c647266e --- /dev/null +++ b/template/v4/actions/router_no_check_role.go.template @@ -0,0 +1,30 @@ +package router + +import ( + "github.com/gin-gonic/gin" + + "go-admin/app/admin/middleware" + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + "go-admin/common/actions" +) + +func init() { + routerNoCheckRole = append(routerNoCheckRole, register{{.ClassName}}Router) +} + +// 无需认证的路由代码 +func register{{.ClassName}}Router(v1 *gin.RouterGroup) { + r := v1.Group("/{{.ModuleName}}") + { + model := &models.{{.ClassName}}{} + r.GET("", actions.IndexAction(model, new(dto.{{.ClassName}}Search), func() interface{} { + list := make([]models.{{.ClassName}}, 0) + return &list + })) + r.GET("/:id", actions.ViewAction(new(dto.{{.ClassName}}ById), nil)) + r.POST("", actions.CreateAction(new(dto.{{.ClassName}}Control))) + r.PUT("/:id", actions.UpdateAction(new(dto.{{.ClassName}}Control))) + r.DELETE("", actions.DeleteAction(new(dto.{{.ClassName}}ById))) + } +} diff --git a/template/v4/dto.go.template b/template/v4/dto.go.template new file mode 100644 index 00000000..c967c3b7 --- /dev/null +++ b/template/v4/dto.go.template @@ -0,0 +1,123 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "gorm.io/gorm" + + "go-admin/app/admin/models" + "go-admin/common/dto" + "go-admin/common/log" + "go-admin/tools" +) + +type {{.ClassName}}Search struct { + dto.Pagination `search:"-"` + {{ $tablename := .TBName -}} + {{ range .Columns -}} + {{$z := .IsQuery}} + {{- if ($z) -}} + {{.GoField}} {{.GoType}} `form:"{{.JsonField}}" search:"type:{{if eq .QueryType "EQ"}}exact{{ else if eq .QueryType "NE"}}iexact{{ else if eq .QueryType "LIKE"}}contains{{ else if eq .QueryType "GT"}}gt{{ else if eq .QueryType "GTE"}}gte{{ else if eq .QueryType "LT"}}lt{{ else if eq .QueryType "LTE"}}lte{{- end }};column:{{.ColumnName}};table:{{$tablename}}" comment:"{{.ColumnComment}}"` + + {{ end -}} + {{- end }} +} + +func (m *{{.ClassName}}Search) GetNeedSearch() interface{} { + return *m +} + +func (m *{{.ClassName}}Search) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +type {{.ClassName}}Control struct { + {{ range .Columns -}} + {{$x := .Pk}} + {{- if ($x) }} + {{.GoField}} {{.GoType}} `uri:"{{.JsonField}}" comment:"{{.ColumnComment}}"` // {{.ColumnComment}} + {{- else if eq .GoField "CreatedAt" -}} + {{- else if eq .GoField "UpdatedAt" -}} + {{- else if eq .GoField "DeletedAt" -}} + {{- else if eq .GoField "CreateBy" -}} + {{- else if eq .GoField "UpdateBy" -}} + + {{- else }} + + {{.GoField}} {{.GoType}} `json:"{{.JsonField}}" comment:"{{.ColumnComment}}"` + {{end -}} + {{- end }} +} + +func (s *{{.ClassName}}Control) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *{{.ClassName}}Control) Generate() (*models.{{.ClassName}}, error) { + return &models.{{.ClassName}}{ + {{ range .Columns -}} + {{$x := .Pk}} + {{- if ($x) }} + Model: gorm.Model{ID: s.ID}, + {{- else if eq .GoField "CreatedAt" -}} + {{- else if eq .GoField "UpdatedAt" -}} + {{- else if eq .GoField "DeletedAt" -}} + {{- else if eq .GoField "CreateBy" -}} + + + {{- else if eq .GoField "UpdateBy" -}} + {{- else }} + {{.GoField}}: s.{{.GoField}}, + {{- end }} + {{- end }} + }, nil +} + +func (s *{{.ClassName}}Control) GetId() interface{} { + return s.{{.PkGoField}} +} + +type {{.ClassName}}ById struct { + Id int `uri:"id"` + Ids []int `json:"ids"` +} + +func (s *{{.ClassName}}ById) GetId() interface{} { + if len(s.Ids) > 0 { + s.Ids = append(s.Ids, s.Id) + return s.Ids + } + return s.Id +} + +func (s *{{.ClassName}}ById) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *{{.ClassName}}ById) SetUpdateBy(id int) { + +} diff --git a/template/v4/js.go.template b/template/v4/js.go.template new file mode 100644 index 00000000..db3d4a27 --- /dev/null +++ b/template/v4/js.go.template @@ -0,0 +1,47 @@ +import request from '@/utils/request' + +// 查询{{.ClassName}}列表 +export function list{{.ClassName}}(query) { + return request({ + url: '/api/v1/{{.ModuleName}}', + method: 'get', + params: query + }) +} + +// 查询{{.ClassName}}详细 +export function get{{.ClassName}} ({{.PkJsonField}}) { + return request({ + url: '/api/v1/{{.ModuleName}}/' + {{.PkJsonField}}, + method: 'get' + }) +} + + +// 新增{{.ClassName}} +export function add{{.ClassName}}(data) { + return request({ + url: '/api/v1/{{.ModuleName}}', + method: 'post', + data: data + }) +} + +// 修改{{.ClassName}} +export function update{{.ClassName}}(data) { + return request({ + url: '/api/v1/{{.ModuleName}}/'+data.{{.PkJsonField}}, + method: 'put', + data: data + }) +} + +// 删除{{.ClassName}} +export function del{{.ClassName}}(data) { + return request({ + url: '/api/v1/{{.ModuleName}}', + method: 'delete', + data: data + }) +} + diff --git a/template/v4/model.go.template b/template/v4/model.go.template new file mode 100644 index 00000000..913fb1cb --- /dev/null +++ b/template/v4/model.go.template @@ -0,0 +1,37 @@ +package models + +import ( + "gorm.io/gorm" + + "go-admin/common/models" +) + +type {{.ClassName}} struct { + gorm.Model + models.ControlBy + {{ range .Columns -}} + {{$x := .Pk}} + {{- if ($x) }} + + {{- else if eq .GoField "CreatedAt" -}} + {{- else if eq .GoField "UpdatedAt" -}} + {{- else if eq .GoField "DeletedAt" -}} + {{- else if eq .GoField "CreateBy" -}} + {{- else if eq .GoField "UpdateBy" -}} + {{- else }} + {{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};comment:{{- if eq .ColumnComment "" -}}{{.GoField}}{{- else -}}{{.ColumnComment}}{{end -}}"` {{end -}} + {{- end }} +} + +func ({{.ClassName}}) TableName() string { + return "{{.TBName}}" +} + +func (e *{{.ClassName}}) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *{{.ClassName}}) GetId() interface{} { + return e.{{.PkGoField}} +} diff --git a/template/v4/no_actions/apis.go.template b/template/v4/no_actions/apis.go.template new file mode 100644 index 00000000..60beaf05 --- /dev/null +++ b/template/v4/no_actions/apis.go.template @@ -0,0 +1,189 @@ +package {{.ModuleName}} + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/service" + "net/http" + + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + "go-admin/common/actions" + "go-admin/common/apis" + "go-admin/common/log" + "go-admin/tools" +) + +type {{.ClassName}} struct { + apis.Api +} + +func (e *{{.ClassName}}) Get{{.ClassName}}List(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.{{.ClassName}}Search) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + //查询列表 + err = d.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + //数据权限检查 + p := actions.GetPermissionFromContext(c) + + list := make([]models.{{.ClassName}}, 0) + var count int64 + serviceStudent := service.{{.ClassName}}{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + err = serviceStudent.Get{{.ClassName}}Page(d, p, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") +} + +func (e *{{.ClassName}}) Get{{.ClassName}}(c *gin.Context) { + control := new(dto.{{.ClassName}}ById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object models.{{.ClassName}} + + //数据权限检查 + p := actions.GetPermissionFromContext(c) + + service{{.ClassName}} := service.{{.ClassName}}{} + service{{.ClassName}}.MsgID = msgID + service{{.ClassName}}.Orm = db + err = service{{.ClassName}}.Get{{.ClassName}}(control, p, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) { + control := new(dto.{{.ClassName}}Control) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserId(c)) + + service{{.ClassName}} := service.{{.ClassName}}{} + service{{.ClassName}}.Orm = db + service{{.ClassName}}.MsgID = msgID + err = service{{.ClassName}}.Insert{{.ClassName}}(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) { + control := new(dto.{{.ClassName}}Control) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //更新操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.SetUpdateBy(tools.GetUserId(c)) + + //数据权限检查 + p := actions.GetPermissionFromContext(c) + + service{{.ClassName}} := service.{{.ClassName}}{} + service{{.ClassName}}.Orm = db + service{{.ClassName}}.MsgID = msgID + err = service{{.ClassName}}.Update{{.ClassName}}(object, p) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *{{.ClassName}}) Delete{{.ClassName}}(c *gin.Context) { + control := new(dto.{{.ClassName}}ById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + err = control.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + // 设置编辑人 + control.SetUpdateBy(tools.GetUserId(c)) + + // 数据权限检查 + p := actions.GetPermissionFromContext(c) + + service{{.ClassName}} := service.{{.ClassName}}{} + service{{.ClassName}}.Orm = db + service{{.ClassName}}.MsgID = msgID + err = service{{.ClassName}}.Remove{{.ClassName}}(control, p) + if err != nil { + log.Error(err) + return + } + e.OK(c, control.GetId(), "删除成功") +} diff --git a/template/v4/no_actions/router_check_role.go.template b/template/v4/no_actions/router_check_role.go.template new file mode 100644 index 00000000..6caf11cc --- /dev/null +++ b/template/v4/no_actions/router_check_role.go.template @@ -0,0 +1,25 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/{{.ModuleName}}" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, register{{.ClassName}}Router) +} + +// 需认证的路由代码 +func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &{{.ModuleName}}.{{.ClassName}}{} + r := v1.Group("/{{.ModuleName}}").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.Get{{.ClassName}}List) + r.GET("/:id", api.Get{{.ClassName}}) + r.POST("", api.Insert{{.ClassName}}) + r.PUT("/:id", api.Update{{.ClassName}}) + r.DELETE("", api.Delete{{.ClassName}}) + } +} diff --git a/template/v4/no_actions/router_no_check_role.go.template b/template/v4/no_actions/router_no_check_role.go.template new file mode 100644 index 00000000..c74691e0 --- /dev/null +++ b/template/v4/no_actions/router_no_check_role.go.template @@ -0,0 +1,24 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/{{.ModuleName}}" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, register{{.ClassName}}Router) +} + +// 需认证的路由代码 +func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &{{.ModuleName}}.{{.ClassName}}{} + r := v1.Group("/{{.ModuleName}}").Use(authMiddleware.MiddlewareFunc()) + { + r.GET("", api.Get{{.ClassName}}List) + r.GET("/:id", api.Get{{.ClassName}}) + r.POST("", api.Insert{{.ClassName}}) + r.PUT("/:id", api.Update{{.ClassName}}) + r.DELETE("", api.Delete{{.ClassName}}) + } +} diff --git a/template/v4/no_actions/service.go.template b/template/v4/no_actions/service.go.template new file mode 100644 index 00000000..e0ac9bd3 --- /dev/null +++ b/template/v4/no_actions/service.go.template @@ -0,0 +1,119 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models" + "go-admin/common/actions" + cDto "go-admin/common/dto" + "go-admin/common/log" + "go-admin/app/admin/service/dto" + "go-admin/common/service" + "gorm.io/gorm" +) + +type {{.ClassName}} struct { + service.Service +} + +// Get{{.ClassName}}Page 获取{{.ClassName}}列表 +func (e *{{.ClassName}}) Get{{.ClassName}}Page(c *dto.{{.ClassName}}Search, p *actions.DataPermission, list *[]models.{{.ClassName}}, count *int64) error { + var err error + var data models.{{.ClassName}} + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + actions.Permission(data.TableName(), p), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Get{{.ClassName}} 获取{{.ClassName}}对象 +func (e *{{.ClassName}}) Get{{.ClassName}}(d *dto.{{.ClassName}}ById, p *actions.DataPermission, model *models.{{.ClassName}}) error { + var err error + var data models.{{.ClassName}} + msgID := e.MsgID + + db := e.Orm.Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Insert{{.ClassName}} 创建{{.ClassName}}对象 +func (e *{{.ClassName}}) Insert{{.ClassName}}(model *models.{{.ClassName}}) error { + var err error + var data models.{{.ClassName}} + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Update{{.ClassName}} 修改{{.ClassName}}对象 +func (e *{{.ClassName}}) Update{{.ClassName}}(c *models.{{.ClassName}}, p *actions.DataPermission) error { + var err error + var data models.{{.ClassName}} + msgID := e.MsgID + + db := e.Orm.Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ).Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// Remove{{.ClassName}} 删除{{.ClassName}} +func (e *{{.ClassName}}) Remove{{.ClassName}}(d *dto.{{.ClassName}}ById, p *actions.DataPermission) error { + var err error + var data models.{{.ClassName}} + msgID := e.MsgID + + db := e.Orm.Model(&data). + Scopes( + actions.Permission(data.TableName(), p), + ).Delete(&data, d.GetId()) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} \ No newline at end of file diff --git a/template/v4/vue.go.template b/template/v4/vue.go.template new file mode 100644 index 00000000..b479b09a --- /dev/null +++ b/template/v4/vue.go.template @@ -0,0 +1,470 @@ +{{$tableComment:=.TableComment}} + + + From 8a3659d949f7dbd96bb78fc70b2a6d042ec0056b Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sat, 16 Jan 2021 15:05:12 +0800 Subject: [PATCH 073/201] =?UTF-8?q?perf=F0=9F=91=8C=20:=20=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E5=92=8C=E8=8F=9C=E5=8D=95=E5=8A=9F=E8=83=BD=E6=94=B9?= =?UTF-8?q?=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/dept.go | 14 +- app/admin/apis/system/sys_dept/sys_dept.go | 174 ++++++++++++ app/admin/apis/system/sysuser.go | 2 +- app/admin/models/dept.go | 48 ++-- app/admin/models/sys_dept.go | 33 +++ app/admin/models/sys_meun.go | 64 +++++ app/admin/service/dto/sys_dept.go | 131 +++++++++ app/admin/service/dto/sys_menu.go | 150 +++++++++++ app/admin/service/sys_dept.go | 164 ++++++++++++ app/admin/service/sys_menu.go | 249 ++++++++++++++++++ .../version/1599190683670_migrate.go | 10 +- 11 files changed, 1002 insertions(+), 37 deletions(-) create mode 100644 app/admin/apis/system/sys_dept/sys_dept.go create mode 100644 app/admin/models/sys_dept.go create mode 100644 app/admin/models/sys_meun.go create mode 100644 app/admin/service/dto/sys_dept.go create mode 100644 app/admin/service/dto/sys_menu.go create mode 100644 app/admin/service/sys_dept.go create mode 100644 app/admin/service/sys_menu.go diff --git a/app/admin/apis/system/dept.go b/app/admin/apis/system/dept.go index fb33bfae..d3c2f10c 100644 --- a/app/admin/apis/system/dept.go +++ b/app/admin/apis/system/dept.go @@ -20,7 +20,7 @@ import ( // @Router /api/v1/deptList [get] // @Security Bearer func GetDeptList(c *gin.Context) { - var Dept models.SysDept + var Dept models.SysDepts Dept.DeptName = c.Request.FormValue("deptName") Dept.Status = c.Request.FormValue("status") Dept.DeptId, _ = tools.StringToInt(c.Request.FormValue("deptId")) @@ -31,7 +31,7 @@ func GetDeptList(c *gin.Context) { } func GetDeptTree(c *gin.Context) { - var Dept models.SysDept + var Dept models.SysDepts Dept.DeptName = c.Request.FormValue("deptName") Dept.Status = c.Request.FormValue("status") Dept.DeptId, _ = tools.StringToInt(c.Request.FormValue("deptId")) @@ -49,7 +49,7 @@ func GetDeptTree(c *gin.Context) { // @Router /api/v1/dept/{deptId} [get] // @Security Bearer func GetDept(c *gin.Context) { - var Dept models.SysDept + var Dept models.SysDepts Dept.DeptId, _ = tools.StringToInt(c.Param("deptId")) Dept.DataScope = tools.GetUserIdStr(c) result, err := Dept.Get() @@ -68,7 +68,7 @@ func GetDept(c *gin.Context) { // @Router /api/v1/dept [post] // @Security Bearer func InsertDept(c *gin.Context) { - var data models.SysDept + var data models.SysDepts err := c.BindWith(&data, binding.JSON) tools.HasError(err, "", 500) data.CreateBy = tools.GetUserIdStr(c) @@ -89,7 +89,7 @@ func InsertDept(c *gin.Context) { // @Router /api/v1/dept [put] // @Security Bearer func UpdateDept(c *gin.Context) { - var data models.SysDept + var data models.SysDepts err := c.BindJSON(&data) tools.HasError(err, "", -1) data.UpdateBy = tools.GetUserIdStr(c) @@ -106,7 +106,7 @@ func UpdateDept(c *gin.Context) { // @Success 200 {string} string "{"code": -1, "message": "删除失败"}" // @Router /api/v1/dept/{id} [delete] func DeleteDept(c *gin.Context) { - var data models.SysDept + var data models.SysDepts id, err := tools.StringToInt(c.Param("id")) _, err = data.Delete(id) tools.HasError(err, "删除失败", 500) @@ -114,7 +114,7 @@ func DeleteDept(c *gin.Context) { } func GetDeptTreeRoleselect(c *gin.Context) { - var Dept models.SysDept + var Dept models.SysDepts var SysRole models.SysRole id, err := tools.StringToInt(c.Param("roleId")) SysRole.RoleId = id diff --git a/app/admin/apis/system/sys_dept/sys_dept.go b/app/admin/apis/system/sys_dept/sys_dept.go new file mode 100644 index 00000000..2e2b3602 --- /dev/null +++ b/app/admin/apis/system/sys_dept/sys_dept.go @@ -0,0 +1,174 @@ +package sys_dept + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/models" + + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + "go-admin/tools" + + "net/http" +) + +type SysDept struct { + apis.Api +} + +func (e *SysDept) GetSysDeptList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysDeptSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + //查询列表 + err = d.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]models.SysDept, 0) + var count int64 + serviceStudent := service.SysDept{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + err = serviceStudent.GetSysDeptPage(d, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") +} + +func (e *SysDept) GetSysDept(c *gin.Context) { + control := new(dto.SysDeptById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object models.SysDept + + serviceSysOperlog := service.SysDept{} + serviceSysOperlog.MsgID = msgID + serviceSysOperlog.Orm = db + err = serviceSysOperlog.GetSysDept(control, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysDept) InsertSysDept(c *gin.Context) { + control := new(dto.SysDeptControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserId(c)) + + serviceSysDept := service.SysDept{} + serviceSysDept.Orm = db + serviceSysDept.MsgID = msgID + err = serviceSysDept.InsertSysDept(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysDept) UpdateSysDept(c *gin.Context) { + control := new(dto.SysDeptControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //更新操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.SetUpdateBy(tools.GetUserId(c)) + + serviceSysDept := service.SysDept{} + serviceSysDept.Orm = db + serviceSysDept.MsgID = msgID + err = serviceSysDept.UpdateSysDept(object) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysDept) DeleteSysDept(c *gin.Context) { + control := new(dto.SysDeptById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + err = control.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + serviceSysDept := service.SysDept{} + serviceSysDept.Orm = db + serviceSysDept.MsgID = msgID + err = serviceSysDept.RemoveSysDept(control) + if err != nil { + log.Error(err) + return + } + e.OK(c, control.GetId(), "删除成功") +} diff --git a/app/admin/apis/system/sysuser.go b/app/admin/apis/system/sysuser.go index 9748ef5b..c9cf2298 100644 --- a/app/admin/apis/system/sysuser.go +++ b/app/admin/apis/system/sysuser.go @@ -98,7 +98,7 @@ func GetSysUserProfile(c *gin.Context) { tools.HasError(err, "抱歉未找到相关信息", -1) var SysRole models.SysRole var Post models.Post - var Dept models.SysDept + var Dept models.SysDepts //获取角色列表 roles, err := SysRole.GetList() //获取职位列表 diff --git a/app/admin/models/dept.go b/app/admin/models/dept.go index cb756989..8e31d7ca 100644 --- a/app/admin/models/dept.go +++ b/app/admin/models/dept.go @@ -8,7 +8,7 @@ import ( "go-admin/tools" ) -type SysDept struct { +type SysDepts struct { DeptId int `json:"deptId" gorm:"primary_key;auto_increment;"` //部门编码 ParentId int `json:"parentId" gorm:""` //上级部门 DeptPath string `json:"deptPath" gorm:"size:255;"` // @@ -24,10 +24,10 @@ type SysDept struct { DataScope string `json:"dataScope" gorm:"-"` Params string `json:"params" gorm:"-"` - Children []SysDept `json:"children" gorm:"-"` + Children []SysDepts `json:"children" gorm:"-"` } -func (SysDept) TableName() string { +func (SysDepts) TableName() string { return "sys_dept" } @@ -37,8 +37,8 @@ type DeptLable struct { Children []DeptLable `gorm:"-" json:"children"` } -func (e *SysDept) Create() (SysDept, error) { - var doc SysDept +func (e *SysDepts) Create() (SysDepts, error) { + var doc SysDepts result := orm.Eloquent.Table(e.TableName()).Create(&e) if result.Error != nil { err := result.Error @@ -46,7 +46,7 @@ func (e *SysDept) Create() (SysDept, error) { } deptPath := "/" + tools.IntToString(e.DeptId) if int(e.ParentId) != 0 { - var deptP SysDept + var deptP SysDepts orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", e.ParentId).First(&deptP) deptPath = deptP.DeptPath + deptPath } else { @@ -63,8 +63,8 @@ func (e *SysDept) Create() (SysDept, error) { return doc, nil } -func (e *SysDept) Get() (SysDept, error) { - var doc SysDept +func (e *SysDepts) Get() (SysDepts, error) { + var doc SysDepts table := orm.Eloquent.Table(e.TableName()) if e.DeptId != 0 { @@ -80,8 +80,8 @@ func (e *SysDept) Get() (SysDept, error) { return doc, nil } -func (e *SysDept) GetList() ([]SysDept, error) { - var doc []SysDept +func (e *SysDepts) GetList() ([]SysDepts, error) { + var doc []SysDepts table := orm.Eloquent.Table(e.TableName()) if e.DeptId != 0 { @@ -100,8 +100,8 @@ func (e *SysDept) GetList() ([]SysDept, error) { return doc, nil } -func (e *SysDept) GetPage(bl bool) ([]SysDept, error) { - var doc []SysDept +func (e *SysDepts) GetPage(bl bool) ([]SysDepts, error) { + var doc []SysDepts table := orm.Eloquent.Table(e.TableName()) if e.DeptId != 0 { @@ -133,10 +133,10 @@ func (e *SysDept) GetPage(bl bool) ([]SysDept, error) { return doc, nil } -func (e *SysDept) SetDept(bl bool) ([]SysDept, error) { +func (e *SysDepts) SetDept(bl bool) ([]SysDepts, error) { list, err := e.GetPage(bl) - m := make([]SysDept, 0) + m := make([]SysDepts, 0) for i := 0; i < len(list); i++ { if list[i].ParentId != 0 { continue @@ -148,16 +148,16 @@ func (e *SysDept) SetDept(bl bool) ([]SysDept, error) { return m, err } -func Digui(deptlist *[]SysDept, menu SysDept) SysDept { +func Digui(deptlist *[]SysDepts, menu SysDepts) SysDepts { list := *deptlist - min := make([]SysDept, 0) + min := make([]SysDepts, 0) for j := 0; j < len(list); j++ { if menu.DeptId != list[j].ParentId { continue } - mi := SysDept{} + mi := SysDepts{} mi.DeptId = list[j].DeptId mi.ParentId = list[j].ParentId mi.DeptPath = list[j].DeptPath @@ -168,7 +168,7 @@ func Digui(deptlist *[]SysDept, menu SysDept) SysDept { mi.Email = list[j].Email mi.Status = list[j].Status mi.CreatedAt = list[j].CreatedAt - mi.Children = []SysDept{} + mi.Children = []SysDepts{} ms := Digui(deptlist, mi) min = append(min, ms) @@ -177,14 +177,14 @@ func Digui(deptlist *[]SysDept, menu SysDept) SysDept { return menu } -func (e *SysDept) Update(id int) (update SysDept, err error) { +func (e *SysDepts) Update(id int) (update SysDepts, err error) { if err = orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", id).First(&update).Error; err != nil { return } deptPath := "/" + tools.IntToString(e.DeptId) if int(e.ParentId) != 0 { - var deptP SysDept + var deptP SysDepts orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", e.ParentId).First(&deptP) deptPath = deptP.DeptPath + deptPath } else { @@ -206,7 +206,7 @@ func (e *SysDept) Update(id int) (update SysDept, err error) { return } -func (e *SysDept) Delete(id int) (success bool, err error) { +func (e *SysDepts) Delete(id int) (success bool, err error) { user := SysUser{} user.DeptId = id @@ -226,7 +226,7 @@ func (e *SysDept) Delete(id int) (success bool, err error) { return } - if err = tx.Table(e.TableName()).Where("dept_id = ?", id).Delete(&SysDept{}).Error; err != nil { + if err = tx.Table(e.TableName()).Where("dept_id = ?", id).Delete(&SysDepts{}).Error; err != nil { success = false tx.Rollback() return @@ -240,7 +240,7 @@ func (e *SysDept) Delete(id int) (success bool, err error) { return } -func (dept *SysDept) SetDeptLable() (m []DeptLable, err error) { +func (dept *SysDepts) SetDeptLable() (m []DeptLable, err error) { deptlist, err := dept.GetList() m = make([]DeptLable, 0) @@ -258,7 +258,7 @@ func (dept *SysDept) SetDeptLable() (m []DeptLable, err error) { return } -func DiguiDeptLable(deptlist *[]SysDept, dept DeptLable) DeptLable { +func DiguiDeptLable(deptlist *[]SysDepts, dept DeptLable) DeptLable { list := *deptlist min := make([]DeptLable, 0) diff --git a/app/admin/models/sys_dept.go b/app/admin/models/sys_dept.go new file mode 100644 index 00000000..fbd2f2d3 --- /dev/null +++ b/app/admin/models/sys_dept.go @@ -0,0 +1,33 @@ +package models + +import "go-admin/common/models" + +type SysDept struct { + DeptId int `json:"deptId" gorm:"primary_key;auto_increment;"` //部门编码 + ParentId int `json:"parentId" gorm:""` //上级部门 + DeptPath string `json:"deptPath" gorm:"size:255;"` // + DeptName string `json:"deptName" gorm:"size:128;"` //部门名称 + Sort int `json:"sort" gorm:""` //排序 + Leader string `json:"leader" gorm:"size:128;"` //负责人 + Phone string `json:"phone" gorm:"size:11;"` //手机 + Email string `json:"email" gorm:"size:64;"` //邮箱 + Status string `json:"status" gorm:"size:4;"` //状态 + models.ControlBy + models.ModelTime + DataScope string `json:"dataScope" gorm:"-"` + Params string `json:"params" gorm:"-"` + Children []SysDept `json:"children" gorm:"-"` +} + +func (SysDept) TableName() string { + return "sys_dept" +} + +func (e *SysDept) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysDept) GetId() interface{} { + return e.DeptId +} diff --git a/app/admin/models/sys_meun.go b/app/admin/models/sys_meun.go new file mode 100644 index 00000000..8adeca4c --- /dev/null +++ b/app/admin/models/sys_meun.go @@ -0,0 +1,64 @@ +package models + +import "go-admin/common/models" + +type SysMenu struct { + MenuId int `json:"menuId" gorm:"primary_key;AUTO_INCREMENT"` + MenuName string `json:"menuName" gorm:"size:128;"` + Title string `json:"title" gorm:"size:128;"` + Icon string `json:"icon" gorm:"size:128;"` + Path string `json:"path" gorm:"size:128;"` + Paths string `json:"paths" gorm:"size:128;"` + MenuType string `json:"menuType" gorm:"size:1;"` + Action string `json:"action" gorm:"size:16;"` + Permission string `json:"permission" gorm:"size:255;"` + ParentId int `json:"parentId" gorm:"size:11;"` + NoCache bool `json:"noCache" gorm:"size:8;"` + Breadcrumb string `json:"breadcrumb" gorm:"size:255;"` + Component string `json:"component" gorm:"size:255;"` + Sort int `json:"sort" gorm:"size:4;"` + Visible string `json:"visible" gorm:"size:1;"` + IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"` + models.ControlBy + models.ModelTime + DataScope string `json:"dataScope" gorm:"-"` + Params string `json:"params" gorm:"-"` + RoleId int `gorm:"-"` + Children []SysMenu `json:"children" gorm:"-"` + IsSelect bool `json:"is_select" gorm:"-"` +} + +type SysMenus struct { + MenuId int `json:"menuId" gorm:"column:menu_id;primary_key;"` + MenuName string `json:"menuName" gorm:"column:menu_name"` + Title string `json:"title" gorm:"column:title"` + Icon string `json:"icon" gorm:"column:icon"` + Path string `json:"path" gorm:"column:path"` + MenuType string `json:"menuType" gorm:"column:menu_type"` + Action string `json:"action" gorm:"column:action"` + Permission string `json:"permission" gorm:"column:permission"` + ParentId int `json:"parentId" gorm:"column:parent_id"` + NoCache bool `json:"noCache" gorm:"column:no_cache"` + Breadcrumb string `json:"breadcrumb" gorm:"column:breadcrumb"` + Component string `json:"component" gorm:"column:component"` + Sort int `json:"sort" gorm:"column:sort"` + Visible string `json:"visible" gorm:"column:visible"` + Children []SysMenu `json:"children" gorm:"-"` + models.ControlBy + models.ModelTime + DataScope string `json:"dataScope" gorm:"-"` + Params string `json:"params" gorm:"-"` +} + +func (SysMenu) TableName() string { + return "sys_menu" +} + +func (e *SysMenu) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysMenu) GetId() interface{} { + return e.MenuId +} diff --git a/app/admin/service/dto/sys_dept.go b/app/admin/service/dto/sys_dept.go new file mode 100644 index 00000000..1d48de80 --- /dev/null +++ b/app/admin/service/dto/sys_dept.go @@ -0,0 +1,131 @@ +package dto + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" + "go-admin/app/admin/models" + "go-admin/common/dto" + "go-admin/common/log" + "go-admin/tools" +) + +// SysConfigSearch 列表或者搜索使用结构体 +type SysDeptSearch struct { + dto.Pagination `search:"-"` + ParentId int `form:"parentId" search:"type:exact;column:parent_id;table:sys_dept" comment:"上级部门"` //上级部门 + DeptPath string `form:"deptPath" search:"type:exact;column:dept_path;table:sys_dept" comment:""` //路径 + DeptName string `form:"deptName" search:"type:exact;column:dept_name;table:sys_dept" comment:"部门名称"` //部门名称 + Sort int `form:"sort" search:"type:exact;column:sort;table:sys_dept" comment:"排序"` //排序 + Leader string `form:"leader" search:"type:exact;column:leader;table:sys_dept" comment:"负责人"` //负责人 + Phone string `form:"phone" search:"type:exact;column:phone;table:sys_dept" comment:"手机"` //手机 + Email string `form:"email" search:"type:exact;column:email;table:sys_dept" comment:"邮箱"` //邮箱 + Status string `form:"status" search:"type:exact;column:status;table:sys_dept" comment:"状态"` //状态 +} + +func (m *SysDeptSearch) GetNeedSearch() interface{} { + return *m +} + +// Bind 映射上下文中的结构体数据 +func (m *SysDeptSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +// SysConfigControl 增、改使用的结构体 +type SysDeptControl struct { + DeptId int `uri:"id" comment:"编码"` // 编码 + ParentId int `form:"parentId" comment:"上级部门"` //上级部门 + DeptPath string `form:"deptPath" comment:""` //路径 + DeptName string `form:"deptName" comment:"部门名称"` //部门名称 + Sort int `form:"sort" comment:"排序"` //排序 + Leader string `form:"leader" comment:"负责人"` //负责人 + Phone string `form:"phone" comment:"手机"` //手机 + Email string `form:"email" comment:"邮箱"` //邮箱 + Status string `form:"status" comment:"状态"` //状态 +} + +// Bind 映射上下文中的结构体数据 +func (s *SysDeptControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBindBodyWith(s, binding.JSON) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + var jsonStr []byte + jsonStr, err = json.Marshal(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + ctx.Set("body", string(jsonStr)) + return err +} + +// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型 +func (s *SysDeptControl) Generate() (*models.SysDept, error) { + return &models.SysDept{ + DeptId: s.DeptId, + DeptName: s.DeptName, + ParentId: s.ParentId, + DeptPath: s.DeptPath, + Sort: s.Sort, + Leader: s.Leader, + Phone: s.Phone, + Email: s.Email, + Status: s.Status, + }, nil +} + +// GetId 获取数据对应的ID +func (s *SysDeptControl) GetId() interface{} { + return s.DeptId +} + +// SysConfigById 获取单个或者删除的结构体 +type SysDeptById struct { + Id int `uri:"id"` + Ids []int `json:"ids"` +} + +func (s *SysDeptById) Generate() *SysDeptById { + cp := *s + return &cp +} + +func (s *SysDeptById) GetId() interface{} { + return s.Id +} + +func (s *SysDeptById) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysDeptById) GenerateM() (*models.SysDept, error) { + return &models.SysDept{}, nil +} + +type DeptLabel struct { + Id int `gorm:"-" json:"id"` + Label string `gorm:"-" json:"label"` + Children []DeptLabel `gorm:"-" json:"children"` +} \ No newline at end of file diff --git a/app/admin/service/dto/sys_menu.go b/app/admin/service/dto/sys_menu.go new file mode 100644 index 00000000..46e5cd89 --- /dev/null +++ b/app/admin/service/dto/sys_menu.go @@ -0,0 +1,150 @@ +package dto + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" + "go-admin/app/admin/models" + "go-admin/common/dto" + "go-admin/common/log" + "go-admin/tools" +) + +// SysMenuSearch 列表或者搜索使用结构体 +type SysMenuSearch struct { + dto.Pagination `search:"-"` + ParentId int `form:"parentId" search:"type:exact;column:parent_id;table:sys_dept" comment:"上级部门"` //上级部门 + DeptPath string `form:"deptPath" search:"type:exact;column:dept_path;table:sys_dept" comment:""` //路径 + DeptName string `form:"deptName" search:"type:exact;column:dept_name;table:sys_dept" comment:"部门名称"` //部门名称 + Sort int `form:"sort" search:"type:exact;column:sort;table:sys_dept" comment:"排序"` //排序 + Leader string `form:"leader" search:"type:exact;column:leader;table:sys_dept" comment:"负责人"` //负责人 + Phone string `form:"phone" search:"type:exact;column:phone;table:sys_dept" comment:"手机"` //手机 + Email string `form:"email" search:"type:exact;column:email;table:sys_dept" comment:"邮箱"` //邮箱 + Status string `form:"status" search:"type:exact;column:status;table:sys_dept" comment:"状态"` //状态 +} + +func (m *SysMenuSearch) GetNeedSearch() interface{} { + return *m +} + +// Bind 映射上下文中的结构体数据 +func (m *SysMenuSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +// SysConfigControl 增、改使用的结构体 +type SysMenuControl struct { + MenuId int `uri:"id" comment:"编码"` // 编码 + MenuName string `form:"menuName" comment:"菜单name"` //菜单name + Title string `form:"title" comment:"显示名称"` //显示名称 + Icon string `form:"icon" comment:"图标"` //图标 + Path string `form:"path" comment:"路径"` //路径 + Paths string `form:"paths" comment:"id路径"` //id路径 + MenuType string `form:"menuType" comment:"菜单类型"` //菜单类型 + Action string `form:"action" comment:"请求方式"` //请求方式 + Permission string `form:"permission" comment:"权限编码"` //权限编码 + ParentId int `form:"parentId" comment:"上级菜单"` //上级菜单 + NoCache bool `form:"noCache" comment:"是否缓存"` //是否缓存 + Breadcrumb string `form:"breadcrumb" comment:"是否面包屑"` //是否面包屑 + Component string `form:"component" comment:"组件"` //组件 + Sort int `form:"sort" comment:"排序"` //排序 + Visible string `form:"visible" comment:"是否显示"` //是否显示 + IsFrame string `form:"isFrame" comment:"是否frame"` //是否frame +} + +// Bind 映射上下文中的结构体数据 +func (s *SysMenuControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBindBodyWith(s, binding.JSON) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + var jsonStr []byte + jsonStr, err = json.Marshal(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + ctx.Set("body", string(jsonStr)) + return err +} + +// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型 +func (s *SysMenuControl) Generate() (*models.SysMenu, error) { + return &models.SysMenu{ + MenuId: s.MenuId, + MenuName: s.MenuName, + Title: s.Title, + Icon: s.Icon, + Path: s.Path, + Paths: s.Paths, + MenuType: s.MenuType, + Action: s.Action, + Permission: s.Permission, + ParentId: s.ParentId, + NoCache: s.NoCache, + Breadcrumb: s.Breadcrumb, + Component: s.Component, + Sort: s.Sort, + Visible: s.Visible, + IsFrame: s.IsFrame, + }, nil +} + +// GetId 获取数据对应的ID +func (s *SysMenuControl) GetId() interface{} { + return s.MenuId +} + +// SysConfigById 获取单个或者删除的结构体 +type SysMenuById struct { + Id int `uri:"id"` + Ids []int `json:"ids"` +} + +func (s *SysMenuById) Generate() *SysMenuById { + cp := *s + return &cp +} + +func (s *SysMenuById) GetId() interface{} { + return s.Id +} + +func (s *SysMenuById) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysMenuById) GenerateM() (*models.SysMenu, error) { + return &models.SysMenu{}, nil +} + +type MenuLabel struct { + Id int `json:"id" gorm:"-"` + Label string `json:"label" gorm:"-"` + Children []MenuLabel `json:"children" gorm:"-"` +} + +type MenuRole struct { + models.SysMenus + IsSelect bool `json:"is_select" gorm:"-"` +} diff --git a/app/admin/service/sys_dept.go b/app/admin/service/sys_dept.go new file mode 100644 index 00000000..7cf85b16 --- /dev/null +++ b/app/admin/service/sys_dept.go @@ -0,0 +1,164 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + cDto "go-admin/common/dto" + "go-admin/common/log" + "go-admin/common/service" + "gorm.io/gorm" +) + +type SysDept struct { + service.Service +} + +// GetSysDeptPage 获取SysDept列表 +func (e *SysDept) GetSysDeptPage(c *dto.SysDeptSearch, list *[]models.SysDept, count *int64) error { + var err error + var data models.SysDept + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysDept 获取SysDept对象 +func (e *SysDept) GetSysDept(d *dto.SysDeptById, model *models.SysDept) error { + var err error + var data models.SysDept + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysDept 创建SysDept对象 +func (e *SysDept) InsertSysDept(model *models.SysDept) error { + var err error + var data models.SysDept + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// UpdateSysDept 修改SysDept对象 +func (e *SysDept) UpdateSysDept(c *models.SysDept) error { + var err error + var data models.SysDept + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysDept 删除SysDept +func (e *SysDept) RemoveSysDept(d *dto.SysDeptById) error { + var err error + var data models.SysDept + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(d.GetId()).Delete(&data) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} + +// GetSysDeptList 获取组织数据 +func (e *SysDept) GetSysDeptList(c *dto.SysDeptSearch, list *[]models.SysDept) error { + var err error + var data models.SysDept + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + ). + Find(list).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// SetDeptTree 设置组织数据 +func (e *SysDept) SetDeptTree() (c *dto.SysDeptSearch, m []dto.DeptLabel, err error) { + var list []models.SysDept + err = e.GetSysDeptList(c, &list) + + m = make([]dto.DeptLabel, 0) + for i := 0; i < len(list); i++ { + if list[i].ParentId != 0 { + continue + } + e := dto.DeptLabel{} + e.Id = list[i].DeptId + e.Label = list[i].DeptName + deptsInfo := DeptCall(&list, e) + + m = append(m, deptsInfo) + } + return +} + +// Call 递归构造组织数据 +func DeptCall(deptlist *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabel { + list := *deptlist + min := make([]dto.DeptLabel, 0) + for j := 0; j < len(list); j++ { + if dept.Id != list[j].ParentId { + continue + } + mi := dto.DeptLabel{Id: list[j].DeptId, Label: list[j].DeptName, Children: []dto.DeptLabel{}} + ms := DeptCall(deptlist, mi) + min = append(min, ms) + } + dept.Children = min + return dept +} diff --git a/app/admin/service/sys_menu.go b/app/admin/service/sys_menu.go new file mode 100644 index 00000000..f833bd41 --- /dev/null +++ b/app/admin/service/sys_menu.go @@ -0,0 +1,249 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models" + "go-admin/app/admin/service/dto" + cDto "go-admin/common/dto" + "go-admin/common/log" + "go-admin/common/service" + "go-admin/tools" + "gorm.io/gorm" +) + +type SysMenu struct { + service.Service +} + +// GetSysMenuPage 获取SysMenu列表 +func (e *SysMenu) getSysMenuPage(c *dto.SysMenuSearch, list *[]models.SysMenu) error { + var err error + var data models.SysMenu + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + ). + Find(list).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysMenu 获取SysMenu对象 +func (e *SysMenu) GetSysMenu(d *dto.SysMenuById, model *models.SysMenu) error { + var err error + var data models.SysMenu + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysMenu 创建SysMenu对象 +func (e *SysMenu) InsertSysMenu(model *models.SysMenu) error { + var err error + var data models.SysMenu + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +func (e *SysMenu) initPaths(menu *models.SysMenu) error { + var err error + var data models.SysMenu + parentMenu := new(models.SysMenu) + if int(menu.ParentId) != 0 { + e.Orm.Model(&data).First(parentMenu, menu.ParentId) + if parentMenu.Paths == "" { + err = errors.New("父级paths异常,请尝试对当前节点父级菜单进行更新操作!") + return err + } + menu.Paths = parentMenu.Paths + "/" + tools.IntToString(menu.MenuId) + } else { + menu.Paths = "/0/" + tools.IntToString(menu.MenuId) + } + e.Orm.Model(&data).Where("menu_id = ?", menu.MenuId).Update("paths", menu.Paths) + return err +} + +// UpdateSysMenu 修改SysMenu对象 +func (e *SysMenu) UpdateSysMenu(c *models.SysMenu) error { + var err error + var data models.SysMenu + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysMenu 删除SysMenu +func (e *SysMenu) RemoveSysMenu(d *dto.SysMenuById) error { + var err error + var data models.SysMenu + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(d.GetId()).Delete(&data) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} + +// GetSysMenuList 获取菜单数据 +func (e *SysMenu) GetSysMenuList(c *dto.SysMenuSearch, list *[]models.SysMenu) error { + var err error + var data models.SysMenu + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + ). + Find(list).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// SetSysMenuTree 设置菜单数据 +func (e *SysMenu) SetSysMenuTree() (c *dto.SysMenuSearch, m []dto.MenuLabel, err error) { + var list []models.SysMenu + err = e.GetSysMenuList(c, &list) + + m = make([]dto.MenuLabel, 0) + for i := 0; i < len(list); i++ { + if list[i].ParentId != 0 { + continue + } + e := dto.MenuLabel{} + e.Id = list[i].MenuId + e.Label = list[i].Title + deptsInfo := menuLabelCall(&list, e) + + m = append(m, deptsInfo) + } + return +} + +// menuLabelCall 递归构造组织数据 +func menuLabelCall(elist *[]models.SysMenu, dept dto.MenuLabel) dto.MenuLabel { + list := *elist + + min := make([]dto.MenuLabel, 0) + for j := 0; j < len(list); j++ { + + if dept.Id != list[j].ParentId { + continue + } + mi := dto.MenuLabel{} + mi.Id = list[j].MenuId + mi.Label = list[j].Title + mi.Children = []dto.MenuLabel{} + if list[j].MenuType != "F" { + ms := menuLabelCall(elist, mi) + min = append(min, ms) + } else { + min = append(min, mi) + } + } + if len(min) > 0 { + dept.Children = min + } else { + dept.Children = nil + } + return dept +} + +// GetMenuList 菜单列表 +func (e *SysMenu) GetSysMenuPage() (c *dto.SysMenuSearch, m []models.SysMenu, err error) { + err = e.getSysMenuPage(c,&m) + m = make([]models.SysMenu, 0) + for i := 0; i < len(m); i++ { + if m[i].ParentId != 0 { + continue + } + menusInfo := menuCall(&m, m[i]) + + m = append(m, menusInfo) + } + return +} + +func menuCall(menulist *[]models.SysMenu, menu models.SysMenu) models.SysMenu { + list := *menulist + + min := make([]models.SysMenu, 0) + for j := 0; j < len(list); j++ { + + if menu.MenuId != list[j].ParentId { + continue + } + mi := models.SysMenu{} + mi.MenuId = list[j].MenuId + mi.MenuName = list[j].MenuName + mi.Title = list[j].Title + mi.Icon = list[j].Icon + mi.Path = list[j].Path + mi.MenuType = list[j].MenuType + mi.Action = list[j].Action + mi.Permission = list[j].Permission + mi.ParentId = list[j].ParentId + mi.NoCache = list[j].NoCache + mi.Breadcrumb = list[j].Breadcrumb + mi.Component = list[j].Component + mi.Sort = list[j].Sort + mi.Visible = list[j].Visible + mi.CreatedAt = list[j].CreatedAt + mi.Children = []models.SysMenu{} + + if mi.MenuType != "F" { + ms := menuCall(menulist, mi) + min = append(min, ms) + + } else { + min = append(min, mi) + } + + } + menu.Children = min + return menu +} \ No newline at end of file diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index 91aa1e68..9763e5c4 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -21,11 +21,11 @@ func _1599190683670Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { list3 := []models.SysDept{ - {DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 8, ParentId: 1, DeptPath: "/0/1/8", DeptName: "运维部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 9, ParentId: 1, DeptPath: "/0/1/9", DeptName: "客服部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 8, ParentId: 1, DeptPath: "/0/1/8", DeptName: "运维部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 9, ParentId: 1, DeptPath: "/0/1/9", DeptName: "客服部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } list4 := []system.SysConfig{ From 792c8874aa4a15188fabd48f463df78ff1d0064f Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sat, 16 Jan 2021 21:46:57 +0800 Subject: [PATCH 074/201] =?UTF-8?q?perf=F0=9F=91=8C=20:=20=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E3=80=81=E8=A7=92=E8=89=B2=E5=8A=9F=E8=83=BD=E6=94=B9?= =?UTF-8?q?=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/menu.go | 86 +++--- app/admin/apis/system/sys_dept/sys_dept.go | 42 ++- app/admin/apis/system/sys_menu/sys_menu.go | 281 ++++++++++++++++++ app/admin/apis/system/sys_post/sys_post.go | 174 +++++++++++ app/admin/apis/system/sys_role/sys_role.go | 175 +++++++++++ app/admin/models/system/sys_post.go | 30 ++ app/admin/models/system/sys_role.go | 33 ++ app/admin/router/sys_dept.go | 32 ++ app/admin/router/sys_menu.go | 39 +++ app/admin/router/sys_post.go | 26 ++ app/admin/router/sys_role.go | 25 ++ app/admin/router/sysrouter.go | 56 ++-- app/admin/service/dto/sys_dept.go | 3 +- app/admin/service/dto/sys_post.go | 117 ++++++++ app/admin/service/dto/sys_role.go | 128 ++++++++ app/admin/service/sys_dept.go | 64 +++- app/admin/service/sys_menu.go | 98 ++++-- app/admin/service/sys_post.go | 109 +++++++ app/admin/service/sys_role.go | 109 +++++++ .../version/1610804233204_migrate.go | 39 +++ common/dto/order.go | 12 + 21 files changed, 1575 insertions(+), 103 deletions(-) create mode 100644 app/admin/apis/system/sys_menu/sys_menu.go create mode 100644 app/admin/apis/system/sys_post/sys_post.go create mode 100644 app/admin/apis/system/sys_role/sys_role.go create mode 100644 app/admin/models/system/sys_post.go create mode 100644 app/admin/models/system/sys_role.go create mode 100644 app/admin/router/sys_dept.go create mode 100644 app/admin/router/sys_menu.go create mode 100644 app/admin/router/sys_post.go create mode 100644 app/admin/router/sys_role.go create mode 100644 app/admin/service/dto/sys_post.go create mode 100644 app/admin/service/dto/sys_role.go create mode 100644 app/admin/service/sys_post.go create mode 100644 app/admin/service/sys_role.go create mode 100644 cmd/migrate/migration/version/1610804233204_migrate.go create mode 100644 common/dto/order.go diff --git a/app/admin/apis/system/menu.go b/app/admin/apis/system/menu.go index ffe65e03..b76c4f7d 100644 --- a/app/admin/apis/system/menu.go +++ b/app/admin/apis/system/menu.go @@ -46,49 +46,6 @@ func GetMenu(c *gin.Context) { app.OK(c, result, "") } -// GetMenuTreeRoleselect 角色修改中的菜单列表 -func GetMenuTreeRoleselect(c *gin.Context) { - var Menu models.Menu - var SysRole models.SysRole - - id, err := tools.StringToInt(c.Param("roleId")) - SysRole.RoleId = id - //var r *models.SysRole - r, err := SysRole.Get() - - var result *[]models.MenuLable - menuIds := make([]int, 0) - if r.RoleKey != "admin" { - result, err = Menu.SetMenuLabel() - tools.HasError(err, "抱歉未找到相关信息", -1) - if id != 0 { - menuIds, err = SysRole.GetRoleMeunId() - tools.HasError(err, "抱歉未找到相关信息", -1) - } - } - app.Custum(c, gin.H{ - "code": 200, - "menus": result, - "checkedKeys": menuIds, - }) -} - -// @Summary 获取菜单树 -// @Description 获取JSON -// @Tags 菜单 -// @Accept application/x-www-form-urlencoded -// @Product application/x-www-form-urlencoded -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/menuTreeselect [get] -// @Security Bearer -func GetMenuTreeelect(c *gin.Context) { - var data models.Menu - result, err := data.SetMenuLabel() - tools.HasError(err, "抱歉未找到相关信息", -1) - app.OK(c, result, "") -} - // @Summary 创建菜单 // @Description 获取JSON // @Tags 菜单 @@ -183,3 +140,46 @@ func GetMenuIDS(c *gin.Context) { tools.HasError(err, "获取失败", 500) app.OK(c, result, "") } + +// GetMenuTreeRoleselect 角色修改中的菜单列表 +func GetMenuTreeRoleselect(c *gin.Context) { + var Menu models.Menu + var SysRole models.SysRole + + id, err := tools.StringToInt(c.Param("roleId")) + SysRole.RoleId = id + //var r *models.SysRole + r, err := SysRole.Get() + + var result *[]models.MenuLable + menuIds := make([]int, 0) + if r.RoleKey != "admin" { + result, err = Menu.SetMenuLabel() + tools.HasError(err, "抱歉未找到相关信息", -1) + if id != 0 { + menuIds, err = SysRole.GetRoleMeunId() + tools.HasError(err, "抱歉未找到相关信息", -1) + } + } + app.Custum(c, gin.H{ + "code": 200, + "menus": result, + "checkedKeys": menuIds, + }) +} + +// @Summary 获取菜单树 +// @Description 获取JSON +// @Tags 菜单 +// @Accept application/x-www-form-urlencoded +// @Product application/x-www-form-urlencoded +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/menuTreeselect [get] +// @Security Bearer +func GetMenuTreeelect(c *gin.Context) { + var data models.Menu + result, err := data.SetMenuLabel() + tools.HasError(err, "抱歉未找到相关信息", -1) + app.OK(c, result, "") +} \ No newline at end of file diff --git a/app/admin/apis/system/sys_dept/sys_dept.go b/app/admin/apis/system/sys_dept/sys_dept.go index 2e2b3602..a564f7e6 100644 --- a/app/admin/apis/system/sys_dept/sys_dept.go +++ b/app/admin/apis/system/sys_dept/sys_dept.go @@ -3,7 +3,6 @@ package sys_dept import ( "github.com/gin-gonic/gin" "go-admin/app/admin/models" - "go-admin/app/admin/service" "go-admin/app/admin/service/dto" "go-admin/common/apis" @@ -34,17 +33,16 @@ func (e *SysDept) GetSysDeptList(c *gin.Context) { } list := make([]models.SysDept, 0) - var count int64 serviceStudent := service.SysDept{} serviceStudent.MsgID = msgID serviceStudent.Orm = db - err = serviceStudent.GetSysDeptPage(d, &list, &count) + list, err = serviceStudent.SetDeptPage(d) if err != nil { e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") return } - e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") + e.OK(c, list, "查询成功") } func (e *SysDept) GetSysDept(c *gin.Context) { @@ -172,3 +170,39 @@ func (e *SysDept) DeleteSysDept(c *gin.Context) { } e.OK(c, control.GetId(), "删除成功") } + +// GetDeptTree 用户管理 左侧部门树 +func (e *SysDept) GetDeptTree(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysDeptSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + //查询列表 + err = d.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]dto.DeptLabel, 0) + serviceStudent := service.SysDept{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + list, err = serviceStudent.SetDeptTree(d) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + //var Dept models.SysDepts + //Dept.DeptName = c.Request.FormValue("deptName") + //Dept.Status = c.Request.FormValue("status") + //Dept.DeptId, _ = tools.StringToInt(c.Request.FormValue("deptId")) + //result, err := Dept.SetDept(false) + //tools.HasError(err, "抱歉未找到相关信息", -1) + e.OK(c, list, "") +} \ No newline at end of file diff --git a/app/admin/apis/system/sys_menu/sys_menu.go b/app/admin/apis/system/sys_menu/sys_menu.go new file mode 100644 index 00000000..ab61c27d --- /dev/null +++ b/app/admin/apis/system/sys_menu/sys_menu.go @@ -0,0 +1,281 @@ +package sys_menu + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/models" + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + "go-admin/tools" + "go-admin/tools/app" + "net/http" +) + +type SysMenu struct { + apis.Api +} + +func (e *SysMenu) GetSysMenuList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysMenuSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + //查询列表 + err = d.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + var list *[]models.SysMenu + serviceSysMenu := service.SysMenu{} + serviceSysMenu.MsgID = msgID + serviceSysMenu.Orm = db + list, err = serviceSysMenu.GetSysMenuPage(d) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, list, "查询成功") +} + +func (e *SysMenu) GetSysMenu(c *gin.Context) { + control := new(dto.SysMenuById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object models.SysMenu + + serviceSysMenu := service.SysMenu{} + serviceSysMenu.MsgID = msgID + serviceSysMenu.Orm = db + err = serviceSysMenu.GetSysMenu(control, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysMenu) InsertSysMenu(c *gin.Context) { + control := new(dto.SysMenuControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserId(c)) + + serviceSysMenu := service.SysMenu{} + serviceSysMenu.Orm = db + serviceSysMenu.MsgID = msgID + err = serviceSysMenu.InsertSysMenu(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysMenu) UpdateSysMenu(c *gin.Context) { + control := new(dto.SysMenuControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //更新操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.SetUpdateBy(tools.GetUserId(c)) + + serviceSysMenu := service.SysMenu{} + serviceSysMenu.Orm = db + serviceSysMenu.MsgID = msgID + err = serviceSysMenu.UpdateSysMenu(object) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysMenu) DeleteSysMenu(c *gin.Context) { + control := new(dto.SysMenuById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + err = control.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + serviceSysMenu := service.SysMenu{} + serviceSysMenu.Orm = db + serviceSysMenu.MsgID = msgID + err = serviceSysMenu.RemoveSysMenu(control) + if err != nil { + log.Error(err) + return + } + e.OK(c, control.GetId(), "删除成功") +} + +// @Summary 根据角色名称获取菜单列表数据(左菜单使用) +// @Description 获取JSON +// @Tags 菜单 +// @Param id path int true "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/menurole [get] +// @Security Bearer +func (e *SysMenu) GetMenuRole(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + serviceSysMenu := service.SysMenu{} + serviceSysMenu.MsgID = msgID + serviceSysMenu.Orm = db + result, err := serviceSysMenu.SetMenuRole(tools.GetRoleName(c)) + + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + app.OK(c, result, "") +} + +// @Summary 获取角色对应的菜单id数组 +// @Description 获取JSON +// @Tags 菜单 +// @Param id path int true "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/menuids/{id} [get] +// @Security Bearer +func (e *SysMenu) GetMenuIDS(c *gin.Context) { + var data models.RoleMenu + data.RoleName = c.GetString("role") + data.UpdateBy = tools.GetUserIdStr(c) + result, err := data.GetIDS() + tools.HasError(err, "获取失败", 500) + app.OK(c, result, "") +} + +// GetMenuTreeRoleselect 角色修改中的菜单列表 +func (e *SysMenu) GetMenuTreeRoleselect(c *gin.Context) { + var Menu models.Menu + var SysRole models.SysRole + + id, err := tools.StringToInt(c.Param("roleId")) + SysRole.RoleId = id + //var r *models.SysRole + r, err := SysRole.Get() + + var result *[]models.MenuLable + menuIds := make([]int, 0) + if r.RoleKey != "admin" { + result, err = Menu.SetMenuLabel() + tools.HasError(err, "抱歉未找到相关信息", -1) + if id != 0 { + menuIds, err = SysRole.GetRoleMeunId() + tools.HasError(err, "抱歉未找到相关信息", -1) + } + } + app.Custum(c, gin.H{ + "code": 200, + "menus": result, + "checkedKeys": menuIds, + }) +} + +// @Summary 获取菜单树 +// @Description 获取JSON +// @Tags 菜单 +// @Accept application/x-www-form-urlencoded +// @Product application/x-www-form-urlencoded +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/menuTreeselect [get] +// @Security Bearer +func (e *SysMenu) GetMenuTreeSelect(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysMenuSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + err = d.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + serviceSysMenu := service.SysMenu{} + serviceSysMenu.MsgID = msgID + serviceSysMenu.Orm = db + result, err := serviceSysMenu.SetSysMenuLabel(d) + + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + e.OK(c, result, "") +} diff --git a/app/admin/apis/system/sys_post/sys_post.go b/app/admin/apis/system/sys_post/sys_post.go new file mode 100644 index 00000000..8ab880fc --- /dev/null +++ b/app/admin/apis/system/sys_post/sys_post.go @@ -0,0 +1,174 @@ +package sys_post + +import ( + "github.com/gin-gonic/gin" + + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + "go-admin/tools" + + "net/http" +) + +type SysPost struct { + apis.Api +} + +func (e *SysPost) GetSysPostList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysPostSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + //查询列表 + err = d.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]system.SysPost, 0) + var count int64 + serviceStudent := service.SysPost{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + err = serviceStudent.GetSysPostPage(d, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") +} + +func (e *SysPost) GetSysPost(c *gin.Context) { + control := new(dto.SysPostById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object system.SysPost + + serviceSysOperlog := service.SysPost{} + serviceSysOperlog.MsgID = msgID + serviceSysOperlog.Orm = db + err = serviceSysOperlog.GetSysPost(control, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysPost) InsertSysPost(c *gin.Context) { + control := new(dto.SysPostControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.SetCreateBy(tools.GetUserId(c)) + + serviceSysPost := service.SysPost{} + serviceSysPost.Orm = db + serviceSysPost.MsgID = msgID + err = serviceSysPost.InsertSysPost(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysPost) UpdateSysPost(c *gin.Context) { + control := new(dto.SysPostControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //更新操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.SetUpdateBy(tools.GetUserId(c)) + + serviceSysPost := service.SysPost{} + serviceSysPost.Orm = db + serviceSysPost.MsgID = msgID + err = serviceSysPost.UpdateSysPost(object) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysPost) DeleteSysPost(c *gin.Context) { + control := new(dto.SysPostById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + err = control.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + serviceSysPost := service.SysPost{} + serviceSysPost.Orm = db + serviceSysPost.MsgID = msgID + err = serviceSysPost.RemoveSysPost(control) + if err != nil { + log.Error(err) + return + } + e.OK(c, control.GetId(), "删除成功") +} diff --git a/app/admin/apis/system/sys_role/sys_role.go b/app/admin/apis/system/sys_role/sys_role.go new file mode 100644 index 00000000..2e535d74 --- /dev/null +++ b/app/admin/apis/system/sys_role/sys_role.go @@ -0,0 +1,175 @@ +package sys_role + +import ( + "github.com/gin-gonic/gin" + + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + "go-admin/tools" + + "net/http" +) + +type SysRole struct { + apis.Api +} + +func (e *SysRole) GetSysRoleList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + d := new(dto.SysRoleSearch) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + //查询列表 + err = d.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]system.SysRole, 0) + var count int64 + serviceStudent := service.SysRole{} + serviceStudent.MsgID = msgID + serviceStudent.Orm = db + err = serviceStudent.GetSysRolePage(d, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") +} + +func (e *SysRole) GetSysRole(c *gin.Context) { + control := new(dto.SysRoleById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object system.SysRole + + serviceSysOperlog := service.SysRole{} + serviceSysOperlog.MsgID = msgID + serviceSysOperlog.Orm = db + err = serviceSysOperlog.GetSysRole(control, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +func (e *SysRole) InsertSysRole(c *gin.Context) { + control := new(dto.SysRoleControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + // 设置创建人 + object.CreateBy= tools.GetUserId(c) + + serviceSysRole := service.SysRole{} + serviceSysRole.Orm = db + serviceSysRole.MsgID = msgID + err = serviceSysRole.InsertSysRole(object) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +func (e *SysRole) UpdateSysRole(c *gin.Context) { + control := new(dto.SysRoleControl) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //更新操作 + err = control.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, err := control.Generate() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + object.UpdateBy = tools.GetUserId(c) + + serviceSysRole := service.SysRole{} + serviceSysRole.Orm = db + serviceSysRole.MsgID = msgID + err = serviceSysRole.UpdateSysRole(object) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +func (e *SysRole) DeleteSysRole(c *gin.Context) { + control := new(dto.SysRoleById) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + err = control.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + serviceSysRole := service.SysRole{} + serviceSysRole.Orm = db + serviceSysRole.MsgID = msgID + err = serviceSysRole.RemoveSysRole(control) + if err != nil { + log.Error(err) + return + } + e.OK(c, control.GetId(), "删除成功") +} + diff --git a/app/admin/models/system/sys_post.go b/app/admin/models/system/sys_post.go new file mode 100644 index 00000000..352f7064 --- /dev/null +++ b/app/admin/models/system/sys_post.go @@ -0,0 +1,30 @@ +package system + +import "go-admin/common/models" + +type SysPost struct { + PostId int `gorm:"primary_key;AUTO_INCREMENT" json:"postId"` //岗位编号 + PostName string `gorm:"size:128;" json:"postName"` //岗位名称 + PostCode string `gorm:"size:128;" json:"postCode"` //岗位代码 + Sort int `gorm:"" json:"sort"` //岗位排序 + Status int `gorm:"size:4;" json:"status"` //状态 + Remark string `gorm:"size:255;" json:"remark"` //描述 + models.ControlBy + models.ModelTime + + DataScope string `gorm:"-" json:"dataScope"` + Params string `gorm:"-" json:"params"` +} + +func (SysPost) TableName() string { + return "sys_post" +} + +func (e *SysPost) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysPost) GetId() interface{} { + return e.PostId +} diff --git a/app/admin/models/system/sys_role.go b/app/admin/models/system/sys_role.go new file mode 100644 index 00000000..b3c1482a --- /dev/null +++ b/app/admin/models/system/sys_role.go @@ -0,0 +1,33 @@ +package system + +import "go-admin/common/models" + +type SysRole struct { + RoleId int `json:"roleId" gorm:"primary_key;AUTO_INCREMENT"` // 角色编码 + RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称 + Status string `json:"status" gorm:"size:4;"` // + RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码 + RoleSort int `json:"roleSort" gorm:""` //角色排序 + Flag string `json:"flag" gorm:"size:128;"` // + Remark string `json:"remark" gorm:"size:255;"` //备注 + Admin bool `json:"admin" gorm:"size:4;"` + DataScope string `json:"dataScope" gorm:"size:128;"` + models.ControlBy + models.ModelTime + Params string `json:"params" gorm:"-"` + MenuIds []int `json:"menuIds" gorm:"-"` + DeptIds []int `json:"deptIds" gorm:"-"` +} + +func (SysRole) TableName() string { + return "sys_role" +} + +func (e *SysRole) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysRole) GetId() interface{} { + return e.RoleId +} diff --git a/app/admin/router/sys_dept.go b/app/admin/router/sys_dept.go new file mode 100644 index 00000000..432d0d73 --- /dev/null +++ b/app/admin/router/sys_dept.go @@ -0,0 +1,32 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/system/sys_dept" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysDeptRouter) +} + +// 需认证的路由代码 +func registerSysDeptRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &sys_dept.SysDept{} + r := v1.Group("/dept").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetSysDeptList) + r.GET("/:id", api.GetSysDept) + r.POST("", api.InsertSysDept) + r.PUT("/:id", api.UpdateSysDept) + r.DELETE("/:id", api.DeleteSysDept) + } + + r1 := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r1.GET("/deptTree", api.GetDeptTree) + } + + +} diff --git a/app/admin/router/sys_menu.go b/app/admin/router/sys_menu.go new file mode 100644 index 00000000..1b34dfa3 --- /dev/null +++ b/app/admin/router/sys_menu.go @@ -0,0 +1,39 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/system/sys_menu" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysMenuRouter) +} + +// 需认证的路由代码 +func registerSysMenuRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &sys_menu.SysMenu{} + //menu := v1.Group("/menu").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + //{ + // menu.GET("/:id", system.GetMenu) + // menu.POST("", system.InsertMenu) + // menu.PUT("", system.UpdateMenu) + // menu.DELETE("/:id", system.DeleteMenu) + //} + r := v1.Group("/menu").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetSysMenuList) + r.GET("/:id", api.GetSysMenu) + r.POST("", api.InsertSysMenu) + r.PUT("/:id", api.UpdateSysMenu) + r.DELETE("/:id", api.DeleteSysMenu) + } + + r1 := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r1.GET("/menurole", api.GetMenuRole) + } + + +} diff --git a/app/admin/router/sys_post.go b/app/admin/router/sys_post.go new file mode 100644 index 00000000..17c1ce71 --- /dev/null +++ b/app/admin/router/sys_post.go @@ -0,0 +1,26 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/system/sys_post" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSyPostRouter) +} + +// 需认证的路由代码 +func registerSyPostRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &sys_post.SysPost{} + r := v1.Group("/post").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetSysPostList) + r.GET("/:id", api.GetSysPost) + r.POST("", api.InsertSysPost) + r.PUT("/:id", api.UpdateSysPost) + r.DELETE("/:id", api.DeleteSysPost) + } +} + diff --git a/app/admin/router/sys_role.go b/app/admin/router/sys_role.go new file mode 100644 index 00000000..189c0e6c --- /dev/null +++ b/app/admin/router/sys_role.go @@ -0,0 +1,25 @@ +package router + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/apis/system/sys_role" + "go-admin/app/admin/middleware" + jwt "go-admin/pkg/jwtauth" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysRoleRouter) +} + +// 需认证的路由代码 +func registerSysRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := &sys_role.SysRole{} + r := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetSysRoleList) + r.GET("/:id", api.GetSysRole) + r.POST("", api.InsertSysRole) + r.PUT("/:id", api.UpdateSysRole) + r.DELETE("/:id", api.DeleteSysRole) + } +} diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sysrouter.go index 9e68d750..774a1413 100644 --- a/app/admin/router/sysrouter.go +++ b/app/admin/router/sysrouter.go @@ -104,20 +104,20 @@ func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle registerPageRouter(v1, authMiddleware) registerBaseRouter(v1, authMiddleware) - registerDeptRouter(v1, authMiddleware) + //registerDeptRouter(v1, authMiddleware) registerDictRouter(v1, authMiddleware) registerSysUserRouter(v1, authMiddleware) - registerRoleRouter(v1, authMiddleware) + //registerRoleRouter(v1, authMiddleware) registerUserCenterRouter(v1, authMiddleware) - registerPostRouter(v1, authMiddleware) - registerMenuRouter(v1, authMiddleware) + //registerPostRouter(v1, authMiddleware) + //registerMenuRouter(v1, authMiddleware) } func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { v1auth := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { v1auth.GET("/getinfo", system.GetInfo) - v1auth.GET("/menurole", system.GetMenuRole) + v1auth.PUT("/roledatascope", system.UpdateRoleDataScope) v1auth.GET("/roleMenuTreeselect/:roleId", system.GetMenuTreeRoleselect) v1auth.GET("/roleDeptTreeselect/:roleId", system.GetDeptTreeRoleselect) @@ -130,13 +130,13 @@ func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar func registerPageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { v1auth := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - v1auth.GET("/deptList", system.GetDeptList) - v1auth.GET("/deptTree", system.GetDeptTree) + //v1auth.GET("/deptList", system.GetDeptList) + //v1auth.GET("/deptTree", system.GetDeptTree) v1auth.GET("/sysUserList", system.GetSysUserList) - v1auth.GET("/rolelist", system.GetRoleList) + //v1auth.GET("/rolelist", system.GetRoleList) //v1auth.GET("/configList", system.GetConfigList) - v1auth.GET("/postlist", system.GetPostList) - v1auth.GET("/menulist", system.GetMenuList) + //v1auth.GET("/postlist", system.GetPostList) + //v1auth.GET("/menulist", system.GetMenuList) } } @@ -159,15 +159,15 @@ func registerPostRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar } } -func registerMenuRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - menu := v1.Group("/menu").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - menu.GET("/:id", system.GetMenu) - menu.POST("", system.InsertMenu) - menu.PUT("", system.UpdateMenu) - menu.DELETE("/:id", system.DeleteMenu) - } -} +//func registerMenuRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { +// menu := v1.Group("/menu").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) +// { +// menu.GET("/:id", system.GetMenu) +// menu.POST("", system.InsertMenu) +// menu.PUT("", system.UpdateMenu) +// menu.DELETE("/:id", system.DeleteMenu) +// } +//} func registerRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { role := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) @@ -209,15 +209,15 @@ func registerDictRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar } } -func registerDeptRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - dept := v1.Group("/dept").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - dept.GET("/:deptId", system.GetDept) - dept.POST("", system.InsertDept) - dept.PUT("", system.UpdateDept) - dept.DELETE("/:id", system.DeleteDept) - } -} +//func registerDeptRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { +// dept := v1.Group("/dept").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) +// { +// dept.GET("/:deptId", system.GetDept) +// dept.POST("", system.InsertDept) +// dept.PUT("", system.UpdateDept) +// dept.DELETE("/:id", system.DeleteDept) +// } +//} func registerSysSettingRouter(v1 *gin.RouterGroup) { api := system.SysSetting{} setting := v1.Group("/setting") diff --git a/app/admin/service/dto/sys_dept.go b/app/admin/service/dto/sys_dept.go index 1d48de80..4e1133d2 100644 --- a/app/admin/service/dto/sys_dept.go +++ b/app/admin/service/dto/sys_dept.go @@ -13,6 +13,7 @@ import ( // SysConfigSearch 列表或者搜索使用结构体 type SysDeptSearch struct { dto.Pagination `search:"-"` + DeptId int `form:"deptId" search:"type:exact;column:dept_id;table:sys_dept" comment:"id"` //id ParentId int `form:"parentId" search:"type:exact;column:parent_id;table:sys_dept" comment:"上级部门"` //上级部门 DeptPath string `form:"deptPath" search:"type:exact;column:dept_path;table:sys_dept" comment:""` //路径 DeptName string `form:"deptName" search:"type:exact;column:dept_name;table:sys_dept" comment:"部门名称"` //部门名称 @@ -128,4 +129,4 @@ type DeptLabel struct { Id int `gorm:"-" json:"id"` Label string `gorm:"-" json:"label"` Children []DeptLabel `gorm:"-" json:"children"` -} \ No newline at end of file +} diff --git a/app/admin/service/dto/sys_post.go b/app/admin/service/dto/sys_post.go new file mode 100644 index 00000000..59df058e --- /dev/null +++ b/app/admin/service/dto/sys_post.go @@ -0,0 +1,117 @@ +package dto + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" + "go-admin/app/admin/models/system" + "go-admin/common/dto" + "go-admin/common/log" + "go-admin/tools" +) + +// SysPostSearch 列表或者搜索使用结构体 +type SysPostSearch struct { + dto.Pagination `search:"-"` + PostId int `form:"postId" search:"type:exact;column:post_id;table:sys_post" comment:"id"` // id + PostName string `form:"postName" search:"type:exact;column:post_name;table:sys_post" comment:"名称"` // 名称 + PostCode string `form:"postCode" search:"type:exact;column:post_code;table:sys_post" comment:"编码"` // 编码 + Sort int `form:"sort" search:"type:exact;column:sort;table:sys_post" comment:"排序"` // 排序 + Status int `form:"status" search:"type:exact;column:status;table:sys_post" comment:"状态"` // 状态 + Remark string `form:"remark" search:"type:exact;column:remark;table:sys_post" comment:"备注"` // 备注 +} + +func (m *SysPostSearch) GetNeedSearch() interface{} { + return *m +} + +// Bind 映射上下文中的结构体数据 +func (m *SysPostSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +// SysConfigControl 增、改使用的结构体 +type SysPostControl struct { + PostId int `uri:"id" comment:"id"` // id + PostName string `form:"postName" comment:"名称"` // 名称 + PostCode string `form:"postCode" comment:"编码"` // 编码 + Sort int `form:"sort" comment:"排序"` // 排序 + Status int `form:"status" comment:"状态"` // 状态 + Remark string `form:"remark" comment:"备注"` // 备注 +} + +// Bind 映射上下文中的结构体数据 +func (s *SysPostControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBindBodyWith(s, binding.JSON) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + var jsonStr []byte + jsonStr, err = json.Marshal(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + ctx.Set("body", string(jsonStr)) + return err +} + +// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型 +func (s *SysPostControl) Generate() (*system.SysPost, error) { + return &system.SysPost{ + PostId: s.PostId, + PostName: s.PostName, + PostCode: s.PostCode, + Sort: s.Sort, + Status: s.Status, + Remark: s.Remark, + }, nil +} + +// GetId 获取数据对应的ID +func (s *SysPostControl) GetId() interface{} { + return s.PostId +} + +// SysConfigById 获取单个或者删除的结构体 +type SysPostById struct { + Id int `uri:"id"` + Ids []int `json:"ids"` +} + +func (s *SysPostById) Generate() *SysPostById { + cp := *s + return &cp +} + +func (s *SysPostById) GetId() interface{} { + return s.Id +} + +func (s *SysPostById) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysPostById) GenerateM() (*system.SysPost, error) { + return &system.SysPost{}, nil +} diff --git a/app/admin/service/dto/sys_role.go b/app/admin/service/dto/sys_role.go new file mode 100644 index 00000000..26effbeb --- /dev/null +++ b/app/admin/service/dto/sys_role.go @@ -0,0 +1,128 @@ +package dto + +import ( + "encoding/json" + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" + "go-admin/app/admin/models" + "go-admin/app/admin/models/system" + "go-admin/common/dto" + "go-admin/common/log" + "go-admin/tools" +) + +// SysRoleSearch 列表或者搜索使用结构体 +type SysRoleSearch struct { + dto.Pagination `search:"-"` + + RoleId int `form:"roleId" search:"type:exact;column:role_id;table:sys_role" comment:"角色编码"` // 角色编码 + RoleName string `form:"roleName" search:"type:exact;column:role_name;table:sys_role" comment:"角色名称"` // 角色名称 + Status string `form:"status" search:"type:exact;column:status;table:sys_role" comment:"状态"` // 状态 + RoleKey string `form:"roleKey" search:"type:exact;column:role_key;table:sys_role" comment:"角色代码"` // 角色代码 + RoleSort int `form:"roleSort" search:"type:exact;column:role_sort;table:sys_role" comment:"角色排序"` // 角色排序 + Flag string `form:"flag" search:"type:exact;column:flag;table:sys_role" comment:"标记"` // 标记 + Remark string `form:"remark" search:"type:exact;column:remark;table:sys_role" comment:"备注"` // 备注 + Admin bool `form:"admin" search:"type:exact;column:admin;table:sys_role" comment:"是否管理员"` + DataScope string `form:"dataScope" search:"type:exact;column:data_scope;table:sys_role" comment:"是否管理员"` +} + +func (m *SysRoleSearch) GetNeedSearch() interface{} { + return *m +} + +// Bind 映射上下文中的结构体数据 +func (m *SysRoleSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +// SysConfigControl 增、改使用的结构体 +type SysRoleControl struct { + RoleId int `uri:"roleId" comment:"角色编码"` // 角色编码 + RoleName string `form:"roleName" comment:"角色名称"` // 角色名称 + Status string `form:"status" comment:"状态"` // 状态 + RoleKey string `form:"roleKey" comment:"角色代码"` // 角色代码 + RoleSort int `form:"roleSort" comment:"角色排序"` // 角色排序 + Flag string `form:"flag" comment:"标记"` // 标记 + Remark string `form:"remark" comment:"备注"` // 备注 + Admin bool `form:"admin" comment:"是否管理员"` + DataScope string `form:"dataScope" comment:"是否管理员"` +} + +// Bind 映射上下文中的结构体数据 +func (s *SysRoleControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBindBodyWith(s, binding.JSON) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + var jsonStr []byte + jsonStr, err = json.Marshal(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + ctx.Set("body", string(jsonStr)) + return err +} + +// Generate 结构体数据转化 从 SysConfigControl 至 system.SysConfig 对应的模型 +func (s *SysRoleControl) Generate() (*system.SysRole, error) { + return &system.SysRole{ + RoleId: s.RoleId, + RoleName: s.RoleName, + Status: s.Status, + RoleKey: s.RoleKey, + RoleSort: s.RoleSort, + Flag: s.Flag, + Remark: s.Remark, + Admin: s.Admin, + DataScope: s.DataScope, + }, nil +} + +// GetId 获取数据对应的ID +func (s *SysRoleControl) GetId() interface{} { + return s.RoleId +} + +// SysConfigById 获取单个或者删除的结构体 +type SysRoleById struct { + Id int `uri:"id"` + Ids []int `json:"ids"` +} + +func (s *SysRoleById) Generate() *SysRoleById { + cp := *s + return &cp +} + +func (s *SysRoleById) GetId() interface{} { + return s.Id +} + +func (s *SysRoleById) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysRoleById) GenerateM() (*models.SysRole, error) { + return &models.SysRole{}, nil +} diff --git a/app/admin/service/sys_dept.go b/app/admin/service/sys_dept.go index 7cf85b16..5078c04e 100644 --- a/app/admin/service/sys_dept.go +++ b/app/admin/service/sys_dept.go @@ -15,7 +15,7 @@ type SysDept struct { } // GetSysDeptPage 获取SysDept列表 -func (e *SysDept) GetSysDeptPage(c *dto.SysDeptSearch, list *[]models.SysDept, count *int64) error { +func (e *SysDept) GetSysDeptPage(c *dto.SysDeptSearch, list *[]models.SysDept) error { var err error var data models.SysDept msgID := e.MsgID @@ -23,10 +23,8 @@ func (e *SysDept) GetSysDeptPage(c *dto.SysDeptSearch, list *[]models.SysDept, c err = e.Orm.Model(&data). Scopes( cDto.MakeCondition(c.GetNeedSearch()), - cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), ). - Find(list).Limit(-1).Offset(-1). - Count(count).Error + Find(list).Error if err != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) return err @@ -110,7 +108,7 @@ func (e *SysDept) RemoveSysDept(d *dto.SysDeptById) error { } // GetSysDeptList 获取组织数据 -func (e *SysDept) GetSysDeptList(c *dto.SysDeptSearch, list *[]models.SysDept) error { +func (e *SysDept) getSysDeptList(c *dto.SysDeptSearch, list *[]models.SysDept) error { var err error var data models.SysDept msgID := e.MsgID @@ -128,9 +126,9 @@ func (e *SysDept) GetSysDeptList(c *dto.SysDeptSearch, list *[]models.SysDept) e } // SetDeptTree 设置组织数据 -func (e *SysDept) SetDeptTree() (c *dto.SysDeptSearch, m []dto.DeptLabel, err error) { +func (e *SysDept) SetDeptTree(c *dto.SysDeptSearch) (m []dto.DeptLabel, err error) { var list []models.SysDept - err = e.GetSysDeptList(c, &list) + err = e.getSysDeptList(c, &list) m = make([]dto.DeptLabel, 0) for i := 0; i < len(list); i++ { @@ -140,7 +138,7 @@ func (e *SysDept) SetDeptTree() (c *dto.SysDeptSearch, m []dto.DeptLabel, err er e := dto.DeptLabel{} e.Id = list[i].DeptId e.Label = list[i].DeptName - deptsInfo := DeptCall(&list, e) + deptsInfo := deptTreeCall(&list, e) m = append(m, deptsInfo) } @@ -148,7 +146,7 @@ func (e *SysDept) SetDeptTree() (c *dto.SysDeptSearch, m []dto.DeptLabel, err er } // Call 递归构造组织数据 -func DeptCall(deptlist *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabel { +func deptTreeCall(deptlist *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabel { list := *deptlist min := make([]dto.DeptLabel, 0) for j := 0; j < len(list); j++ { @@ -156,9 +154,55 @@ func DeptCall(deptlist *[]models.SysDept, dept dto.DeptLabel) dto.DeptLabel { continue } mi := dto.DeptLabel{Id: list[j].DeptId, Label: list[j].DeptName, Children: []dto.DeptLabel{}} - ms := DeptCall(deptlist, mi) + ms := deptTreeCall(deptlist, mi) min = append(min, ms) } dept.Children = min return dept } + +// SetDeptPage 设置dept页面数据 +func (e *SysDept) SetDeptPage(c *dto.SysDeptSearch) (m []models.SysDept, err error) { + var list []models.SysDept + err = e.getSysDeptList(c, &list) + + //m := make([]models.SysDept, 0) + for i := 0; i < len(list); i++ { + if list[i].ParentId != 0 { + continue + } + info := e.deptPageCall(&list, list[i]) + + m = append(m, info) + } + return +} + +func (e *SysDept) deptPageCall(deptlist *[]models.SysDept, menu models.SysDept) models.SysDept { + list := *deptlist + + min := make([]models.SysDept, 0) + for j := 0; j < len(list); j++ { + + if menu.DeptId != list[j].ParentId { + continue + } + mi := models.SysDept{} + mi.DeptId = list[j].DeptId + mi.ParentId = list[j].ParentId + mi.DeptPath = list[j].DeptPath + mi.DeptName = list[j].DeptName + mi.Sort = list[j].Sort + mi.Leader = list[j].Leader + mi.Phone = list[j].Phone + mi.Email = list[j].Email + mi.Status = list[j].Status + mi.CreatedAt = list[j].CreatedAt + mi.Children = []models.SysDept{} + ms := e.deptPageCall(deptlist, mi) + min = append(min, ms) + + } + menu.Children = min + return menu +} diff --git a/app/admin/service/sys_menu.go b/app/admin/service/sys_menu.go index f833bd41..024a9ad9 100644 --- a/app/admin/service/sys_menu.go +++ b/app/admin/service/sys_menu.go @@ -16,6 +16,23 @@ type SysMenu struct { } // GetSysMenuPage 获取SysMenu列表 +func (e *SysMenu) GetSysMenuPage(c *dto.SysMenuSearch) (*[]models.SysMenu, error) { + var m = make([]models.SysMenu, 0) + var err error + var menu = make([]models.SysMenu, 0) + err = e.getSysMenuPage(c, &menu) + for i := 0; i < len(menu); i++ { + if menu[i].ParentId != 0 { + continue + } + menusInfo := menuCall(&menu, menu[i]) + + m = append(m, menusInfo) + } + return &m, err +} + +// getSysMenuPage 菜单列表 func (e *SysMenu) getSysMenuPage(c *dto.SysMenuSearch, list *[]models.SysMenu) error { var err error var data models.SysMenu @@ -23,6 +40,7 @@ func (e *SysMenu) getSysMenuPage(c *dto.SysMenuSearch, list *[]models.SysMenu) e err = e.Orm.Model(&data). Scopes( + cDto.OrderDest("sort", false), cDto.MakeCondition(c.GetNeedSearch()), ). Find(list).Error @@ -145,7 +163,7 @@ func (e *SysMenu) GetSysMenuList(c *dto.SysMenuSearch, list *[]models.SysMenu) e } // SetSysMenuTree 设置菜单数据 -func (e *SysMenu) SetSysMenuTree() (c *dto.SysMenuSearch, m []dto.MenuLabel, err error) { +func (e *SysMenu) SetSysMenuLabel(c *dto.SysMenuSearch) (m []dto.MenuLabel, err error) { var list []models.SysMenu err = e.GetSysMenuList(c, &list) @@ -164,6 +182,29 @@ func (e *SysMenu) SetSysMenuTree() (c *dto.SysMenuSearch, m []dto.MenuLabel, err return } +// 左侧菜单 +func (e *SysMenu) GetSysMenuByRoleName(roleName string) (Menus []models.SysMenu, err error) { + var table *gorm.DB + var data models.SysMenu + msgID := e.MsgID + + if roleName == "admin" { + table = e.Orm.Model(&data).Select("sys_menu.*") + table = table.Where(" menu_type in ('M','C')") + } else { + table = e.Orm.Model(&data).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id") + table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", roleName) + } + + err = table.Order("sort").Find(&Menus).Error + + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return + } + return +} + // menuLabelCall 递归构造组织数据 func menuLabelCall(elist *[]models.SysMenu, dept dto.MenuLabel) dto.MenuLabel { list := *elist @@ -193,21 +234,6 @@ func menuLabelCall(elist *[]models.SysMenu, dept dto.MenuLabel) dto.MenuLabel { return dept } -// GetMenuList 菜单列表 -func (e *SysMenu) GetSysMenuPage() (c *dto.SysMenuSearch, m []models.SysMenu, err error) { - err = e.getSysMenuPage(c,&m) - m = make([]models.SysMenu, 0) - for i := 0; i < len(m); i++ { - if m[i].ParentId != 0 { - continue - } - menusInfo := menuCall(&m, m[i]) - - m = append(m, menusInfo) - } - return -} - func menuCall(menulist *[]models.SysMenu, menu models.SysMenu) models.SysMenu { list := *menulist @@ -246,4 +272,42 @@ func menuCall(menulist *[]models.SysMenu, menu models.SysMenu) models.SysMenu { } menu.Children = min return menu -} \ No newline at end of file +} + +func (e *SysMenu) SetMenuRole(roleName string) (m []models.SysMenu, err error) { + + menus, err := e.getByRoleName(roleName) + + m = make([]models.SysMenu, 0) + for i := 0; i < len(menus); i++ { + if menus[i].ParentId != 0 { + continue + } + menusInfo := menuCall(&menus, menus[i]) + + m = append(m, menusInfo) + } + return +} + +func (e *SysMenu) getByRoleName(roleName string) (Menus []models.SysMenu, err error) { + var data models.SysMenu + msgID := e.MsgID + var table *gorm.DB + if roleName == "admin" { + table = e.Orm.Model(&data).Select("sys_menu.*") + table = table.Where(" menu_type in ('M','C')") + } else { + table = e.Orm.Model(&data).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id") + table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", roleName) + } + err = table.Scopes( + cDto.OrderDest("sort", false), + ).Find(&Menus).Error + + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return + } + return +} diff --git a/app/admin/service/sys_post.go b/app/admin/service/sys_post.go new file mode 100644 index 00000000..6dfad2a3 --- /dev/null +++ b/app/admin/service/sys_post.go @@ -0,0 +1,109 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models/system" + "go-admin/app/admin/service/dto" + cDto "go-admin/common/dto" + "go-admin/common/log" + "go-admin/common/service" + "gorm.io/gorm" +) + +type SysPost struct { + service.Service +} + +// GetSysPostPage 获取SysPost列表 +func (e *SysPost) GetSysPostPage(c *dto.SysPostSearch, list *[]system.SysPost, count *int64) error { + var err error + var data system.SysPost + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysPost 获取SysPost对象 +func (e *SysPost) GetSysPost(d *dto.SysPostById, model *system.SysPost) error { + var err error + var data system.SysPost + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysPost 创建SysPost对象 +func (e *SysPost) InsertSysPost(model *system.SysPost) error { + var err error + var data system.SysPost + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// UpdateSysPost 修改SysPost对象 +func (e *SysPost) UpdateSysPost(c *system.SysPost) error { + var err error + var data system.SysPost + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysPost 删除SysPost +func (e *SysPost) RemoveSysPost(d *dto.SysPostById) error { + var err error + var data system.SysPost + msgID := e.MsgID + + db := e.Orm.Model(&data).Delete(&data, d.GetId()) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} diff --git a/app/admin/service/sys_role.go b/app/admin/service/sys_role.go new file mode 100644 index 00000000..637004eb --- /dev/null +++ b/app/admin/service/sys_role.go @@ -0,0 +1,109 @@ +package service + +import ( + "errors" + "go-admin/app/admin/models/system" + "go-admin/app/admin/service/dto" + cDto "go-admin/common/dto" + "go-admin/common/log" + "go-admin/common/service" + "gorm.io/gorm" +) + +type SysRole struct { + service.Service +} + +// GetSysRolePage 获取SysRole列表 +func (e *SysRole) GetSysRolePage(c *dto.SysRoleSearch, list *[]system.SysRole, count *int64) error { + var err error + var data system.SysRole + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// GetSysRole 获取SysRole对象 +func (e *SysRole) GetSysRole(d *dto.SysRoleById, model *system.SysRole) error { + var err error + var data system.SysRole + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// InsertSysRole 创建SysRole对象 +func (e *SysRole) InsertSysRole(model *system.SysRole) error { + var err error + var data system.SysRole + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// UpdateSysRole 修改SysRole对象 +func (e *SysRole) UpdateSysRole(c *system.SysRole) error { + var err error + var data system.SysRole + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// RemoveSysRole 删除SysRole +func (e *SysRole) RemoveSysRole(d *dto.SysRoleById) error { + var err error + var data system.SysRole + msgID := e.MsgID + + db := e.Orm.Model(&data).Delete(&data, d.GetId()) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} diff --git a/cmd/migrate/migration/version/1610804233204_migrate.go b/cmd/migrate/migration/version/1610804233204_migrate.go new file mode 100644 index 00000000..390515bd --- /dev/null +++ b/cmd/migrate/migration/version/1610804233204_migrate.go @@ -0,0 +1,39 @@ +package version + +import ( + "go-admin/app/admin/models/system" + + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1610804233204Test) +} + +func _1610804233204Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + // TODO: 这里开始写入要变更的内容 + post := system.SysPost{} + err := tx.Model(&post).Where("status = ?", 0).Update("status", 2).Error + if err != nil { + return err + } + + role := system.SysRole{} + err = tx.Model(&role).Where("status = ?", 0).Update("status", 2).Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/common/dto/order.go b/common/dto/order.go new file mode 100644 index 00000000..25455fbe --- /dev/null +++ b/common/dto/order.go @@ -0,0 +1,12 @@ +package dto + +import ( + "gorm.io/gorm" + "gorm.io/gorm/clause" +) + +func OrderDest(sort string, bl bool) func(db *gorm.DB) *gorm.DB { + return func(db *gorm.DB) *gorm.DB { + return db.Order(clause.OrderByColumn{Column: clause.Column{Name: sort}, Desc: bl}) + } +} From 128739f09736321b079177940a38173513f3a60b Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Wed, 20 Jan 2021 00:31:52 +0800 Subject: [PATCH 075/201] =?UTF-8?q?=E4=BC=98=E5=8C=96response=E7=BB=93?= =?UTF-8?q?=E6=9E=84=20=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97writer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- go.mod | 2 +- go.sum | 19 +++++++++++++------ pkg/logger/logger.go | 3 ++- pkg/logger/setup.go | 7 +++---- tools/app/model.go | 12 ++++++------ tools/app/return.go | 10 +++++----- 7 files changed, 32 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ff1570b..8f4facd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.cn-shanghai.aliyuncs.com/lwmeng/golang:alpine as builder +FROM golang:alpine as builder MAINTAINER lwnmengjing @@ -15,7 +15,7 @@ RUN pwd && ls RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -a -installsuffix cgo -o go-admin . -FROM registry.cn-shanghai.aliyuncs.com/lwmeng/alpine +FROM alpine COPY --from=builder /go/release/go-admin / diff --git a/go.mod b/go.mod index fce79ee4..4d6665a0 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.3-0.20201220113221-2cfd5dffb397 + github.com/go-admin-team/go-admin-core v1.2.3-0.20210119162352-941321145a99 github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 diff --git a/go.sum b/go.sum index 9ebdda74..3fbc56eb 100644 --- a/go.sum +++ b/go.sum @@ -166,8 +166,8 @@ github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwv github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.3-0.20201220113221-2cfd5dffb397 h1:UoEF/o3iL/KQkMnvIQT4u7IhHjG51vxb7gXJVJY1dCU= -github.com/go-admin-team/go-admin-core v1.2.3-0.20201220113221-2cfd5dffb397/go.mod h1:EsJra0ae2d6rsV2lqSf4srzyFTW4OV2ME7UXXVbYE3s= +github.com/go-admin-team/go-admin-core v1.2.3-0.20210119162352-941321145a99 h1:oOdKx+5NCTzivBcF6X7AoIWJdwxn8PXoKOuLynw+EPA= +github.com/go-admin-team/go-admin-core v1.2.3-0.20210119162352-941321145a99/go.mod h1:fWE/Bf2hDggmyIrRmN+2wI3kZCE6J1yo8cPa1kmv58s= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -649,6 +649,7 @@ github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4m github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -721,6 +722,7 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -752,8 +754,9 @@ golang.org/x/net v0.0.0-20191027093000-83d349e8ac1a/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -763,6 +766,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -805,8 +809,9 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -849,14 +854,16 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b h1:zSzQJAznWxAh9fZxiPy2FZo+ZZEYoYFYYDYdOrU7AaM= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39 h1:BTs2GMGSMWpgtCpv1CE7vkJTv7XcHdcLLnAMu7UbgTY= +golang.org/x/tools v0.0.0-20210115202250-e0d201561e39/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index 452652b0..c1bae33d 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -1,8 +1,9 @@ package logger import ( - "github.com/go-admin-team/go-admin-core/logger" "os" + + "github.com/go-admin-team/go-admin-core/logger" ) // Logger 通用log个性化实现 diff --git a/pkg/logger/setup.go b/pkg/logger/setup.go index 2ff45d1d..36670b70 100644 --- a/pkg/logger/setup.go +++ b/pkg/logger/setup.go @@ -11,17 +11,16 @@ import ( // SetupLogger 日志 func SetupLogger(path string, prefix string) logger.Logger { var setLogger logger.Logger - prefix = "[" + prefix + "] " if !tools.PathExist(path) { err := tools.PathCreate(path) if err != nil { - log.Fatal("create dir error: %s", err.Error()) + log.Fatalf("create dir error: %s", err.Error()) } } - output, err := writer.NewFileWriter(path, prefix, "log") + output, err := writer.NewFileWriter(path, "log") if err != nil { log.Fatal("%s logger setup error: %s", prefix, err.Error()) } - setLogger = logger.NewHelper(logger.NewLogger(logger.WithOutput(output))) + setLogger = logger.NewHelper(logger.NewLogger(logger.WithOutput(output), logger.WithName(prefix))) return setLogger } diff --git a/tools/app/model.go b/tools/app/model.go index 0f88de43..e9ef870c 100644 --- a/tools/app/model.go +++ b/tools/app/model.go @@ -1,13 +1,13 @@ package app +import ( + pbErrors "github.com/go-admin-team/go-admin-core/errors" +) + type Response struct { - // 代码 - Code int `json:"code" example:"200"` + pbErrors.Error // 数据集 Data interface{} `json:"data"` - // 消息 - Msg string `json:"msg"` - RequestId string `json:"requestId"` } type Page struct { @@ -22,7 +22,7 @@ func (res *Response) ReturnOK() *Response { return res } -func (res *Response) ReturnError(code int) *Response { +func (res *Response) ReturnError(code int32) *Response { res.Code = code return res } diff --git a/tools/app/return.go b/tools/app/return.go index bd92e256..f9240d6e 100644 --- a/tools/app/return.go +++ b/tools/app/return.go @@ -2,16 +2,16 @@ package app import ( "encoding/json" - "go-admin/common/log" "net/http" "github.com/gin-gonic/gin" + "go-admin/common/log" "go-admin/tools" ) // 失败数据处理 -func Error(c *gin.Context, code int, err error, msg string) { +func Error(c *gin.Context, code int32, err error, msg string) { msgID := tools.GenerateMsgIDFromContext(c) var res Response if err != nil { @@ -27,7 +27,7 @@ func Error(c *gin.Context, code int, err error, msg string) { if err != nil { log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) } - c.Set("result",string(jsonStr)) + c.Set("result", string(jsonStr)) c.AbortWithStatusJSON(http.StatusOK, Return) } @@ -46,7 +46,7 @@ func OK(c *gin.Context, data interface{}, msg string) { if err != nil { log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) } - c.Set("result",string(jsonStr)) + c.Set("result", string(jsonStr)) c.AbortWithStatusJSON(http.StatusOK, Return) } @@ -69,6 +69,6 @@ func Custum(c *gin.Context, data gin.H) { if err != nil { log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) } - c.Set("result",string(jsonStr)) + c.Set("result", string(jsonStr)) c.AbortWithStatusJSON(http.StatusOK, Return) } From f67e653abee77a23dfd74281fa76cc87cc8f6ee8 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 29 Jan 2021 14:53:52 +0800 Subject: [PATCH 076/201] =?UTF-8?q?=E6=95=B4=E7=90=86requestId=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=85=BC=E5=AE=B9istio=E7=9A=84header?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/utils.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tools/utils.go b/tools/utils.go index 3313e304..4dabe713 100644 --- a/tools/utils.go +++ b/tools/utils.go @@ -3,17 +3,17 @@ package tools import ( "errors" "fmt" - "gorm.io/gorm" "log" "runtime" "strconv" "github.com/gin-gonic/gin" - "github.com/google/uuid" - "github.com/spf13/cast" "golang.org/x/crypto/bcrypt" + "gorm.io/gorm" ) +const TrafficKey = "X-Request-Id" + func CompareHashAndPassword(e string, p string) (bool, error) { err := bcrypt.CompareHashAndPassword([]byte(e), []byte(p)) if err != nil { @@ -56,15 +56,12 @@ func HasError(err error, msg string, code ...int) { // GenerateMsgIDFromContext 生成msgID func GenerateMsgIDFromContext(c *gin.Context) string { - var msgID string - data, ok := c.Get("msgID") - if !ok { - msgID = uuid.New().String() - c.Set("msgID", msgID) - return msgID + requestId := c.GetHeader(TrafficKey) + if requestId == "" { + fmt.Println("no", requestId) + c.Header(TrafficKey, requestId) } - msgID = cast.ToString(data) - return msgID + return requestId } // GetOrm 获取orm连接 From 7ce090af38f3a90a5f59f23fb95e8742ac28f80d Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 5 Feb 2021 10:24:11 +0800 Subject: [PATCH 077/201] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/utils.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/utils.go b/tools/utils.go index 4dabe713..9eafa6d5 100644 --- a/tools/utils.go +++ b/tools/utils.go @@ -58,7 +58,6 @@ func HasError(err error, msg string, code ...int) { func GenerateMsgIDFromContext(c *gin.Context) string { requestId := c.GetHeader(TrafficKey) if requestId == "" { - fmt.Println("no", requestId) c.Header(TrafficKey, requestId) } return requestId From 981e992f28bb62eb59f976f4dde2ea6ba65275d7 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 5 Feb 2021 10:30:48 +0800 Subject: [PATCH 078/201] =?UTF-8?q?=E4=B8=8D=E5=85=A8=E5=A4=9A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9A=84=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/utils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/utils.go b/tools/utils.go index 9eafa6d5..13823a18 100644 --- a/tools/utils.go +++ b/tools/utils.go @@ -8,6 +8,7 @@ import ( "strconv" "github.com/gin-gonic/gin" + "github.com/google/uuid" "golang.org/x/crypto/bcrypt" "gorm.io/gorm" ) @@ -58,6 +59,7 @@ func HasError(err error, msg string, code ...int) { func GenerateMsgIDFromContext(c *gin.Context) string { requestId := c.GetHeader(TrafficKey) if requestId == "" { + requestId = uuid.New().String() c.Header(TrafficKey, requestId) } return requestId From a24c31c6b9e3fbea759dd852c750556fb0acdbc2 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 19 Feb 2021 10:01:45 +0800 Subject: [PATCH 079/201] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E3=80=81=E8=A7=92=E8=89=B2=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/sys_meun.go | 70 +++++++++---------- app/admin/models/system/sys_role.go | 6 +- .../version/1613697961697_migrate.go | 46 ++++++++++++ 3 files changed, 84 insertions(+), 38 deletions(-) create mode 100644 cmd/migrate/migration/version/1613697961697_migrate.go diff --git a/app/admin/models/sys_meun.go b/app/admin/models/sys_meun.go index 8adeca4c..b5343cb8 100644 --- a/app/admin/models/sys_meun.go +++ b/app/admin/models/sys_meun.go @@ -3,46 +3,46 @@ package models import "go-admin/common/models" type SysMenu struct { - MenuId int `json:"menuId" gorm:"primary_key;AUTO_INCREMENT"` - MenuName string `json:"menuName" gorm:"size:128;"` - Title string `json:"title" gorm:"size:128;"` - Icon string `json:"icon" gorm:"size:128;"` - Path string `json:"path" gorm:"size:128;"` - Paths string `json:"paths" gorm:"size:128;"` - MenuType string `json:"menuType" gorm:"size:1;"` - Action string `json:"action" gorm:"size:16;"` - Permission string `json:"permission" gorm:"size:255;"` - ParentId int `json:"parentId" gorm:"size:11;"` - NoCache bool `json:"noCache" gorm:"size:8;"` - Breadcrumb string `json:"breadcrumb" gorm:"size:255;"` - Component string `json:"component" gorm:"size:255;"` - Sort int `json:"sort" gorm:"size:4;"` - Visible string `json:"visible" gorm:"size:1;"` - IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"` + MenuId int `json:"menuId" gorm:"primary_key;AUTO_INCREMENT"` + MenuName string `json:"menuName" gorm:"size:128;"` + Title string `json:"title" gorm:"size:128;"` + Icon string `json:"icon" gorm:"size:128;"` + Path string `json:"path" gorm:"size:128;"` + Paths string `json:"paths" gorm:"size:128;"` + MenuType string `json:"menuType" gorm:"size:1;"` + Action string `json:"action" gorm:"size:16;"` + Permission string `json:"permission" gorm:"size:255;"` + ParentId int `json:"parentId" gorm:"size:11;"` + NoCache bool `json:"noCache" gorm:"size:8;"` + Breadcrumb string `json:"breadcrumb" gorm:"size:255;"` + Component string `json:"component" gorm:"size:255;"` + Sort int `json:"sort" gorm:"size:4;"` + Visible string `json:"visible" gorm:"size:1;"` + IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"` + DataScope string `json:"dataScope" gorm:"-"` + Params string `json:"params" gorm:"-"` + RoleId int `gorm:"-"` + Children []SysMenu `json:"children" gorm:"-"` + IsSelect bool `json:"is_select" gorm:"-"` models.ControlBy models.ModelTime - DataScope string `json:"dataScope" gorm:"-"` - Params string `json:"params" gorm:"-"` - RoleId int `gorm:"-"` - Children []SysMenu `json:"children" gorm:"-"` - IsSelect bool `json:"is_select" gorm:"-"` } type SysMenus struct { - MenuId int `json:"menuId" gorm:"column:menu_id;primary_key;"` - MenuName string `json:"menuName" gorm:"column:menu_name"` - Title string `json:"title" gorm:"column:title"` - Icon string `json:"icon" gorm:"column:icon"` - Path string `json:"path" gorm:"column:path"` - MenuType string `json:"menuType" gorm:"column:menu_type"` - Action string `json:"action" gorm:"column:action"` - Permission string `json:"permission" gorm:"column:permission"` - ParentId int `json:"parentId" gorm:"column:parent_id"` - NoCache bool `json:"noCache" gorm:"column:no_cache"` - Breadcrumb string `json:"breadcrumb" gorm:"column:breadcrumb"` - Component string `json:"component" gorm:"column:component"` - Sort int `json:"sort" gorm:"column:sort"` - Visible string `json:"visible" gorm:"column:visible"` + MenuId int `json:"menuId" gorm:"column:menu_id;primary_key;"` + MenuName string `json:"menuName" gorm:"column:menu_name"` + Title string `json:"title" gorm:"column:title"` + Icon string `json:"icon" gorm:"column:icon"` + Path string `json:"path" gorm:"column:path"` + MenuType string `json:"menuType" gorm:"column:menu_type"` + Action string `json:"action" gorm:"column:action"` + Permission string `json:"permission" gorm:"column:permission"` + ParentId int `json:"parentId" gorm:"column:parent_id"` + NoCache bool `json:"noCache" gorm:"column:no_cache"` + Breadcrumb string `json:"breadcrumb" gorm:"column:breadcrumb"` + Component string `json:"component" gorm:"column:component"` + Sort int `json:"sort" gorm:"column:sort"` + Visible string `json:"visible" gorm:"column:visible"` Children []SysMenu `json:"children" gorm:"-"` models.ControlBy models.ModelTime diff --git a/app/admin/models/system/sys_role.go b/app/admin/models/system/sys_role.go index b3c1482a..4588da82 100644 --- a/app/admin/models/system/sys_role.go +++ b/app/admin/models/system/sys_role.go @@ -12,11 +12,11 @@ type SysRole struct { Remark string `json:"remark" gorm:"size:255;"` //备注 Admin bool `json:"admin" gorm:"size:4;"` DataScope string `json:"dataScope" gorm:"size:128;"` + Params string `json:"params" gorm:"-"` + MenuIds []int `json:"menuIds" gorm:"-"` + DeptIds []int `json:"deptIds" gorm:"-"` models.ControlBy models.ModelTime - Params string `json:"params" gorm:"-"` - MenuIds []int `json:"menuIds" gorm:"-"` - DeptIds []int `json:"deptIds" gorm:"-"` } func (SysRole) TableName() string { diff --git a/cmd/migrate/migration/version/1613697961697_migrate.go b/cmd/migrate/migration/version/1613697961697_migrate.go new file mode 100644 index 00000000..8a47c938 --- /dev/null +++ b/cmd/migrate/migration/version/1613697961697_migrate.go @@ -0,0 +1,46 @@ +package version + +import ( + "go-admin/app/admin/models" + "go-admin/app/admin/models/system" + + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613697961697Test) +} + +func _1613697961697Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + //修改字段类型 + err := tx.Migrator().AlterColumn(&models.SysMenu{}, "create_by") + if err != nil { + return err + } + err = tx.Migrator().AlterColumn(&models.SysMenu{}, "update_by") + if err != nil { + return err + } + + err = tx.Migrator().AlterColumn(&system.SysRole{}, "create_by") + if err != nil { + return err + } + err = tx.Migrator().AlterColumn(&system.SysRole{}, "update_by") + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} From 9186c6ce04f1dc3095b0aae71fa6b040b8a5b33b Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 19 Feb 2021 10:48:27 +0800 Subject: [PATCH 080/201] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/datascope.go | 5 +- .../migration/version/1599190683659_tables.go | 4 +- .../version/1600089797118_migrate.go | 2 +- .../version/1613638159444_migrate.go | 50 +++++++++++++++++++ common/models/by.go | 13 ++--- 5 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 cmd/migrate/migration/version/1613638159444_migrate.go diff --git a/app/admin/models/datascope.go b/app/admin/models/datascope.go index 83702fb8..6e9ad60e 100644 --- a/app/admin/models/datascope.go +++ b/app/admin/models/datascope.go @@ -2,10 +2,9 @@ package models import ( "errors" - "fmt" - "gorm.io/gorm" + "go-admin/common/log" "go-admin/tools" "go-admin/tools/config" ) @@ -21,7 +20,7 @@ func (e *DataPermission) GetDataScope(tbname string, table *gorm.DB) (*gorm.DB, if !config.ApplicationConfig.EnableDP { usageStr := `数据权限已经为您` + tools.Green(`关闭`) + `,如需开启请参考配置文件字段说明` - fmt.Printf("%s\n", usageStr) + log.Debug("%s\n", usageStr) return table, nil } SysUser := new(SysUser) diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 1306553f..d7f18976 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -24,13 +24,13 @@ func _1599190683659Tables(db *gorm.DB, version string) error { new(system.SysConfig), new(tools.SysTables), new(tools.SysColumns), - new(models.Menu), + new(models.SysMenu), new(system.SysLoginLog), new(system.SysOperaLog), new(models.RoleMenu), new(models.SysRoleDept), new(models.SysUser), - new(models.SysRole), + new(system.SysRole), new(models.Post), new(models.DictData), new(models.DictType), diff --git a/cmd/migrate/migration/version/1600089797118_migrate.go b/cmd/migrate/migration/version/1600089797118_migrate.go index d18f2c47..12b603ba 100644 --- a/cmd/migrate/migration/version/1600089797118_migrate.go +++ b/cmd/migrate/migration/version/1600089797118_migrate.go @@ -20,7 +20,7 @@ func _1600089797118Migrate(db *gorm.DB, version string) error { f := &models.SysFileDir{ Label: "根目录", PId: 0, - //Sort: "0", + Sort: "0", Path: "", ControlBy: common.ControlBy{ CreateBy: 1, diff --git a/cmd/migrate/migration/version/1613638159444_migrate.go b/cmd/migrate/migration/version/1613638159444_migrate.go new file mode 100644 index 00000000..b8d4e930 --- /dev/null +++ b/cmd/migrate/migration/version/1613638159444_migrate.go @@ -0,0 +1,50 @@ +package version + +import ( + "go-admin/app/admin/models" + "go-admin/app/admin/models/system" + + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613638159444Test) +} + +func _1613638159444Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + // TODO: 这里开始写入要变更的内容 + + // TODO: 例如 修改表字段 使用过程中请删除此段代码 + err := tx.Migrator().AlterColumn(&system.SysRole{}, "create_by") + if err != nil { + return err + } + err = tx.Migrator().AlterColumn(&system.SysRole{}, "update_by") + if err != nil { + return err + } + + err = tx.Migrator().AlterColumn(&models.SysMenu{}, "update_by") + if err != nil { + return err + } + err = tx.Migrator().AlterColumn(&models.SysMenu{}, "create_by") + if err != nil { + return err + } + + + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/common/models/by.go b/common/models/by.go index 89ad0abb..442fec96 100644 --- a/common/models/by.go +++ b/common/models/by.go @@ -3,8 +3,8 @@ package models import "time" type ControlBy struct { - CreateBy int `gorm:"index;comment:'创建者'"` - UpdateBy int `gorm:"index;comment:'更新者'"` + CreateBy int `json:"createBy" gorm:"index;comment:创建者"` + UpdateBy int `json:"updateBy" gorm:"index;comment:更新者"` } func (e *ControlBy) SetCreateBy(createBy int) { @@ -17,11 +17,12 @@ func (e *ControlBy) SetUpdateBy(updateBy int) { type Model struct { - ID int `gorm:"primaryKey;autoIncrement;comment:'主键编码'"` + ID int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"` } type ModelTime struct { - CreatedAt time.Time `gorm:"comment:'创建时间'"` - UpdatedAt time.Time `gorm:"comment:'最后更新时间'"` - DeletedAt *time.Time `gorm:"index;comment:'删除时间'"` + CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"` + UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"` + DeletedAt *time.Time `json:"-" gorm:"index;comment:删除时间"` } + From e04b5559bda44a0f5cc565fe068d15533eadf36a Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 19 Feb 2021 16:50:57 +0800 Subject: [PATCH 081/201] =?UTF-8?q?=E5=89=8D=E5=90=8E=E7=AB=AF=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/role.go | 6 +- app/admin/models/sys_file_dir.go | 11 +-- app/admin/models/{sys_meun.go => sys_menu.go} | 0 app/admin/models/syscontent.go | 2 +- app/admin/models/system/sys_login_log.go | 23 +++--- app/admin/models/system/sys_opera_log.go | 39 +++++----- app/admin/service/dto/sys_file_dir.go | 4 + app/admin/service/dto/sys_login_log.go | 2 +- app/admin/service/dto/sys_opera_log.go | 4 +- app/admin/service/dto/sys_role.go | 18 +++-- app/admin/service/sys_file_dir.go | 31 ++++---- app/admin/service/sys_login_log.go | 4 +- app/admin/service/sys_opera_log.go | 2 +- app/admin/service/sys_role.go | 1 - .../version/1599190683670_migrate.go | 16 ++-- .../version/1613720892819_migrate.go | 76 +++++++++++++++++++ cmd/migrate/server.go | 4 +- common/dto/generate.go | 4 +- common/models/by.go | 13 ++-- 19 files changed, 176 insertions(+), 84 deletions(-) rename app/admin/models/{sys_meun.go => sys_menu.go} (100%) create mode 100644 cmd/migrate/migration/version/1613720892819_migrate.go diff --git a/app/admin/apis/system/role.go b/app/admin/apis/system/role.go index 8a97c045..b2355647 100644 --- a/app/admin/apis/system/role.go +++ b/app/admin/apis/system/role.go @@ -2,6 +2,7 @@ package system import ( "github.com/gin-gonic/gin" + "go-admin/app/admin/service/dto" "go-admin/app/admin/models" "go-admin/common/global" @@ -126,9 +127,12 @@ func UpdateRole(c *gin.Context) { func UpdateRoleDataScope(c *gin.Context) { var data models.SysRole + var req dto.RoleDataScopeReq data.UpdateBy = tools.GetUserIdStr(c) - err := c.Bind(&data) + err := c.Bind(&req) tools.HasError(err, "数据解析失败", -1) + data.RoleId = req.RoleId + data.DataScope = req.DataScope result, err := data.Update(data.RoleId) var t models.SysRoleDept diff --git a/app/admin/models/sys_file_dir.go b/app/admin/models/sys_file_dir.go index 7d28a84b..d2f6c9ea 100644 --- a/app/admin/models/sys_file_dir.go +++ b/app/admin/models/sys_file_dir.go @@ -6,10 +6,11 @@ import ( type SysFileDir struct { models.Model - Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 - PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 - Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 - Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 + Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称 + PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录 + Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序 + Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 + Children []SysFileDir `json:"children,omitempty" gorm:"-"` // 下级信息 models.ControlBy models.ModelTime } @@ -22,7 +23,7 @@ type SysFileDirL struct { Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径 models.ControlBy models.ModelTime - Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息 + Children []SysFileDirL `json:"children,omitempty" gorm:"-"` // 下级信息 } func (SysFileDir) TableName() string { /**/ diff --git a/app/admin/models/sys_meun.go b/app/admin/models/sys_menu.go similarity index 100% rename from app/admin/models/sys_meun.go rename to app/admin/models/sys_menu.go diff --git a/app/admin/models/syscontent.go b/app/admin/models/syscontent.go index cfa93026..c68a54bc 100644 --- a/app/admin/models/syscontent.go +++ b/app/admin/models/syscontent.go @@ -106,7 +106,7 @@ func (e *SysContent) Update(id int) (update SysContent, err error) { //参数1:是要修改的数据 //参数2:是修改的数据 - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { + if err = orm.Eloquent.Table(e.TableName()).Model(&update).Where("id = ?", id).Updates(&e).Error; err != nil { return } return diff --git a/app/admin/models/system/sys_login_log.go b/app/admin/models/system/sys_login_log.go index 85719bb9..74cf118c 100644 --- a/app/admin/models/system/sys_login_log.go +++ b/app/admin/models/system/sys_login_log.go @@ -8,18 +8,19 @@ import ( type SysLoginLog struct { models.Model - Username string `json:"username" gorm:"type:varchar(128);comment:用户名"` // - Status string `json:"status" gorm:"type:varchar(4);comment:状态"` // - Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"` // - LoginLocation string `json:"loginLocation" gorm:"type:varchar(255);comment:归属地"` // - Browser string `json:"browser" gorm:"type:varchar(255);comment:浏览器"` // - Os string `json:"os" gorm:"type:varchar(255);comment:系统"` // - Platform string `json:"platform" gorm:"type:varchar(255);comment:固件"` // - LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"` // - Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // - Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"` // + Username string `json:"username" gorm:"type:varchar(128);comment:用户名"` + Status string `json:"status" gorm:"type:varchar(4);comment:状态"` + Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"` + LoginLocation string `json:"loginLocation" gorm:"type:varchar(255);comment:归属地"` + Browser string `json:"browser" gorm:"type:varchar(255);comment:浏览器"` + Os string `json:"os" gorm:"type:varchar(255);comment:系统"` + Platform string `json:"platform" gorm:"type:varchar(255);comment:固件"` + LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"` + Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` + Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"` + CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"` + UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"` models.ControlBy - models.ModelTime } func (SysLoginLog) TableName() string { diff --git a/app/admin/models/system/sys_opera_log.go b/app/admin/models/system/sys_opera_log.go index 5029a2e5..f2384351 100644 --- a/app/admin/models/system/sys_opera_log.go +++ b/app/admin/models/system/sys_opera_log.go @@ -8,26 +8,27 @@ import ( type SysOperaLog struct { models.Model - Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` // - BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` // - BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` // - Method string `json:"method" gorm:"type:varchar(128);comment:函数"` // - RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式"` // - OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"` // - OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"` // - DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"` // - OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"` // - OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"` // - OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"` // - OperParam string `json:"operParam" gorm:"type:varchar(255);comment:请求参数"` // - Status string `json:"status" gorm:"type:varchar(4);comment:操作状态"` // - OperTime time.Time `json:"operTime" gorm:"type:timestamp;comment:操作时间"` // - JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"` // - Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` // - LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` // - UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` // + Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` + BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` + BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` + Method string `json:"method" gorm:"type:varchar(128);comment:函数"` + RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式"` + OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"` + OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"` + DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"` + OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"` + OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"` + OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"` + OperParam string `json:"operParam" gorm:"type:varchar(255);comment:请求参数"` + Status string `json:"status" gorm:"type:varchar(4);comment:操作状态"` + OperTime time.Time `json:"operTime" gorm:"type:timestamp;comment:操作时间"` + JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"` + Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` + LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` + UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` + CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"` + UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"` models.ControlBy - models.ModelTime } func (SysOperaLog) TableName() string { diff --git a/app/admin/service/dto/sys_file_dir.go b/app/admin/service/dto/sys_file_dir.go index 4f9655c1..01be4cc6 100644 --- a/app/admin/service/dto/sys_file_dir.go +++ b/app/admin/service/dto/sys_file_dir.go @@ -74,6 +74,10 @@ func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) { PId: s.PId, //Sort: s.Sort, Path: s.Path, + ControlBy: common.ControlBy{ + CreateBy: s.CreateBy, + UpdateBy: s.UpdateBy, + }, }, nil } diff --git a/app/admin/service/dto/sys_login_log.go b/app/admin/service/dto/sys_login_log.go index e9ad0576..62ec6818 100644 --- a/app/admin/service/dto/sys_login_log.go +++ b/app/admin/service/dto/sys_login_log.go @@ -96,7 +96,7 @@ func (s *SysLoginLogById) Bind(ctx *gin.Context) error { log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) return err } - err = ctx.ShouldBind(s) + err = ctx.ShouldBind(&s.Ids) if err != nil { log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) } diff --git a/app/admin/service/dto/sys_opera_log.go b/app/admin/service/dto/sys_opera_log.go index 34155b2f..b9cf977c 100644 --- a/app/admin/service/dto/sys_opera_log.go +++ b/app/admin/service/dto/sys_opera_log.go @@ -118,7 +118,7 @@ func (s *SysOperaLogById) Bind(ctx *gin.Context) error { log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) return err } - err = ctx.ShouldBind(s) + err = ctx.ShouldBind(&s.Ids) if err != nil { log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) } @@ -126,5 +126,5 @@ func (s *SysOperaLogById) Bind(ctx *gin.Context) error { } func (s *SysOperaLogById) SetUpdateBy(id int) { - + } diff --git a/app/admin/service/dto/sys_role.go b/app/admin/service/dto/sys_role.go index 26effbeb..40e5022f 100644 --- a/app/admin/service/dto/sys_role.go +++ b/app/admin/service/dto/sys_role.go @@ -42,7 +42,7 @@ func (m *SysRoleSearch) Bind(ctx *gin.Context) error { // SysConfigControl 增、改使用的结构体 type SysRoleControl struct { - RoleId int `uri:"roleId" comment:"角色编码"` // 角色编码 + RoleId int `uri:"id" comment:"角色编码"` // 角色编码 RoleName string `form:"roleName" comment:"角色名称"` // 角色名称 Status string `form:"status" comment:"状态"` // 状态 RoleKey string `form:"roleKey" comment:"角色代码"` // 角色代码 @@ -56,15 +56,15 @@ type SysRoleControl struct { // Bind 映射上下文中的结构体数据 func (s *SysRoleControl) Bind(ctx *gin.Context) error { msgID := tools.GenerateMsgIDFromContext(ctx) - err := ctx.ShouldBindUri(s) + err := ctx.ShouldBindBodyWith(s, binding.JSON) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + err = ctx.ShouldBindUri(s) if err != nil { log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) return err } - err = ctx.ShouldBindBodyWith(s, binding.JSON) - if err != nil { - log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) - } var jsonStr []byte jsonStr, err = json.Marshal(s) if err != nil { @@ -126,3 +126,9 @@ func (s *SysRoleById) Bind(ctx *gin.Context) error { func (s *SysRoleById) GenerateM() (*models.SysRole, error) { return &models.SysRole{}, nil } + +// RoleDataScopeReq 角色数据权限修改 +type RoleDataScopeReq struct { + RoleId int `json:"roleId" binding:"required"` + DataScope string `json:"dataScope" binding:"required"` +} diff --git a/app/admin/service/sys_file_dir.go b/app/admin/service/sys_file_dir.go index b0690bf4..e7267e86 100644 --- a/app/admin/service/sys_file_dir.go +++ b/app/admin/service/sys_file_dir.go @@ -2,13 +2,13 @@ package service import ( "errors" + "fmt" "go-admin/app/admin/models" "go-admin/app/admin/service/dto" "go-admin/common/actions" cDto "go-admin/common/dto" "go-admin/common/log" "go-admin/common/service" - "go-admin/tools" "gorm.io/gorm" ) @@ -59,31 +59,30 @@ func (e *SysFileDir) GetSysFileDir(d cDto.Control, model *models.SysFileDir) err // InsertSysFileDir 创建SysFileDir对象 func (e *SysFileDir) InsertSysFileDir(model *dto.SysFileDirControl) error { var err error - var data models.SysFileDir + data, _ := model.GenerateM() + msgID := e.MsgID - db := e.Orm.Model(&data). - Create(model) - if db.Error != nil { + err = e.Orm.Create(data).Error + if err != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) return err } - id := model.GetId() - path := "/" + tools.IntToString(id.(int)) - db = e.Orm.Model(&data). - First(&data, model.GetId()) - err = db.Error + path := fmt.Sprintf("/%d", model.ID) + //db = e.Orm.Model(&data). + // First(&data, model.GetId()) + //err = db.Error - if data.PId != 0 { + if model.PId != 0 { var dept models.SysFileDir - e.Orm.Model(&data).Where("id = ?", data.PId).First(&dept) + e.Orm.Model(&models.SysFileDir{}).Where("id = ?", model.PId).First(&dept) path = dept.Path + path } else { path = "/0" + path } //var mp = map[string]string{} //mp["path"] = path - if err := e.Orm.Model(&data).Where("id = ?", data.ID).Update("path", path).Error; err != nil { + if err := e.Orm.Model(&models.SysFileDir{}).Where("id = ?", model.ID).Update("path", path).Error; err != nil { return err } @@ -93,13 +92,13 @@ func (e *SysFileDir) InsertSysFileDir(model *dto.SysFileDirControl) error { // UpdateSysFileDir 修改SysFileDir对象 func (e *SysFileDir) UpdateSysFileDir(c *dto.SysFileDirControl, p *actions.DataPermission) error { var err error - var data models.SysFileDir + data, _ := c.GenerateM() msgID := e.MsgID - db := e.Orm.Model(&data). + db := e.Orm. Scopes( actions.Permission(data.TableName(), p), - ).Where(c.ID).Updates(c) + ).Where(c.ID).Updates(data) if db.Error != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) return err diff --git a/app/admin/service/sys_login_log.go b/app/admin/service/sys_login_log.go index dc6ccd62..69064d6d 100644 --- a/app/admin/service/sys_login_log.go +++ b/app/admin/service/sys_login_log.go @@ -97,7 +97,7 @@ func (e *SysLoginLog) RemoveSysLoginLog(d *dto.SysLoginLogById, c common.ActiveR msgID := e.MsgID db := e.Orm.Model(&data). - Where(d.GetId()).Delete(c) + Where(d.Ids).Delete(c) if db.Error != nil { err = db.Error log.Errorf("MsgID[%s] Delete error: %s", msgID, err) @@ -108,4 +108,4 @@ func (e *SysLoginLog) RemoveSysLoginLog(d *dto.SysLoginLogById, c common.ActiveR return err } return nil -} \ No newline at end of file +} diff --git a/app/admin/service/sys_opera_log.go b/app/admin/service/sys_opera_log.go index 7bcd9997..c14f80da 100644 --- a/app/admin/service/sys_opera_log.go +++ b/app/admin/service/sys_opera_log.go @@ -95,7 +95,7 @@ func (e *SysOperaLog) RemoveSysOperaLog(d *dto.SysOperaLogById) error { var data system.SysOperaLog msgID := e.MsgID - db := e.Orm.Model(&data).Delete(&data, d.GetId()) + db := e.Orm.Model(&data).Where(d.Ids).Delete(&data) if db.Error != nil { err = db.Error log.Errorf("MsgID[%s] Delete error: %s", msgID, err) diff --git a/app/admin/service/sys_role.go b/app/admin/service/sys_role.go index 637004eb..599661d8 100644 --- a/app/admin/service/sys_role.go +++ b/app/admin/service/sys_role.go @@ -84,7 +84,6 @@ func (e *SysRole) UpdateSysRole(c *system.SysRole) error { } if db.RowsAffected == 0 { return errors.New("无权更新该数据") - } return nil } diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index 9763e5c4..c5cf05e3 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -21,17 +21,17 @@ func _1599190683670Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { list3 := []models.SysDept{ - {DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 8, ParentId: 1, DeptPath: "/0/1/8", DeptName: "运维部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 9, ParentId: 1, DeptPath: "/0/1/9", DeptName: "客服部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, - {DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", ControlBy:common.ControlBy{ CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 8, ParentId: 1, DeptPath: "/0/1/8", DeptName: "运维部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 9, ParentId: 1, DeptPath: "/0/1/9", DeptName: "客服部", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "2", ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, + {DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, } list4 := []system.SysConfig{ - {Model: common.Model{ID: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: nil}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"}, - {Model: common.Model{ID: 2}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: nil}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"}, - {Model: common.Model{ID: 3}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: nil}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"}, + {Model: common.Model{ID: 1}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"}, + {Model: common.Model{ID: 2}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"}, + {Model: common.Model{ID: 3}, ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"}, } list5 := []models.Post{ diff --git a/cmd/migrate/migration/version/1613720892819_migrate.go b/cmd/migrate/migration/version/1613720892819_migrate.go new file mode 100644 index 00000000..66bf690b --- /dev/null +++ b/cmd/migrate/migration/version/1613720892819_migrate.go @@ -0,0 +1,76 @@ +package version + +import ( + "go-admin/app/admin/models" + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613720892819Test) +} + +func _1613720892819Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + // TODO: 这里开始写入要变更的内容 + t := &models.DictType{ + DictName: "内容状态", + DictType: "sys_content_status", + Status: "2", + CreateBy: "1", + UpdateBy: "1", + } + err := tx.Create(t).Error + if err != nil { + return err + } + + data := make([]models.DictData, 2) + data[0] = models.DictData{ + DictSort: 0, + DictLabel: "正常", + DictValue: "1", + DictType: "sys_content_status", + Status: "1", + CreateBy: "1", + UpdateBy: "1", + } + data[1] = models.DictData{ + DictSort: 1, + DictLabel: "禁用", + DictValue: "2", + DictType: "sys_content_status", + Status: "1", + CreateBy: "1", + UpdateBy: "1", + } + err = tx.Create(data).Error + if err != nil { + return err + } + + // TODO: 例如 修改表字段 使用过程中请删除此段代码 + //err := tx.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id") + //if err != nil { + // return err + //} + + // TODO: 例如 新增表结构 使用过程中请删除此段代码 + //err = tx.Debug().Migrator().AutoMigrate( + // new(models.CasbinRule), + // ) + //if err != nil { + // return err + //} + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index 0cd27d5f..99da7ead 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -42,10 +42,9 @@ func init() { } func run() { - usage := `start init` - fmt.Println(usage) if !generate { + fmt.Println(`start init`) //1. 读取配置 config.Setup(file.NewSource, file.WithPath(configYml)) //2. 设置日志 @@ -54,6 +53,7 @@ func run() { global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request") _ = initDB() } else { + fmt.Println(`generate migration file`) _ = genFile() } } diff --git a/common/dto/generate.go b/common/dto/generate.go index f8f7d6c0..ec70b9b4 100644 --- a/common/dto/generate.go +++ b/common/dto/generate.go @@ -13,7 +13,7 @@ type ObjectById struct { func (s *ObjectById) Bind(ctx *gin.Context) error { if ctx.Request.Method == http.MethodDelete { - err := ctx.Bind(s) + err := ctx.ShouldBind(&s.Ids) if err != nil { return err } @@ -21,7 +21,7 @@ func (s *ObjectById) Bind(ctx *gin.Context) error { return nil } } - return ctx.BindUri(s) + return ctx.ShouldBindUri(s) } func (s *ObjectById) GetId() interface{} { diff --git a/common/models/by.go b/common/models/by.go index 442fec96..48e31adb 100644 --- a/common/models/by.go +++ b/common/models/by.go @@ -1,6 +1,9 @@ package models -import "time" +import ( + "gorm.io/gorm" + "time" +) type ControlBy struct { CreateBy int `json:"createBy" gorm:"index;comment:创建者"` @@ -15,14 +18,12 @@ func (e *ControlBy) SetUpdateBy(updateBy int) { e.UpdateBy = updateBy } - type Model struct { ID int `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"` } type ModelTime struct { - CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"` - UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"` - DeletedAt *time.Time `json:"-" gorm:"index;comment:删除时间"` + CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"` + UpdatedAt time.Time `json:"updatedAt" gorm:"comment:最后更新时间"` + DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:删除时间"` } - From 4979fd659f01c804f33cc2e9f4e405232df1a569 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Sat, 20 Feb 2021 11:06:59 +0800 Subject: [PATCH 082/201] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/dict/dictdata.go | 154 ----------- app/admin/apis/system/dict/dicttype.go | 137 --------- app/admin/apis/system/dict/sys_dict_data.go | 253 +++++++++++++++++ app/admin/apis/system/dict/sys_dict_type.go | 261 ++++++++++++++++++ app/admin/models/dictdata.go | 168 ----------- app/admin/models/dicttype.go | 152 ---------- app/admin/models/system/sys_dict_data.go | 35 +++ app/admin/models/system/sys_dict_type.go | 29 ++ app/admin/router/sysrouter.go | 26 +- app/admin/service/dto/sys_dict_data.go | 126 +++++++++ app/admin/service/dto/sys_dict_type.go | 96 +++++++ app/admin/service/sys_dict_data.go | 130 +++++++++ app/admin/service/sys_dict_type.go | 130 +++++++++ .../migration/version/1599190683659_tables.go | 4 +- .../version/1599190683670_migrate.go | 4 +- .../version/1606579402398_migrate.go | 4 +- .../version/1606582844753_migrate.go | 2 +- .../version/1613720892819_migrate.go | 9 +- .../version/1613783303115_migrate.go | 45 +++ cmd/migrate/migration/version/dictdata.go | 26 ++ cmd/migrate/migration/version/dicttype.go | 20 ++ 21 files changed, 1176 insertions(+), 635 deletions(-) delete mode 100644 app/admin/apis/system/dict/dictdata.go delete mode 100644 app/admin/apis/system/dict/dicttype.go create mode 100644 app/admin/apis/system/dict/sys_dict_data.go create mode 100644 app/admin/apis/system/dict/sys_dict_type.go delete mode 100644 app/admin/models/dictdata.go delete mode 100644 app/admin/models/dicttype.go create mode 100644 app/admin/models/system/sys_dict_data.go create mode 100644 app/admin/models/system/sys_dict_type.go create mode 100644 app/admin/service/dto/sys_dict_data.go create mode 100644 app/admin/service/dto/sys_dict_type.go create mode 100644 app/admin/service/sys_dict_data.go create mode 100644 app/admin/service/sys_dict_type.go create mode 100644 cmd/migrate/migration/version/1613783303115_migrate.go create mode 100644 cmd/migrate/migration/version/dictdata.go create mode 100644 cmd/migrate/migration/version/dicttype.go diff --git a/app/admin/apis/system/dict/dictdata.go b/app/admin/apis/system/dict/dictdata.go deleted file mode 100644 index bd58b907..00000000 --- a/app/admin/apis/system/dict/dictdata.go +++ /dev/null @@ -1,154 +0,0 @@ -package dict - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" -) - -// @Summary 字典数据列表 -// @Description 获取JSON -// @Tags 字典数据 -// @Param status query string false "status" -// @Param dictCode query string false "dictCode" -// @Param dictType query string false "dictType" -// @Param pageSize query int false "页条数" -// @Param pageIndex query int false "页码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/dict/data/list [get] -// @Security Bearer -func GetDictDataList(c *gin.Context) { - var data models.DictData - var err error - var pageSize = 10 - var pageIndex = 1 - - if size := c.Request.FormValue("pageSize"); size != "" { - pageSize, err = tools.StringToInt(size) - } - - if index := c.Request.FormValue("pageIndex"); index != "" { - pageIndex, err = tools.StringToInt(index) - } - - data.DictLabel = c.Request.FormValue("dictLabel") - data.Status = c.Request.FormValue("status") - data.DictType = c.Request.FormValue("dictType") - id := c.Request.FormValue("dictCode") - data.DictCode, _ = tools.StringToInt(id) - data.DataScope = tools.GetUserIdStr(c) - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - var mp = make(map[string]interface{}, 3) - mp["list"] = result - mp["count"] = count - mp["pageIndex"] = pageIndex - mp["pageSize"] = pageSize - - var res app.Response - res.Data = mp - - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 通过编码获取字典数据 -// @Description 获取JSON -// @Tags 字典数据 -// @Param dictCode path int true "字典编码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/dict/data/{dictCode} [get] -// @Security Bearer -func GetDictData(c *gin.Context) { - var DictData models.DictData - DictData.DictLabel = c.Request.FormValue("dictLabel") - DictData.DictCode, _ = tools.StringToInt(c.Param("dictCode")) - result, err := DictData.GetByCode() - tools.HasError(err, "抱歉未找到相关信息", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 通过字典类型获取字典数据 -// @Description 获取JSON -// @Tags 字典数据 -// @Param dictType path int true "dictType" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/dict/databyType/{dictType} [get] -// @Security Bearer -func GetDictDataByDictType(c *gin.Context) { - var DictData models.DictData - DictData.DictType = c.Param("dictType") - result, err := DictData.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 添加字典数据 -// @Description 获取JSON -// @Tags 字典数据 -// @Accept application/json -// @Product application/json -// @Param data body models.DictType true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/dict/data [post] -// @Security Bearer -func InsertDictData(c *gin.Context) { - var data models.DictData - err := c.ShouldBindJSON(&data) - data.CreateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 修改字典数据 -// @Description 获取JSON -// @Tags 字典数据 -// @Accept application/json -// @Product application/json -// @Param data body models.DictType true "body" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/dict/data [put] -// @Security Bearer -func UpdateDictData(c *gin.Context) { - var data models.DictData - err := c.BindWith(&data, binding.JSON) - data.UpdateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", -1) - result, err := data.Update(data.DictCode) - tools.HasError(err, "", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 删除字典数据 -// @Description 删除数据 -// @Tags 字典数据 -// @Param dictCode path int true "dictCode" -// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" -// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" -// @Router /api/v1/dict/data/{dictCode} [delete] -func DeleteDictData(c *gin.Context) { - var data models.DictData - data.UpdateBy = tools.GetUserIdStr(c) - IDS := tools.IdsStrToIdsIntGroup("dictCode", c) - result, err := data.BatchDelete(IDS) - tools.HasError(err, "修改失败", 500) - app.OK(c, result, "删除成功") -} diff --git a/app/admin/apis/system/dict/dicttype.go b/app/admin/apis/system/dict/dicttype.go deleted file mode 100644 index 2a09b0e6..00000000 --- a/app/admin/apis/system/dict/dicttype.go +++ /dev/null @@ -1,137 +0,0 @@ -package dict - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/gin-gonic/gin/binding" - - "go-admin/app/admin/models" - "go-admin/tools" - "go-admin/tools/app" -) - -// @Summary 字典类型列表数据 -// @Description 获取JSON -// @Tags 字典类型 -// @Param dictName query string false "dictName" -// @Param dictId query string false "dictId" -// @Param dictType query string false "dictType" -// @Param pageSize query int false "页条数" -// @Param pageIndex query int false "页码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/dict/type/list [get] -// @Security Bearer -func GetDictTypeList(c *gin.Context) { - var data models.DictType - var err error - var pageSize = 10 - var pageIndex = 1 - - if size := c.Request.FormValue("pageSize"); size != "" { - pageSize, err = tools.StringToInt(size) - } - - if index := c.Request.FormValue("pageIndex"); index != "" { - pageIndex, err = tools.StringToInt(index) - } - - data.DictName = c.Request.FormValue("dictName") - id := c.Request.FormValue("dictId") - data.DictId, _ = tools.StringToInt(id) - data.DictType = c.Request.FormValue("dictType") - data.DataScope = tools.GetUserIdStr(c) - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - app.PageOK(c, result, count, pageIndex, pageSize, "") -} - -// @Summary 通过字典id获取字典类型 -// @Description 获取JSON -// @Tags 字典类型 -// @Param dictId path int true "字典类型编码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/dict/type/{dictId} [get] -// @Security Bearer -func GetDictType(c *gin.Context) { - var DictType models.DictType - DictType.DictName = c.Request.FormValue("dictName") - DictType.DictId, _ = tools.StringToInt(c.Param("dictId")) - result, err := DictType.Get() - tools.HasError(err, "抱歉未找到相关信息", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -func GetDictTypeOptionSelect(c *gin.Context) { - var DictType models.DictType - DictType.DictName = c.Request.FormValue("dictName") - DictType.DictId, _ = tools.StringToInt(c.Param("dictId")) - result, err := DictType.GetList() - tools.HasError(err, "抱歉未找到相关信息", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 添加字典类型 -// @Description 获取JSON -// @Tags 字典类型 -// @Accept application/json -// @Product application/json -// @Param data body models.DictType true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/dict/type [post] -// @Security Bearer -func InsertDictType(c *gin.Context) { - var data models.DictType - err := c.BindWith(&data, binding.JSON) - data.CreateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", 500) - result, err := data.Create() - tools.HasError(err, "", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 修改字典类型 -// @Description 获取JSON -// @Tags 字典类型 -// @Accept application/json -// @Product application/json -// @Param data body models.DictType true "body" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/dict/type [put] -// @Security Bearer -func UpdateDictType(c *gin.Context) { - var data models.DictType - err := c.BindWith(&data, binding.JSON) - data.UpdateBy = tools.GetUserIdStr(c) - tools.HasError(err, "", -1) - result, err := data.Update(data.DictId) - tools.HasError(err, "", -1) - var res app.Response - res.Data = result - c.JSON(http.StatusOK, res.ReturnOK()) -} - -// @Summary 删除字典类型 -// @Description 删除数据 -// @Tags 字典类型 -// @Param dictId path int true "dictId" -// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" -// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" -// @Router /api/v1/dict/type/{dictId} [delete] -func DeleteDictType(c *gin.Context) { - var data models.DictType - data.UpdateBy = tools.GetUserIdStr(c) - IDS := tools.IdsStrToIdsIntGroup("dictId", c) - result, err := data.BatchDelete(IDS) - tools.HasError(err, "修改失败", 500) - app.OK(c, result, "删除成功") -} diff --git a/app/admin/apis/system/dict/sys_dict_data.go b/app/admin/apis/system/dict/sys_dict_data.go new file mode 100644 index 00000000..0ddccead --- /dev/null +++ b/app/admin/apis/system/dict/sys_dict_data.go @@ -0,0 +1,253 @@ +package dict + +import ( + "net/http" + + "github.com/gin-gonic/gin" + + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" +) + +type SysDictData struct { + apis.Api +} + +// @Summary 字典数据列表 +// @Description 获取JSON +// @Tags 字典数据 +// @Param status query string false "status" +// @Param dictCode query string false "dictCode" +// @Param dictType query string false "dictType" +// @Param pageSize query int false "页条数" +// @Param pageIndex query int false "页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/dict/data [get] +// @Security Bearer +func (e *SysDictData) GetSysDictDataList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + req := &dto.SysDictDataSearch{} + + //查询列表 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]system.SysDictData, 0) + var count int64 + s := service.SysDictData{} + s.MsgID = msgID + s.Orm = db.Debug() + err = s.GetPage(req, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") +} + +// @Summary 通过编码获取字典数据 +// @Description 获取JSON +// @Tags 字典数据 +// @Param dictCode path int true "字典编码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/dict/data/{dictCode} [get] +// @Security Bearer +func (e *SysDictData) GetSysDictData(c *gin.Context) { + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + req := &dto.SysDictDataById{} + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object system.SysDictData + + s := service.SysDictData{} + s.MsgID = msgID + s.Orm = db + err = s.Get(req, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +// @Summary 添加字典数据 +// @Description 获取JSON +// @Tags 字典数据 +// @Accept application/json +// @Product application/json +// @Param data body system.DictType true "data" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/dict/data [post] +// @Security Bearer +func (e *SysDictData) InsertSysDictData(c *gin.Context) { + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + req := &dto.SysDictDataControl{} + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, _ := req.GenerateM() + // 设置创建人 + object.SetCreateBy(tools.GetUserId(c)) + + s := service.SysDictData{} + s.Orm = db + s.MsgID = msgID + err = s.Insert(object.(*system.SysDictData)) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +// @Summary 修改字典数据 +// @Description 获取JSON +// @Tags 字典数据 +// @Accept application/json +// @Product application/json +// @Param data body models.DictType true "body" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/dict/data/{dictCode} [put] +// @Security Bearer +func (e *SysDictData) UpdateSysDictData(c *gin.Context) { + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + req := &dto.SysDictDataControl{} + //更新操作 + err = req.Bind(c) + if err != nil { + log.Errorf("msgID[%s] request validate error, %s", msgID, err.Error()) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, _ := req.GenerateM() + object.SetUpdateBy(tools.GetUserId(c)) + + s := service.SysDictData{} + s.Orm = db + s.MsgID = msgID + err = s.Update(object.(*system.SysDictData)) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +// @Summary 删除字典数据 +// @Description 删除数据 +// @Tags 字典数据 +// @Param dictCode path int true "dictCode" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/dict/data/{dictCode} [delete] +func (e *SysDictData) DeleteSysDictData(c *gin.Context) { + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + req := new(dto.SysDictDataById) + err = req.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + + // 设置编辑人 + object.SetUpdateBy(tools.GetUserId(c)) + + s := service.SysDictData{} + s.Orm = db + s.MsgID = msgID + err = s.Remove(req, object.(*system.SysDictData)) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "删除成功") +} + +func (e *SysDictData) GetSysDictDataAll(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + req := &dto.SysDictDataSearch{} + + //查询列表 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]system.SysDictData, 0) + s := service.SysDictData{} + s.MsgID = msgID + s.Orm = db + err = s.GetAll(req, &list) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, list, "查询成功") +} diff --git a/app/admin/apis/system/dict/sys_dict_type.go b/app/admin/apis/system/dict/sys_dict_type.go new file mode 100644 index 00000000..9aa5a631 --- /dev/null +++ b/app/admin/apis/system/dict/sys_dict_type.go @@ -0,0 +1,261 @@ +package dict + +import ( + "net/http" + + "github.com/gin-gonic/gin" + + "go-admin/app/admin/models/system" + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/apis" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" +) + +type SysDictType struct { + apis.Api +} + +// @Summary 字典类型列表数据 +// @Description 获取JSON +// @Tags 字典类型 +// @Param dictName query string false "dictName" +// @Param dictId query string false "dictId" +// @Param dictType query string false "dictType" +// @Param pageSize query int false "页条数" +// @Param pageIndex query int false "页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/dict/type [get] +// @Security Bearer +func (e *SysDictType) GetSysDictTypeList(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + req := &dto.SysDictTypeSearch{} + + //查询列表 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]system.SysDictType, 0) + var count int64 + s := service.SysDictType{} + s.MsgID = msgID + s.Orm = db.Debug() + err = s.GetPage(req, &list, &count) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功") +} + +// @Summary 通过字典id获取字典类型 +// @Description 获取JSON +// @Tags 字典类型 +// @Param dictId path int true "字典类型编码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/dict/type/{dictId} [get] +// @Security Bearer +func (e *SysDictType) GetSysDictType(c *gin.Context) { + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //查看详情 + req := &dto.SysDictTypeById{} + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object system.SysDictType + + s := service.SysDictType{} + s.MsgID = msgID + s.Orm = db + err = s.Get(req, &object) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, object, "查看成功") +} + +// @Summary 添加字典类型 +// @Description 获取JSON +// @Tags 字典类型 +// @Accept application/json +// @Product application/json +// @Param data body models.DictType true "data" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/dict/type [post] +// @Security Bearer +func (e *SysDictType) InsertSysDictType(c *gin.Context) { + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //新增操作 + req := &dto.SysDictTypeControl{} + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, _ := req.GenerateM() + // 设置创建人 + object.SetCreateBy(tools.GetUserId(c)) + + s := service.SysDictType{} + s.Orm = db + s.MsgID = msgID + err = s.Insert(object.(*system.SysDictType)) + if err != nil { + log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "创建失败") + return + } + + e.OK(c, object.GetId(), "创建成功") +} + +// @Summary 修改字典类型 +// @Description 获取JSON +// @Tags 字典类型 +// @Accept application/json +// @Product application/json +// @Param data body models.DictType true "body" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/dict/type/{dictId} [put] +// @Security Bearer +func (e *SysDictType) UpdateSysDictType(c *gin.Context) { + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + req := &dto.SysDictTypeControl{} + //更新操作 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + object, _ := req.GenerateM() + object.SetUpdateBy(tools.GetUserId(c)) + + s := service.SysDictType{} + s.Orm = db + s.MsgID = msgID + err = s.Update(object.(*system.SysDictType)) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "更新成功") +} + +// @Summary 删除字典类型 +// @Description 删除数据 +// @Tags 字典类型 +// @Param dictId path int true "dictId" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/dict/type/{dictId} [delete] +func (e *SysDictType) DeleteSysDictType(c *gin.Context) { + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //删除操作 + req := new(dto.SysDictTypeById) + err = req.Bind(c) + if err != nil { + log.Errorf("MsgID[%s] Bind error: %s", msgID, err) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + var object common.ActiveRecord + object, err = req.GenerateM() + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "模型生成失败") + return + } + + // 设置编辑人 + object.SetUpdateBy(tools.GetUserId(c)) + + s := service.SysDictType{} + s.Orm = db + s.MsgID = msgID + err = s.Remove(req, object.(*system.SysDictType)) + if err != nil { + log.Error(err) + return + } + e.OK(c, object.GetId(), "删除成功") +} + +// @Summary 字典类型全部数据 +// @Description 获取JSON +// @Tags 字典类型 +// @Param dictName query string false "dictName" +// @Param dictId query string false "dictId" +// @Param dictType query string false "dictType" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/dict/type-option-select [get] +// @Security Bearer +func (e *SysDictType) GetSysDictTypeAll(c *gin.Context) { + msgID := tools.GenerateMsgIDFromContext(c) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + req := &dto.SysDictTypeSearch{} + + //查询列表 + err = req.Bind(c) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + + list := make([]system.SysDictType, 0) + s := service.SysDictType{} + s.MsgID = msgID + s.Orm = db + err = s.GetAll(req, &list) + if err != nil { + e.Error(c, http.StatusUnprocessableEntity, err, "查询失败") + return + } + + e.OK(c, list, "查询成功") +} diff --git a/app/admin/models/dictdata.go b/app/admin/models/dictdata.go deleted file mode 100644 index 60d6f4f0..00000000 --- a/app/admin/models/dictdata.go +++ /dev/null @@ -1,168 +0,0 @@ -package models - -import ( - "errors" - - orm "go-admin/common/global" - "go-admin/tools" -) - -type DictData struct { - DictCode int `gorm:"primary_key;auto_increment;" json:"dictCode" example:"1"` //字典编码 - DictSort int `gorm:"" json:"dictSort"` //显示顺序 - DictLabel string `gorm:"size:128;" json:"dictLabel"` //数据标签 - DictValue string `gorm:"size:255;" json:"dictValue"` //数据键值 - DictType string `gorm:"size:64;" json:"dictType"` //字典类型 - CssClass string `gorm:"size:128;" json:"cssClass"` // - ListClass string `gorm:"size:128;" json:"listClass"` // - IsDefault string `gorm:"size:8;" json:"isDefault"` // - Status string `gorm:"size:4;" json:"status"` //状态 - Default string `gorm:"size:8;" json:"default"` // - CreateBy string `gorm:"size:64;" json:"createBy"` // - UpdateBy string `gorm:"size:64;" json:"updateBy"` // - Remark string `gorm:"size:255;" json:"remark"` //备注 - BaseModel - - Params string `gorm:"-" json:"params"` - DataScope string `gorm:"-" json:"dataScope"` -} - -func (DictData) TableName() string { - return "sys_dict_data" -} - -func (e *DictData) Create() (DictData, error) { - var doc DictData - - var i int64 - if err := orm.Eloquent.Table(e.TableName()). - Where("dict_type = ?", e.DictType). - Where("dict_label=? or (dict_label=? and dict_value = ?)", e.DictLabel, e.DictLabel, e.DictValue). - Count(&i).Error; err != nil { - return doc, err - } - if i > 0 { - return doc, errors.New("字典标签或者字典键值已经存在!") - } - - result := orm.Eloquent.Table(e.TableName()).Create(&e) - if result.Error != nil { - err := result.Error - return doc, err - } - doc = *e - return doc, nil -} - -func (e *DictData) GetByCode() (DictData, error) { - var doc DictData - - table := orm.Eloquent.Table(e.TableName()) - if e.DictCode != 0 { - table = table.Where("dict_code = ?", e.DictCode) - } - if e.DictLabel != "" { - table = table.Where("dict_label = ?", e.DictLabel) - } - if e.DictType != "" { - table = table.Where("dict_type = ?", e.DictType) - } - - if err := table.First(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -func (e *DictData) Get() ([]DictData, error) { - var doc []DictData - - table := orm.Eloquent.Table(e.TableName()) - if e.DictCode != 0 { - table = table.Where("dict_code = ?", e.DictCode) - } - if e.DictLabel != "" { - table = table.Where("dict_label = ?", e.DictLabel) - } - if e.DictType != "" { - table = table.Where("dict_type = ?", e.DictType) - } - - table = table.Where("status = ?", 2) - - if err := table.Order("dict_sort").Find(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -func (e *DictData) GetPage(pageSize int, pageIndex int) ([]DictData, int, error) { - var doc []DictData - - table := orm.Eloquent.Table(e.TableName()) - if e.DictCode != 0 { - table = table.Where("dict_code = ?", e.DictCode) - } - if e.DictType != "" { - table = table.Where("dict_type = ?", e.DictType) - } - if e.DictLabel != "" { - table = table.Where("dict_label = ?", e.DictLabel) - } - if e.Status != "" { - table = table.Where("status = ?", e.Status) - } - - // 数据权限控制 - dataPermission := new(DataPermission) - dataPermission.UserId, _ = tools.StringToInt(e.DataScope) - table, err := dataPermission.GetDataScope("sys_dict_data", table) - if err != nil { - return nil, 0, err - } - var count int64 - - if err := table.Order("dict_sort").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil { - return nil, 0, err - } - //table.Where("`deleted_at` IS NULL").Count(&count) - return doc, int(count), nil -} - -func (e *DictData) Update(id int) (update DictData, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("dict_code = ?", id).First(&update).Error; err != nil { - return - } - - if e.DictLabel != "" && e.DictLabel != update.DictLabel { - return update, errors.New("标签不允许修改!") - } - - if e.DictValue != "" && e.DictValue != update.DictValue { - return update, errors.New("键值不允许修改!") - } - - //参数1:是要修改的数据 - //参数2:是修改的数据 - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { - return - } - return -} - -func (e *DictData) Delete(id int) (success bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("dict_code = ?", id).Delete(&DictData{}).Error; err != nil { - success = false - return - } - success = true - return -} - -func (e *DictData) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("dict_code in (?)", id).Delete(&DictData{}).Error; err != nil { - return - } - Result = true - return -} diff --git a/app/admin/models/dicttype.go b/app/admin/models/dicttype.go deleted file mode 100644 index 3b77fd0b..00000000 --- a/app/admin/models/dicttype.go +++ /dev/null @@ -1,152 +0,0 @@ -package models - -import ( - "errors" - - "gorm.io/gorm" - - orm "go-admin/common/global" - "go-admin/tools" -) - -type DictType struct { - DictId int `gorm:"primary_key;auto_increment;" json:"dictId"` - DictName string `gorm:"size:128;" json:"dictName"` //字典名称 - DictType string `gorm:"size:128;" json:"dictType"` //字典类型 - Status string `gorm:"size:4;" json:"status"` //状态 - CreateBy string `gorm:"size:11;" json:"createBy"` //创建者 - UpdateBy string `gorm:"size:11;" json:"updateBy"` //更新者 - Remark string `gorm:"size:255;" json:"remark"` //备注 - BaseModel - - DataScope string `gorm:"-" json:"dataScope"` // - Params string `gorm:"-" json:"params"` // -} - -func (DictType) TableName() string { - return "sys_dict_type" -} - -func (e *DictType) Create() (DictType, error) { - var doc DictType - - var i int64 - orm.Eloquent.Table(e.TableName()).Where("dict_name=? or dict_type = ?", e.DictName, e.DictType).Count(&i) - if i > 0 { - return doc, errors.New("字典名称或者字典类型已经存在!") - } - - result := orm.Eloquent.Table(e.TableName()).Create(&e) - if result.Error != nil { - err := result.Error - return doc, err - } - doc = *e - return doc, nil -} - -func (e *DictType) Get() (DictType, error) { - var doc DictType - - table := orm.Eloquent.Table(e.TableName()) - if e.DictId != 0 { - table = table.Where("dict_id = ?", e.DictId) - } - if e.DictName != "" { - table = table.Where("dict_name = ?", e.DictName) - } - if e.DictType != "" { - table = table.Where("dict_type = ?", e.DictType) - } - - if err := table.First(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -func (e *DictType) GetList() ([]DictType, error) { - var doc []DictType - - table := orm.Eloquent.Table(e.TableName()) - if e.DictId != 0 { - table = table.Where("dict_id = ?", e.DictId) - } - if e.DictName != "" { - table = table.Where("dict_name = ?", e.DictName) - } - if e.DictType != "" { - table = table.Where("dict_type = ?", e.DictType) - } - - if err := table.Find(&doc).Error; err != nil { - return doc, err - } - return doc, nil -} - -func (e *DictType) GetPage(pageSize int, pageIndex int) ([]DictType, int, error) { - var doc []DictType - var db *gorm.DB - - table := orm.Eloquent.Table(e.TableName()) - if e.DictId != 0 { - db = db.Where("dict_id = ?", e.DictId) - } - if e.DictName != "" { - db = db.Where("dict_name = ?", e.DictName) - } - - // 数据权限控制 - dataPermission := new(DataPermission) - dataPermission.UserId, _ = tools.StringToInt(e.DataScope) - table, err := dataPermission.GetDataScope("sys_dict_type", table) - if err != nil { - return nil, 0, err - } - var count int64 - - if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil { - return nil, 0, err - } - //table.Count(&count) - return doc, int(count), nil -} - -func (e *DictType) Update(id int) (update DictType, err error) { - if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil { - return - } - - if e.DictName != "" && e.DictName != update.DictName { - return update, errors.New("名称不允许修改!") - } - - if e.DictType != "" && e.DictType != update.DictType { - return update, errors.New("类型不允许修改!") - } - - //参数1:是要修改的数据 - //参数2:是修改的数据 - if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil { - return - } - return -} - -func (e *DictType) Delete(id int) (success bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("dict_id = ?", id).Delete(&DictData{}).Error; err != nil { - success = false - return - } - success = true - return -} - -func (e *DictType) BatchDelete(id []int) (Result bool, err error) { - if err = orm.Eloquent.Table(e.TableName()).Where("dict_id in (?)", id).Delete(&DictType{}).Error; err != nil { - return - } - Result = true - return -} diff --git a/app/admin/models/system/sys_dict_data.go b/app/admin/models/system/sys_dict_data.go new file mode 100644 index 00000000..f2f20e9b --- /dev/null +++ b/app/admin/models/system/sys_dict_data.go @@ -0,0 +1,35 @@ +package system + +import ( + "go-admin/common/models" +) + +type SysDictData struct { + models.ControlBy + models.ModelTime + + DictCode int `json:"dictCode" gorm:"primaryKey;column:dict_code;autoIncrement;comment:主键编码"` + DictSort int `json:"dictSort" gorm:"type:bigint(20);comment:DictSort"` + DictLabel string `json:"dictLabel" gorm:"type:varchar(128);comment:DictLabel"` + DictValue string `json:"dictValue" gorm:"type:varchar(255);comment:DictValue"` + DictType string `json:"dictType" gorm:"type:varchar(64);comment:DictType"` + CssClass string `json:"cssClass" gorm:"type:varchar(128);comment:CssClass"` + ListClass string `json:"listClass" gorm:"type:varchar(128);comment:ListClass"` + IsDefault string `json:"isDefault" gorm:"type:varchar(8);comment:IsDefault"` + Status string `json:"status" gorm:"type:varchar(4);comment:Status"` + Default string `json:"default" gorm:"type:varchar(8);comment:Default"` + Remark string `json:"remark" gorm:"type:varchar(255);comment:Remark"` +} + +func (SysDictData) TableName() string { + return "sys_dict_data" +} + +func (e *SysDictData) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysDictData) GetId() interface{} { + return e.DictCode +} diff --git a/app/admin/models/system/sys_dict_type.go b/app/admin/models/system/sys_dict_type.go new file mode 100644 index 00000000..dfc053d6 --- /dev/null +++ b/app/admin/models/system/sys_dict_type.go @@ -0,0 +1,29 @@ +package system + +import ( + "go-admin/common/models" +) + +type SysDictType struct { + models.ControlBy + models.ModelTime + + ID int `json:"id" gorm:"primaryKey;column:dict_id;autoIncrement;comment:主键编码"` + DictName string `json:"dictName" gorm:"type:varchar(128);comment:DictName"` + DictType string `json:"dictType" gorm:"type:varchar(128);comment:DictType"` + Status string `json:"status" gorm:"type:varchar(4);comment:Status"` + Remark string `json:"remark" gorm:"type:varchar(255);comment:Remark"` +} + +func (SysDictType) TableName() string { + return "sys_dict_type" +} + +func (e *SysDictType) Generate() models.ActiveRecord { + o := *e + return &o +} + +func (e *SysDictType) GetId() interface{} { + return e.ID +} diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sysrouter.go index 774a1413..aaf96b0a 100644 --- a/app/admin/router/sysrouter.go +++ b/app/admin/router/sysrouter.go @@ -63,7 +63,6 @@ func sysNoCheckRoleRouter(r *gin.RouterGroup) { v1.GET("/gen/todb/:tableId", GenMenuAndApi) v1.GET("/gen/tabletree", GetSysTablesTree) v1.GET("/menuTreeselect", system.GetMenuTreeelect) - v1.GET("/dict/databytype/:dictType", dict.GetDictDataByDictType) registerDBRouter(v1) registerSysTableRouter(v1) @@ -191,21 +190,24 @@ func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle } func registerDictRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + dictApi := &dict.SysDictType{} + dataApi := &dict.SysDictData{} dicts := v1.Group("/dict").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - dicts.GET("/datalist", dict.GetDictDataList) - dicts.GET("/typelist", dict.GetDictTypeList) - dicts.GET("/typeoptionselect", dict.GetDictTypeOptionSelect) - dicts.GET("/data/:dictCode", dict.GetDictData) - dicts.POST("/data", dict.InsertDictData) - dicts.PUT("/data/", dict.UpdateDictData) - dicts.DELETE("/data/:dictCode", dict.DeleteDictData) + dicts.GET("/data-all", dataApi.GetSysDictDataAll) + dicts.GET("/data", dataApi.GetSysDictDataList) + dicts.GET("/data/:dictCode", dataApi.GetSysDictData) + dicts.POST("/data", dataApi.InsertSysDictData) + dicts.PUT("/data/:dictCode", dataApi.UpdateSysDictData) + dicts.DELETE("/data/:dictCode", dataApi.DeleteSysDictData) - dicts.GET("/type/:dictId", dict.GetDictType) - dicts.POST("/type", dict.InsertDictType) - dicts.PUT("/type", dict.UpdateDictType) - dicts.DELETE("/type/:dictId", dict.DeleteDictType) + dicts.GET("/type-option-select", dictApi.GetSysDictTypeAll) + dicts.GET("/type", dictApi.GetSysDictTypeList) + dicts.GET("/type/:id", dictApi.GetSysDictType) + dicts.POST("/type", dictApi.InsertSysDictType) + dicts.PUT("/type/:id", dictApi.UpdateSysDictType) + dicts.DELETE("/type/:id", dictApi.DeleteSysDictType) } } diff --git a/app/admin/service/dto/sys_dict_data.go b/app/admin/service/dto/sys_dict_data.go new file mode 100644 index 00000000..8da5df9d --- /dev/null +++ b/app/admin/service/dto/sys_dict_data.go @@ -0,0 +1,126 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "net/http" + + "go-admin/app/admin/models/system" + "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" +) + +type SysDictDataSearch struct { + dto.Pagination `search:"-"` + Id int `form:"id" search:"type:exact;column:dict_code;table:sys_dict_data" comment:""` + DictLabel string `form:"dictLabel" search:"type:contains;column:dict_label;table:sys_dict_data" comment:""` + DictValue string `form:"dictValue" search:"type:contains;column:dict_value;table:sys_dict_data" comment:""` + DictType string `form:"dictType" search:"type:contains;column:dict_type;table:sys_dict_data" comment:""` + Status string `form:"status" search:"type:exact;column:status;table:sys_dict_data" comment:""` +} + +func (m *SysDictDataSearch) GetNeedSearch() interface{} { + return *m +} + +func (m *SysDictDataSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +func (m *SysDictDataSearch) Generate() dto.Index { + o := *m + return &o +} + +type SysDictDataControl struct { + Id int `uri:"dictCode" comment:""` + DictSort int `json:"dictSort" comment:""` + DictLabel string `json:"dictLabel" comment:""` + DictValue string `json:"dictValue" comment:""` + DictType string `json:"dictType" comment:""` + CssClass string `json:"cssClass" comment:""` + ListClass string `json:"listClass" comment:""` + IsDefault string `json:"isDefault" comment:""` + Status string `json:"status" comment:""` + Default string `json:"default" comment:""` + Remark string `json:"remark" comment:""` +} + +func (s *SysDictDataControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysDictDataControl) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysDictDataControl) GenerateM() (common.ActiveRecord, error) { + return &system.SysDictData{ + DictCode: s.Id, + DictSort: s.DictSort, + DictLabel: s.DictLabel, + DictValue: s.DictValue, + DictType: s.DictType, + CssClass: s.CssClass, + ListClass: s.ListClass, + IsDefault: s.IsDefault, + Status: s.Status, + Default: s.Default, + Remark: s.Remark, + }, nil +} + +func (s *SysDictDataControl) GetId() interface{} { + return s.Id +} + +type SysDictDataById struct { + Id int `uri:"dictCode"` + Ids []int `json:"ids"` +} + +func (s *SysDictDataById) Bind(ctx *gin.Context) error { + if ctx.Request.Method == http.MethodDelete { + err := ctx.ShouldBind(&s.Ids) + if err != nil { + return err + } + if len(s.Ids) > 0 { + return nil + } + } + return ctx.ShouldBindUri(s) +} + +func (s *SysDictDataById) GetId() interface{} { + if len(s.Ids) > 0 { + return s.Ids + } + return s.Id +} + +func (s *SysDictDataById) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysDictDataById) GenerateM() (common.ActiveRecord, error) { + return &system.SysDictData{}, nil +} diff --git a/app/admin/service/dto/sys_dict_type.go b/app/admin/service/dto/sys_dict_type.go new file mode 100644 index 00000000..57ebfd8c --- /dev/null +++ b/app/admin/service/dto/sys_dict_type.go @@ -0,0 +1,96 @@ +package dto + +import ( + "github.com/gin-gonic/gin" + "go-admin/app/admin/models/system" + + "go-admin/common/dto" + "go-admin/common/log" + common "go-admin/common/models" + "go-admin/tools" +) + +type SysDictTypeSearch struct { + dto.Pagination `search:"-"` + DictId []int `form:"dictId" search:"type:in;column:dict_id;table:sys_dict_type"` + DictName string `form:"dictName" search:"type:icontains;column:dict_name;table:sys_dict_type"` + DictType string `form:"dictType" search:"type:icontains;column:dict_type;table:sys_dict_type"` + Status int `form:"status" search:"type:exact;column:status;table:sys_dict_type"` +} + +func (m *SysDictTypeSearch) GetNeedSearch() interface{} { + return *m +} + +func (m *SysDictTypeSearch) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBind(m) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error()) + } + return err +} + +func (m *SysDictTypeSearch) Generate() dto.Index { + o := *m + return &o +} + +type SysDictTypeControl struct { + Id int `uri:"id" comment:""` // + + DictName string `json:"dictName" comment:""` + + DictType string `json:"dictType" comment:""` + + Status string `json:"status" comment:""` + + Remark string `json:"remark" comment:""` +} + +func (s *SysDictTypeControl) Bind(ctx *gin.Context) error { + msgID := tools.GenerateMsgIDFromContext(ctx) + err := ctx.ShouldBindUri(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) + return err + } + err = ctx.ShouldBind(s) + if err != nil { + log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) + } + return err +} + +func (s *SysDictTypeControl) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysDictTypeControl) GenerateM() (common.ActiveRecord, error) { + return &system.SysDictType{ + + ID: s.Id, + DictName: s.DictName, + DictType: s.DictType, + Status: s.Status, + Remark: s.Remark, + }, nil +} + +func (s *SysDictTypeControl) GetId() interface{} { + return s.Id +} + +type SysDictTypeById struct { + dto.ObjectById +} + +func (s *SysDictTypeById) Generate() dto.Control { + cp := *s + return &cp +} + +func (s *SysDictTypeById) GenerateM() (common.ActiveRecord, error) { + return &system.SysDictType{}, nil +} diff --git a/app/admin/service/sys_dict_data.go b/app/admin/service/sys_dict_data.go new file mode 100644 index 00000000..e17a5894 --- /dev/null +++ b/app/admin/service/sys_dict_data.go @@ -0,0 +1,130 @@ +package service + +import ( + "errors" + + "gorm.io/gorm" + + "go-admin/app/admin/models/system" + "go-admin/app/admin/service/dto" + cDto "go-admin/common/dto" + "go-admin/common/log" + "go-admin/common/service" +) + +type SysDictData struct { + service.Service +} + +// GetPage 获取列表 +func (e *SysDictData) GetPage(c *dto.SysDictDataSearch, list *[]system.SysDictData, count *int64) error { + var err error + var data system.SysDictData + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Get 获取对象 +func (e *SysDictData) Get(d *dto.SysDictDataById, model *system.SysDictData) error { + var err error + var data system.SysDictData + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Insert 创建对象 +func (e *SysDictData) Insert(model *system.SysDictData) error { + var err error + var data system.SysDictData + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Update 修改对象 +func (e *SysDictData) Update(c *system.SysDictData) error { + var err error + var data system.SysDictData + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// Remove 删除 +func (e *SysDictData) Remove(d *dto.SysDictDataById, c *system.SysDictData) error { + var err error + var data system.SysDictData + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(d.GetId()).Delete(c) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} + +// GetAll 获取所有 +func (e *SysDictData) GetAll(c *dto.SysDictDataSearch, list *[]system.SysDictData) error { + var err error + var data system.SysDictData + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + ). + Find(list).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} diff --git a/app/admin/service/sys_dict_type.go b/app/admin/service/sys_dict_type.go new file mode 100644 index 00000000..fbc215c9 --- /dev/null +++ b/app/admin/service/sys_dict_type.go @@ -0,0 +1,130 @@ +package service + +import ( + "errors" + + "gorm.io/gorm" + + "go-admin/app/admin/models/system" + "go-admin/app/admin/service/dto" + cDto "go-admin/common/dto" + "go-admin/common/log" + "go-admin/common/service" +) + +type SysDictType struct { + service.Service +} + +// GetPage 获取列表 +func (e *SysDictType) GetPage(c *dto.SysDictTypeSearch, list *[]system.SysDictType, count *int64) error { + var err error + var data system.SysDictType + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + cDto.Paginate(c.GetPageSize(), c.GetPageIndex()), + ). + Find(list).Limit(-1).Offset(-1). + Count(count).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Get 获取对象 +func (e *SysDictType) Get(d *dto.SysDictTypeById, model *system.SysDictType) error { + var err error + var data system.SysDictType + msgID := e.MsgID + + db := e.Orm.Model(&data). + First(model, d.GetId()) + err = db.Error + if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { + err = errors.New("查看对象不存在或无权查看") + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Insert 创建对象 +func (e *SysDictType) Insert(model *system.SysDictType) error { + var err error + var data system.SysDictType + msgID := e.MsgID + + err = e.Orm.Model(&data). + Create(model).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} + +// Update 修改对象 +func (e *SysDictType) Update(c *system.SysDictType) error { + var err error + var data system.SysDictType + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(c.GetId()).Updates(c) + if db.Error != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + if db.RowsAffected == 0 { + return errors.New("无权更新该数据") + + } + return nil +} + +// Remove 删除 +func (e *SysDictType) Remove(d *dto.SysDictTypeById, c *system.SysDictType) error { + var err error + var data system.SysDictType + msgID := e.MsgID + + db := e.Orm.Model(&data). + Where(d.GetId()).Delete(c) + if db.Error != nil { + err = db.Error + log.Errorf("MsgID[%s] Delete error: %s", msgID, err) + return err + } + if db.RowsAffected == 0 { + err = errors.New("无权删除该数据") + return err + } + return nil +} + +// GetAll 获取所有 +func (e *SysDictType) GetAll(c *dto.SysDictTypeSearch, list *[]system.SysDictType) error { + var err error + var data system.SysDictType + msgID := e.MsgID + + err = e.Orm.Model(&data). + Scopes( + cDto.MakeCondition(c.GetNeedSearch()), + ). + Find(list).Error + if err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } + return nil +} diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index d7f18976..408ee5ce 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -32,8 +32,8 @@ func _1599190683659Tables(db *gorm.DB, version string) error { new(models.SysUser), new(system.SysRole), new(models.Post), - new(models.DictData), - new(models.DictType), + new(DictData), + new(DictType), new(models.SysJob), new(system.SysConfig), new(models.SysSetting), diff --git a/cmd/migrate/migration/version/1599190683670_migrate.go b/cmd/migrate/migration/version/1599190683670_migrate.go index c5cf05e3..ee2034f4 100644 --- a/cmd/migrate/migration/version/1599190683670_migrate.go +++ b/cmd/migrate/migration/version/1599190683670_migrate.go @@ -44,7 +44,7 @@ func _1599190683670Test(db *gorm.DB, version string) error { {1, "系统管理员", "2", "admin", 1, "", "1", "", "", true, "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, "", []int{}, []int{}}, } - list7 := []models.DictType{ + list7 := []DictType{ {DictId: 1, DictName: "系统开关", DictType: "sys_normal_disable", Status: "2", CreateBy: "1", UpdateBy: "1", Remark: "系统开关列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, {DictId: 2, DictName: "用户性别", DictType: "sys_user_sex", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "用户性别列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, {DictId: 3, DictName: "菜单状态", DictType: "sys_show_hide", Status: "2", CreateBy: "1", UpdateBy: "", Remark: "菜单状态列表", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, @@ -61,7 +61,7 @@ func _1599190683670Test(db *gorm.DB, version string) error { {models.SysUserId{1}, models.LoginM{models.UserName{"admin"}, models.PassWord{"$2a$10$cKFFTCzGOvaIHHJY2K45Zuwt8TD6oPzYi4s5MzYIBAWCLL6ZhouP2"}}, models.SysUserB{"zhangwj", "13818888888", 1, "", "", "0", "1@qq.com", 1, 1, "1", "1", "", "2", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, "", ""}}, } - list9 := []models.DictData{ + list9 := []DictData{ {DictCode: 1, DictSort: 0, DictLabel: "正常", DictValue: "2", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统正常", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, {DictCode: 2, DictSort: 0, DictLabel: "停用", DictValue: "1", DictType: "sys_normal_disable", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "系统停用", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, {DictCode: 3, DictSort: 0, DictLabel: "男", DictValue: "0", DictType: "sys_user_sex", CssClass: "", ListClass: "", IsDefault: "", Status: "2", Default: "", CreateBy: "1", UpdateBy: "", Remark: "性别男", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}}, diff --git a/cmd/migrate/migration/version/1606579402398_migrate.go b/cmd/migrate/migration/version/1606579402398_migrate.go index 845c1f90..fb2ed5ef 100644 --- a/cmd/migrate/migration/version/1606579402398_migrate.go +++ b/cmd/migrate/migration/version/1606579402398_migrate.go @@ -18,13 +18,13 @@ func init() { func _1606579402398Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - dicData := models.DictData{} + dicData := DictData{} err := tx.Model(&dicData).Where("dict_code = ?", 1).Update("dict_value", 2).Error if err != nil { return err } - dicType := models.DictType{} + dicType := DictType{} err = tx.Model(&dicType).Where("status = ?", 0).Update("status", 2).Error if err != nil { return err diff --git a/cmd/migrate/migration/version/1606582844753_migrate.go b/cmd/migrate/migration/version/1606582844753_migrate.go index 103ebe96..0717e3cb 100644 --- a/cmd/migrate/migration/version/1606582844753_migrate.go +++ b/cmd/migrate/migration/version/1606582844753_migrate.go @@ -24,7 +24,7 @@ func _1606582844753Test(db *gorm.DB, version string) error { return err } - dictData := models.DictData{} + dictData := DictData{} err = tx.Model(&dictData).Where("status = ?", 0).Update("status", 2).Error if err != nil { return err diff --git a/cmd/migrate/migration/version/1613720892819_migrate.go b/cmd/migrate/migration/version/1613720892819_migrate.go index 66bf690b..dc7ef431 100644 --- a/cmd/migrate/migration/version/1613720892819_migrate.go +++ b/cmd/migrate/migration/version/1613720892819_migrate.go @@ -1,7 +1,6 @@ package version import ( - "go-admin/app/admin/models" //"go-admin/app/admin/models" "gorm.io/gorm" "runtime" @@ -19,7 +18,7 @@ func _1613720892819Test(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { // TODO: 这里开始写入要变更的内容 - t := &models.DictType{ + t := &DictType{ DictName: "内容状态", DictType: "sys_content_status", Status: "2", @@ -31,8 +30,8 @@ func _1613720892819Test(db *gorm.DB, version string) error { return err } - data := make([]models.DictData, 2) - data[0] = models.DictData{ + data := make([]DictData, 2) + data[0] = DictData{ DictSort: 0, DictLabel: "正常", DictValue: "1", @@ -41,7 +40,7 @@ func _1613720892819Test(db *gorm.DB, version string) error { CreateBy: "1", UpdateBy: "1", } - data[1] = models.DictData{ + data[1] = DictData{ DictSort: 1, DictLabel: "禁用", DictValue: "2", diff --git a/cmd/migrate/migration/version/1613783303115_migrate.go b/cmd/migrate/migration/version/1613783303115_migrate.go new file mode 100644 index 00000000..02f88c0e --- /dev/null +++ b/cmd/migrate/migration/version/1613783303115_migrate.go @@ -0,0 +1,45 @@ +package version + +import ( + "go-admin/app/admin/models/system" + + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613783303115Test) +} + +func _1613783303115Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + //修改字段类型 + err := tx.Migrator().AlterColumn(&system.SysDictType{}, "create_by") + if err != nil { + return err + } + err = tx.Migrator().AlterColumn(&system.SysDictType{}, "update_by") + if err != nil { + return err + } + + err = tx.Migrator().AlterColumn(&system.SysDictData{}, "create_by") + if err != nil { + return err + } + err = tx.Migrator().AlterColumn(&system.SysDictData{}, "update_by") + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/cmd/migrate/migration/version/dictdata.go b/cmd/migrate/migration/version/dictdata.go new file mode 100644 index 00000000..c330d977 --- /dev/null +++ b/cmd/migrate/migration/version/dictdata.go @@ -0,0 +1,26 @@ +package version + +import ( + "go-admin/app/admin/models" +) + +type DictData struct { + DictCode int `gorm:"primary_key;auto_increment;" json:"dictCode" example:"1"` //字典编码 + DictSort int `gorm:"" json:"dictSort"` //显示顺序 + DictLabel string `gorm:"size:128;" json:"dictLabel"` //数据标签 + DictValue string `gorm:"size:255;" json:"dictValue"` //数据键值 + DictType string `gorm:"size:64;" json:"dictType"` //字典类型 + CssClass string `gorm:"size:128;" json:"cssClass"` // + ListClass string `gorm:"size:128;" json:"listClass"` // + IsDefault string `gorm:"size:8;" json:"isDefault"` // + Status string `gorm:"size:4;" json:"status"` //状态 + Default string `gorm:"size:8;" json:"default"` // + CreateBy string `gorm:"size:64;" json:"createBy"` // + UpdateBy string `gorm:"size:64;" json:"updateBy"` // + Remark string `gorm:"size:255;" json:"remark"` //备注 + models.BaseModel +} + +func (DictData) TableName() string { + return "sys_dict_data" +} diff --git a/cmd/migrate/migration/version/dicttype.go b/cmd/migrate/migration/version/dicttype.go new file mode 100644 index 00000000..73fff340 --- /dev/null +++ b/cmd/migrate/migration/version/dicttype.go @@ -0,0 +1,20 @@ +package version + +import ( + "go-admin/app/admin/models" +) + +type DictType struct { + DictId int `gorm:"primary_key;auto_increment;" json:"dictId"` + DictName string `gorm:"size:128;" json:"dictName"` //字典名称 + DictType string `gorm:"size:128;" json:"dictType"` //字典类型 + Status string `gorm:"size:4;" json:"status"` //状态 + CreateBy string `gorm:"size:11;" json:"createBy"` //创建者 + UpdateBy string `gorm:"size:11;" json:"updateBy"` //更新者 + Remark string `gorm:"size:255;" json:"remark"` //备注 + models.BaseModel +} + +func (DictType) TableName() string { + return "sys_dict_type" +} From deeb82048bb0de9a9863cc4db32204ea8795f3b6 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Sun, 21 Feb 2021 14:06:13 +0800 Subject: [PATCH 083/201] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=88=9D=E5=A7=8B=E5=8C=96=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E6=9D=83=E9=99=90=E9=83=A8=E5=88=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/role.go | 167 ----------------- app/admin/apis/system/sys_role/sys_role.go | 124 +++++++++++-- app/admin/middleware/db.go | 42 ----- app/admin/middleware/db_other.go | 23 --- app/admin/middleware/db_sqlite3.go | 28 --- app/admin/middleware/init.go | 4 +- app/admin/middleware/permission.go | 4 +- app/admin/models/roledept.go | 47 ----- app/admin/models/system/role_dept.go | 11 ++ app/admin/models/system/role_menu.go | 172 ++++++++++++++++++ app/admin/router/initrouter.go | 1 - app/admin/router/sys_role.go | 1 + app/admin/router/sysrouter.go | 20 +- app/admin/service/dto/sys_role.go | 3 + app/admin/service/sys_role.go | 139 +++++++++++++- app/admin/service/sys_role_menu.go | 113 ++++++++++++ cmd/api/server.go | 24 +-- cmd/config/server.go | 4 +- .../migration/version/1599190683659_tables.go | 2 +- cmd/migrate/server.go | 2 +- common/config/config.go | 60 +++--- common/config/type.go | 15 +- common/database/initialize.go | 66 +++++-- common/database/initialize_sqlite3.go | 21 --- common/database/interface.go | 11 -- common/database/mysql_drive.go | 77 -------- common/database/open.go | 14 ++ common/database/open_sqlite3.go | 16 ++ common/database/pgsql_driver.go | 75 -------- common/database/sqlite3_driver.go | 77 -------- common/dto/search.go | 5 +- common/global/adm.go | 4 +- common/global/casbin.go | 12 +- common/middleware/db.go | 15 +- examples/run.go | 5 +- tools/config/config.go | 38 ++-- tools/config/database.go | 5 +- 37 files changed, 726 insertions(+), 721 deletions(-) delete mode 100644 app/admin/apis/system/role.go delete mode 100644 app/admin/middleware/db.go delete mode 100644 app/admin/middleware/db_other.go delete mode 100644 app/admin/middleware/db_sqlite3.go delete mode 100644 app/admin/models/roledept.go create mode 100644 app/admin/models/system/role_dept.go create mode 100644 app/admin/models/system/role_menu.go create mode 100644 app/admin/service/sys_role_menu.go delete mode 100644 common/database/initialize_sqlite3.go delete mode 100644 common/database/interface.go delete mode 100644 common/database/mysql_drive.go create mode 100644 common/database/open.go create mode 100644 common/database/open_sqlite3.go delete mode 100644 common/database/pgsql_driver.go delete mode 100644 common/database/sqlite3_driver.go diff --git a/app/admin/apis/system/role.go b/app/admin/apis/system/role.go deleted file mode 100644 index b2355647..00000000 --- a/app/admin/apis/system/role.go +++ /dev/null @@ -1,167 +0,0 @@ -package system - -import ( - "github.com/gin-gonic/gin" - "go-admin/app/admin/service/dto" - - "go-admin/app/admin/models" - "go-admin/common/global" - "go-admin/tools" - "go-admin/tools/app" -) - -// @Summary 角色列表数据 -// @Description Get JSON -// @Tags 角色/Role -// @Param roleName query string false "roleName" -// @Param status query string false "status" -// @Param roleKey query string false "roleKey" -// @Param pageSize query int false "页条数" -// @Param pageIndex query int false "页码" -// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" -// @Router /api/v1/rolelist [get] -// @Security Bearer -func GetRoleList(c *gin.Context) { - var data models.SysRole - var err error - var pageSize = 10 - var pageIndex = 1 - - if size := c.Request.FormValue("pageSize"); size != "" { - pageSize, err = tools.StringToInt(size) - } - - if index := c.Request.FormValue("pageIndex"); index != "" { - pageIndex, err = tools.StringToInt(index) - } - - data.RoleKey = c.Request.FormValue("roleKey") - data.RoleName = c.Request.FormValue("roleName") - data.Status = c.Request.FormValue("status") - data.DataScope = tools.GetUserIdStr(c) - result, count, err := data.GetPage(pageSize, pageIndex) - tools.HasError(err, "", -1) - - app.PageOK(c, result, count, pageIndex, pageSize, "") -} - -// @Summary 获取Role数据 -// @Description 获取JSON -// @Tags 角色/Role -// @Param roleId path string false "roleId" -// @Success 200 {string} string "{"code": 200, "data": [...]}" -// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" -// @Router /api/v1/role [get] -// @Security Bearer -func GetRole(c *gin.Context) { - var Role models.SysRole - Role.RoleId, _ = tools.StringToInt(c.Param("roleId")) - result, err := Role.Get() - menuIds := make([]int, 0) - menuIds, err = Role.GetRoleMeunId() - tools.HasError(err, "抱歉未找到相关信息", -1) - result.MenuIds = menuIds - app.OK(c, result, "") - -} - -// @Summary 创建角色 -// @Description 获取JSON -// @Tags 角色/Role -// @Accept application/json -// @Product application/json -// @Param data body models.SysRole true "data" -// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -// @Router /api/v1/role [post] -func InsertRole(c *gin.Context) { - var data models.SysRole - data.CreateBy = tools.GetUserIdStr(c) - err := c.Bind(&data) - tools.HasError(err, "数据解析失败", 500) - id, err := data.Insert() - tools.HasError(err, "", -1) - data.RoleId = id - - var t models.RoleMenu - if len(data.MenuIds) > 0 { - _, err = t.Insert(id, data.MenuIds) - tools.HasError(err, "", -1) - } - - _, err = global.LoadPolicy() - tools.HasError(err, "", -1) - - app.OK(c, data, "添加成功") -} - -// @Summary 修改用户角色 -// @Description 获取JSON -// @Tags 角色/Role -// @Accept application/json -// @Product application/json -// @Param data body models.SysRole true "body" -// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" -// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" -// @Router /api/v1/role [put] -func UpdateRole(c *gin.Context) { - var data models.SysRole - data.UpdateBy = tools.GetUserIdStr(c) - err := c.Bind(&data) - tools.HasError(err, "数据解析失败", -1) - result, err := data.Update(data.RoleId) - tools.HasError(err, "", -1) - var t models.RoleMenu - _, err = t.DeleteRoleMenu(data.RoleId) - tools.HasError(err, "修改失败(delete rm)", -1) - if len(data.MenuIds) > 0 { - _, err2 := t.Insert(data.RoleId, data.MenuIds) - tools.HasError(err2, "修改失败(insert)", -1) - } - - _, err = global.LoadPolicy() - tools.HasError(err, "", -1) - - app.OK(c, result, "修改成功") -} - -func UpdateRoleDataScope(c *gin.Context) { - var data models.SysRole - var req dto.RoleDataScopeReq - data.UpdateBy = tools.GetUserIdStr(c) - err := c.Bind(&req) - tools.HasError(err, "数据解析失败", -1) - data.RoleId = req.RoleId - data.DataScope = req.DataScope - result, err := data.Update(data.RoleId) - - var t models.SysRoleDept - _, err = t.DeleteRoleDept(data.RoleId) - tools.HasError(err, "添加失败1", -1) - if data.DataScope == "2" { - _, err2 := t.Insert(data.RoleId, data.DeptIds) - tools.HasError(err2, "添加失败2", -1) - } - app.OK(c, result, "修改成功") -} - -// @Summary 删除用户角色 -// @Description 删除数据 -// @Tags 角色/Role -// @Param roleId path int true "roleId" -// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" -// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" -// @Router /api/v1/role/{roleId} [delete] -func DeleteRole(c *gin.Context) { - var Role models.SysRole - Role.UpdateBy = tools.GetUserIdStr(c) - - IDS := tools.IdsStrToIdsIntGroup("roleId", c) - _, err := Role.BatchDelete(IDS) - tools.HasError(err, "删除失败", -1) - - _, err = global.LoadPolicy() - tools.HasError(err, "", -1) - - app.OK(c, "", "删除成功") -} diff --git a/app/admin/apis/system/sys_role/sys_role.go b/app/admin/apis/system/sys_role/sys_role.go index 2e535d74..c28af473 100644 --- a/app/admin/apis/system/sys_role/sys_role.go +++ b/app/admin/apis/system/sys_role/sys_role.go @@ -2,14 +2,13 @@ package sys_role import ( "github.com/gin-gonic/gin" - "go-admin/app/admin/models/system" "go-admin/app/admin/service" "go-admin/app/admin/service/dto" "go-admin/common/apis" + "go-admin/common/global" "go-admin/common/log" "go-admin/tools" - "net/http" ) @@ -17,6 +16,17 @@ type SysRole struct { apis.Api } +// @Summary 角色列表数据 +// @Description Get JSON +// @Tags 角色/Role +// @Param roleName query string false "roleName" +// @Param status query string false "status" +// @Param roleKey query string false "roleKey" +// @Param pageSize query int false "页条数" +// @Param pageIndex query int false "页码" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/role [get] +// @Security Bearer func (e *SysRole) GetSysRoleList(c *gin.Context) { msgID := tools.GenerateMsgIDFromContext(c) d := new(dto.SysRoleSearch) @@ -47,6 +57,14 @@ func (e *SysRole) GetSysRoleList(c *gin.Context) { e.PageOK(c, list, int(count), d.GetPageIndex(), d.GetPageSize(), "查询成功") } +// @Summary 获取Role数据 +// @Description 获取JSON +// @Tags 角色/Role +// @Param roleId path string false "roleId" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" +// @Router /api/v1/role/{id} [get] +// @Security Bearer func (e *SysRole) GetSysRole(c *gin.Context) { control := new(dto.SysRoleById) db, err := tools.GetOrm(c) @@ -76,6 +94,16 @@ func (e *SysRole) GetSysRole(c *gin.Context) { e.OK(c, object, "查看成功") } +// @Summary 创建角色 +// @Description 获取JSON +// @Tags 角色/Role +// @Accept application/json +// @Product application/json +// @Param data body models.SysRole true "data" +// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" +// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" +// @Router /api/v1/role [post] +// @Security Bearer func (e *SysRole) InsertSysRole(c *gin.Context) { control := new(dto.SysRoleControl) db, err := tools.GetOrm(c) @@ -97,21 +125,35 @@ func (e *SysRole) InsertSysRole(c *gin.Context) { return } // 设置创建人 - object.CreateBy= tools.GetUserId(c) + object.CreateBy = tools.GetUserId(c) - serviceSysRole := service.SysRole{} - serviceSysRole.Orm = db - serviceSysRole.MsgID = msgID - err = serviceSysRole.InsertSysRole(object) + s := service.SysRole{} + s.Orm = db + s.MsgID = msgID + err = s.InsertSysRole(object) if err != nil { log.Error(err) e.Error(c, http.StatusInternalServerError, err, "创建失败") return } - + _, err = global.LoadPolicy(c) + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "") + return + } e.OK(c, object.GetId(), "创建成功") } +// @Summary 修改用户角色 +// @Description 获取JSON +// @Tags 角色/Role +// @Accept application/json +// @Product application/json +// @Param data body models.SysRole true "body" +// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" +// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" +// @Router /api/v1/role/{id} [put] +// @Security Bearer func (e *SysRole) UpdateSysRole(c *gin.Context) { control := new(dto.SysRoleControl) db, err := tools.GetOrm(c) @@ -134,17 +176,30 @@ func (e *SysRole) UpdateSysRole(c *gin.Context) { } object.UpdateBy = tools.GetUserId(c) - serviceSysRole := service.SysRole{} - serviceSysRole.Orm = db - serviceSysRole.MsgID = msgID - err = serviceSysRole.UpdateSysRole(object) + s := service.SysRole{} + s.Orm = db + s.MsgID = msgID + err = s.UpdateSysRole(object) if err != nil { log.Error(err) return } + _, err = global.LoadPolicy(c) + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "") + return + } e.OK(c, object.GetId(), "更新成功") } +// @Summary 删除用户角色 +// @Description 删除数据 +// @Tags 角色/Role +// @Param roleId path int true "roleId" +// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" +// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" +// @Router /api/v1/role/{roleId} [delete] +// @Security Bearer func (e *SysRole) DeleteSysRole(c *gin.Context) { control := new(dto.SysRoleById) db, err := tools.GetOrm(c) @@ -162,14 +217,51 @@ func (e *SysRole) DeleteSysRole(c *gin.Context) { return } - serviceSysRole := service.SysRole{} - serviceSysRole.Orm = db - serviceSysRole.MsgID = msgID - err = serviceSysRole.RemoveSysRole(control) + s := service.SysRole{} + s.Orm = db + s.MsgID = msgID + err = s.RemoveSysRole(control) if err != nil { log.Error(err) return } + _, err = global.LoadPolicy(c) + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "") + return + } e.OK(c, control.GetId(), "删除成功") } +func (e *SysRole) UpdateRoleDataScope(c *gin.Context) { + control := new(dto.RoleDataScopeReq) + db, err := tools.GetOrm(c) + if err != nil { + log.Error(err) + return + } + + msgID := tools.GenerateMsgIDFromContext(c) + //更新操作 + err = c.Bind(control) + if err != nil { + log.Errorf("msgID[%s] request bind error, %s", msgID, err.Error()) + e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败") + return + } + data := &system.SysRole{ + RoleId: control.RoleId, + DataScope: control.DataScope, + DeptIds: control.DeptIds, + } + data.UpdateBy = tools.GetUserId(c) + s := &service.SysRole{} + s.Orm = db + s.MsgID = msgID + err = s.UpdateDataScope(data) + if err != nil { + e.Error(c, http.StatusInternalServerError, err, "") + return + } + e.OK(c, nil, "操作成功") +} diff --git a/app/admin/middleware/db.go b/app/admin/middleware/db.go deleted file mode 100644 index 03f509ff..00000000 --- a/app/admin/middleware/db.go +++ /dev/null @@ -1,42 +0,0 @@ -package middleware - -import ( - "gorm.io/gorm" - "gorm.io/gorm/schema" - - "go-admin/common/config" - "go-admin/common/global" - "go-admin/common/middleware" - "go-admin/tools" -) - -var WithContextDb = middleware.WithContextDb - -func GetGormFromConfig(cfg config.Conf) map[string]*gorm.DB { - gormDB := make(map[string]*gorm.DB) - if cfg.GetSaas() { - var err error - for k, v := range cfg.GetDbs() { - gormDB[k], err = getGormFromDb(v.Driver, v.DB, &gorm.Config{ - NamingStrategy: schema.NamingStrategy{ - SingularTable: true, - }, - }) - if err != nil { - global.Logger.Fatal(tools.Red(k+" connect error :"), err) - } - } - return gormDB - } - c := cfg.GetDb() - db, err := getGormFromDb(c.Driver, c.DB, &gorm.Config{ - NamingStrategy: schema.NamingStrategy{ - SingularTable: true, - }, - }) - if err != nil { - global.Logger.Fatal(tools.Red(c.Driver+" connect error :"), err) - } - gormDB["*"] = db - return gormDB -} diff --git a/app/admin/middleware/db_other.go b/app/admin/middleware/db_other.go deleted file mode 100644 index d0eacbe9..00000000 --- a/app/admin/middleware/db_other.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build !sqlite3 - -package middleware - -import ( - "database/sql" - "errors" - - "gorm.io/driver/mysql" - "gorm.io/driver/postgres" - "gorm.io/gorm" -) - -func getGormFromDb(driver string, db *sql.DB, config *gorm.Config) (*gorm.DB, error) { - switch driver { - case "mysql": - return gorm.Open(mysql.New(mysql.Config{Conn: db}), config) - case "postgres": - return gorm.Open(postgres.New(postgres.Config{Conn: db}), config) - default: - return nil, errors.New("not support this db driver") - } -} diff --git a/app/admin/middleware/db_sqlite3.go b/app/admin/middleware/db_sqlite3.go deleted file mode 100644 index f2e2bde0..00000000 --- a/app/admin/middleware/db_sqlite3.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build sqlite3 - -package middleware - -import ( - "database/sql" - "errors" - - "gorm.io/driver/mysql" - "gorm.io/driver/postgres" - "gorm.io/driver/sqlite" - "gorm.io/gorm" - - "go-admin/common/global" -) - -func getGormFromDb(driver string, db *sql.DB, config *gorm.Config) (*gorm.DB, error) { - switch driver { - case "mysql": - return gorm.Open(mysql.New(mysql.Config{Conn: db}), config) - case "postgres": - return gorm.Open(postgres.New(postgres.Config{Conn: db}), config) - case "sqlite3": - return gorm.Open(sqlite.Open(global.Source), config) - default: - return nil, errors.New("not support this db driver") - } -} diff --git a/app/admin/middleware/init.go b/app/admin/middleware/init.go index 4b8be88e..7c15185d 100644 --- a/app/admin/middleware/init.go +++ b/app/admin/middleware/init.go @@ -17,5 +17,7 @@ func InitMiddleware(r *gin.Engine) { // Secure is a middleware function that appends security r.Use(Secure) // 链路追踪 - r.Use(middleware.Trace()) + //r.Use(middleware.Trace()) + // 数据库链接 + r.Use(middleware.WithContextDb) } diff --git a/app/admin/middleware/permission.go b/app/admin/middleware/permission.go index 8a5a138c..79187205 100644 --- a/app/admin/middleware/permission.go +++ b/app/admin/middleware/permission.go @@ -17,7 +17,7 @@ func AuthCheckRole() gin.HandlerFunc { return func(c *gin.Context) { data, _ := c.Get(jwtauth.JwtPayloadKey) v := data.(jwtauth.MapClaims) - e := global.CasbinEnforcer + e := global.Cfg.GetCasbinKey(c.Request.Host) var res bool var err error msgID := tools.GenerateMsgIDFromContext(c) @@ -38,7 +38,7 @@ func AuthCheckRole() gin.HandlerFunc { log.Infof("msgID[%s] isTrue: %v role: %s method: %s path: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path) c.Next() } else { - log.Warnf("msgID[%s] isTrue: %v role: %s method: %s path: %s message: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path,"当前request无权限,请管理员确认!") + log.Warnf("msgID[%s] isTrue: %v role: %s method: %s path: %s message: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path, "当前request无权限,请管理员确认!") c.JSON(http.StatusOK, gin.H{ "code": 403, "msg": "对不起,您没有该接口访问权限,请联系管理员", diff --git a/app/admin/models/roledept.go b/app/admin/models/roledept.go deleted file mode 100644 index dd094e1c..00000000 --- a/app/admin/models/roledept.go +++ /dev/null @@ -1,47 +0,0 @@ -package models - -import ( - "fmt" - - orm "go-admin/common/global" -) - -//sys_role_dept -type SysRoleDept struct { - RoleId int `gorm:""` - DeptId int `gorm:""` -} - -func (SysRoleDept) TableName() string { - return "sys_role_dept" -} - -func (rm *SysRoleDept) Insert(roleId int, deptIds []int) (bool, error) { - //ORM不支持批量插入所以需要拼接 sql 串 - sql := "INSERT INTO `sys_role_dept` (`role_id`,`dept_id`) VALUES " - - for i := 0; i < len(deptIds); i++ { - if len(deptIds)-1 == i { - //最后一条数据 以分号结尾 - sql += fmt.Sprintf("(%d,%d);", roleId, deptIds[i]) - } else { - sql += fmt.Sprintf("(%d,%d),", roleId, deptIds[i]) - } - } - orm.Eloquent.Exec(sql) - - return true, nil -} - -func (rm *SysRoleDept) DeleteRoleDept(roleId int) (bool, error) { - if err := orm.Eloquent.Table("sys_role_dept").Where("role_id = ?", roleId).Delete(&rm).Error; err != nil { - return false, err - } - var role SysRole - if err := orm.Eloquent.Table("sys_role").Where("role_id = ?", roleId).First(&role).Error; err != nil { - return false, err - } - - return true, nil - -} diff --git a/app/admin/models/system/role_dept.go b/app/admin/models/system/role_dept.go new file mode 100644 index 00000000..526f42e7 --- /dev/null +++ b/app/admin/models/system/role_dept.go @@ -0,0 +1,11 @@ +package system + +//sys_role_dept +type SysRoleDept struct { + RoleId int `gorm:"size:11;primaryKey"` + DeptId int `gorm:"size:11;primaryKey"` +} + +func (SysRoleDept) TableName() string { + return "sys_role_dept" +} diff --git a/app/admin/models/system/role_menu.go b/app/admin/models/system/role_menu.go new file mode 100644 index 00000000..12f234fd --- /dev/null +++ b/app/admin/models/system/role_menu.go @@ -0,0 +1,172 @@ +package system + +import ( + "fmt" + "github.com/casbin/casbin/v2" + "gorm.io/gorm" + + "go-admin/app/admin/models" + "go-admin/tools" +) + +type RoleMenu struct { + RoleId int `gorm:""` + MenuId int `gorm:""` + RoleName string `gorm:"size:128)"` + CreateBy string `gorm:"size:128)"` + UpdateBy string `gorm:"size:128)"` +} + +func (RoleMenu) TableName() string { + return "sys_role_menu" +} + +type MenuPath struct { + Path string `json:"path"` +} + +func (rm *RoleMenu) Get(tx *gorm.DB) ([]RoleMenu, error) { + var r []RoleMenu + table := tx.Table("sys_role_menu") + if rm.RoleId != 0 { + table = table.Where("role_id = ?", rm.RoleId) + + } + if err := table.Find(&r).Error; err != nil { + return nil, err + } + return r, nil +} + +func (rm *RoleMenu) GetPermis(tx *gorm.DB) ([]string, error) { + var r []models.Menu + table := tx.Select("sys_menu.permission").Table("sys_menu").Joins("left join sys_role_menu on sys_menu.menu_id = sys_role_menu.menu_id") + + table = table.Where("role_id = ?", rm.RoleId) + + table = table.Where("sys_menu.menu_type in('F','C')") + if err := table.Find(&r).Error; err != nil { + return nil, err + } + var list []string + for i := 0; i < len(r); i++ { + list = append(list, r[i].Permission) + } + return list, nil +} + +func (rm *RoleMenu) GetIDS(tx *gorm.DB) ([]MenuPath, error) { + var r []MenuPath + table := tx.Select("sys_menu.path").Table("sys_role_menu") + table = table.Joins("left join sys_role on sys_role.role_id=sys_role_menu.role_id") + table = table.Joins("left join sys_menu on sys_menu.id=sys_role_menu.menu_id") + table = table.Where("sys_role.role_name = ? and sys_menu.type=1", rm.RoleName) + if err := table.Find(&r).Error; err != nil { + return nil, err + } + return r, nil +} + +func (rm *RoleMenu) DeleteRoleMenu(tx *gorm.DB, roleId int) error { + if err := tx.Table("sys_role_dept").Where("role_id = ?", roleId).Delete(&rm).Error; err != nil { + return err + } + if err := tx.Table("sys_role_menu").Where("role_id = ?", roleId).Delete(&rm).Error; err != nil { + return err + } + var role SysRole + if err := tx.Table("sys_role").Where("role_id = ?", roleId).First(&role).Error; err != nil { + return err + } + sql3 := "delete from sys_casbin_rule where v0= '" + role.RoleKey + "';" + if err := tx.Exec(sql3).Error; err != nil { + return err + } + return nil + +} + +// 该方法即将弃用 +func (rm *RoleMenu) BatchDeleteRoleMenu(tx *gorm.DB, roleIds []int) error { + if err := tx.Table("sys_role_menu").Where("role_id in (?)", roleIds).Delete(&rm).Error; err != nil { + return err + } + var role []SysRole + if err := tx.Table("sys_role").Where("role_id in (?)", roleIds).Find(&role).Error; err != nil { + return err + } + sql := "" + for i := 0; i < len(role); i++ { + sql += "delete from sys_casbin_rule where v0= '" + role[i].RoleName + "';" + } + if err := tx.Exec(sql).Error; err != nil { + return err + } + if err := tx.Commit().Error; err != nil { + return err + } + return nil + +} + +func (rm *RoleMenu) Insert(tx *gorm.DB, enforcer *casbin.SyncedEnforcer, roleId int, menuId []int) error { + var err error + var ( + role SysRole + menu []models.Menu + casbinRules []models.CasbinRule // casbinRule 待插入队列 + ) + // 在事务中做一些数据库操作(从这一点使用'tx',而不是'db') + if err = tx.Table("sys_role").Where("role_id = ?", roleId).First(&role).Error; err != nil { + return err + } + if err = tx.Table("sys_menu").Where("menu_id in (?)", menuId).Find(&menu).Error; err != nil { + return err + } + //ORM不支持批量插入所以需要拼接 sql 串 + sysRoleMenuSql := "INSERT INTO `sys_role_menu` (`role_id`,`menu_id`,`role_name`) VALUES " + + for i, m := range menu { + // 拼装'role_menu'表批量插入SQL语句 + sysRoleMenuSql += fmt.Sprintf("(%d,%d,'%s')", role.RoleId, m.MenuId, role.RoleKey) + if i == len(menu)-1 { + sysRoleMenuSql += ";" //最后一条数据 以分号结尾 + } else { + sysRoleMenuSql += "," + } + if m.MenuType == "A" { + // 加入队列 + casbinRules = append(casbinRules, + models.CasbinRule{ + V0: role.RoleKey, + V1: m.Path, + V2: m.Action, + }) + } + } + // 执行批量插入sys_role_menu + if err = tx.Exec(sysRoleMenuSql).Error; err != nil { + return err + } + + // 执行批量插入sys_casbin_rule + if len(casbinRules) > 0 { + if err = tx.Create(&casbinRules).Error; err != nil { + return err + } + } + return nil +} + +func (rm *RoleMenu) Delete(tx *gorm.DB, RoleId string, MenuID string) (bool, error) { + rm.RoleId, _ = tools.StringToInt(RoleId) + table := tx.Table("sys_role_menu").Where("role_id = ?", RoleId) + if MenuID != "" { + table = table.Where("menu_id = ?", MenuID) + } + if err := table.Delete(&rm).Error; err != nil { + return false, err + } + return true, nil + +} diff --git a/app/admin/router/initrouter.go b/app/admin/router/initrouter.go index 8bc82ed7..c3b62452 100644 --- a/app/admin/router/initrouter.go +++ b/app/admin/router/initrouter.go @@ -32,7 +32,6 @@ func InitRouter() { if config.SslConfig.Enable { r.Use(handler.TlsHandler()) } - r.Use(middleware.WithContextDb(middleware.GetGormFromConfig(global.Cfg))) r.Use(common.Sentinel()) middleware.InitMiddleware(r) diff --git a/app/admin/router/sys_role.go b/app/admin/router/sys_role.go index 189c0e6c..809580f1 100644 --- a/app/admin/router/sys_role.go +++ b/app/admin/router/sys_role.go @@ -22,4 +22,5 @@ func registerSysRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle r.PUT("/:id", api.UpdateSysRole) r.DELETE("/:id", api.DeleteSysRole) } + v1.PUT("/roledatascope", api.UpdateRoleDataScope) } diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sysrouter.go index aaf96b0a..b3d55e04 100644 --- a/app/admin/router/sysrouter.go +++ b/app/admin/router/sysrouter.go @@ -117,7 +117,7 @@ func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar { v1auth.GET("/getinfo", system.GetInfo) - v1auth.PUT("/roledatascope", system.UpdateRoleDataScope) + //v1auth.PUT("/roledatascope", system.UpdateRoleDataScope) v1auth.GET("/roleMenuTreeselect/:roleId", system.GetMenuTreeRoleselect) v1auth.GET("/roleDeptTreeselect/:roleId", system.GetDeptTreeRoleselect) @@ -168,15 +168,15 @@ func registerPostRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar // } //} -func registerRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - role := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - role.GET("/:roleId", system.GetRole) - role.POST("", system.InsertRole) - role.PUT("", system.UpdateRole) - role.DELETE("/:roleId", system.DeleteRole) - } -} +//func registerRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { +// role := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) +// { +// role.GET("/:roleId", system.GetRole) +// role.POST("", system.InsertRole) +// role.PUT("", system.UpdateRole) +// role.DELETE("/:roleId", system.DeleteRole) +// } +//} func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { sysuser := v1.Group("/sysUser").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) diff --git a/app/admin/service/dto/sys_role.go b/app/admin/service/dto/sys_role.go index 40e5022f..f5c01317 100644 --- a/app/admin/service/dto/sys_role.go +++ b/app/admin/service/dto/sys_role.go @@ -51,6 +51,7 @@ type SysRoleControl struct { Remark string `form:"remark" comment:"备注"` // 备注 Admin bool `form:"admin" comment:"是否管理员"` DataScope string `form:"dataScope" comment:"是否管理员"` + MenuIds []int `json:"menuIds"` } // Bind 映射上下文中的结构体数据 @@ -86,6 +87,7 @@ func (s *SysRoleControl) Generate() (*system.SysRole, error) { Remark: s.Remark, Admin: s.Admin, DataScope: s.DataScope, + MenuIds: s.MenuIds, }, nil } @@ -131,4 +133,5 @@ func (s *SysRoleById) GenerateM() (*models.SysRole, error) { type RoleDataScopeReq struct { RoleId int `json:"roleId" binding:"required"` DataScope string `json:"dataScope" binding:"required"` + DeptIds []int `json:"deptIds"` } diff --git a/app/admin/service/sys_role.go b/app/admin/service/sys_role.go index 599661d8..00692ff4 100644 --- a/app/admin/service/sys_role.go +++ b/app/admin/service/sys_role.go @@ -2,12 +2,16 @@ package service import ( "errors" + + "gorm.io/gorm" + + "go-admin/app/admin/models" "go-admin/app/admin/models/system" "go-admin/app/admin/service/dto" cDto "go-admin/common/dto" + orm "go-admin/common/global" "go-admin/common/log" "go-admin/common/service" - "gorm.io/gorm" ) type SysRole struct { @@ -48,35 +52,66 @@ func (e *SysRole) GetSysRole(d *dto.SysRoleById, model *system.SysRole) error { log.Errorf("msgID[%s] db error:%s", msgID, err) return err } - if db.Error != nil { + if err != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) return err } + data.MenuIds, err = e.GetRoleMenuId(data.RoleId) + if err != nil { + log.Errorf("msgID[%s] get menuIds error, %s", msgID, err.Error()) + return err + } return nil } // InsertSysRole 创建SysRole对象 -func (e *SysRole) InsertSysRole(model *system.SysRole) error { +func (e *SysRole) InsertSysRole(c *system.SysRole) error { var err error var data system.SysRole msgID := e.MsgID - err = e.Orm.Model(&data). - Create(model).Error + tx := e.Orm.Begin() + defer func() { + if err != nil { + tx.Rollback() + } else { + tx.Commit() + } + }() + + err = tx.Model(&data). + Create(c).Error if err != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) return err } + if len(c.MenuIds) > 0 { + s := SysRoleMenu{} + s.Orm = e.Orm + s.MsgID = msgID + err = s.ReloadRule(tx, c.RoleId, c.MenuIds) + if err != nil { + log.Errorf("msgID[%s] reload casbin rule error, %", msgID, err.Error()) + return err + } + } return nil } // UpdateSysRole 修改SysRole对象 func (e *SysRole) UpdateSysRole(c *system.SysRole) error { var err error - var data system.SysRole msgID := e.MsgID - db := e.Orm.Model(&data). + tx := e.Orm.Debug().Begin() + defer func() { + if err != nil { + tx.Rollback() + } else { + tx.Commit() + } + }() + db := tx.Model(&c). Where(c.GetId()).Updates(c) if db.Error != nil { log.Errorf("msgID[%s] db error:%s", msgID, err) @@ -85,6 +120,23 @@ func (e *SysRole) UpdateSysRole(c *system.SysRole) error { if db.RowsAffected == 0 { return errors.New("无权更新该数据") } + + var t system.RoleMenu + err = t.DeleteRoleMenu(tx, c.RoleId) + if err != nil { + log.Errorf("msgID[%s] delete role menu error, %", msgID, err.Error()) + return err + } + if len(c.MenuIds) > 0 { + s := SysRoleMenu{} + s.Orm = e.Orm + s.MsgID = msgID + err = s.ReloadRule(tx, c.RoleId, c.MenuIds) + if err != nil { + log.Errorf("msgID[%s] reload casbin rule error, %", msgID, err.Error()) + return err + } + } return nil } @@ -94,7 +146,16 @@ func (e *SysRole) RemoveSysRole(d *dto.SysRoleById) error { var data system.SysRole msgID := e.MsgID - db := e.Orm.Model(&data).Delete(&data, d.GetId()) + tx := e.Orm.Begin() + defer func() { + if err != nil { + tx.Rollback() + } else { + tx.Commit() + } + }() + + db := tx.Model(&data).Delete(&data, d.GetId()) if db.Error != nil { err = db.Error log.Errorf("MsgID[%s] Delete error: %s", msgID, err) @@ -104,5 +165,67 @@ func (e *SysRole) RemoveSysRole(d *dto.SysRoleById) error { err = errors.New("无权删除该数据") return err } + s := SysRoleMenu{} + s.Orm = db + s.MsgID = msgID + err = s.DeleteRoleMenu(tx, d.Id) + if err != nil { + log.Errorf("msgID[%s] insert role menu error, %", msgID, err.Error()) + return err + } return nil } + +// 获取角色对应的菜单ids +func (e *SysRole) GetRoleMenuId(roleId int) ([]int, error) { + menuIds := make([]int, 0) + menuList := make([]models.MenuIdList, 0) + if err := orm.Eloquent.Table("sys_role_menu"). + Select("sys_role_menu.menu_id"). + Where("role_id = ? ", roleId). + Where(" sys_role_menu.menu_id not in(select sys_menu.parent_id from sys_role_menu "+ + "LEFT JOIN sys_menu on sys_menu.menu_id=sys_role_menu.menu_id where role_id =? and parent_id is not null)", roleId). + Find(&menuList).Error; err != nil { + return nil, err + } + + for i := 0; i < len(menuList); i++ { + menuIds = append(menuIds, menuList[i].MenuId) + } + return menuIds, nil +} + +func (e *SysRole) UpdateDataScope(c *system.SysRole) (err error) { + tx := e.Orm.Begin() + defer func() { + if err != nil { + tx.Rollback() + } else { + tx.Commit() + } + }() + err = tx.Model(&system.SysRole{}).Where("role_id = ?", c.RoleId).Select("data_scope, update_by").Updates(c).Error + if err != nil { + return err + } + + err = tx.Where("role_id = ?", c.RoleId).Delete(&system.SysRoleDept{}).Error + if err != nil { + return err + } + + if c.DataScope == "2" { + deptRoles := make([]system.SysRoleDept, len(c.DeptIds)) + for i := range c.DeptIds { + deptRoles[i] = system.SysRoleDept{ + RoleId: c.RoleId, + DeptId: c.DeptIds[i], + } + } + err = tx.Create(&deptRoles).Error + if err != nil { + return err + } + } + return err +} diff --git a/app/admin/service/sys_role_menu.go b/app/admin/service/sys_role_menu.go new file mode 100644 index 00000000..a4fe849e --- /dev/null +++ b/app/admin/service/sys_role_menu.go @@ -0,0 +1,113 @@ +package service + +import ( + "go-admin/app/admin/models" + "go-admin/app/admin/models/system" + "go-admin/common/log" + "go-admin/common/service" + "gorm.io/gorm" +) + +type SysRoleMenu struct { + service.Service +} + +func (e *SysRoleMenu) ReloadRule(tx *gorm.DB, roleId int, menuId []int) (err error) { + var role system.SysRole + + msgID := e.MsgID + + menu := make([]models.Menu, 0) + roleMenu := make([]system.RoleMenu, len(menuId)) + casbinRule := make([]models.CasbinRule, 0) + //先删除所有的 + err = e.DeleteRoleMenu(tx, roleId) + if err != nil { + return + } + + // 在事务中做一些数据库操作(从这一点使用'tx',而不是'db') + err = tx.Where("role_id = ?", roleId).First(&role).Error + if err != nil { + log.Errorf("msgID[%s] get role error, %s", msgID, err.Error()) + return + } + err = tx.Where("menu_id in (?)", menuId). + //Select("path, action, menu_id, menu_type"). + Find(&menu).Error + if err != nil { + log.Errorf("msgID[%s] get menu error, %s", msgID, err.Error()) + return + } + for i := range menu { + roleMenu[i] = system.RoleMenu{ + RoleId: role.RoleId, + MenuId: menu[i].MenuId, + RoleName: role.RoleKey, + } + if menu[i].MenuType == "A" { + casbinRule = append(casbinRule, models.CasbinRule{ + PType: "p", + V0: role.RoleKey, + V1: menu[i].Path, + V2: menu[i].Action, + }) + } + } + err = tx.Create(&roleMenu).Error + if err != nil { + log.Errorf("msgID[%s] batch create role's menu error, %s", msgID, err.Error()) + return + } + if len(casbinRule) > 0 { + err = tx.Create(&casbinRule).Error + if err != nil { + log.Errorf("msgID[%s] batch create casbin rule error, %s", msgID, err.Error()) + return + } + } + + return +} + +func (e *SysRoleMenu) DeleteRoleMenu(tx *gorm.DB, roleId int) (err error) { + msgID := e.MsgID + err = tx.Where("role_id = ?", roleId). + Delete(&system.SysRoleDept{}).Error + if err != nil { + log.Errorf("msgID[%s] delete role's dept error, %s", msgID, err.Error()) + return + } + err = tx.Where("role_id = ?", roleId). + Delete(&system.RoleMenu{}).Error + if err != nil { + log.Errorf("msgID[%s] delete role's menu error, %s", msgID, err.Error()) + return + } + var role system.SysRole + err = tx.Where("role_id = ?", roleId). + First(&role).Error + if err != nil { + log.Errorf("msgID[%s] get role error, %s", msgID, err.Error()) + return + } + err = tx.Where("v0 = ?", role.RoleKey). + Delete(&models.CasbinRule{}).Error + if err != nil { + log.Errorf("msgID[%s] delete casbin rule error, %s", msgID, err.Error()) + return + } + return +} + +func (e *SysRoleMenu) GetIDS(tx *gorm.DB, roleName string) ([]system.MenuPath, error) { + var r []system.MenuPath + table := tx.Select("sys_menu.path").Table("sys_role_menu") + table = table.Joins("left join sys_role on sys_role.role_id=sys_role_menu.role_id") + table = table.Joins("left join sys_menu on sys_menu.id=sys_role_menu.menu_id") + table = table.Where("sys_role.role_name = ? and sys_menu.type=1", roleName) + if err := table.Find(&r).Error; err != nil { + return nil, err + } + return r, nil +} diff --git a/cmd/api/server.go b/cmd/api/server.go index 55bdffda..3197a064 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -17,19 +17,14 @@ import ( "go-admin/common/database" "go-admin/common/global" "go-admin/common/log" - mycasbin "go-admin/pkg/casbin" "go-admin/pkg/logger" "go-admin/tools" "go-admin/tools/config" - "go-admin/tools/trace" ) var ( - configYml string - port string - mode string - traceStart bool - StartCmd = &cobra.Command{ + configYml string + StartCmd = &cobra.Command{ Use: "server", Short: "Start API server", Example: "go-admin server -c config/settings.yml", @@ -47,9 +42,6 @@ var AppRouters = make([]func(), 0) func init() { StartCmd.PersistentFlags().StringVarP(&configYml, "config", "c", "config/settings.yml", "Start server with provided configuration file") - StartCmd.PersistentFlags().StringVarP(&port, "port", "p", "8000", "Tcp port server listening on") - StartCmd.PersistentFlags().StringVarP(&mode, "mode", "m", "dev", "server mode ; eg:dev,test,prod") - StartCmd.PersistentFlags().BoolVarP(&traceStart, "traceStart", "t", false, "start traceStart app dash") //注册路由 fixme 其他应用的路由,在本目录新建文件放在init方法 AppRouters = append(AppRouters, router.InitRouter) @@ -65,9 +57,7 @@ func setup() { global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job") global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request") //3. 初始化数据库链接 - database.Setup(config.DatabaseConfig.Driver) - //4. 接口访问控制加载 - global.CasbinEnforcer = mycasbin.Setup(global.Eloquent, "sys_") + database.Setup() usageStr := `starting api server` log.Info(usageStr) @@ -85,7 +75,7 @@ func run() error { engine = gin.New() } - if mode == "dev" { + if config.ApplicationConfig.Mode == "dev" { //监控 AppRouters = append(AppRouters, router.Monitor) } @@ -107,12 +97,6 @@ func run() error { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - if traceStart { - //链路追踪, fixme 页面显示需要自备梯子 - trace.Start() - defer trace.Stop(ctx) - } - go func() { // 服务连接 if config.SslConfig.Enable { diff --git a/cmd/config/server.go b/cmd/config/server.go index f23cba39..38d65afa 100644 --- a/cmd/config/server.go +++ b/cmd/config/server.go @@ -12,7 +12,6 @@ import ( var ( configYml string - mode string StartCmd = &cobra.Command{ Use: "config", Short: "Get Application config info", @@ -42,7 +41,8 @@ func run() { } fmt.Println("jwt:", string(jwt)) - database, errs := json.MarshalIndent(config.DatabaseConfig, "", " ") //转换成JSON返回的是byte[] + // todo 需要兼容 + database, errs := json.MarshalIndent(config.DatabasesConfig, "", " ") //转换成JSON返回的是byte[] if errs != nil { fmt.Println(errs.Error()) } diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 408ee5ce..ba500d39 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -28,7 +28,7 @@ func _1599190683659Tables(db *gorm.DB, version string) error { new(system.SysLoginLog), new(system.SysOperaLog), new(models.RoleMenu), - new(models.SysRoleDept), + new(system.SysRoleDept), new(models.SysUser), new(system.SysRole), new(models.Post), diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index 99da7ead..f47ebf73 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -72,7 +72,7 @@ func migrateModel() error { } func initDB() error { //3. 初始化数据库链接 - database.Setup(config.DatabaseConfig.Driver) + database.Setup() //4. 数据库迁移 fmt.Println("数据库迁移开始") _ = migrateModel() diff --git a/common/config/config.go b/common/config/config.go index 5222d114..0b5fa438 100644 --- a/common/config/config.go +++ b/common/config/config.go @@ -1,47 +1,47 @@ package config import ( - "database/sql" "net/http" + "github.com/casbin/casbin/v2" "github.com/go-admin-team/go-admin-core/logger" + "gorm.io/gorm" ) type Config struct { - saas bool - dbs map[string]*DBConfig - db *DBConfig - engine http.Handler + dbs map[string]*gorm.DB + casbins map[string]*casbin.SyncedEnforcer + engine http.Handler } -type DBConfig struct { - Driver string - DB *sql.DB -} - -// SetDbs 设置对应key的db -func (c *Config) SetDbs(key string, db *DBConfig) { +// SetDb 设置对应key的db +func (c *Config) SetDb(key string, db *gorm.DB) { c.dbs[key] = db } -// GetDbs 获取所有map里的db数据 -func (c *Config) GetDbs() map[string]*DBConfig { +// GetDb 获取所有map里的db数据 +func (c *Config) GetDb() map[string]*gorm.DB { return c.dbs } // GetDbByKey 根据key获取db -func (c *Config) GetDbByKey(key string) *DBConfig { +func (c *Config) GetDbByKey(key string) *gorm.DB { + if db, ok := c.dbs["*"]; ok { + return db + } return c.dbs[key] } -// SetDb 设置单个db -func (c *Config) SetDb(db *DBConfig) { - c.db = db +func (c *Config) SetCasbin(key string, enforcer *casbin.SyncedEnforcer) { + c.casbins[key] = enforcer } -// GetDb 获取单个db -func (c *Config) GetDb() *DBConfig { - return c.db +// GetCasbinKey 根据key获取casbin +func (c *Config) GetCasbinKey(key string) *casbin.SyncedEnforcer { + if e, ok := c.casbins["*"]; ok { + return e + } + return c.casbins[key] } // SetEngine 设置路由引擎 @@ -64,16 +64,10 @@ func (c *Config) GetLogger() logger.Logger { return logger.DefaultLogger } -// SetSaas 设置是否是saas应用 -func (c *Config) SetSaas(saas bool) { - c.saas = saas -} - -// GetSaas 获取是否是saas应用 -func (c *Config) GetSaas() bool { - return c.saas -} - -func DefaultConfig() *Config { - return &Config{} +// NewConfig 默认值 +func NewConfig() *Config { + return &Config{ + dbs: make(map[string]*gorm.DB), + casbins: make(map[string]*casbin.SyncedEnforcer), + } } diff --git a/common/config/type.go b/common/config/type.go index a8060a62..c3f772a1 100644 --- a/common/config/type.go +++ b/common/config/type.go @@ -1,22 +1,21 @@ package config import ( + "github.com/casbin/casbin/v2" "net/http" "github.com/go-admin-team/go-admin-core/logger" + "gorm.io/gorm" ) type Conf interface { //多db设置,⚠️SetDbs不允许并发,可以根据自己的业务,例如app分库、host分库 - SetDbs(key string, db *DBConfig) - GetDbs() map[string]*DBConfig - GetDbByKey(key string) *DBConfig - GetSaas() bool - SetSaas(bool) + SetDb(key string, db *gorm.DB) + GetDb() map[string]*gorm.DB + GetDbByKey(key string) *gorm.DB - //单库业务实现这两个接口 - SetDb(db *DBConfig) - GetDb() *DBConfig + SetCasbin(key string, enforcer *casbin.SyncedEnforcer) + GetCasbinKey(key string) *casbin.SyncedEnforcer //使用的路由 SetEngine(engine http.Handler) diff --git a/common/database/initialize.go b/common/database/initialize.go index f59ac3bb..0a188546 100644 --- a/common/database/initialize.go +++ b/common/database/initialize.go @@ -1,17 +1,59 @@ -// +build !sqlite3 - package database -// Setup 配置数据库 -func Setup(driver string) { - dbType := driver - if dbType == "mysql" { - var db = new(Mysql) - db.Setup() - } +import ( + . "log" + "time" - if dbType == "postgres" { - var db = new(PgSql) - db.Setup() + logCore "github.com/go-admin-team/go-admin-core/logger" + "gorm.io/gorm" + "gorm.io/gorm/logger" + "gorm.io/gorm/schema" + + "go-admin/common/global" + "go-admin/common/log" + mycasbin "go-admin/pkg/casbin" + "go-admin/tools" + toolsConfig "go-admin/tools/config" +) + +// Setup 配置数据库 +func Setup() { + for k := range toolsConfig.DatabasesConfig { + setupSimpleDatabase(k, toolsConfig.DatabasesConfig[k]) } } + +func setupSimpleDatabase(host string, c *toolsConfig.Database) { + if global.Driver == "" { + global.Driver = c.Driver + } + log.Infof("%s => %s", host, tools.Green(c.Source)) + db, err := gorm.Open(open[c.Driver](c.Source), &gorm.Config{ + NamingStrategy: schema.NamingStrategy{ + SingularTable: true, + }, + Logger: logger.New( + New(logCore.DefaultLogger.Options().Out, "\r\n", LstdFlags), + logger.Config{ + SlowThreshold: time.Second, + Colorful: true, + LogLevel: logger.LogLevel( + logCore.DefaultLogger.Options().Level.LevelForGorm()), + }, + ), + }) + if err != nil { + log.Fatal(tools.Red(c.Driver+" connect error :"), err) + } else { + log.Info(tools.Green(c.Driver + " connect success !")) + } + + e := mycasbin.Setup(db, "sys_") + + if host == "*" { + global.Eloquent = db + } + + global.Cfg.SetDb(host, db) + global.Cfg.SetCasbin(host, e) +} diff --git a/common/database/initialize_sqlite3.go b/common/database/initialize_sqlite3.go deleted file mode 100644 index 7bd6523e..00000000 --- a/common/database/initialize_sqlite3.go +++ /dev/null @@ -1,21 +0,0 @@ -// +build sqlite3 - -package database - -func Setup(driver string) { - dbType := driver - if dbType == "mysql" { - var db = new(Mysql) - db.Setup() - } - - if dbType == "sqlite3" { - var db = new(SqLite) - db.Setup() - } - - if dbType == "postgres" { - var db = new(PgSql) - db.Setup() - } -} diff --git a/common/database/interface.go b/common/database/interface.go deleted file mode 100644 index 59c5e1ce..00000000 --- a/common/database/interface.go +++ /dev/null @@ -1,11 +0,0 @@ -package database - -import "gorm.io/gorm" - -// Database 数据库配置 -type Database interface { - Setup() - Open(conn string, cfg *gorm.Config) (db *gorm.DB, err error) - GetConnect() string - GetDriver() string -} diff --git a/common/database/mysql_drive.go b/common/database/mysql_drive.go deleted file mode 100644 index faa4d977..00000000 --- a/common/database/mysql_drive.go +++ /dev/null @@ -1,77 +0,0 @@ -package database - -import ( - "database/sql" - . "log" - "time" - - goAdminLogger "github.com/go-admin-team/go-admin-core/logger" - "gorm.io/driver/mysql" - "gorm.io/gorm" - "gorm.io/gorm/logger" - "gorm.io/gorm/schema" - - "go-admin/common/config" - "go-admin/common/global" - "go-admin/common/log" - "go-admin/tools" - toolsConfig "go-admin/tools/config" -) - -// Mysql mysql配置结构体 -type Mysql struct { -} - -// Setup 配置步骤 -func (e *Mysql) Setup() { - global.Source = e.GetConnect() - log.Info(tools.Green(global.Source)) - db, err := sql.Open("mysql", global.Source) - if err != nil { - log.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) - } - global.Cfg.SetDb(&config.DBConfig{ - Driver: "mysql", - DB: db, - }) - global.Eloquent, err = e.Open(db, &gorm.Config{ - NamingStrategy: schema.NamingStrategy{ - SingularTable: true, - }, - }) - if err != nil { - log.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) - } else { - log.Info(tools.Green(e.GetDriver() + " connect success !")) - } - - if global.Eloquent.Error != nil { - log.Fatal(tools.Red(" database error :"), global.Eloquent.Error) - } - - if toolsConfig.LoggerConfig.EnabledDB { - global.Eloquent.Logger = logger.New( - New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", LstdFlags), - logger.Config{ - SlowThreshold: time.Second, - Colorful: true, - LogLevel: logger.LogLevel( - goAdminLogger.DefaultLogger.Options().Level.LevelForGorm()), - }) - } -} - -// Open 打开数据库连接 -func (e *Mysql) Open(db *sql.DB, cfg *gorm.Config) (*gorm.DB, error) { - return gorm.Open(mysql.New(mysql.Config{Conn: db}), cfg) -} - -// GetConnect 获取数据库连接 -func (e *Mysql) GetConnect() string { - return toolsConfig.DatabaseConfig.Source -} - -// GetDriver 获取连接 -func (e *Mysql) GetDriver() string { - return toolsConfig.DatabaseConfig.Driver -} diff --git a/common/database/open.go b/common/database/open.go new file mode 100644 index 00000000..1dbd4a32 --- /dev/null +++ b/common/database/open.go @@ -0,0 +1,14 @@ +// +build !sqlite3 + +package database + +import ( + "gorm.io/driver/mysql" + "gorm.io/driver/postgres" + "gorm.io/gorm" +) + +var open = map[string]func(string) gorm.Dialector{ + "mysql": mysql.Open, + "postgres": postgres.Open, +} diff --git a/common/database/open_sqlite3.go b/common/database/open_sqlite3.go new file mode 100644 index 00000000..387d1286 --- /dev/null +++ b/common/database/open_sqlite3.go @@ -0,0 +1,16 @@ +// +build sqlite3 + +package database + +import ( + "gorm.io/driver/mysql" + "gorm.io/driver/postgres" + "gorm.io/driver/sqlite" + "gorm.io/gorm" +) + +var open = map[string]func(string) gorm.Dialector{ + "mysql": mysql.Open, + "postgres": postgres.Open, + "sqlite3": sqlite.Open, +} diff --git a/common/database/pgsql_driver.go b/common/database/pgsql_driver.go deleted file mode 100644 index b1d9bead..00000000 --- a/common/database/pgsql_driver.go +++ /dev/null @@ -1,75 +0,0 @@ -package database - -import ( - "database/sql" - "go-admin/common/log" - . "log" - "time" - - "gorm.io/driver/postgres" - "gorm.io/gorm" - "gorm.io/gorm/logger" - "gorm.io/gorm/schema" - - goAdminLogger "github.com/go-admin-team/go-admin-core/logger" - "go-admin/common/config" - "go-admin/common/global" - "go-admin/tools" - toolsConfig "go-admin/tools/config" -) - -type PgSql struct { -} - -func (e *PgSql) Setup() { - var err error - - global.Source = e.GetConnect() - log.Info(global.Source) - db, err := sql.Open("postgresql", global.Source) - if err != nil { - global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) - } - global.Cfg.SetDb(&config.DBConfig{ - Driver: "mysql", - DB: db, - }) - global.Eloquent, err = e.Open(db, &gorm.Config{ - NamingStrategy: schema.NamingStrategy{ - SingularTable: true, - }, - }) - if err != nil { - log.Fatalf("%s connect error %v", e.GetDriver(), err) - } else { - log.Infof("%s connect success!", e.GetDriver()) - } - - if global.Eloquent.Error != nil { - log.Fatalf("database error %v", global.Eloquent.Error) - } - - if toolsConfig.LoggerConfig.EnabledDB { - global.Eloquent.Logger = logger.New( - New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", LstdFlags), - logger.Config{ - SlowThreshold: time.Second, - Colorful: true, - LogLevel: logger.LogLevel( - goAdminLogger.DefaultLogger.Options().Level.LevelForGorm()), - }) - } -} - -// 打开数据库连接 -func (e *PgSql) Open(db *sql.DB, cfg *gorm.Config) (*gorm.DB, error) { - return gorm.Open(postgres.New(postgres.Config{Conn: db}), cfg) -} - -func (e *PgSql) GetConnect() string { - return toolsConfig.DatabaseConfig.Source -} - -func (e *PgSql) GetDriver() string { - return toolsConfig.DatabaseConfig.Driver -} diff --git a/common/database/sqlite3_driver.go b/common/database/sqlite3_driver.go deleted file mode 100644 index c7fb5173..00000000 --- a/common/database/sqlite3_driver.go +++ /dev/null @@ -1,77 +0,0 @@ -// +build sqlite3 - -package database - -import ( - "database/sql" - . "log" - "os" - "time" - - "gorm.io/driver/sqlite" - "gorm.io/gorm" - "gorm.io/gorm/logger" - "gorm.io/gorm/schema" - - "go-admin/common/config" - "go-admin/common/global" - "go-admin/common/log" - "go-admin/tools" - toolsConfig "go-admin/tools/config" -) - -type SqLite struct { -} - -func (e *SqLite) Setup() { - var err error - - global.Source = e.GetConnect() - log.Info(global.Source) - db, err := sql.Open("sqlite3", global.Source) - if err != nil { - global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err) - } - global.Cfg.SetDb(&config.DBConfig{ - Driver: "sqlite3", - DB: db, - }) - global.Eloquent, err = e.Open(e.GetConnect(), &gorm.Config{ - NamingStrategy: schema.NamingStrategy{ - SingularTable: true, - }, - }) - - if err != nil { - log.Fatalf("%s connect error %v", e.GetDriver(), err) - } else { - log.Infof("%s connect success!", e.GetDriver()) - } - - if global.Eloquent.Error != nil { - log.Fatalf("database error %v", global.Eloquent.Error) - } - - if toolsConfig.LoggerConfig.EnabledDB { - global.Eloquent.Logger = logger.New( - New(os.Stdout, "\r\n", LstdFlags), logger.Config{ - SlowThreshold: time.Second, - Colorful: true, - LogLevel: logger.Info, - }, - ) - } -} - -// 打开数据库连接 -func (*SqLite) Open(conn string, cfg *gorm.Config) (db *gorm.DB, err error) { - return gorm.Open(sqlite.Open(conn), cfg) -} - -func (e *SqLite) GetConnect() string { - return toolsConfig.DatabaseConfig.Source -} - -func (e *SqLite) GetDriver() string { - return toolsConfig.DatabaseConfig.Driver -} diff --git a/common/dto/search.go b/common/dto/search.go index 5c2cbcf8..72cc60e4 100644 --- a/common/dto/search.go +++ b/common/dto/search.go @@ -2,9 +2,8 @@ package dto import ( "github.com/go-admin-team/go-admin-core/tools/search" + "go-admin/common/global" "gorm.io/gorm" - - "go-admin/tools/config" ) type GeneralDelDto struct { @@ -45,7 +44,7 @@ func MakeCondition(q interface{}) func(db *gorm.DB) *gorm.DB { GormPublic: search.GormPublic{}, Join: make([]*search.GormJoin, 0), } - search.ResolveSearchQuery(config.DatabaseConfig.Driver, q, condition) + search.ResolveSearchQuery(global.Driver, q, condition) for _, join := range condition.Join { if join == nil { continue diff --git a/common/global/adm.go b/common/global/adm.go index 291e4fef..58d20b09 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -1,7 +1,6 @@ package global import ( - "github.com/casbin/casbin/v2" "github.com/gin-gonic/gin" "github.com/robfig/cron/v3" "gorm.io/gorm" @@ -15,10 +14,9 @@ const ( Version = "1.2.3" ) -var Cfg config.Conf = config.DefaultConfig() +var Cfg config.Conf = config.NewConfig() var GinEngine *gin.Engine -var CasbinEnforcer *casbin.SyncedEnforcer var Eloquent *gorm.DB var GADMCron *cron.Cron diff --git a/common/global/casbin.go b/common/global/casbin.go index bbe300fe..f10d9df5 100644 --- a/common/global/casbin.go +++ b/common/global/casbin.go @@ -3,13 +3,17 @@ package global import ( "github.com/casbin/casbin/v2" "github.com/casbin/casbin/v2/log" + "github.com/gin-gonic/gin" + + "go-admin/tools" ) -func LoadPolicy() (*casbin.SyncedEnforcer, error) { - if err := CasbinEnforcer.LoadPolicy(); err == nil { - return CasbinEnforcer, err +func LoadPolicy(c *gin.Context) (*casbin.SyncedEnforcer, error) { + if err := Cfg.GetCasbinKey(c.Request.Host).LoadPolicy(); err == nil { + return Cfg.GetCasbinKey(c.Request.Host), err } else { - log.LogPrintf("casbin rbac_model or policy init error, message: %v \r\n", err.Error()) + msgID := tools.GenerateMsgIDFromContext(c) + log.LogPrintf("msgID[%s] casbin rbac_model or policy init error, message: %v \r\n", msgID, err.Error()) return nil, err } } diff --git a/common/middleware/db.go b/common/middleware/db.go index 272ec3df..f2d3f895 100644 --- a/common/middleware/db.go +++ b/common/middleware/db.go @@ -2,16 +2,11 @@ package middleware import ( "github.com/gin-gonic/gin" - "gorm.io/gorm" + + "go-admin/common/global" ) -func WithContextDb(dbMap map[string]*gorm.DB) gin.HandlerFunc { - return func(c *gin.Context) { - if db, ok := dbMap["*"]; ok { - c.Set("db", db) - } else { - c.Set("db", dbMap[c.Request.Host]) - } - c.Next() - } +func WithContextDb(c *gin.Context) { + c.Set("db", global.Cfg.GetDbByKey(c.Request.Host)) + c.Next() } diff --git a/examples/run.go b/examples/run.go index a6bbc3dc..74a23dec 100644 --- a/examples/run.go +++ b/examples/run.go @@ -16,12 +16,11 @@ import ( ) func main() { - var err error - global.Eloquent, err = gorm.Open(mysql.Open("root:123456@tcp/inmg?charset=utf8&parseTime=True&loc=Local"), &gorm.Config{}) + db, err := gorm.Open(mysql.Open("root:123456@tcp/inmg?charset=utf8&parseTime=True&loc=Local"), &gorm.Config{}) if err != nil { panic(err) } - global.CasbinEnforcer = mycasbin.Setup(global.Eloquent, "sys_") + _ = mycasbin.Setup(db, "sys_") global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus") global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job") global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request") diff --git a/tools/config/config.go b/tools/config/config.go index 6edee1f7..2a97eb95 100644 --- a/tools/config/config.go +++ b/tools/config/config.go @@ -9,6 +9,8 @@ import ( var ( ExtendConfig interface{} + _watch config.Watcher + _cfg *Settings ) // Settings 兼容原先的配置结构 @@ -18,19 +20,25 @@ type Settings struct { // Config 配置集合 type Config struct { - Application *Application `yaml:"application"` - Ssl *Ssl `yaml:"ssl"` - Logger *Logger `yaml:"logger"` - Jwt *Jwt `yaml:"jwt"` - Database *Database `yaml:"database"` - Gen *Gen `yaml:"gen"` - Extend interface{} `yaml:"extend"` + Application *Application `yaml:"application"` + Ssl *Ssl `yaml:"ssl"` + Logger *Logger `yaml:"logger"` + Jwt *Jwt `yaml:"jwt"` + Database *Database `yaml:"database"` + Databases *map[string]*Database `yaml:"databases"` + Gen *Gen `yaml:"gen"` + Extend interface{} `yaml:"extend"` } -var ( - _watch config.Watcher - _cfg *Settings -) +// 多db改造 +func (e *Config) multiDatabase() { + if len(*e.Databases) == 0 { + *e.Databases = map[string]*Database{ + "*": e.Database, + } + + } +} // Setup 载入配置文件 func Setup(f func(opts ...source.Option) source.Source, options ...source.Option) { @@ -50,7 +58,8 @@ func Setup(f func(opts ...source.Option) source.Source, options ...source.Option Ssl: SslConfig, Logger: LoggerConfig, Jwt: JwtConfig, - Database: DatabaseConfig, + Database: new(Database), + Databases: &DatabasesConfig, Gen: GenConfig, Extend: ExtendConfig, }} @@ -58,6 +67,7 @@ func Setup(f func(opts ...source.Option) source.Source, options ...source.Option if err != nil { log.Fatal(fmt.Sprintf("Scan config fail: %s", err.Error())) } + _cfg.Settings.multiDatabase() _watch, err = c.Watch() if err != nil { @@ -65,7 +75,7 @@ func Setup(f func(opts ...source.Option) source.Source, options ...source.Option } } -// Watch 配置监听, 重载时报错,不影响运行 +// Watch 配置监听, 重载时报错,不影响运行 fixme 数据连接 redis连接还没支持动态配置 func Watch() { for { v, err := _watch.Next() @@ -80,7 +90,7 @@ func Watch() { log.Println(fmt.Sprintf("Scan config fail: %s", err.Error())) break } - fmt.Println(DatabaseConfig) + _cfg.Settings.multiDatabase() } } diff --git a/tools/config/database.go b/tools/config/database.go index 0de8f4f6..b260b691 100644 --- a/tools/config/database.go +++ b/tools/config/database.go @@ -5,4 +5,7 @@ type Database struct { Source string } -var DatabaseConfig = new(Database) +var ( + DatabaseConfig = new(Database) + DatabasesConfig = make(map[string]*Database) +) From e184ad84cd983911039de715eebf7c62026702fd Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 22 Feb 2021 14:54:54 +0800 Subject: [PATCH 084/201] =?UTF-8?q?docs=F0=9F=93=9D=20=EF=BC=9A=E6=9B=B4?= =?UTF-8?q?=E6=96=B0readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 603e04d3..94c43209 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ npm run dev ## 🎬 在线体验 > admin / 123456 -演示地址:[http://www.zhangwj.com](http://www.zhangwj.com/#/login) +演示地址:[http://www.go-admin.dev](http://www.go-admin.dev/#/login) ## 📨 互动 @@ -230,18 +230,24 @@ npm run dev go-admin技术交流乙号 - + +## JetBrains 开源证书支持 + +`go-admin` 项目一直以来都是在 JetBrains 公司旗下的 GoLand 集成开发环境中进行开发,基于 **free JetBrains Open Source license(s)** 正版免费授权,在此表达我的谢意。 + + + ## 🤝 特别感谢 -[chengxiao](https://github.com/chengxiao) -[gin](https://github.com/gin-gonic/gin) -[casbin](https://github.com/casbin/casbin) -[spf13/viper](https://github.com/spf13/viper) -[gorm](https://github.com/jinzhu/gorm) -[gin-swagger](https://github.com/swaggo/gin-swagger) -[jwt-go](https://github.com/dgrijalva/jwt-go) -[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) -[ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue) +1. [chengxiao](https://github.com/chengxiao) +2. [gin](https://github.com/gin-gonic/gin) +2. [casbin](https://github.com/casbin/casbin) +2. [spf13/viper](https://github.com/spf13/viper) +2. [gorm](https://github.com/jinzhu/gorm) +2. [gin-swagger](https://github.com/swaggo/gin-swagger) +2. [jwt-go](https://github.com/dgrijalva/jwt-go) +2. [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) +2. [ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue) ## 🤟 打赏 @@ -256,6 +262,9 @@ npm run dev zhuqiyun LLL狐 星星之火 cjj770 Sam 唐*i 晓聪 aLong *渊 海马 魏镇坪 + 111 *哥 我的宇哥哥 *声 *节 +## 🤝友情链接 +[Go开发者成长线路图](http://www.golangroadmap.com/) + ## 🔑 License [MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md) From 017d669a04abe5c4a1ac58d1dc9504a9695341d6 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 22 Feb 2021 15:44:04 +0800 Subject: [PATCH 085/201] =?UTF-8?q?fix=F0=9F=90=9B=20=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=80=9A=E8=BF=87=E5=AD=97=E5=85=B8=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AD=97=E6=AE=B5=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E8=B7=AF=E6=9C=89=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../version/1613978564961_migrate.go | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 cmd/migrate/migration/version/1613978564961_migrate.go diff --git a/cmd/migrate/migration/version/1613978564961_migrate.go b/cmd/migrate/migration/version/1613978564961_migrate.go new file mode 100644 index 00000000..79e1c988 --- /dev/null +++ b/cmd/migrate/migration/version/1613978564961_migrate.go @@ -0,0 +1,32 @@ +package version + +import ( + "go-admin/app/admin/models" + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613978564961Test) +} + +func _1613978564961Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + // TODO: 这里开始写入要变更的内容 + menu := models.Menu{MenuId: 110, Path: "/api/v1/config"} + err := tx.Model(&menu).Where("menu_id = ?", 110).Update("Path", "/api/v1/dict/data-all").Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} From e9617ec677006c2be5c2b46e12f1ff663e12dc82 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 22 Feb 2021 16:18:24 +0800 Subject: [PATCH 086/201] =?UTF-8?q?fix=F0=9F=90=9B=20=EF=BC=9A=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E5=86=85=E5=AE=B9=E5=92=8Cjob=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys_content.go} | 2 +- .../{sysjob/sysjob.go => sys_job/sys_job.go} | 2 +- app/admin/router/router.go | 3 -- .../router/{syscontent.go => sys_content.go} | 12 +++---- app/admin/router/{sysjob.go => sys_job.go} | 4 +-- app/admin/router/sysrouter.go | 33 ------------------- 6 files changed, 10 insertions(+), 46 deletions(-) rename app/admin/apis/{syscontent/syscontent.go => sys_content/sys_content.go} (99%) rename app/admin/apis/{sysjob/sysjob.go => sys_job/sys_job.go} (98%) rename app/admin/router/{syscontent.go => sys_content.go} (65%) rename app/admin/router/{sysjob.go => sys_job.go} (94%) diff --git a/app/admin/apis/syscontent/syscontent.go b/app/admin/apis/sys_content/sys_content.go similarity index 99% rename from app/admin/apis/syscontent/syscontent.go rename to app/admin/apis/sys_content/sys_content.go index ceb851c3..cf5d2ac1 100644 --- a/app/admin/apis/syscontent/syscontent.go +++ b/app/admin/apis/sys_content/sys_content.go @@ -1,4 +1,4 @@ -package syscontent +package sys_content import ( "github.com/gin-gonic/gin" diff --git a/app/admin/apis/sysjob/sysjob.go b/app/admin/apis/sys_job/sys_job.go similarity index 98% rename from app/admin/apis/sysjob/sysjob.go rename to app/admin/apis/sys_job/sys_job.go index c0067b49..4f2b1a77 100644 --- a/app/admin/apis/sysjob/sysjob.go +++ b/app/admin/apis/sys_job/sys_job.go @@ -1,4 +1,4 @@ -package sysjob +package sys_job import ( "github.com/gin-gonic/gin" diff --git a/app/admin/router/router.go b/app/admin/router/router.go index a69b59d5..83f9210a 100644 --- a/app/admin/router/router.go +++ b/app/admin/router/router.go @@ -48,7 +48,4 @@ func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddle for _, f := range routerCheckRole { f(v1, authMiddleware) } - - // {{认证路由自动补充在此处请勿删除}} - } diff --git a/app/admin/router/syscontent.go b/app/admin/router/sys_content.go similarity index 65% rename from app/admin/router/syscontent.go rename to app/admin/router/sys_content.go index 12220e1e..ffc03d6a 100644 --- a/app/admin/router/syscontent.go +++ b/app/admin/router/sys_content.go @@ -2,7 +2,7 @@ package router import ( "github.com/gin-gonic/gin" - "go-admin/app/admin/apis/syscontent" + "go-admin/app/admin/apis/sys_content" "go-admin/app/admin/middleware" jwt "go-admin/pkg/jwtauth" ) @@ -17,15 +17,15 @@ func registerSysContentRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMid r := v1.Group("/syscontent").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - r.GET("/:id", syscontent.GetSysContent) - r.POST("", syscontent.InsertSysContent) - r.PUT("", syscontent.UpdateSysContent) - r.DELETE("/:id", syscontent.DeleteSysContent) + r.GET("/:id", sys_content.GetSysContent) + r.POST("", sys_content.InsertSysContent) + r.PUT("", sys_content.UpdateSysContent) + r.DELETE("/:id", sys_content.DeleteSysContent) } l := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - l.GET("/syscontentList", syscontent.GetSysContentList) + l.GET("/syscontentList", sys_content.GetSysContentList) } } diff --git a/app/admin/router/sysjob.go b/app/admin/router/sys_job.go similarity index 94% rename from app/admin/router/sysjob.go rename to app/admin/router/sys_job.go index 85270907..27fcef05 100644 --- a/app/admin/router/sysjob.go +++ b/app/admin/router/sys_job.go @@ -2,7 +2,7 @@ package router import ( "github.com/gin-gonic/gin" - "go-admin/app/admin/apis/sysjob" + "go-admin/app/admin/apis/sys_job" "go-admin/app/admin/middleware" "go-admin/app/admin/models" "go-admin/app/admin/service/dto" @@ -31,7 +31,7 @@ func registerSysJobRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlew r.PUT("", actions.PermissionAction(), actions.UpdateAction(new(dto.SysJobControl))) r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.SysJobById))) } - sysJob := &sysjob.SysJob{} + sysJob := &sys_job.SysJob{} v1.GET("/job/remove/:id", sysJob.RemoveJobForService) v1.GET("/job/start/:id", sysJob.StartJobForService) diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sysrouter.go index b3d55e04..8f7e7806 100644 --- a/app/admin/router/sysrouter.go +++ b/app/admin/router/sysrouter.go @@ -103,24 +103,17 @@ func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle registerPageRouter(v1, authMiddleware) registerBaseRouter(v1, authMiddleware) - //registerDeptRouter(v1, authMiddleware) registerDictRouter(v1, authMiddleware) registerSysUserRouter(v1, authMiddleware) - //registerRoleRouter(v1, authMiddleware) registerUserCenterRouter(v1, authMiddleware) - //registerPostRouter(v1, authMiddleware) - //registerMenuRouter(v1, authMiddleware) } func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { v1auth := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { v1auth.GET("/getinfo", system.GetInfo) - - //v1auth.PUT("/roledatascope", system.UpdateRoleDataScope) v1auth.GET("/roleMenuTreeselect/:roleId", system.GetMenuTreeRoleselect) v1auth.GET("/roleDeptTreeselect/:roleId", system.GetDeptTreeRoleselect) - v1auth.POST("/logout", handler.LogOut) v1auth.GET("/menuids", system.GetMenuIDS) } @@ -129,13 +122,7 @@ func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar func registerPageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { v1auth := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - //v1auth.GET("/deptList", system.GetDeptList) - //v1auth.GET("/deptTree", system.GetDeptTree) v1auth.GET("/sysUserList", system.GetSysUserList) - //v1auth.GET("/rolelist", system.GetRoleList) - //v1auth.GET("/configList", system.GetConfigList) - //v1auth.GET("/postlist", system.GetPostList) - //v1auth.GET("/menulist", system.GetMenuList) } } @@ -158,26 +145,6 @@ func registerPostRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar } } -//func registerMenuRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { -// menu := v1.Group("/menu").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) -// { -// menu.GET("/:id", system.GetMenu) -// menu.POST("", system.InsertMenu) -// menu.PUT("", system.UpdateMenu) -// menu.DELETE("/:id", system.DeleteMenu) -// } -//} - -//func registerRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { -// role := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) -// { -// role.GET("/:roleId", system.GetRole) -// role.POST("", system.InsertRole) -// role.PUT("", system.UpdateRole) -// role.DELETE("/:roleId", system.DeleteRole) -// } -//} - func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { sysuser := v1.Group("/sysUser").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { From da347e095fe0bbbe815f5465b4f92cf35e923251 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Mon, 22 Feb 2021 22:00:34 +0800 Subject: [PATCH 087/201] =?UTF-8?q?=E6=9D=83=E9=99=90=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/system/sys_role/sys_role.go | 8 +- app/admin/router/sys_config.go | 2 +- app/admin/router/sys_role.go | 2 +- app/admin/router/sysrouter.go | 4 +- app/admin/service/dto/sys_config.go | 2 +- app/admin/service/dto/sys_role.go | 17 +-- app/admin/service/sys_role.go | 20 ++-- .../version/1613998164781_migrate.go | 104 ++++++++++++++++++ common/dto/generate.go | 15 ++- 9 files changed, 140 insertions(+), 34 deletions(-) create mode 100644 cmd/migrate/migration/version/1613998164781_migrate.go diff --git a/app/admin/apis/system/sys_role/sys_role.go b/app/admin/apis/system/sys_role/sys_role.go index c28af473..f66ddffb 100644 --- a/app/admin/apis/system/sys_role/sys_role.go +++ b/app/admin/apis/system/sys_role/sys_role.go @@ -126,6 +126,9 @@ func (e *SysRole) InsertSysRole(c *gin.Context) { } // 设置创建人 object.CreateBy = tools.GetUserId(c) + if object.Status == "" { + object.Status = "2" + } s := service.SysRole{} s.Orm = db @@ -195,10 +198,10 @@ func (e *SysRole) UpdateSysRole(c *gin.Context) { // @Summary 删除用户角色 // @Description 删除数据 // @Tags 角色/Role -// @Param roleId path int true "roleId" +// @Param data body dto.SysRoleById true "body" // @Success 200 {string} string "{"code": 200, "message": "删除成功"}" // @Success 200 {string} string "{"code": -1, "message": "删除失败"}" -// @Router /api/v1/role/{roleId} [delete] +// @Router /api/v1/role [delete] // @Security Bearer func (e *SysRole) DeleteSysRole(c *gin.Context) { control := new(dto.SysRoleById) @@ -223,6 +226,7 @@ func (e *SysRole) DeleteSysRole(c *gin.Context) { err = s.RemoveSysRole(control) if err != nil { log.Error(err) + e.Error(c, http.StatusInternalServerError, err, "") return } _, err = global.LoadPolicy(c) diff --git a/app/admin/router/sys_config.go b/app/admin/router/sys_config.go index e869a2cd..e1c5e826 100644 --- a/app/admin/router/sys_config.go +++ b/app/admin/router/sys_config.go @@ -26,6 +26,6 @@ func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMidd r1 := v1.Group("/configKey").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { api := &sys_config.SysConfig{} - r1.POST("", api.GetSysConfigByKEYForService) + r1.GET("/:configKey", api.GetSysConfigByKEYForService) } } diff --git a/app/admin/router/sys_role.go b/app/admin/router/sys_role.go index 809580f1..c9945f17 100644 --- a/app/admin/router/sys_role.go +++ b/app/admin/router/sys_role.go @@ -20,7 +20,7 @@ func registerSysRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle r.GET("/:id", api.GetSysRole) r.POST("", api.InsertSysRole) r.PUT("/:id", api.UpdateSysRole) - r.DELETE("/:id", api.DeleteSysRole) + r.DELETE("", api.DeleteSysRole) } v1.PUT("/roledatascope", api.UpdateRoleDataScope) } diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sysrouter.go index 8f7e7806..ba202a12 100644 --- a/app/admin/router/sysrouter.go +++ b/app/admin/router/sysrouter.go @@ -167,14 +167,14 @@ func registerDictRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar dicts.GET("/data/:dictCode", dataApi.GetSysDictData) dicts.POST("/data", dataApi.InsertSysDictData) dicts.PUT("/data/:dictCode", dataApi.UpdateSysDictData) - dicts.DELETE("/data/:dictCode", dataApi.DeleteSysDictData) + dicts.DELETE("/data", dataApi.DeleteSysDictData) dicts.GET("/type-option-select", dictApi.GetSysDictTypeAll) dicts.GET("/type", dictApi.GetSysDictTypeList) dicts.GET("/type/:id", dictApi.GetSysDictType) dicts.POST("/type", dictApi.InsertSysDictType) dicts.PUT("/type/:id", dictApi.UpdateSysDictType) - dicts.DELETE("/type/:id", dictApi.DeleteSysDictType) + dicts.DELETE("/type", dictApi.DeleteSysDictType) } } diff --git a/app/admin/service/dto/sys_config.go b/app/admin/service/dto/sys_config.go index 1cb69e4d..bb791a5b 100644 --- a/app/admin/service/dto/sys_config.go +++ b/app/admin/service/dto/sys_config.go @@ -37,7 +37,7 @@ func (m *SysConfigSearch) Bind(ctx *gin.Context) error { type SysConfigControl struct { ID int `uri:"ID" comment:"编码"` // 编码 ConfigName string `json:"configName" comment:""` - ConfigKey string `json:"configKey" comment:""` + ConfigKey string `uri:"configKey" json:"configKey" comment:""` ConfigValue string `json:"configValue" comment:""` ConfigType string `json:"configType" comment:""` Remark string `json:"remark" comment:""` diff --git a/app/admin/service/dto/sys_role.go b/app/admin/service/dto/sys_role.go index f5c01317..9cc19d32 100644 --- a/app/admin/service/dto/sys_role.go +++ b/app/admin/service/dto/sys_role.go @@ -98,8 +98,7 @@ func (s *SysRoleControl) GetId() interface{} { // SysConfigById 获取单个或者删除的结构体 type SysRoleById struct { - Id int `uri:"id"` - Ids []int `json:"ids"` + dto.ObjectById } func (s *SysRoleById) Generate() *SysRoleById { @@ -111,20 +110,6 @@ func (s *SysRoleById) GetId() interface{} { return s.Id } -func (s *SysRoleById) Bind(ctx *gin.Context) error { - msgID := tools.GenerateMsgIDFromContext(ctx) - err := ctx.ShouldBindUri(s) - if err != nil { - log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error()) - return err - } - err = ctx.ShouldBind(s) - if err != nil { - log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error()) - } - return err -} - func (s *SysRoleById) GenerateM() (*models.SysRole, error) { return &models.SysRole{}, nil } diff --git a/app/admin/service/sys_role.go b/app/admin/service/sys_role.go index 00692ff4..5303d07c 100644 --- a/app/admin/service/sys_role.go +++ b/app/admin/service/sys_role.go @@ -155,7 +155,17 @@ func (e *SysRole) RemoveSysRole(d *dto.SysRoleById) error { } }() - db := tx.Model(&data).Delete(&data, d.GetId()) + s := SysRoleMenu{} + s.Orm = tx + s.MsgID = msgID + for _, roleId := range d.Ids { + err = s.DeleteRoleMenu(tx, roleId) + if err != nil { + log.Errorf("msgID[%s] insert role menu error, %", msgID, err.Error()) + return err + } + } + db := tx.Model(&data).Delete(&data, d.Ids) if db.Error != nil { err = db.Error log.Errorf("MsgID[%s] Delete error: %s", msgID, err) @@ -165,14 +175,6 @@ func (e *SysRole) RemoveSysRole(d *dto.SysRoleById) error { err = errors.New("无权删除该数据") return err } - s := SysRoleMenu{} - s.Orm = db - s.MsgID = msgID - err = s.DeleteRoleMenu(tx, d.Id) - if err != nil { - log.Errorf("msgID[%s] insert role menu error, %", msgID, err.Error()) - return err - } return nil } diff --git a/cmd/migrate/migration/version/1613998164781_migrate.go b/cmd/migrate/migration/version/1613998164781_migrate.go new file mode 100644 index 00000000..4e201cd8 --- /dev/null +++ b/cmd/migrate/migration/version/1613998164781_migrate.go @@ -0,0 +1,104 @@ +package version + +import ( + "go-admin/app/admin/models" + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1613998164781Test) +} + +func _1613998164781Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + err := tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/deptList").Update("path", "/api/v1/dept").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/roleList").Update("path", "/api/v1/role").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/menuList").Update("path", "/api/v1/menu").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/postList").Update("path", "/api/v1/post").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/dict/typelist").Update("path", "/api/v1/dict/type").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/dict/datalist").Update("path", "/api/v1/dict/data").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path like ?", "/api/v1/dict/data"). + Where("action = ?", "PUT").Update("path", "/api/v1/dict/data/:id").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path like ?", "/api/v1/dict/data/:id"). + Where("action = ?", "DELETE").Update("path", "/api/v1/dict/data").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path like ?", "/api/v1/dict/type"). + Where("action = ?", "PUT").Update("path", "/api/v1/dict/type/:id").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path like ?", "/api/v1/dict/type/:id"). + Where("action = ?", "DELETE").Update("path", "/api/v1/dict/type").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/operloglist").Update("path", "/api/v1/sys-opera-log").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/loginloglist").Update("path", "/api/v1/sys-login-log").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/loginlog/:id").Where("action = ?", "DELETE").Update("path", "/api/v1/sys-opera-log").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path like ?", "/api/v1/operloglist%").Where("action = ?", "DELETE").Update("path", "/api/v1/sys-opera-log").Error + if err != nil { + return err + } + + err = tx.Model(&models.Menu{}).Where("path like ?", "/api/v1/role/:id").Where("action = ?", "DELETE").Update("path", "/api/v1/role").Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/common/dto/generate.go b/common/dto/generate.go index ec70b9b4..46d00010 100644 --- a/common/dto/generate.go +++ b/common/dto/generate.go @@ -12,16 +12,27 @@ type ObjectById struct { } func (s *ObjectById) Bind(ctx *gin.Context) error { + var err error + err = ctx.ShouldBindUri(s) + if err != nil { + return err + } if ctx.Request.Method == http.MethodDelete { - err := ctx.ShouldBind(&s.Ids) + err = ctx.ShouldBind(&s.Ids) if err != nil { return err } if len(s.Ids) > 0 { return nil } + if s.Ids == nil { + s.Ids = make([]int, 0) + } + if s.Id != 0 { + s.Ids = append(s.Ids, s.Id) + } } - return ctx.ShouldBindUri(s) + return err } func (s *ObjectById) GetId() interface{} { From c3bb36c9698b177996e40ec8ef334832f1b2355c Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 23 Feb 2021 17:44:20 +0800 Subject: [PATCH 088/201] =?UTF-8?q?fix=F0=9F=90=9B=20=EF=BC=9A=E9=83=A8?= =?UTF-8?q?=E9=97=A8path=E5=88=9B=E5=BB=BA=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/sys_dept.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/admin/service/sys_dept.go b/app/admin/service/sys_dept.go index 5078c04e..e4b8c031 100644 --- a/app/admin/service/sys_dept.go +++ b/app/admin/service/sys_dept.go @@ -7,6 +7,7 @@ import ( cDto "go-admin/common/dto" "go-admin/common/log" "go-admin/common/service" + "go-admin/tools" "gorm.io/gorm" ) @@ -65,6 +66,20 @@ func (e *SysDept) InsertSysDept(model *models.SysDept) error { log.Errorf("msgID[%s] db error:%s", msgID, err) return err } + deptPath := "/" + tools.IntToString(model.DeptId) + if model.ParentId != 0 { + var deptP models.SysDepts + e.Orm.Model(&data).First(&deptP, model.ParentId) + deptPath = deptP.DeptPath + deptPath + } else { + deptPath = "/0" + deptPath + } + var mp = map[string]string{} + mp["dept_path"] = deptPath + if err := e.Orm.Model(&model).Update("dept_path",deptPath).Error; err != nil { + log.Errorf("msgID[%s] db error:%s", msgID, err) + return err + } return nil } @@ -82,8 +97,11 @@ func (e *SysDept) UpdateSysDept(c *models.SysDept) error { } if db.RowsAffected == 0 { return errors.New("无权更新该数据") - } + + //参数1:是要修改的数据 + //参数2:是修改的数据 + return nil } From 561566f1728b962e25d3ab669b29d46f7e8652cb Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 23 Feb 2021 17:50:53 +0800 Subject: [PATCH 089/201] =?UTF-8?q?fix=F0=9F=90=9B=20=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=86=85=E5=AE=B9=E5=88=86=E9=A1=B5=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../version/1614073723691_migrate.go | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 cmd/migrate/migration/version/1614073723691_migrate.go diff --git a/cmd/migrate/migration/version/1614073723691_migrate.go b/cmd/migrate/migration/version/1614073723691_migrate.go new file mode 100644 index 00000000..08a6534b --- /dev/null +++ b/cmd/migrate/migration/version/1614073723691_migrate.go @@ -0,0 +1,32 @@ +package version + +import ( + "go-admin/app/admin/models" + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1614073723691Test) +} + +func _1614073723691Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + // TODO: 这里开始写入要变更的内容 + + err := tx.Model(&models.Menu{}).Where("path = ?", "/api/v1/syscontentList").Update("path", "/api/v1/syscontent").Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} From f22f654c91319b1646950151ef45ec1288b7f1e9 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 24 Feb 2021 14:22:33 +0800 Subject: [PATCH 090/201] =?UTF-8?q?format=F0=9F=A5=9A=20=EF=BC=9A=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=B8=BB=E9=94=AEkey=E5=92=8C=E8=87=AA=E5=A2=9E?= =?UTF-8?q?=E9=95=BFtag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/dept.go | 2 +- app/admin/models/menu.go | 4 ++-- app/admin/models/post.go | 2 +- app/admin/models/role.go | 2 +- app/admin/models/sys_dept.go | 2 +- app/admin/models/sys_menu.go | 4 ++-- app/admin/models/syscontent.go | 2 +- app/admin/models/sysjob.go | 2 +- app/admin/models/system/role_menu.go | 6 +++--- app/admin/models/system/sys_post.go | 2 +- app/admin/models/system/sys_role.go | 2 +- app/admin/models/sysuser.go | 2 +- app/admin/models/tools/syscolumns.go | 2 +- app/admin/models/tools/systables.go | 2 +- cmd/migrate/migration/version/dictdata.go | 2 +- cmd/migrate/migration/version/dicttype.go | 2 +- common/models/migrate.go | 2 +- 17 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/admin/models/dept.go b/app/admin/models/dept.go index 8e31d7ca..1d791f5f 100644 --- a/app/admin/models/dept.go +++ b/app/admin/models/dept.go @@ -9,7 +9,7 @@ import ( ) type SysDepts struct { - DeptId int `json:"deptId" gorm:"primary_key;auto_increment;"` //部门编码 + DeptId int `json:"deptId" gorm:"primaryKey;autoIncrement;"` //部门编码 ParentId int `json:"parentId" gorm:""` //上级部门 DeptPath string `json:"deptPath" gorm:"size:255;"` // DeptName string `json:"deptName" gorm:"size:128;"` //部门名称 diff --git a/app/admin/models/menu.go b/app/admin/models/menu.go index a50175db..3ac32455 100644 --- a/app/admin/models/menu.go +++ b/app/admin/models/menu.go @@ -9,7 +9,7 @@ import ( ) type Menu struct { - MenuId int `json:"menuId" gorm:"primary_key;AUTO_INCREMENT"` + MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"` MenuName string `json:"menuName" gorm:"size:128;"` Title string `json:"title" gorm:"size:128;"` Icon string `json:"icon" gorm:"size:128;"` @@ -46,7 +46,7 @@ type MenuLable struct { } type Menus struct { - MenuId int `json:"menuId" gorm:"column:menu_id;primary_key;"` + MenuId int `json:"menuId" gorm:"column:menu_id;primaryKey;autoIncrement;"` MenuName string `json:"menuName" gorm:"column:menu_name"` Title string `json:"title" gorm:"column:title"` Icon string `json:"icon" gorm:"column:icon"` diff --git a/app/admin/models/post.go b/app/admin/models/post.go index bbfcf1c5..0b509561 100644 --- a/app/admin/models/post.go +++ b/app/admin/models/post.go @@ -6,7 +6,7 @@ import ( ) type Post struct { - PostId int `gorm:"primary_key;AUTO_INCREMENT" json:"postId"` //岗位编号 + PostId int `gorm:"primaryKey;autoIncrement" json:"postId"` //岗位编号 PostName string `gorm:"size:128;" json:"postName"` //岗位名称 PostCode string `gorm:"size:128;" json:"postCode"` //岗位代码 Sort int `gorm:"" json:"sort"` //岗位排序 diff --git a/app/admin/models/role.go b/app/admin/models/role.go index ec125b83..e4773013 100644 --- a/app/admin/models/role.go +++ b/app/admin/models/role.go @@ -10,7 +10,7 @@ import ( ) type SysRole struct { - RoleId int `json:"roleId" gorm:"primary_key;AUTO_INCREMENT"` // 角色编码 + RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码 RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称 Status string `json:"status" gorm:"size:4;"` // RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码 diff --git a/app/admin/models/sys_dept.go b/app/admin/models/sys_dept.go index fbd2f2d3..530e9b40 100644 --- a/app/admin/models/sys_dept.go +++ b/app/admin/models/sys_dept.go @@ -3,7 +3,7 @@ package models import "go-admin/common/models" type SysDept struct { - DeptId int `json:"deptId" gorm:"primary_key;auto_increment;"` //部门编码 + DeptId int `json:"deptId" gorm:"primaryKey;autoIncrement;"` //部门编码 ParentId int `json:"parentId" gorm:""` //上级部门 DeptPath string `json:"deptPath" gorm:"size:255;"` // DeptName string `json:"deptName" gorm:"size:128;"` //部门名称 diff --git a/app/admin/models/sys_menu.go b/app/admin/models/sys_menu.go index b5343cb8..9e2f240e 100644 --- a/app/admin/models/sys_menu.go +++ b/app/admin/models/sys_menu.go @@ -3,7 +3,7 @@ package models import "go-admin/common/models" type SysMenu struct { - MenuId int `json:"menuId" gorm:"primary_key;AUTO_INCREMENT"` + MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"` MenuName string `json:"menuName" gorm:"size:128;"` Title string `json:"title" gorm:"size:128;"` Icon string `json:"icon" gorm:"size:128;"` @@ -29,7 +29,7 @@ type SysMenu struct { } type SysMenus struct { - MenuId int `json:"menuId" gorm:"column:menu_id;primary_key;"` + MenuId int `json:"menuId" gorm:"column:menu_id;primaryKey;autoIncrement;"` MenuName string `json:"menuName" gorm:"column:menu_name"` Title string `json:"title" gorm:"column:title"` Icon string `json:"icon" gorm:"column:icon"` diff --git a/app/admin/models/syscontent.go b/app/admin/models/syscontent.go index c68a54bc..0acf332d 100644 --- a/app/admin/models/syscontent.go +++ b/app/admin/models/syscontent.go @@ -6,7 +6,7 @@ import ( ) type SysContent struct { - Id int `json:"id" gorm:"type:int(11);primary_key;auto_increment"` // id + Id int `json:"id" gorm:"type:int(11);primaryKey;autoIncrement"` // id CateId string `json:"cateId" gorm:"type:int(11);"` // 分类id Name string `json:"name" gorm:"type:varchar(255);"` // 名称 Status string `json:"status" gorm:"type:int(1);"` // 状态 diff --git a/app/admin/models/sysjob.go b/app/admin/models/sysjob.go index 3997b094..c18e37a9 100644 --- a/app/admin/models/sysjob.go +++ b/app/admin/models/sysjob.go @@ -9,7 +9,7 @@ import ( ) type SysJob struct { - JobId int `json:"jobId" gorm:"primary_key;AUTO_INCREMENT"` // 编码 + JobId int `json:"jobId" gorm:"primaryKey;autoIncrement"` // 编码 JobName string `json:"jobName" gorm:"size:255;"` // 名称 JobGroup string `json:"jobGroup" gorm:"size:255;"` // 任务分组 JobType int `json:"jobType" gorm:"size:1;"` // 任务类型 diff --git a/app/admin/models/system/role_menu.go b/app/admin/models/system/role_menu.go index 12f234fd..6ba97d8d 100644 --- a/app/admin/models/system/role_menu.go +++ b/app/admin/models/system/role_menu.go @@ -12,9 +12,9 @@ import ( type RoleMenu struct { RoleId int `gorm:""` MenuId int `gorm:""` - RoleName string `gorm:"size:128)"` - CreateBy string `gorm:"size:128)"` - UpdateBy string `gorm:"size:128)"` + RoleName string `gorm:"size:128"` + CreateBy string `gorm:"size:128"` + UpdateBy string `gorm:"size:128"` } func (RoleMenu) TableName() string { diff --git a/app/admin/models/system/sys_post.go b/app/admin/models/system/sys_post.go index 352f7064..c1954a22 100644 --- a/app/admin/models/system/sys_post.go +++ b/app/admin/models/system/sys_post.go @@ -3,7 +3,7 @@ package system import "go-admin/common/models" type SysPost struct { - PostId int `gorm:"primary_key;AUTO_INCREMENT" json:"postId"` //岗位编号 + PostId int `gorm:"primaryKey;autoIncrement" json:"postId"` //岗位编号 PostName string `gorm:"size:128;" json:"postName"` //岗位名称 PostCode string `gorm:"size:128;" json:"postCode"` //岗位代码 Sort int `gorm:"" json:"sort"` //岗位排序 diff --git a/app/admin/models/system/sys_role.go b/app/admin/models/system/sys_role.go index 4588da82..3ae0fe05 100644 --- a/app/admin/models/system/sys_role.go +++ b/app/admin/models/system/sys_role.go @@ -3,7 +3,7 @@ package system import "go-admin/common/models" type SysRole struct { - RoleId int `json:"roleId" gorm:"primary_key;AUTO_INCREMENT"` // 角色编码 + RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码 RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称 Status string `json:"status" gorm:"size:4;"` // RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码 diff --git a/app/admin/models/sysuser.go b/app/admin/models/sysuser.go index fa5db4f7..c273365d 100644 --- a/app/admin/models/sysuser.go +++ b/app/admin/models/sysuser.go @@ -39,7 +39,7 @@ type LoginM struct { } type SysUserId struct { - UserId int `gorm:"primary_key;AUTO_INCREMENT" json:"userId"` // 编码 + UserId int `gorm:"primaryKey;autoIncrement" json:"userId"` // 编码 } type SysUserB struct { diff --git a/app/admin/models/tools/syscolumns.go b/app/admin/models/tools/syscolumns.go index 9bcbd83b..830db6df 100644 --- a/app/admin/models/tools/syscolumns.go +++ b/app/admin/models/tools/syscolumns.go @@ -6,7 +6,7 @@ import ( ) type SysColumns struct { - ColumnId int `gorm:"primary_key;auto_increment" json:"columnId"` + ColumnId int `gorm:"primaryKey;autoIncrement" json:"columnId"` TableId int `gorm:"" json:"tableId"` ColumnName string `gorm:"size:128;" json:"columnName"` ColumnComment string `gorm:"column:column_comment;size:128;" json:"columnComment"` diff --git a/app/admin/models/tools/systables.go b/app/admin/models/tools/systables.go index 4275b8bd..d0c6746a 100644 --- a/app/admin/models/tools/systables.go +++ b/app/admin/models/tools/systables.go @@ -8,7 +8,7 @@ import ( ) type SysTables struct { - TableId int `gorm:"primary_key;auto_increment" json:"tableId"` //表编码 + TableId int `gorm:"primaryKey;autoIncrement" json:"tableId"` //表编码 TBName string `gorm:"column:table_name;size:255;" json:"tableName"` //表名称 TableComment string `gorm:"size:255;" json:"tableComment"` //表备注 ClassName string `gorm:"size:255;" json:"className"` //类名 diff --git a/cmd/migrate/migration/version/dictdata.go b/cmd/migrate/migration/version/dictdata.go index c330d977..7ee0f7c5 100644 --- a/cmd/migrate/migration/version/dictdata.go +++ b/cmd/migrate/migration/version/dictdata.go @@ -5,7 +5,7 @@ import ( ) type DictData struct { - DictCode int `gorm:"primary_key;auto_increment;" json:"dictCode" example:"1"` //字典编码 + DictCode int `gorm:"primaryKey;autoIncrement;" json:"dictCode" example:"1"` //字典编码 DictSort int `gorm:"" json:"dictSort"` //显示顺序 DictLabel string `gorm:"size:128;" json:"dictLabel"` //数据标签 DictValue string `gorm:"size:255;" json:"dictValue"` //数据键值 diff --git a/cmd/migrate/migration/version/dicttype.go b/cmd/migrate/migration/version/dicttype.go index 73fff340..61c6aa18 100644 --- a/cmd/migrate/migration/version/dicttype.go +++ b/cmd/migrate/migration/version/dicttype.go @@ -5,7 +5,7 @@ import ( ) type DictType struct { - DictId int `gorm:"primary_key;auto_increment;" json:"dictId"` + DictId int `gorm:"primaryKey;autoIncrement;" json:"dictId"` DictName string `gorm:"size:128;" json:"dictName"` //字典名称 DictType string `gorm:"size:128;" json:"dictType"` //字典类型 Status string `gorm:"size:4;" json:"status"` //状态 diff --git a/common/models/migrate.go b/common/models/migrate.go index 0a70d042..5573cb22 100644 --- a/common/models/migrate.go +++ b/common/models/migrate.go @@ -3,7 +3,7 @@ package models import "time" type Migration struct { - Version string `gorm:"primary_key"` + Version string `gorm:"primaryKey"` ApplyTime time.Time `gorm:"autoCreateTime"` } From 117392bfe82ce43d1a2f0e73939fa5b24219f223 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 24 Feb 2021 14:23:13 +0800 Subject: [PATCH 091/201] =?UTF-8?q?format=F0=9F=A5=9A=20=EF=BC=9A=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/router/{initrouter.go => init_router.go} | 0 app/admin/router/sys_content.go | 7 +------ app/admin/router/{sysrouter.go => sys_router.go} | 0 app/admin/service/dto/{sysfileinfo.go => sys_file_info.go} | 0 app/admin/service/dto/{sysjob.go => sys_job.go} | 0 app/admin/service/{sysfileinfo.go => sys_file_info.go} | 0 app/admin/service/{sysjob.go => sys_job.go} | 0 7 files changed, 1 insertion(+), 6 deletions(-) rename app/admin/router/{initrouter.go => init_router.go} (100%) rename app/admin/router/{sysrouter.go => sys_router.go} (100%) rename app/admin/service/dto/{sysfileinfo.go => sys_file_info.go} (100%) rename app/admin/service/dto/{sysjob.go => sys_job.go} (100%) rename app/admin/service/{sysfileinfo.go => sys_file_info.go} (100%) rename app/admin/service/{sysjob.go => sys_job.go} (100%) diff --git a/app/admin/router/initrouter.go b/app/admin/router/init_router.go similarity index 100% rename from app/admin/router/initrouter.go rename to app/admin/router/init_router.go diff --git a/app/admin/router/sys_content.go b/app/admin/router/sys_content.go index ffc03d6a..39131d30 100644 --- a/app/admin/router/sys_content.go +++ b/app/admin/router/sys_content.go @@ -17,15 +17,10 @@ func registerSysContentRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMid r := v1.Group("/syscontent").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { + r.GET("", sys_content.GetSysContentList) r.GET("/:id", sys_content.GetSysContent) r.POST("", sys_content.InsertSysContent) r.PUT("", sys_content.UpdateSysContent) r.DELETE("/:id", sys_content.DeleteSysContent) } - - l := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - l.GET("/syscontentList", sys_content.GetSysContentList) - } - } diff --git a/app/admin/router/sysrouter.go b/app/admin/router/sys_router.go similarity index 100% rename from app/admin/router/sysrouter.go rename to app/admin/router/sys_router.go diff --git a/app/admin/service/dto/sysfileinfo.go b/app/admin/service/dto/sys_file_info.go similarity index 100% rename from app/admin/service/dto/sysfileinfo.go rename to app/admin/service/dto/sys_file_info.go diff --git a/app/admin/service/dto/sysjob.go b/app/admin/service/dto/sys_job.go similarity index 100% rename from app/admin/service/dto/sysjob.go rename to app/admin/service/dto/sys_job.go diff --git a/app/admin/service/sysfileinfo.go b/app/admin/service/sys_file_info.go similarity index 100% rename from app/admin/service/sysfileinfo.go rename to app/admin/service/sys_file_info.go diff --git a/app/admin/service/sysjob.go b/app/admin/service/sys_job.go similarity index 100% rename from app/admin/service/sysjob.go rename to app/admin/service/sys_job.go From 5ff282c23d6684cf9319a6dfb306061272f40c31 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 25 Feb 2021 01:32:06 +0800 Subject: [PATCH 092/201] =?UTF-8?q?feat=E2=9C=A8=20=EF=BC=9A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=B5=84=E6=BA=90=E7=AE=A1=E7=90=86=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=BC=80=E6=94=BE=E7=9A=84=E5=BF=85=E5=BC=80?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../version/1614159531111_migrate.go | 36 ++++++++++ common/database/initialize.go | 15 +++- common/database/open.go | 2 +- common/database/open_sqlite3.go | 2 +- go.mod | 7 +- go.sum | 70 ++++++++++++++++++- tools/config/database.go | 21 +++++- 7 files changed, 141 insertions(+), 12 deletions(-) create mode 100644 cmd/migrate/migration/version/1614159531111_migrate.go diff --git a/cmd/migrate/migration/version/1614159531111_migrate.go b/cmd/migrate/migration/version/1614159531111_migrate.go new file mode 100644 index 00000000..e9e191d9 --- /dev/null +++ b/cmd/migrate/migration/version/1614159531111_migrate.go @@ -0,0 +1,36 @@ +package version + +import ( + //"go-admin/app/admin/models" + "gorm.io/gorm" + "runtime" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _1614159531111Test) +} + +func _1614159531111Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + sql1 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `is_frame`, `create_by`, `update_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (525, '', '公共资源目录获取', 'bug', '/api/v1/sysfiledir', '', 'A', 'GET', '', 256, 0, '', '', 0, '1', '1', 1, 1, '2021-02-24 17:36:02.900', '2021-02-24 17:36:16.600', NULL);" + sql2 := "INSERT INTO `sys_menu`(`menu_id`, `menu_name`, `title`, `icon`, `path`, `paths`, `menu_type`, `action`, `permission`, `parent_id`, `no_cache`, `breadcrumb`, `component`, `sort`, `visible`, `is_frame`, `create_by`, `update_by`, `created_at`, `updated_at`, `deleted_at`) VALUES (526, '', '公共资源获取', 'bug', '/api/v1/sysfileinfo', '', 'A', 'GET', '', 256, 0, '', '', 0, '1', '1', 1, 0, '2021-02-24 17:36:49.575', '2021-02-24 17:36:49.575', NULL);" + err := tx.Exec(sql1).Error + if err != nil { + return err + } + + err = tx.Exec(sql2).Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} diff --git a/common/database/initialize.go b/common/database/initialize.go index 0a188546..2f3be928 100644 --- a/common/database/initialize.go +++ b/common/database/initialize.go @@ -5,6 +5,7 @@ import ( "time" logCore "github.com/go-admin-team/go-admin-core/logger" + toolsDB "github.com/go-admin-team/go-admin-core/tools/database" "gorm.io/gorm" "gorm.io/gorm/logger" "gorm.io/gorm/schema" @@ -28,7 +29,16 @@ func setupSimpleDatabase(host string, c *toolsConfig.Database) { global.Driver = c.Driver } log.Infof("%s => %s", host, tools.Green(c.Source)) - db, err := gorm.Open(open[c.Driver](c.Source), &gorm.Config{ + registers := make([]toolsDB.ResolverConfigure, len(c.Registers)) + for i := range c.Registers { + registers[i] = toolsDB.NewResolverConfigure( + c.Registers[i].Sources, + c.Registers[i].Replicas, + c.Registers[i].Policy, + c.Registers[i].Tables) + } + resolverConfig := toolsDB.NewConfigure(c.Source, c.MaxIdleConns, c.MaxOpenConns, c.ConnMaxIdleTime, c.ConnMaxLifetime, registers) + db, err := resolverConfig.Init(&gorm.Config{ NamingStrategy: schema.NamingStrategy{ SingularTable: true, }, @@ -41,7 +51,8 @@ func setupSimpleDatabase(host string, c *toolsConfig.Database) { logCore.DefaultLogger.Options().Level.LevelForGorm()), }, ), - }) + }, opens[c.Driver]) + if err != nil { log.Fatal(tools.Red(c.Driver+" connect error :"), err) } else { diff --git a/common/database/open.go b/common/database/open.go index 1dbd4a32..50c10fea 100644 --- a/common/database/open.go +++ b/common/database/open.go @@ -8,7 +8,7 @@ import ( "gorm.io/gorm" ) -var open = map[string]func(string) gorm.Dialector{ +var opens = map[string]func(string) gorm.Dialector{ "mysql": mysql.Open, "postgres": postgres.Open, } diff --git a/common/database/open_sqlite3.go b/common/database/open_sqlite3.go index 387d1286..51754190 100644 --- a/common/database/open_sqlite3.go +++ b/common/database/open_sqlite3.go @@ -9,7 +9,7 @@ import ( "gorm.io/gorm" ) -var open = map[string]func(string) gorm.Dialector{ +var opens = map[string]func(string) gorm.Dialector{ "mysql": mysql.Open, "postgres": postgres.Open, "sqlite3": sqlite.Open, diff --git a/go.mod b/go.mod index 4d6665a0..9bc4f3b0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go-admin -go 1.14 +go 1.15 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 @@ -10,7 +10,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.3-0.20210119162352-941321145a99 + github.com/go-admin-team/go-admin-core v1.2.3-0.20210224172350-99aa3d05fead github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 @@ -35,7 +35,8 @@ require ( gorm.io/driver/mysql v1.0.4-0.20201206014609-ae5fd10184f6 gorm.io/driver/postgres v1.0.6-0.20201208020313-1ed927cfab53 gorm.io/driver/sqlite v1.1.5-0.20201206014648-c84401fbe3ba - gorm.io/gorm v1.20.8 + gorm.io/gorm v1.20.12 + gorm.io/plugin/dbresolver v1.1.0 sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 // indirect ) diff --git a/go.sum b/go.sum index 3fbc56eb..f958bbdb 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,7 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c/go.mod h1:7xhjOwRV2+0HXGmM0jxaEu+ZiXJFoVZOTfL/dmqbrD8= +github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks= @@ -45,6 +46,7 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.0/go.mod h1:zpDJeKyp9ScW4NNrbdr+Eyxvry3ilGPewKoXw3XGN1k= github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE= @@ -67,6 +69,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -76,7 +79,9 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA= github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= @@ -93,6 +98,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY= +github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= @@ -115,10 +121,13 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= @@ -144,6 +153,7 @@ github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2Vvl github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE= github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -153,6 +163,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -163,11 +174,12 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f h1:8l4Aw3Jmx0pLKYMkY+1b6yBPgE+rzRtA5T3vqFyI2Z8= github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.3-0.20210119162352-941321145a99 h1:oOdKx+5NCTzivBcF6X7AoIWJdwxn8PXoKOuLynw+EPA= -github.com/go-admin-team/go-admin-core v1.2.3-0.20210119162352-941321145a99/go.mod h1:fWE/Bf2hDggmyIrRmN+2wI3kZCE6J1yo8cPa1kmv58s= +github.com/go-admin-team/go-admin-core v1.2.3-0.20210224172350-99aa3d05fead h1:5k33PAn9lZ3WwGOoMcQVMFdoW1hfp/+7wfMzbtVffPk= +github.com/go-admin-team/go-admin-core v1.2.3-0.20210224172350-99aa3d05fead/go.mod h1:hNfmIFc75XLFdfWGeGV1ted94FGnozbKfXXVLTDJKMM= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= @@ -179,6 +191,7 @@ github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3I github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -196,6 +209,7 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= @@ -207,6 +221,7 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -216,6 +231,7 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22 github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -254,6 +270,7 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -268,6 +285,7 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= @@ -310,12 +328,15 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -333,6 +354,7 @@ github.com/jackc/pgconn v1.8.0 h1:FmjZ0rOyXTr1wfWs45i4a9vjnjWUAGpMuQLD9OSs+lw= github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= @@ -384,10 +406,13 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -399,11 +424,14 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA= github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w= @@ -418,6 +446,7 @@ github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPp github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA= github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ= @@ -434,6 +463,7 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -450,9 +480,11 @@ github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp github.com/mattn/go-sqlite3 v1.14.5 h1:1IdxlwTNazvbKJQSxoJ5/9ECbEeaTTyeU7sEAZ5KKTQ= github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mattn/goveralls v0.0.2 h1:7eJB6EqsPhRVxvwEXGnqdO2sJI0PTsrWoTMXEk9/OQc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg= github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY= @@ -469,8 +501,10 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0= github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY= @@ -487,6 +521,7 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk= github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw= @@ -497,8 +532,10 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -517,6 +554,7 @@ github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -524,6 +562,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -555,12 +594,14 @@ github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKc github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= +github.com/robinjoseph08/redisqueue/v2 v2.1.0 h1:GactHlrxS8YSCJc4CbP1KbTObo14pieNmNWSUlquTGI= github.com/robinjoseph08/redisqueue/v2 v2.1.0/go.mod h1:fiNYBqIF/DqZxKvO6faLB6nkBtfJucuM+rDbFhZG1vs= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ= @@ -574,17 +615,23 @@ github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w= github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 h1:pXY9qYc/MP5zdvqWEUH6SjNiu7VhSjuVFTFiTcphaLU= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -600,11 +647,13 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= github.com/swaggo/gin-swagger v1.2.0 h1:YskZXEiv51fjOMTsXrOetAjrMDfFaXD79PEoQBOe2W0= @@ -620,6 +669,7 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE= github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY= +github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY= github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -634,8 +684,10 @@ github.com/unrolled/secure v1.0.8 h1:JaMvKbe4CRt8oyxVXn+xY+6jlqd7pyJNSVkmsBxxQsM github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8p0BXDPI= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -722,6 +774,7 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -905,13 +958,16 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/AlecAivazis/survey.v1 v1.8.5 h1:QoEEmn/d5BbuPIL2qvXwzJdttFFhRQFkaq+tEKb7SMI= gopkg.in/AlecAivazis/survey.v1 v1.8.5/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= @@ -920,12 +976,14 @@ gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdOD gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/kyokomi/emoji.v1 v1.5.1 h1:beetH5mWDMzFznJ+Qzd5KVHp79YKhVUMcdO8LpRLeGw= gopkg.in/kyokomi/emoji.v1 v1.5.1/go.mod h1:N9AZ6hi1jHOPn34PsbpufQZUcKftSD7WgS2pgpmH4Lg= gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiVLxyifmMBrBIuCWFBPYKbRssXB9z67Hw= gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= @@ -936,6 +994,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gorm.io/driver/mysql v0.3.0/go.mod h1:A7H1JD9dKdcjeUTpTuWKEC+E1a74qzW7/zaXqKaTbfM= +gorm.io/driver/mysql v1.0.3/go.mod h1:twGxftLBlFgNVNakL7F+P/x9oYqoymG3YYT8cAfI9oI= gorm.io/driver/mysql v1.0.4-0.20201206014609-ae5fd10184f6 h1:GTZ4w9Fx9LTCtaUq7RDX6a1PSmo7BEwD3H1A8n365YI= gorm.io/driver/mysql v1.0.4-0.20201206014609-ae5fd10184f6/go.mod h1:2r8kyPBl12K36bLBN+vsYYHXRQcNmR+gNHOnSNVqLJs= gorm.io/driver/postgres v0.2.6/go.mod h1:AsPyuhKFOplSmQwOPsycVKbe0dRxF8v18KZ7p9i8dIs= @@ -947,8 +1006,13 @@ gorm.io/driver/sqlserver v0.2.4 h1:AGofGL/TfzTZotzIHlaLISfxEKJpzj0ATbtXJW+ga1A= gorm.io/driver/sqlserver v0.2.4/go.mod h1:TcPfkdce5b8qlCMgyUeUdm7HQa1ZzWUuxzI+odcueLA= gorm.io/gorm v0.2.19/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v0.2.23/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= -gorm.io/gorm v1.20.8 h1:iToaOdZgjNvlc44NFkxfLa3U9q63qwaxt0FdNCiwOMs= +gorm.io/gorm v1.20.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.20.11/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/gorm v1.20.12 h1:ebZ5KrSHzet+sqOCVdH9mTjW91L298nX3v5lVxAzSUY= +gorm.io/gorm v1.20.12/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gorm.io/plugin/dbresolver v1.1.0 h1:cegr4DeprR6SkLIQlKhJLYxH8muFbJ4SmnojXvoeb00= +gorm.io/plugin/dbresolver v1.1.0/go.mod h1:tpImigFAEejCALOttyhWqsy4vfa2Uh/vAUVnL5IRF7Y= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/tools/config/database.go b/tools/config/database.go index b260b691..b4f8203f 100644 --- a/tools/config/database.go +++ b/tools/config/database.go @@ -1,11 +1,28 @@ package config +import "gorm.io/plugin/dbresolver" + type Database struct { - Driver string - Source string + Driver string + Source string + ConnMaxIdleTime int + ConnMaxLifetime int + MaxIdleConns int + MaxOpenConns int + Registers []DBResolverConfig +} + +type DBResolverConfig struct { + Sources []string + Replicas []string + Policy string + Tables []string } var ( DatabaseConfig = new(Database) DatabasesConfig = make(map[string]*Database) + Policies = map[string]dbresolver.Policy{ + "random": dbresolver.RandomPolicy{}, + } ) From 7e7065a5798629f3ac3201613c4999746ac1a994 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 25 Feb 2021 10:39:17 +0800 Subject: [PATCH 093/201] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF=E7=BC=96=E8=AF=91go=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 91d18fff..64457815 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.13 + - name: Set up Go 1.14 uses: actions/setup-go@v1 with: - go-version: 1.13 + go-version: 1.14 id: go - name: Check out code into the Go module directory From 78671ae99e06822ef1a4ace8ed0eadc7d0a7e904 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 25 Feb 2021 11:28:37 +0800 Subject: [PATCH 094/201] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=A0=B8=E5=BF=83?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9bc4f3b0..e1dd9d70 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/casbin/gorm-adapter/v3 v3.0.2 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.2.3-0.20210224172350-99aa3d05fead + github.com/go-admin-team/go-admin-core v1.2.3-0.20210225031955-e373f5bcdf3f github.com/go-redis/redis/v7 v7.4.0 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 diff --git a/go.sum b/go.sum index f958bbdb..a813f5e6 100644 --- a/go.sum +++ b/go.sum @@ -178,8 +178,8 @@ github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f h1:8l4Aw3Jmx github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M= -github.com/go-admin-team/go-admin-core v1.2.3-0.20210224172350-99aa3d05fead h1:5k33PAn9lZ3WwGOoMcQVMFdoW1hfp/+7wfMzbtVffPk= -github.com/go-admin-team/go-admin-core v1.2.3-0.20210224172350-99aa3d05fead/go.mod h1:hNfmIFc75XLFdfWGeGV1ted94FGnozbKfXXVLTDJKMM= +github.com/go-admin-team/go-admin-core v1.2.3-0.20210225031955-e373f5bcdf3f h1:1gId+aP+7wyexzwQJmLArCzI9Ffqql9rJdfniCNnX60= +github.com/go-admin-team/go-admin-core v1.2.3-0.20210225031955-e373f5bcdf3f/go.mod h1:hNfmIFc75XLFdfWGeGV1ted94FGnozbKfXXVLTDJKMM= github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= From 734a48dbb8be5767471ad78a3b6f66b1fb541753 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Thu, 25 Feb 2021 14:24:09 +0800 Subject: [PATCH 095/201] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/config/config.go | 2 +- tools/config/database.go | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/config/config.go b/tools/config/config.go index 2a97eb95..6dbb52d1 100644 --- a/tools/config/config.go +++ b/tools/config/config.go @@ -58,7 +58,7 @@ func Setup(f func(opts ...source.Option) source.Source, options ...source.Option Ssl: SslConfig, Logger: LoggerConfig, Jwt: JwtConfig, - Database: new(Database), + Database: DatabaseConfig, Databases: &DatabasesConfig, Gen: GenConfig, Extend: ExtendConfig, diff --git a/tools/config/database.go b/tools/config/database.go index b4f8203f..f6f1dfa9 100644 --- a/tools/config/database.go +++ b/tools/config/database.go @@ -1,7 +1,5 @@ package config -import "gorm.io/plugin/dbresolver" - type Database struct { Driver string Source string @@ -22,7 +20,4 @@ type DBResolverConfig struct { var ( DatabaseConfig = new(Database) DatabasesConfig = make(map[string]*Database) - Policies = map[string]dbresolver.Policy{ - "random": dbresolver.RandomPolicy{}, - } ) From 19e96a01de11294d43a828b2d0482f31fc1c5349 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 25 Feb 2021 23:40:55 +0800 Subject: [PATCH 096/201] =?UTF-8?q?feat=E2=9C=A8=20=EF=BC=9A=E6=A8=A1?= =?UTF-8?q?=E7=89=88=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/tools/gen.go | 10 +++++----- app/admin/apis/tools/systables.go | 10 ++++------ template/migrate.template | 1 - .../v4/actions/router_check_role.go.template | 6 +++--- .../actions/router_no_check_role.go.template | 6 +++--- template/v4/dto.go.template | 2 +- template/v4/vue.go.template | 20 +++++++++---------- 7 files changed, 26 insertions(+), 29 deletions(-) diff --git a/app/admin/apis/tools/gen.go b/app/admin/apis/tools/gen.go index a96cfda2..bdeef987 100644 --- a/app/admin/apis/tools/gen.go +++ b/app/admin/apis/tools/gen.go @@ -206,7 +206,7 @@ func GenMenuAndApi(c *gin.Context) { Cmenu.Path = tab.TBName Cmenu.MenuType = "C" Cmenu.Action = "无" - Cmenu.Permission = tab.ModuleName + ":" + tab.BusinessName + ":list" + Cmenu.Permission = tab.PackageName + ":" + tab.BusinessName + ":list" Cmenu.ParentId = Mmenu.MenuId Cmenu.NoCache = false Cmenu.Component = "/" + tab.BusinessName + "/index" @@ -226,7 +226,7 @@ func GenMenuAndApi(c *gin.Context) { MList.Path = tab.TBName MList.MenuType = "F" MList.Action = "无" - MList.Permission = tab.ModuleName + ":" + tab.BusinessName + ":query" + MList.Permission = tab.PackageName + ":" + tab.BusinessName + ":query" MList.ParentId = Cmenu.MenuId MList.NoCache = false MList.Sort = 0 @@ -245,7 +245,7 @@ func GenMenuAndApi(c *gin.Context) { MCreate.Path = tab.TBName MCreate.MenuType = "F" MCreate.Action = "无" - MCreate.Permission = tab.ModuleName + ":" + tab.BusinessName + ":add" + MCreate.Permission = tab.PackageName + ":" + tab.BusinessName + ":add" MCreate.ParentId = Cmenu.MenuId MCreate.NoCache = false MCreate.Sort = 0 @@ -264,7 +264,7 @@ func GenMenuAndApi(c *gin.Context) { MUpdate.Path = tab.TBName MUpdate.MenuType = "F" MUpdate.Action = "无" - MUpdate.Permission = tab.ModuleName + ":" + tab.BusinessName + ":edit" + MUpdate.Permission = tab.PackageName + ":" + tab.BusinessName + ":edit" MUpdate.ParentId = Cmenu.MenuId MUpdate.NoCache = false MUpdate.Sort = 0 @@ -283,7 +283,7 @@ func GenMenuAndApi(c *gin.Context) { MDelete.Path = tab.TBName MDelete.MenuType = "F" MDelete.Action = "无" - MDelete.Permission = tab.ModuleName + ":" + tab.BusinessName + ":remove" + MDelete.Permission = tab.PackageName + ":" + tab.BusinessName + ":remove" MDelete.ParentId = Cmenu.MenuId MDelete.NoCache = false MDelete.Sort = 0 diff --git a/app/admin/apis/tools/systables.go b/app/admin/apis/tools/systables.go index f4c9dc82..61c8eabc 100644 --- a/app/admin/apis/tools/systables.go +++ b/app/admin/apis/tools/systables.go @@ -191,8 +191,8 @@ func genTableInit(tablesList []string, i int, c *gin.Context) (tools.SysTables, column.IsPk = "1" column.Pk = true data.PkColumn = dbcolumn[i].ColumnName - column.GoField = strings.ToUpper(column.GoField) - column.JsonField = strings.ToUpper(column.JsonField) + //column.GoField = strings.ToUpper(column.GoField) + //column.JsonField = strings.ToUpper(column.JsonField) data.PkGoField = column.GoField data.PkJsonField = column.JsonField } @@ -204,10 +204,8 @@ func genTableInit(tablesList []string, i int, c *gin.Context) (tools.SysTables, if strings.Contains(dbcolumn[i].ColumnType, "int") { if strings.Contains(dbcolumn[i].ColumnKey, "PR") { - column.GoType = "uint" - } else if strings.Contains(dbcolumn[i].ColumnType, "unsigned") { - column.GoType = "uint" - } else { + column.GoType = "int" + } else { column.GoType = "string" } column.HtmlType = "input" diff --git a/template/migrate.template b/template/migrate.template index 960de1cb..f30de78a 100644 --- a/template/migrate.template +++ b/template/migrate.template @@ -1,7 +1,6 @@ package {{.Package}} import ( - //"go-admin/app/admin/models" "gorm.io/gorm" "runtime" diff --git a/template/v4/actions/router_check_role.go.template b/template/v4/actions/router_check_role.go.template index 88451bd2..f2edbcf2 100644 --- a/template/v4/actions/router_check_role.go.template +++ b/template/v4/actions/router_check_role.go.template @@ -3,9 +3,9 @@ package router import ( "github.com/gin-gonic/gin" - "go-admin/app/admin/middleware" - "go-admin/app/admin/models" - "go-admin/app/admin/service/dto" + "go-admin/app/{{.PackageName}}/middleware" + "go-admin/app/{{.PackageName}}/models" + "go-admin/app/{{.PackageName}}/service/dto" "go-admin/common/actions" jwt "go-admin/pkg/jwtauth" ) diff --git a/template/v4/actions/router_no_check_role.go.template b/template/v4/actions/router_no_check_role.go.template index c647266e..01545572 100644 --- a/template/v4/actions/router_no_check_role.go.template +++ b/template/v4/actions/router_no_check_role.go.template @@ -3,9 +3,9 @@ package router import ( "github.com/gin-gonic/gin" - "go-admin/app/admin/middleware" - "go-admin/app/admin/models" - "go-admin/app/admin/service/dto" + "go-admin/app/{{.PackageName}}/middleware" + "go-admin/app/{{.PackageName}}/models" + "go-admin/app/{{.PackageName}}/service/dto" "go-admin/common/actions" ) diff --git a/template/v4/dto.go.template b/template/v4/dto.go.template index c967c3b7..bdc49857 100644 --- a/template/v4/dto.go.template +++ b/template/v4/dto.go.template @@ -4,7 +4,7 @@ import ( "github.com/gin-gonic/gin" "gorm.io/gorm" - "go-admin/app/admin/models" + "go-admin/app/{{.PackageName}}/models" "go-admin/common/dto" "go-admin/common/log" "go-admin/tools" diff --git a/template/v4/vue.go.template b/template/v4/vue.go.template index b479b09a..0e7f050a 100644 --- a/template/v4/vue.go.template +++ b/template/v4/vue.go.template @@ -46,7 +46,7 @@