Skip to content

Commit

Permalink
代码小纠错
Browse files Browse the repository at this point in the history
  • Loading branch information
nivance committed Nov 27, 2015
1 parent e1c2bb1 commit 59ad3c7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
10 changes: 6 additions & 4 deletions de/13.5.md
Expand Up @@ -127,7 +127,7 @@ func (this *EditController) Get() {
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
this.Data["Post"] = models.GetBlog(id)
this.Layout = "layout.tpl"
this.TplNames = "new.tpl"
this.TplNames = "edit.tpl"
}
func (this *EditController) Post() {
Expand All @@ -150,9 +150,11 @@ type DeleteController struct {
}
func (this *DeleteController) Get() {
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
this.Data["Post"] = models.DelBlog(id)
this.Ctx.Redirect(302, "/")
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
blog := models.GetBlog(id int)
this.Data["Post"] = blog
models.DelBlog(blog)
this.Ctx.Redirect(302, "/")
}
```

Expand Down
10 changes: 6 additions & 4 deletions en/13.5.md
Expand Up @@ -127,7 +127,7 @@ func (this *EditController) Get() {
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
this.Data["Post"] = models.GetBlog(id)
this.Layout = "layout.tpl"
this.TplNames = "new.tpl"
this.TplNames = "edit.tpl"
}
func (this *EditController) Post() {
Expand All @@ -150,9 +150,11 @@ type DeleteController struct {
}
func (this *DeleteController) Get() {
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
this.Data["Post"] = models.DelBlog(id)
this.Ctx.Redirect(302, "/")
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
blog := models.GetBlog(id int)
this.Data["Post"] = blog
models.DelBlog(blog)
this.Ctx.Redirect(302, "/")
}
```

Expand Down
8 changes: 4 additions & 4 deletions ja/13.5.md
Expand Up @@ -66,7 +66,7 @@ ViewController:
}

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"
Expand Down Expand Up @@ -103,7 +103,7 @@ EditController
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
this.Data["Post"] = models.GetBlog(id)
this.Layout = "layout.tpl"
this.TplNames = "new.tpl"
this.TplNames = "edit.tpl"
}

func (this *EditController) Post() {
Expand All @@ -124,8 +124,8 @@ DeleteController
}

func (this *DeleteController) Get() {
id, _ := strconv.Atoi(this.Ctx.Input.Params(":id"))
blog := GetBlog(id int)
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
blog := models.GetBlog(id)
this.Data["Post"] = blog
models.DelBlog(blog)
this.Ctx.Redirect(302, "/")
Expand Down
6 changes: 4 additions & 2 deletions pt-br/13.5.md
Expand Up @@ -127,7 +127,7 @@ func (this *EditController) Get() {
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
this.Data["Post"] = models.GetBlog(id)
this.Layout = "layout.tpl"
this.TplNames = "new.tpl"
this.TplNames = "edit.tpl"
}
func (this *EditController) Post() {
Expand All @@ -151,7 +151,9 @@ type DeleteController struct {
func (this *DeleteController) Get() {
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
this.Data["Post"] = models.DelBlog(id)
blog := models.GetBlog(id)
this.Data["Post"] = blog
models.DelBlog(blog)
this.Ctx.Redirect(302, "/")
}
```
Expand Down

0 comments on commit 59ad3c7

Please sign in to comment.