[ADD]初始化用户数据
This commit is contained in:
parent
3f1a325c5d
commit
3e3d9a3d8b
|
@ -7,4 +7,14 @@ import (
|
|||
|
||||
func init() {
|
||||
util.DB.AutoMigrate(&User{}, &basic.MetaDatabase{}, &basic.Vendor{}, &basic.Business{})
|
||||
|
||||
var count int
|
||||
if err := util.DB.Model(&User{}).Count(&count).Error; err == nil && count == 0 {
|
||||
//新增
|
||||
util.DB.Create(&User{
|
||||
Username: "admin",
|
||||
Password: GetSecretPassword("123456"),
|
||||
Nickname: "管理员",
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue