From b31e1c0d58d3b40f9f317f7e0df3d9f7cd76d5cd Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 27 Jul 2022 22:27:38 +0800 Subject: [PATCH 01/16] =?UTF-8?q?feat=E2=9C=A8:=20=20=E5=8D=87=E7=BA=A7go1?= =?UTF-8?q?.18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 22321ed9..022df7ab 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go-admin -go 1.15 +go 1.18 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 @@ -16,7 +16,6 @@ require ( github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.12+incompatible github.com/mssola/user_agent v0.5.2 github.com/opentracing/opentracing-go v1.1.0 - github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.0 github.com/qiniu/go-sdk/v7 v7.11.1 github.com/robfig/cron/v3 v3.0.1 @@ -26,10 +25,110 @@ require ( github.com/swaggo/swag v1.6.7 github.com/unrolled/secure v1.0.8 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 - golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect 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/driver/sqlserver v1.0.4 gorm.io/gorm v1.21.11 ) + +require ( + github.com/BurntSushi/toml v0.3.1 // indirect + github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect + github.com/KyleBanks/depth v1.2.1 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bsm/redislock v0.5.0 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/chanxuehong/rand v0.0.0-20201110082127-2f19a1bdd973 // indirect + github.com/chanxuehong/wechat v0.0.0-20201110083048-0180211b69fd // indirect + github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc // indirect + github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect + github.com/fatih/color v1.9.0 // indirect + github.com/fsnotify/fsnotify v1.4.7 // indirect + github.com/ghodss/yaml v1.0.0 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect + github.com/go-admin-team/go-admin-core/plugins/logger/zap v0.0.0-20210610020726-2db73adb505d // indirect + github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-openapi/jsonpointer v0.19.3 // indirect + github.com/go-openapi/jsonreference v0.19.3 // indirect + github.com/go-openapi/spec v0.19.4 // indirect + github.com/go-openapi/swag v0.19.5 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/validator/v10 v10.8.0 // indirect + github.com/go-redis/redis/v7 v7.4.0 // indirect + github.com/go-sql-driver/mysql v1.5.0 // indirect + github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect + github.com/golang/protobuf v1.4.3 // indirect + github.com/golang/snappy v0.0.1 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/henrylee2cn/ameda v1.4.10 // indirect + github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8 // indirect + github.com/imdario/mergo v0.3.9 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgconn v1.8.0 // indirect + github.com/jackc/pgio v1.0.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.0.6 // indirect + github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect + github.com/jackc/pgtype v1.6.2 // indirect + github.com/jackc/pgx/v4 v4.10.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.2 // indirect + github.com/json-iterator/go v1.1.11 // indirect + github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e // indirect + github.com/mattn/go-colorable v0.1.7 // indirect + github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-sqlite3 v1.14.5 // indirect + github.com/mattn/goveralls v0.0.2 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/mojocn/base64Captcha v1.3.1 // indirect + github.com/nsqio/go-nsq v1.0.8 // indirect + github.com/nyaruka/phonenumbers v1.0.55 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + github.com/robinjoseph08/redisqueue/v2 v2.1.0 // indirect + github.com/shamsher31/goimgext v1.0.0 // indirect + github.com/shirou/gopsutil v2.19.12+incompatible // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/pflag v1.0.3 // indirect + github.com/tklauser/go-sysconf v0.3.9 // indirect + github.com/tklauser/numcpus v0.3.0 // indirect + github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect + github.com/ugorji/go/codec v1.1.7 // indirect + github.com/urfave/cli v1.22.1 // indirect + github.com/yusufpapurcu/wmi v1.2.2 // indirect + go.uber.org/atomic v1.6.0 // indirect + go.uber.org/multierr v1.5.0 // indirect + go.uber.org/zap v1.15.0 // indirect + golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect + golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect + golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect + golang.org/x/sync v0.0.0-20201207232520-09787c993a3a // indirect + golang.org/x/sys v0.0.0-20220111092808-5a964db01320 // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect + golang.org/x/tools v0.0.0-20210106214847-113979e3529a // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/protobuf v1.26.0-rc.1 // indirect + gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect + gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect + gopkg.in/yaml.v2 v2.3.0 // indirect + gorm.io/plugin/dbresolver v1.1.0 // indirect +) From 0f1b9369dfb2dc22208297cb5e47e6190c6d2c15 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 29 Jul 2022 18:43:38 +0800 Subject: [PATCH 02/16] =?UTF-8?q?fix=F0=9F=90=9B:=20=20=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E9=94=99=E8=AF=AF=E4=B8=AD=E9=97=B4=E4=BB=B6bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/middleware/customerror.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/middleware/customerror.go b/common/middleware/customerror.go index a16dccbb..3cfa0191 100644 --- a/common/middleware/customerror.go +++ b/common/middleware/customerror.go @@ -41,6 +41,11 @@ func CustomError(c *gin.Context) { "code": statusCode, "msg": p[2], }) + } else { + c.JSON(http.StatusOK, gin.H{ + "code": 500, + "msg": "未知异常,请联系管理员!", + }) } default: panic(err) From 83b219458f95c29909449bfa9ce256506bced517 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 29 Jul 2022 18:44:22 +0800 Subject: [PATCH 03/16] =?UTF-8?q?fix=F0=9F=90=9B:=20=20=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E4=B8=ADpaths=E6=9C=AA=E8=AE=BE=E7=BD=AE=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/sys_menu.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/admin/service/sys_menu.go b/app/admin/service/sys_menu.go index e2d8a35e..26162f8a 100644 --- a/app/admin/service/sys_menu.go +++ b/app/admin/service/sys_menu.go @@ -4,6 +4,7 @@ import ( "errors" "github.com/go-admin-team/go-admin-core/sdk/pkg" "gorm.io/gorm" + "strings" "go-admin/app/admin/models" "go-admin/app/admin/service/dto" @@ -92,6 +93,11 @@ func (e *SysMenu) Insert(c *dto.SysMenuInsertReq) *SysMenu { _ = e.AddError(err) } c.MenuId = data.MenuId + err = e.initPaths(&data) + if err != nil { + e.Log.Errorf("db error:%s", err) + _ = e.AddError(err) + } return e } @@ -127,6 +133,7 @@ func (e *SysMenu) Update(c *dto.SysMenuUpdateReq) *SysMenu { var alist = make([]models.SysApi, 0) var model = models.SysMenu{} tx.Preload("SysApi").First(&model, c.GetId()) + oldPath := model.Paths tx.Where("id in ?", c.Apis).Find(&alist) err = tx.Model(&model).Association("SysApi").Delete(model.SysApi) if err != nil { @@ -146,6 +153,12 @@ func (e *SysMenu) Update(c *dto.SysMenuUpdateReq) *SysMenu { _ = e.AddError(errors.New("无权更新该数据")) return e } + var menuList []models.SysMenu + tx.Where("paths like ?", oldPath+"%").Find(&menuList) + for _, v := range menuList { + v.Paths = strings.Replace(v.Paths, oldPath, model.Paths, 1) + tx.Model(&v).Update("paths", v.Paths) + } return e } @@ -331,7 +344,7 @@ func (e *SysMenu) getByRoleName(roleName string) ([]models.SysMenu, error) { MenuList = data } else { role.RoleKey = roleName - buttons := make([]models.SysMenu,0) + buttons := make([]models.SysMenu, 0) err = e.Orm.Debug().Model(&role).Where("role_key = ? ", roleName).Preload("SysMenu", func(db *gorm.DB) *gorm.DB { return db.Where(" menu_type in ('F')").Order("sort") }).Find(&role).Error From f43cd117e3942589b9c1c24004bf84e986567b75 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 29 Jul 2022 18:47:12 +0800 Subject: [PATCH 04/16] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=20=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=88=9B=E5=BB=BA=E5=92=8C=E6=9B=B4=E6=96=B0=E5=90=8E?= =?UTF-8?q?=E9=87=8D=E6=96=B0load=20policy=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/apis/sys_role.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/admin/apis/sys_role.go b/app/admin/apis/sys_role.go index 1a1e75b0..d7ee1e7f 100644 --- a/app/admin/apis/sys_role.go +++ b/app/admin/apis/sys_role.go @@ -2,6 +2,7 @@ package apis import ( "fmt" + "go-admin/common/global" "net/http" "github.com/gin-gonic/gin/binding" @@ -128,7 +129,12 @@ func (e SysRole) Insert(c *gin.Context) { e.Error(500, err, "创建失败,"+err.Error()) return } - + _, err = global.LoadPolicy(c) + if err != nil { + e.Logger.Error(err) + e.Error(500, err, "创建失败,"+err.Error()) + return + } e.OK(req.GetId(), "创建成功") } @@ -165,6 +171,13 @@ func (e SysRole) Update(c *gin.Context) { return } + _, err = global.LoadPolicy(c) + if err != nil { + e.Logger.Error(err) + e.Error(500, err, "更新失败,"+err.Error()) + return + } + e.OK(req.GetId(), "更新成功") } From 260eedfcc66a505dbf1e6400567084dd05e1ce8a Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 29 Jul 2022 18:50:46 +0800 Subject: [PATCH 05/16] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=A4=B1=E6=95=88=E6=96=87=E6=A1=A3=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.Zh-cn.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.Zh-cn.md b/README.Zh-cn.md index ff2b8c95..e38d420b 100644 --- a/README.Zh-cn.md +++ b/README.Zh-cn.md @@ -13,10 +13,6 @@ [在线文档](https://doc.go-admin.dev) -[github在线文档](https://wenjianzhang.github.io) - -[gitee在线文档](http://mydearzwj.gitee.io/go-admin-doc/) - [前端项目](https://github.com/go-admin-team/go-admin-ui) [视频教程](https://space.bilibili.com/565616721/channel/detail?cid=125737) From 255c72d3f161bae77deb3a46a9c3e1e5e68e85fb Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 29 Jul 2022 18:51:55 +0800 Subject: [PATCH 06/16] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=20update=20versi?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 510aedbd..6f40ad99 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -2,7 +2,7 @@ package global const ( // Version go-admin version info - Version = "2.0.12" + Version = "2.1.0" ) var ( From c53c4fd9f860e8e61ebdb4f958423188182afe30 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 7 Aug 2022 20:42:24 +0800 Subject: [PATCH 07/16] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=20update=20readm?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.Zh-cn.md | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/README.Zh-cn.md b/README.Zh-cn.md index e38d420b..d77e28e3 100644 --- a/README.Zh-cn.md +++ b/README.Zh-cn.md @@ -247,12 +247,32 @@ npm run dev -## 💎 主要成员 +## 💎 贡献者 - - - - + + + + + + + + + + + + + + + + + + + + + + + + ## JetBrains 开源证书支持 From 98c495abb140543c73c2d7e3e80410f6498e3a18 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 7 Aug 2022 20:43:34 +0800 Subject: [PATCH 08/16] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=20update=20readm?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index efabf308..9e5e4253 100644 --- a/README.md +++ b/README.md @@ -233,12 +233,33 @@ npm run dev -## 💎 Members +## 💎 Contributors - - - - + + + + + + + + + + + + + + + + + + + + + + + + + From 86187e4c79bda201ae9cba0259f8602495af1169 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 7 Aug 2022 21:49:24 +0800 Subject: [PATCH 09/16] =?UTF-8?q?fix=F0=9F=90=9B:=20=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=8F=9C=E5=8D=95=E6=8E=A5=E5=8F=A3menurole?= =?UTF-8?q?=EF=BC=8C=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=AE=8C=E6=95=B4=20(#676)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/sys_menu.go | 67 +++++++++++++++-------------------- 1 file changed, 29 insertions(+), 38 deletions(-) diff --git a/app/admin/service/sys_menu.go b/app/admin/service/sys_menu.go index 26162f8a..1bdb3746 100644 --- a/app/admin/service/sys_menu.go +++ b/app/admin/service/sys_menu.go @@ -1,8 +1,8 @@ package service import ( - "errors" "github.com/go-admin-team/go-admin-core/sdk/pkg" + "github.com/pkg/errors" "gorm.io/gorm" "strings" @@ -334,55 +334,46 @@ func (e *SysMenu) SetMenuRole(roleName string) (m []models.SysMenu, err error) { } func (e *SysMenu) getByRoleName(roleName string) ([]models.SysMenu, error) { - var MenuList []models.SysMenu var role models.SysRole var err error if roleName == "admin" { var data []models.SysMenu - err = e.Orm.Where(" menu_type in ('M','C')").Order("sort").Find(&data).Error - MenuList = data + err = e.Orm.Where(" menu_type in ('M','C') and deleted_at is null and created_at>'2021-08-13'"). + Order("sort"). + Find(&data). + Error + err = errors.WithStack(err) + return data, err } else { role.RoleKey = roleName - buttons := make([]models.SysMenu, 0) - err = e.Orm.Debug().Model(&role).Where("role_key = ? ", roleName).Preload("SysMenu", func(db *gorm.DB) *gorm.DB { - return db.Where(" menu_type in ('F')").Order("sort") - }).Find(&role).Error - if role.SysMenu != nil { - buttons = *role.SysMenu - } - mIds := make([]int, 0) - for _, menu := range buttons { - if menu.ParentId != 0 { - mIds = append(mIds, menu.ParentId) - } - } - var dataC []models.SysMenu - err = e.Orm.Where(" menu_type in ('C') and menu_id in ?", mIds).Order("sort").Find(&dataC).Error - if err != nil { - return nil, err - } - for _, datum := range dataC { - MenuList = append(MenuList, datum) - } - cIds := make([]int, 0) + err = e.Orm. + Model(&role). + Where("role_key = ? ", roleName). + Preload("SysMenu", func(db *gorm.DB) *gorm.DB { + return db.Where(" menu_type in ('F','C')").Order("sort") + }). + Find(&role).Error + MenuList := *role.SysMenu + mIds := make([]string, 0) + mp := make(map[string]string, 0) for _, menu := range MenuList { - if menu.ParentId != 0 { - cIds = append(cIds, menu.ParentId) + ids := strings.Split(menu.Paths, "/") + for _, id := range ids { + if mp[id] == "" { + mp[id] = id + mIds = append(mIds, id) + } } } - var dataM []models.SysMenu - err = e.Orm.Where(" menu_type in ('M') and menu_id in ?", cIds).Order("sort").Find(&dataM).Error + var data []models.SysMenu + err = e.Orm.Where(" menu_id in ? and menu_type in ('M','C')", mIds). + Order("sort"). + Find(&data). + Error if err != nil { return nil, err } - for _, datum := range dataM { - MenuList = append(MenuList, datum) - } + return data, err } - - if err != nil { - e.Log.Errorf("db error:%s", err) - } - return MenuList, err } From 8a3c50ea1ac860f30a9d4e7c98d42b3858a53098 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 7 Aug 2022 21:52:02 +0800 Subject: [PATCH 10/16] =?UTF-8?q?config=F0=9F=94=A7:=20=20=20=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9actions=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= 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 123e1ebf..fb65e63f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,10 +16,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.15 + - name: Set up Go 1.18 uses: actions/setup-go@v3 with: - go-version: 1.15 + go-version: 1.18 id: go - name: Check out code into the Go module directory From 087ba38c243cbcaebedd7bf0d86721a49345ed86 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 8 Aug 2022 09:22:36 +0800 Subject: [PATCH 11/16] =?UTF-8?q?config=F0=9F=94=A7:=20=20=20=20update=20R?= =?UTF-8?q?EADME.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.Zh-cn.md | 2 ++ README.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.Zh-cn.md b/README.Zh-cn.md index d77e28e3..34dae53d 100644 --- a/README.Zh-cn.md +++ b/README.Zh-cn.md @@ -254,6 +254,7 @@ npm run dev + @@ -274,6 +275,7 @@ npm run dev + ## JetBrains 开源证书支持 `go-admin` 项目一直以来都是在 JetBrains 公司旗下的 GoLand 集成开发环境中进行开发,基于 **free JetBrains Open Source license(s)** 正版免费授权,在此表达我的谢意。 diff --git a/README.md b/README.md index 9e5e4253..d3c5fff2 100644 --- a/README.md +++ b/README.md @@ -235,12 +235,12 @@ npm run dev ## 💎 Contributors - + From 50a3b39666121a0c3d1023302427911c9289e228 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 8 Aug 2022 09:26:14 +0800 Subject: [PATCH 12/16] =?UTF-8?q?config=F0=9F=94=A7:=20Modify=20the=20clie?= =?UTF-8?q?nt=20IP=20acquisition=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/middleware/customerror.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/middleware/customerror.go b/common/middleware/customerror.go index 3cfa0191..121a2e7a 100644 --- a/common/middleware/customerror.go +++ b/common/middleware/customerror.go @@ -2,7 +2,6 @@ package middleware import ( "fmt" - "go-admin/common" "net/http" "strconv" "strings" @@ -34,7 +33,7 @@ func CustomError(c *gin.Context) { c.Request.URL, statusCode, c.Request.RequestURI, - common.GetClientIP(c), + c.ClientIP(), p[2], ) c.JSON(http.StatusOK, gin.H{ From bccbd67450454ffa4c7985579dbbc232c8b7253f Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 8 Aug 2022 09:42:31 +0800 Subject: [PATCH 13/16] =?UTF-8?q?config=F0=9F=94=A7:=20update=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.Zh-cn.md | 28 ++++++++++++++++++++-------- README.md | 28 ++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/README.Zh-cn.md b/README.Zh-cn.md index 34dae53d..4126e065 100644 --- a/README.Zh-cn.md +++ b/README.Zh-cn.md @@ -17,6 +17,14 @@ [视频教程](https://space.bilibili.com/565616721/channel/detail?cid=125737) +## 🎬 在线体验 + +vue体验:[https://www.go-admin.dev](https://www.go-admin.dev/#/login) +> ⚠️⚠️⚠️ 账号 / 密码: admin / 123456 + +antd体验:[https://preview.go-admin.dev](https://preview.go-admin.dev/) +> ⚠️⚠️⚠️ 账号 / 密码: admin / 123456 + ## ✨ 特性 - 遵循 RESTful API 设计规范 @@ -96,6 +104,14 @@ ## 📦 本地开发 +### 环境要求 + +go 1.18 + +node版本: v14.16.0 + +npm版本: 6.14.11 + ### 开发目录创建 ```bash @@ -226,12 +242,6 @@ npm install --registry=https://registry.npm.taobao.org npm run dev ``` -## 🎬 在线体验 - -> admin / 123456 - -演示地址:[http://www.go-admin.dev](http://www.go-admin.dev/#/login) - ## 📨 互动 @@ -284,7 +294,8 @@ npm run dev ## 🤝 特别感谢 -1. [chengxiao](https://github.com/chengxiao) +1. [ant-design](https://github.com/ant-design/ant-design) +2. [ant-design-pro](https://github.com/ant-design/ant-design-pro) 2. [gin](https://github.com/gin-gonic/gin) 2. [casbin](https://github.com/casbin/casbin) 2. [spf13/viper](https://github.com/spf13/viper) @@ -295,6 +306,7 @@ npm run dev 2. [ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue) 2. [form-generator](https://github.com/JakHuang/form-generator) + ## 🤟 打赏 > 如果你觉得这个项目帮助到了你,你可以帮作者买一杯果汁表示鼓励 :tropical_drink: @@ -309,4 +321,4 @@ npm run dev [MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md) -Copyright (c) 2020 wenjianzhang +Copyright (c) 2022 wenjianzhang diff --git a/README.md b/README.md index d3c5fff2..596e5d4c 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,14 @@ The front-end and back-end separation authority management system based on Gin + [Video tutorial](https://space.bilibili.com/565616721/channel/detail?cid=125737) +## 🎬 Online Demo + +vue demo:[https://www.go-admin.dev](https://www.go-admin.dev/#/login) +> 账号 / 密码: admin / 123456 + +antd demo:[https://preview.go-admin.dev](https://preview.go-admin.dev/) +> 账号 / 密码: admin / 123456 +> ## ✨ Feature - Follow RESTful API design specifications @@ -94,6 +102,14 @@ At the same time, a series of tutorials including videos and documents are provi ## 📦 Local development +### Environmental requirements + +go 1.18 + +nodejs: v14.16.0 + +npm: 6.14.11 + ### Development directory creation ```bash @@ -214,12 +230,6 @@ npm install # or cnpm install npm run dev ``` -## 🎬 Online Demo -> admin / 123456 - -演示地址:[http://www.go-admin.dev](http://www.go-admin.dev/#/login) - - ## 📨 Interactive
@@ -271,7 +281,9 @@ The `go-admin` project has always been developed in the GoLand integrated develo ## 🤝 Thanks -1. [chengxiao](https://github.com/chengxiao) + +1. [ant-design](https://github.com/ant-design/ant-design) +2. [ant-design-pro](https://github.com/ant-design/ant-design-pro) 2. [gin](https://github.com/gin-gonic/gin) 2. [casbin](https://github.com/casbin/casbin) 2. [spf13/viper](https://github.com/spf13/viper) @@ -295,4 +307,4 @@ The `go-admin` project has always been developed in the GoLand integrated develo [MIT](https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md) -Copyright (c) 2020 wenjianzhang +Copyright (c) 2022 wenjianzhang From 09bfdc3d395733c90c4f2d6ad37dd061cf30e8f5 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 8 Aug 2022 10:15:29 +0800 Subject: [PATCH 14/16] =?UTF-8?q?config=F0=9F=94=A7:=20set=20DB=20CHARSET?= =?UTF-8?q?=20utf8mb4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/migrate/migration/version/1599190683659_tables.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 64780788..5862dae3 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -17,7 +17,7 @@ func init() { func _1599190683659Tables(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - err := tx.Debug().Migrator().AutoMigrate( + err := tx.Set("gorm:table_options", "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4").Migrator().AutoMigrate( new(models.CasbinRule), new(models.SysDept), new(models.SysConfig), From 1bea64bb6d1e87eb04199f76aaf108b0ddde808a Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Mon, 8 Aug 2022 10:16:43 +0800 Subject: [PATCH 15/16] =?UTF-8?q?config=F0=9F=94=A7:=20set=20DB=20CHARSET?= =?UTF-8?q?=20utf8mb4(#674)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/migrate/migration/version/1599190683659_tables.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 5862dae3..64aa9706 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -17,7 +17,7 @@ func init() { func _1599190683659Tables(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - err := tx.Set("gorm:table_options", "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4").Migrator().AutoMigrate( + err := tx.Set("gorm:table_options", "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ").Migrator().AutoMigrate( new(models.CasbinRule), new(models.SysDept), new(models.SysConfig), From 9a596397ca63c03d4bf84f1e9bf9ceedf6de4111 Mon Sep 17 00:00:00 2001 From: Vingurzhou Date: Mon, 8 Aug 2022 11:28:55 +0800 Subject: [PATCH 16/16] Update 1599190683659_tables.go --- cmd/migrate/migration/version/1599190683659_tables.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/migrate/migration/version/1599190683659_tables.go b/cmd/migrate/migration/version/1599190683659_tables.go index 64aa9706..5862dae3 100644 --- a/cmd/migrate/migration/version/1599190683659_tables.go +++ b/cmd/migrate/migration/version/1599190683659_tables.go @@ -17,7 +17,7 @@ func init() { func _1599190683659Tables(db *gorm.DB, version string) error { return db.Transaction(func(tx *gorm.DB) error { - err := tx.Set("gorm:table_options", "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ").Migrator().AutoMigrate( + err := tx.Set("gorm:table_options", "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4").Migrator().AutoMigrate( new(models.CasbinRule), new(models.SysDept), new(models.SysConfig),