Skip to content

Commit e3a3815

Browse files
committed
代码小纠错
1 parent e71da49 commit e3a3815

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

de/13.5.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (this *EditController) Get() {
127127
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
128128
this.Data["Post"] = models.GetBlog(id)
129129
this.Layout = "layout.tpl"
130-
this.TplNames = "new.tpl"
130+
this.TplNames = "edit.tpl"
131131
}
132132
133133
func (this *EditController) Post() {
@@ -150,9 +150,11 @@ type DeleteController struct {
150150
}
151151
152152
func (this *DeleteController) Get() {
153-
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
154-
this.Data["Post"] = models.DelBlog(id)
155-
this.Ctx.Redirect(302, "/")
153+
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
154+
blog := models.GetBlog(id int)
155+
this.Data["Post"] = blog
156+
models.DelBlog(blog)
157+
this.Ctx.Redirect(302, "/")
156158
}
157159
```
158160

ja/13.5.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ViewController:
6666
}
6767

6868
func (this *ViewController) Get() {
69-
id, _ := strconv.Atoi(this.Ctx.Input.Params(":id"))
69+
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
7070
this.Data["Post"] = models.GetBlog(id)
7171
this.Layout = "layout.tpl"
7272
this.TplNames = "view.tpl"
@@ -103,7 +103,7 @@ EditController
103103
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
104104
this.Data["Post"] = models.GetBlog(id)
105105
this.Layout = "layout.tpl"
106-
this.TplNames = "new.tpl"
106+
this.TplNames = "edit.tpl"
107107
}
108108

109109
func (this *EditController) Post() {
@@ -124,8 +124,8 @@ DeleteController
124124
}
125125

126126
func (this *DeleteController) Get() {
127-
id, _ := strconv.Atoi(this.Ctx.Input.Params(":id"))
128-
blog := GetBlog(id int)
127+
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
128+
blog := models.GetBlog(id)
129129
this.Data["Post"] = blog
130130
models.DelBlog(blog)
131131
this.Ctx.Redirect(302, "/")

pt-br/13.5.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (this *EditController) Get() {
127127
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
128128
this.Data["Post"] = models.GetBlog(id)
129129
this.Layout = "layout.tpl"
130-
this.TplNames = "new.tpl"
130+
this.TplNames = "edit.tpl"
131131
}
132132
133133
func (this *EditController) Post() {
@@ -151,7 +151,9 @@ type DeleteController struct {
151151
152152
func (this *DeleteController) Get() {
153153
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
154-
this.Data["Post"] = models.DelBlog(id)
154+
blog := models.GetBlog(id)
155+
this.Data["Post"] = blog
156+
models.DelBlog(blog)
155157
this.Ctx.Redirect(302, "/")
156158
}
157159
```

0 commit comments

Comments
 (0)