diff --git a/server/config.yaml b/server/config.yaml index 1d38f046..b336c7cc 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -56,7 +56,7 @@ mysql: config: 'charset=utf8mb4&parseTime=True&loc=Local' db-name: 'qmPlus' username: 'root' - password: 'root123' + password: 'Aa@6447985' max-idle-conns: 10 max-open-conns: 100 log-mode: false diff --git a/server/core/server.go b/server/core/server.go index 3bbba3c4..65d22a20 100644 --- a/server/core/server.go +++ b/server/core/server.go @@ -29,7 +29,7 @@ func RunWindowsServer() { fmt.Printf(` 欢迎使用 Gin-Vue-Admin - 当前版本:V2.3.6 + 当前版本:V2.3.7 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html 默认前端文件运行地址:http://127.0.0.1:8080 如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/docs/coffee diff --git a/server/service/sys_auto_code.go b/server/service/sys_auto_code.go index afeca1eb..d6fdf0b3 100644 --- a/server/service/sys_auto_code.go +++ b/server/service/sys_auto_code.go @@ -209,7 +209,6 @@ func addAutoMoveFile(data *tplData) { } } - //@author: [piexlmax](https://github.com/piexlmax) //@author: [SliverHorn](https://github.com/SliverHorn) //@function: CreateApi @@ -259,14 +258,13 @@ func AutoCreateApi(a *model.AutoCodeStruct) (err error) { err = global.GVA_DB.Transaction(func(tx *gorm.DB) error { for _, v := range apiList { var api model.SysApi - if err := tx.Where("path = ? AND method = ?", v.Path, v.Method).First(&api).Error; err != nil { - return err - } - if err := tx.Create(&v).Error; err != nil { // 遇到错误时回滚事务 - return err + if errors.Is(tx.Where("path = ? AND method = ?", v.Path, v.Method).First(&api).Error, gorm.ErrRecordNotFound) { + if err := tx.Create(&v).Error; err != nil { // 遇到错误时回滚事务 + return err + } } } return nil }) return err -} \ No newline at end of file +}