码农笔录博客源码
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

50 rindas
1.1 KiB

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