已经接入配置文件,开始准备生成代码
This commit is contained in:
+14
-4
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user