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]