码农笔录博客源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB

пре 6 година
package controllers
пре 6 година
import (
пре 6 година
"beeblog/models"
пре 3 година
"beeblog/service"
beego "github.com/beego/beego/v2/server/web"
пре 6 година
)
пре 6 година
type PageController struct {
beego.Controller
}
пре 6 година
func (this *PageController) IframeUser() {
пре 5 година
userService := service.UserService{}
пре 6 година
uid := this.GetSession("userid")
if uid == nil {
this.Data["IsLogin"] = false
} else {
this.Data["IsLogin"] = true
пре 5 година
if user, err := userService.GetUser(uid.(int64)); err == nil {
пре 6 година
this.Data["User"] = user
} else {
this.Data["User"] = &models.User{Id: uid.(int64)}
}
}
this.TplName = "iframe/user.html"
return
}
пре 6 година
func (this *PageController) UsPage() {
this.Data["IsUs"] = true
пре 6 година
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 година
this.TplName = "us.html"
}
пре 6 година
func (this *PageController) PageNotFound() {
this.TplName = "404.html"
}
func (this *PageController) ServerError() {
this.TplName = "500.html"
}
пре 6 година
func (this *PageController) ServerDemined() {
this.TplName = "403.html"
}