码农笔录博客源码
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 line
1.1 KiB

6 年之前
package controllers
import (
6 年之前
"beeblog/models"
4 年之前
"beeblog/service"
beego "github.com/beego/beego/v2/server/web"
)
6 年之前
type PageController struct {
beego.Controller
}
6 年之前
func (this *PageController) IframeUser() {
6 年之前
userService := service.UserService{}
6 年之前
uid := this.GetSession("userid")
if uid == nil {
this.Data["IsLogin"] = false
} else {
this.Data["IsLogin"] = true
6 年之前
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
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"
}