forked from golang/hotime
数据库操作优化,优化系统管理后台代码生成逻辑
This commit is contained in:
parent
b940afa6b0
commit
7a8b86ed12
@ -566,14 +566,9 @@ func Init(config string) *Application {
|
|||||||
codeMake["name"] = codeMake.GetString("table")
|
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 {
|
if appIns.Router == nil {
|
||||||
appIns.Router = Router{}
|
appIns.Router = Router{}
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HoTimeDB struct {
|
type HoTimeDB struct {
|
||||||
@ -314,7 +315,7 @@ func (that *HoTimeDB) InitDb(err ...*Error) *Error {
|
|||||||
e := that.SlaveDB.Ping()
|
e := that.SlaveDB.Ping()
|
||||||
that.LastErr.SetError(e)
|
that.LastErr.SetError(e)
|
||||||
}
|
}
|
||||||
|
that.DB.SetConnMaxLifetime(time.Second)
|
||||||
return that.LastErr
|
return that.LastErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user