Merge branch 'master' of github.com:viletyy/potato

This commit is contained in:
viletyy 2019-09-03 20:48:14 +08:00
commit 239cbac155
3 changed files with 19 additions and 27 deletions

View File

@ -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

View File

@ -11,9 +11,14 @@ WRITE_TIMEOUT = 60
[database] [database]
TYPE = postgres TYPE = postgres
USER = postgres USER = postgre
PASSWORD = 123456 PASSWORD = 123456
HOST = postgres HOST = 127.0.0.1
PORT = 5432 PORT = 5432
NAME = dbname NAME = data_govern
TABLE_PREFIX = g_ TABLE_PREFIX = d_
[redis]
HOST = 127.0.0.1
PORT = 6379
DB = 1

View File

@ -7,4 +7,14 @@ import (
func init() { func init() {
util.DB.AutoMigrate(&User{}, &basic.MetaDatabase{}, &basic.Vendor{}, &basic.Business{}) 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: "管理员",
})
}
} }