Example #1
0
//首页
func (c *MainController) Get() {
	user, err := models.Is_logined(c)
	if err == nil {
		c.Data["user"] = user
	} else {
		fmt.Println(err.Error())
	}
	c.Layout = "base.tpl"
	c.TplNames = "index.tpl"
}
Example #2
0
//注销
func (c *LogoutController) Post() {
	user, err := models.Is_logined(c)
	if err != nil {
		c.Redirect("/", 302)
	} else {
		user.Logout(c)
		c.Data["user"] = user
		c.Layout = "base.tpl"
		c.TplNames = "logout.tpl"
	}
}