This commit is contained in:
parent
3488eab401
commit
36dec599a2
@ -135,7 +135,8 @@ func (this *Application) SetConfig(configPath ...string) {
|
|||||||
cmap.JsonToMap(string(btes), &this.Error)
|
cmap.JsonToMap(string(btes), &this.Error)
|
||||||
|
|
||||||
for k, v := range cmap {
|
for k, v := range cmap {
|
||||||
this.Config.Put(k, v)
|
this.Config.Put(k, v)//程序配置
|
||||||
|
Config.Put(k,v)//系统配置
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else {
|
//else {
|
||||||
@ -214,7 +215,7 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
|
|||||||
// 如果token存在就判断token是否在Session中有保存
|
// 如果token存在就判断token是否在Session中有保存
|
||||||
// 如果有取出token并复制给cookie
|
// 如果有取出token并复制给cookie
|
||||||
// 没有保存就生成随机的session
|
// 没有保存就生成随机的session
|
||||||
cookie, err := req.Cookie((this.Config["sessionName"]).(string))
|
cookie, err := req.Cookie(this.Config.GetString("sessionName"))
|
||||||
sessionId := Md5(strconv.Itoa(Rand(10)))
|
sessionId := Md5(strconv.Itoa(Rand(10)))
|
||||||
token := req.FormValue("token")
|
token := req.FormValue("token")
|
||||||
//isFirst:=false
|
//isFirst:=false
|
||||||
@ -225,7 +226,7 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
|
|||||||
//else{
|
//else{
|
||||||
// isFirst=true;
|
// 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 {
|
} else {
|
||||||
sessionId = cookie.Value
|
sessionId = cookie.Value
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user