优化 IpPool

This commit is contained in:
bjdgyc
2022-10-09 17:49:44 +08:00
parent 6f875001f2
commit 83263ff635
6 changed files with 62 additions and 49 deletions

View File

@@ -19,11 +19,14 @@ func GetXdb() *xorm.Engine {
func initDb() {
var err error
xdb, err = xorm.NewEngine(base.Cfg.DbType, base.Cfg.DbSource)
// xdb.ShowSQL(true)
if err != nil {
base.Fatal(err)
}
if base.Cfg.ShowSQL {
xdb.ShowSQL(true)
}
// 初始化数据库
err = xdb.Sync2(&User{}, &Setting{}, &Group{}, &IpMap{}, &AccessAudit{}, &Policy{}, &StatsNetwork{}, &StatsCpu{}, &StatsMem{}, &StatsOnline{})
if err != nil {

View File

@@ -47,7 +47,7 @@ type IpMap struct {
Keep bool `json:"keep" xorm:"Bool"` // 保留 ip-mac 绑定
KeepTime time.Time `json:"keep_time" xorm:"DateTime"`
Note string `json:"note" xorm:"varchar(255)"` // 备注
LastLogin time.Time `json:"last_login" xorm:"DateTime updated"`
LastLogin time.Time `json:"last_login" xorm:"DateTime"`
UpdatedAt time.Time `json:"updated_at" xorm:"DateTime updated"`
}