func session(ctx *Context) {
	var cookie *http.Cookie
	cookies := ctx.Request.Cookies()
	if len(cookies) == 0 {
		ctx.Next()
		return
	}

	for _, v := range cookies {
		if v.Name == httpCookie.Name {
			cookie = v
			break
		}
	}
	if cookie == nil {
		ctx.Next()
		return
	}

	sid := cookie.Value
	store, err := provider.Get(sid)
	if err != nil {
		log.WithFields(log.Fields{"sid": sid, "err": err}).Warnln("读取session失败")
		ctx.Fail(err)
		return
	}
	if len(store.Values) > 0 {
		//err := provider.refresh(store)
		err := provider.UpExpire(sid)
		if err != nil {
			log.WithFields(log.Fields{"sid": sid, "err": err}).Warnln("刷新session失败")
			ctx.Fail(err)
			return
		}
		cookie := httpCookie
		cookie.Value = sid
		ctx.Data["session"] = store
		ctx.Data["Sid"] = sid
		http.SetCookie(ctx.ResponseWriter, &cookie)
	}

	ctx.Next()
}
func session(ctx *Context) {
	var cookie *http.Cookie
	cookies := ctx.Request.Cookies()
	if len(cookies) == 0 {
		ctx.Next()
		return
	}

	for _, v := range cookies {
		if v.Name == httpCookie.Name {
			cookie = v
			break
		}
	}
	if cookie == nil {
		ctx.Next()
		return
	}

	sid := cookie.Value
	store, err := provider.Get(sid)
	if err != nil {
		log.WithFields(log.Fields{"sid": sid, "err": err}).Warnln("读取session失败")
		ctx.Fail(err)
		return
	}
	if len(store.Values) > 0 {
		//err := provider.refresh(store)
		err := provider.UpExpire(sid)
		if err != nil {
			log.WithFields(log.Fields{"sid": sid, "err": err}).Warnln("刷新session失败")
			ctx.Fail(err)
			return
		}
		cookie := httpCookie
		cookie.Value = sid
		ctx.Data["session"] = store
		ctx.Data["Sid"] = sid
		http.SetCookie(ctx.ResponseWriter, &cookie)
	}

	ctx.Next()
}
// session session处理