|
@ -41,7 +41,7 @@ func (this *BlogController) Get() { |
|
|
id, _ := strconv.ParseInt(idStr, 10, 64) |
|
|
id, _ := strconv.ParseInt(idStr, 10, 64) |
|
|
blog, err := service.GetBlog(id) |
|
|
blog, err := service.GetBlog(id) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
this.Redirect("/500.html",302) |
|
|
this.Redirect("/500",302) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.Data["Blog"] = blog |
|
|
this.Data["Blog"] = blog |
|
@ -56,7 +56,7 @@ func (this *BlogController) Get() { |
|
|
func (this *BlogController) New() { |
|
|
func (this *BlogController) New() { |
|
|
uid := this.GetSession("userid") |
|
|
uid := this.GetSession("userid") |
|
|
if uid == nil { |
|
|
if uid == nil { |
|
|
this.Redirect("/login.html", 302) |
|
|
this.Redirect("login.html", 302) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.TplName = "newblog.html" |
|
|
this.TplName = "newblog.html" |
|
@ -68,7 +68,7 @@ func (this *BlogController) Blog1() { |
|
|
func (this *BlogController) BlogsPage() { |
|
|
func (this *BlogController) BlogsPage() { |
|
|
cats, errcat := service.GetCats() |
|
|
cats, errcat := service.GetCats() |
|
|
if errcat != nil { |
|
|
if errcat != nil { |
|
|
this.Redirect("500.html", 302) |
|
|
this.Redirect("/500", 302) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
num, _ := this.GetInt("num") |
|
|
num, _ := this.GetInt("num") |
|
@ -87,7 +87,7 @@ func (this *BlogController) BlogsPage() { |
|
|
fmt.Println("nelson page", num, size, cat) |
|
|
fmt.Println("nelson page", num, size, cat) |
|
|
pages, err := service.FindBlogs(num, size, cat, flag) |
|
|
pages, err := service.FindBlogs(num, size, cat, flag) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
this.Redirect("500.html", 302) |
|
|
this.Redirect("/500", 302) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|