提交 661fba3e 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

自动初始化单独建包 为 命令行做基础

上级 800ef882
......@@ -22,8 +22,6 @@ require (
github.com/json-iterator/go v1.1.10 // indirect
github.com/lestrrat-go/file-rotatelogs v2.3.0+incompatible
github.com/lestrrat-go/strftime v1.0.3 // indirect
github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570 // indirect
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/mojocn/base64Captcha v1.3.1
......@@ -42,7 +40,6 @@ require (
github.com/swaggo/swag v1.6.7
github.com/tebeka/strftime v0.1.3 // indirect
github.com/unrolled/secure v1.0.7
github.com/urfave/cli v1.22.2 // indirect
go.uber.org/zap v1.10.0
golang.org/x/net v0.0.0-20200320220750-118fecf932d8 // indirect
golang.org/x/sys v0.0.0-20200610111108-226ff32320da // indirect
......
......@@ -5,6 +5,7 @@ import (
"gin-vue-admin/model"
gormadapter "github.com/casbin/gorm-adapter/v3"
"github.com/satori/go.uuid"
"go.uber.org/zap"
"gorm.io/gorm"
"time"
)
......@@ -309,6 +310,7 @@ func InitSysBaseMenus() (err error) {
{Model: gorm.Model{ID: 23, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: true, ParentId: "3", Path: "dictionaryDetail/:id", Name: "dictionaryDetail", Component: "view/superAdmin/dictionary/sysDictionaryDetail.vue", Sort: 1, Meta: model.Meta{Title: "字典详情", Icon: "s-order"}},
{Model: gorm.Model{ID: 24, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "3", Path: "operation", Name: "operation", Component: "view/superAdmin/operation/sysOperationRecord.vue", Sort: 6, Meta: model.Meta{Title: "操作历史", Icon: "time"}},
{Model: gorm.Model{ID: 25, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, Hidden: false, ParentId: "9", Path: "simpleUploader", Name: "simpleUploader", Component: "view/example/simpleUploader/simpleUploader", Sort: 6, Meta: model.Meta{Title: "断点续传(插件版)", Icon: "upload"}},
{Model: gorm.Model{ID: 26, CreatedAt: time.Now(), UpdatedAt: time.Now()}, MenuLevel: 0, ParentId: "0", Path: "https://www.gin-vue-admin.com", Name: "https://www.gin-vue-admin.com", Hidden: false, Component: "/", Sort: 0, Meta: model.Meta{Title: "官方网站", Icon: "s-home"}},
}
if tx.Create(&insert).Error != nil { // 遇到错误时回滚事务
tx.Rollback()
......@@ -366,6 +368,7 @@ func InitSysAuthorityMenus() (err error) {
{"888", 23},
{"888", 24},
{"888", 25},
{"888", 26},
{"8881", 1},
{"8881", 2},
{"8881", 8},
......@@ -476,7 +479,7 @@ func InitData() {
err = InitSysDictionaryDetail()
err = InitExaFileUploadAndDownload()
if err != nil {
global.GVA_LOG.Error("initialize data failed", err)
global.GVA_LOG.Error("initialize data failed", zap.Any("err", err))
}
global.GVA_LOG.Debug("initialize data success")
}
......@@ -3,7 +3,7 @@ package main
import (
"gin-vue-admin/core"
"gin-vue-admin/global"
"gin-vue-admin/gva/init_data"
//"gin-vue-admin/gva/init_data"
"gin-vue-admin/initialize"
//"runtime"
)
......@@ -25,7 +25,7 @@ func main() {
initialize.Mysql()
}
initialize.DBTables()
init_data.InitData() // 打开注释即可初始化数据
//init_data.InitData() // 打开注释即可初始化数据 使用过后一定要再次注释或删除
// 程序结束前关闭数据库链接
db, _ := global.GVA_DB.DB()
defer db.Close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册