diff --git a/application.go b/application.go index f20289a..6caa23b 100644 --- a/application.go +++ b/application.go @@ -566,14 +566,9 @@ func Init(config string) *Application { codeMake["name"] = codeMake.GetString("table") } - if appIns.Config.GetInt("mode") > 0 { - appIns.MakeCodeRouter[codeMake.GetString("name")] = &code.MakeCode{Error: appIns.Error} + appIns.MakeCodeRouter[codeMake.GetString("name")] = &code.MakeCode{Error: appIns.Error} + appIns.MakeCodeRouter[codeMake.GetString("name")].Db2JSON(&appIns.Db, codeMake) - appIns.MakeCodeRouter[codeMake.GetString("name")].Db2JSON(&appIns.Db, codeMake) - } else { - appIns.MakeCodeRouter[codeMake.GetString("name")] = &code.MakeCode{Error: appIns.Error} - appIns.MakeCodeRouter[codeMake.GetString("name")].Db2JSON(nil, codeMake) - } //接入动态代码层 if appIns.Router == nil { appIns.Router = Router{} diff --git a/db/hotimedb.go b/db/hotimedb.go index a63a8a1..70c2f62 100644 --- a/db/hotimedb.go +++ b/db/hotimedb.go @@ -13,6 +13,7 @@ import ( "reflect" "sort" "strings" + "time" ) type HoTimeDB struct { @@ -314,7 +315,7 @@ func (that *HoTimeDB) InitDb(err ...*Error) *Error { e := that.SlaveDB.Ping() that.LastErr.SetError(e) } - + that.DB.SetConnMaxLifetime(time.Second) return that.LastErr }