Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
49 строки
1.1 KiB
49 строки
1.1 KiB
package controllers
|
|
|
|
import (
|
|
"beeblog/models"
|
|
"beeblog/service"
|
|
beego "github.com/beego/beego/v2/server/web"
|
|
)
|
|
|
|
type PageController struct {
|
|
beego.Controller
|
|
}
|
|
|
|
func (this *PageController) IframeUser() {
|
|
userService := service.UserService{}
|
|
uid := this.GetSession("userid")
|
|
if uid == nil {
|
|
this.Data["IsLogin"] = false
|
|
} else {
|
|
this.Data["IsLogin"] = true
|
|
if user, err := userService.GetUser(uid.(int64)); err == nil {
|
|
this.Data["User"] = user
|
|
} else {
|
|
this.Data["User"] = &models.User{Id: uid.(int64)}
|
|
}
|
|
}
|
|
this.TplName = "iframe/user.html"
|
|
return
|
|
}
|
|
|
|
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
|
|
this.TplName = "us.html"
|
|
}
|
|
|
|
func (this *PageController) PageNotFound() {
|
|
this.TplName = "404.html"
|
|
}
|
|
|
|
func (this *PageController) ServerError() {
|
|
this.TplName = "500.html"
|
|
}
|
|
|
|
func (this *PageController) ServerDemined() {
|
|
this.TplName = "403.html"
|
|
}
|
|
|