From 36dec599a2d5066657f3fd7fc5f0755aa862ea90 Mon Sep 17 00:00:00 2001 From: hoteas Date: Sat, 7 Apr 2018 16:54:08 +0000 Subject: [PATCH] --- application.go | 7 ++++--- error.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/application.go b/application.go index 07aa2c0..a6cc7ea 100644 --- a/application.go +++ b/application.go @@ -135,7 +135,8 @@ func (this *Application) SetConfig(configPath ...string) { cmap.JsonToMap(string(btes), &this.Error) for k, v := range cmap { - this.Config.Put(k, v) + this.Config.Put(k, v)//程序配置 + Config.Put(k,v)//系统配置 } } //else { @@ -214,7 +215,7 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) { // 如果token存在就判断token是否在Session中有保存 // 如果有取出token并复制给cookie // 没有保存就生成随机的session - cookie, err := req.Cookie((this.Config["sessionName"]).(string)) + cookie, err := req.Cookie(this.Config.GetString("sessionName")) sessionId := Md5(strconv.Itoa(Rand(10))) token := req.FormValue("token") //isFirst:=false @@ -225,7 +226,7 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) { //else{ // isFirst=true; //} - http.SetCookie(w, &http.Cookie{Name: this.Config["sessionName"].(string), Value: sessionId, Path: "/"}) + http.SetCookie(w, &http.Cookie{Name: this.Config.GetString("sessionName"), Value: sessionId, Path: "/"}) } else { sessionId = cookie.Value } diff --git a/error.go b/error.go index a3e170c..558bd5d 100644 --- a/error.go +++ b/error.go @@ -24,7 +24,7 @@ func(this *Error)SetError(err error,loglevel ...int){ return } - lev:=Config.GetInt("LOG_NIL") + lev:=Config.GetInt("logLevel") if len(loglevel)!=0{ lev=loglevel[0]