数据库操作优化,优化系统管理后台代码生成逻辑

This commit is contained in:
hoteas 2022-08-17 16:02:36 +08:00
parent b940afa6b0
commit 7a8b86ed12
2 changed files with 4 additions and 8 deletions

View File

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

View File

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