dongfeng-pay/legend/controllers/logoutController.go

30 lines
571 B
Go
Raw Normal View History

2021-04-27 15:33:49 +08:00
package controllers
import (
2021-05-16 15:21:52 +08:00
"github.com/beego/beego/v2/core/logs"
2021-04-27 15:33:49 +08:00
"github.com/beego/beego/v2/server/web"
)
type LogoutController struct {
web.Controller
}
func (c *LogoutController) Logout() {
if err := c.DelSession("username"); err != nil {
logs.Error("用户退出登录出错,错误信息:", err)
}
c.Redirect("/login.html", 302)
}
/**
** 切换用户登录
*/
func (c *LogoutController) SwitchLogin() {
err := c.DelSession("username")
if err != nil {
logs.Error("切换账号失败,错误信息:", err)
}
c.Redirect("/login.html", 302)
}