Merge branch 'master' of github.com:viletyy/potato
This commit is contained in:
commit
239cbac155
23
conf/app.ini
23
conf/app.ini
|
@ -1,23 +0,0 @@
|
|||
RUN_MODE = debug
|
||||
|
||||
[app]
|
||||
PAGE_SIZE = 10
|
||||
JWT_SECRET = 23347$040412
|
||||
|
||||
[server]
|
||||
HTTP_PORT = 8000
|
||||
READ_TIMEOUT = 60
|
||||
WRITE_TIMEOUT = 60
|
||||
|
||||
[database]
|
||||
TYPE = postgres
|
||||
USER = postgre
|
||||
PASSWORD = 123456
|
||||
HOST = 127.0.0.1
|
||||
PORT = 5432
|
||||
NAME = data_govern
|
||||
TABLE_PREFIX = d_
|
||||
|
||||
[redis]
|
||||
HOST = 127.0.0.1
|
||||
PORT = 6379
|
|
@ -11,9 +11,14 @@ WRITE_TIMEOUT = 60
|
|||
|
||||
[database]
|
||||
TYPE = postgres
|
||||
USER = postgres
|
||||
USER = postgre
|
||||
PASSWORD = 123456
|
||||
HOST = postgres
|
||||
HOST = 127.0.0.1
|
||||
PORT = 5432
|
||||
NAME = dbname
|
||||
TABLE_PREFIX = g_
|
||||
NAME = data_govern
|
||||
TABLE_PREFIX = d_
|
||||
|
||||
[redis]
|
||||
HOST = 127.0.0.1
|
||||
PORT = 6379
|
||||
DB = 1
|
|
@ -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