25개 이상의 토픽을 선택하실 수 없습니다.
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							54 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							54 lines
						
					
					
						
							1.0 KiB
						
					
					
				
								package controllers
							 | 
						|
								
							 | 
						|
								import (
							 | 
						|
									"github.com/astaxie/beego"
							 | 
						|
									"beeblog/service"
							 | 
						|
									"beeblog/models"
							 | 
						|
								)
							 | 
						|
								
							 | 
						|
								type PageController struct {
							 | 
						|
									beego.Controller
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								// @router /iframe/blog [get]
							 | 
						|
								func (this *PageController) Blog() {
							 | 
						|
									cats, err := service.GetCats()
							 | 
						|
									if err != nil {
							 | 
						|
										this.Redirect("/500", 302)
							 | 
						|
										return
							 | 
						|
									}
							 | 
						|
									this.Data["Cats"] = cats
							 | 
						|
									this.TplName = "iframe/blog.html"
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								// @router /iframe/user [get]
							 | 
						|
								func (this *PageController) IframeUser() {
							 | 
						|
									uid := this.GetSession("userid")
							 | 
						|
									if uid == nil {
							 | 
						|
										this.Data["IsLogin"] = false
							 | 
						|
									} else {
							 | 
						|
										this.Data["IsLogin"] = true
							 | 
						|
										if user, err := service.GetUser(uid.(int64)); err == nil {
							 | 
						|
											this.Data["User"] = user
							 | 
						|
										} else {
							 | 
						|
											this.Data["User"] = &models.User{Id: uid.(int64)}
							 | 
						|
										}
							 | 
						|
									}
							 | 
						|
									this.TplName = "iframe/user.html"
							 | 
						|
									return
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								// @router /iframe/note [get]
							 | 
						|
								func (this *PageController) IframeNote() {
							 | 
						|
									this.TplName = "iframe/note.html"
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								// @router /404 [get]
							 | 
						|
								func (this *PageController) PageNotFound() {
							 | 
						|
									this.TplName = "404.html"
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								// @router /500 [get]
							 | 
						|
								func (this *PageController) ServerError() {
							 | 
						|
									this.TplName = "500.html"
							 | 
						|
								}
							 | 
						|
								
							 |