已经接入配置文件,开始准备生成代码

This commit is contained in:
2021-06-04 02:57:56 +08:00
parent 99933e02f4
commit fe085ce889
9 changed files with 96 additions and 20 deletions
+14 -4
View File
@@ -2,6 +2,7 @@ package hotime
import (
. "./cache"
"./code"
. "./common"
. "./db"
. "./log"
@@ -19,6 +20,7 @@ import (
)
type Application struct {
*code.MakeCode
MethodRouter
Router
ContextBase
@@ -307,10 +309,9 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
unescapeUrl = req.RequestURI
}
//访问实例
context := Context{SessionIns: SessionIns{SessionId: sessionId,
HoTimeCache: that.HoTimeCache,
},
Resp: w, Req: req, Application: that, RouterString: s, Config: that.Config, Db: &that.Db, HandlerStr: unescapeUrl}
context := Context{SessionIns: SessionIns{SessionId: sessionId, HoTimeCache: that.HoTimeCache},
Resp: w, Req: req, Application: that, RouterString: s, Config: that.Config, Db: &that.Db,
HandlerStr: unescapeUrl}
//header默认设置
header := w.Header()
header.Set("Content-Type", "text/html; charset=utf-8")
@@ -448,6 +449,15 @@ func Init(config string) Application {
SetDB(&appIns)
appIns.SetCache()
appIns.MakeCode = &code.MakeCode{}
codeConfig := appIns.Config.GetMap("codeConfig")
if codeConfig != nil {
for k, _ := range codeConfig {
appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), appIns.Db)
}
}
return appIns
}