码农笔录博客源码
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

50 wiersze
1.1 KiB

6 lat temu
package controllers
import (
6 lat temu
"beeblog/models"
4 lat temu
"beeblog/service"
beego "github.com/beego/beego/v2/server/web"
)
6 lat temu
type PageController struct {
beego.Controller
}
6 lat temu
func (this *PageController) IframeUser() {
6 lat temu
userService := service.UserService{}
6 lat temu
uid := this.GetSession("userid")
if uid == nil {
this.Data["IsLogin"] = false
} else {
this.Data["IsLogin"] = true
6 lat temu
if user, err := userService.GetUser(uid.(int64)); err == nil {
6 lat temu
this.Data["User"] = user
} else {
this.Data["User"] = &models.User{Id: uid.(int64)}
}
}
this.TplName = "iframe/user.html"
return
}
6 lat temu
func (this *PageController) UsPage() {
this.Data["IsUs"] = true
this.Data["UserId"] = this.GetSession("userid")
this.Data["HeadImg"] = this.GetSession("headimg")
this.Data["NickName"] = this.GetSession("nickname")
this.Data["IsLogin"] = this.GetSession("nickname") != nil
6 lat temu
this.TplName = "us.html"
}
6 lat temu
func (this *PageController) PageNotFound() {
this.TplName = "404.html"
}
func (this *PageController) ServerError() {
this.TplName = "500.html"
}
6 lat temu
func (this *PageController) ServerDemined() {
this.TplName = "403.html"
}