码农笔录博客源码
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.

51 rivejä
1.1 KiB

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