Browse Source

Merge pull request #697 from songzhibin97/gva_gormv2_dev

fix:重复生成判断回滚
main
奇淼(piexlmax 3 years ago
committed by GitHub
parent
commit
efb56dc354
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      server/service/system/sys_autocode_history.go
  2. 4
      server/service/system/sys_initdb.go

2
server/service/system/sys_autocode_history.go

@ -25,7 +25,7 @@ var AutoCodeHistoryServiceApp = new(AutoCodeHistoryService)
func (autoCodeHistoryService *AutoCodeHistoryService) Repeat(structName string) bool { func (autoCodeHistoryService *AutoCodeHistoryService) Repeat(structName string) bool {
var count int64 var count int64
global.GVA_DB.Model(&system.SysAutoCodeHistory{}).Where("struct_name = ?", structName).Count(&count)
global.GVA_DB.Model(&system.SysAutoCodeHistory{}).Where("struct_name = ? and flag = 0", structName).Count(&count)
return count > 0 return count > 0
} }

4
server/service/system/sys_initdb.go

@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"path/filepath" "path/filepath"
uuid "github.com/satori/go.uuid"
"github.com/flipped-aurora/gin-vue-admin/server/config" "github.com/flipped-aurora/gin-vue-admin/server/config"
"github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/example" "github.com/flipped-aurora/gin-vue-admin/server/model/example"
@ -33,6 +35,7 @@ func (initDBService *InitDBService) writeConfig(viper *viper.Viper, mysql config
for k, v := range cs { for k, v := range cs {
viper.Set(k, v) viper.Set(k, v)
} }
viper.Set("jwt.signing-key", uuid.NewV4())
return viper.WriteConfig() return viper.WriteConfig()
} }
@ -159,6 +162,7 @@ func (initDBService *InitDBService) InitDB(conf request.InitDB) error {
global.GVA_DB = nil global.GVA_DB = nil
return err return err
} }
if err = initDBService.writeConfig(global.GVA_VP, MysqlConfig); err != nil { if err = initDBService.writeConfig(global.GVA_VP, MysqlConfig); err != nil {
return err return err
} }

Loading…
Cancel
Save