func (rc *TestReflectController) SessionParams(session lvs.HttpSession, params struct { Name string Pwd string }) interface{} { if 0 == len(params.Name) || 0 == len(params.Pwd) { return "" } return session.UID() }
// 基本的获取session func (s *SessionController) Session(sess session.HttpSession) string { outString := "" name, ok := sess.Get("name") if !ok { // 测试存储数据 sess.Set("name", "slowfei") outString = "Has not been set to the name, refreshed look." } else { outString = fmt.Sprintf("%v, welcome", name.(string)) } return fmt.Sprintf("get the session address: %p\n%v", sess, outString) }
func (rc *TestReflectController) Session(session lvs.HttpSession) interface{} { return session.UID() }