码农笔录博客源码
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

50 lines
1.1 KiB

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