From fcd2389d02820df18287c58e79bb4e6247fa6315 Mon Sep 17 00:00:00 2001 From: andyoung <1218853253@qq.com> Date: Wed, 6 Sep 2017 09:16:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E5=87=A0=E5=A4=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E7=94=B1=E4=BA=8E=E5=8E=86=E5=8F=B2API?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E7=BC=96=E8=AF=91=E4=B8=8D=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 有几处代码可能由于历史API原因编译不通过需要更改。 --- zh/13.5.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/zh/13.5.md b/zh/13.5.md index d42e5617..9cd2f12a 100644 --- a/zh/13.5.md +++ b/zh/13.5.md @@ -62,7 +62,7 @@ type IndexController struct { func (this *IndexController) Get() { this.Data["blogs"] = models.GetAll() this.Layout = "layout.tpl" - this.TplNames = "index.tpl" + this.TplName = "index.tpl" } ``` ViewController: @@ -74,10 +74,10 @@ type ViewController struct { } func (this *ViewController) Get() { - id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"]) + id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"]) this.Data["Post"] = models.GetBlog(id) this.Layout = "layout.tpl" - this.TplNames = "view.tpl" + this.TplName = "view.tpl" } ``` NewController @@ -89,7 +89,7 @@ type NewController struct { func (this *NewController) Get() { this.Layout = "layout.tpl" - this.TplNames = "new.tpl" + this.TplName = "new.tpl" } func (this *NewController) Post() { @@ -110,10 +110,10 @@ type EditController struct { } func (this *EditController) Get() { - id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"]) + id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"]) this.Data["Post"] = models.GetBlog(id) this.Layout = "layout.tpl" - this.TplNames = "edit.tpl" + this.TplName = "edit.tpl" } func (this *EditController) Post() { @@ -135,7 +135,7 @@ type DeleteController struct { } func (this *DeleteController) Get() { - id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"]) + id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"]) blog := models.GetBlog(id) this.Data["Post"] = blog models.DelBlog(blog)