代码小纠错
This commit is contained in:
10
de/13.5.md
10
de/13.5.md
@@ -127,7 +127,7 @@ func (this *EditController) Get() {
|
|||||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
||||||
this.Data["Post"] = models.GetBlog(id)
|
this.Data["Post"] = models.GetBlog(id)
|
||||||
this.Layout = "layout.tpl"
|
this.Layout = "layout.tpl"
|
||||||
this.TplNames = "new.tpl"
|
this.TplNames = "edit.tpl"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *EditController) Post() {
|
func (this *EditController) Post() {
|
||||||
@@ -150,9 +150,11 @@ type DeleteController struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *DeleteController) Get() {
|
func (this *DeleteController) Get() {
|
||||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||||
this.Data["Post"] = models.DelBlog(id)
|
blog := models.GetBlog(id int)
|
||||||
this.Ctx.Redirect(302, "/")
|
this.Data["Post"] = blog
|
||||||
|
models.DelBlog(blog)
|
||||||
|
this.Ctx.Redirect(302, "/")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
10
en/13.5.md
10
en/13.5.md
@@ -127,7 +127,7 @@ func (this *EditController) Get() {
|
|||||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
||||||
this.Data["Post"] = models.GetBlog(id)
|
this.Data["Post"] = models.GetBlog(id)
|
||||||
this.Layout = "layout.tpl"
|
this.Layout = "layout.tpl"
|
||||||
this.TplNames = "new.tpl"
|
this.TplNames = "edit.tpl"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *EditController) Post() {
|
func (this *EditController) Post() {
|
||||||
@@ -150,9 +150,11 @@ type DeleteController struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *DeleteController) Get() {
|
func (this *DeleteController) Get() {
|
||||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||||
this.Data["Post"] = models.DelBlog(id)
|
blog := models.GetBlog(id int)
|
||||||
this.Ctx.Redirect(302, "/")
|
this.Data["Post"] = blog
|
||||||
|
models.DelBlog(blog)
|
||||||
|
this.Ctx.Redirect(302, "/")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ ViewController:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ViewController) Get() {
|
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.Data["Post"] = models.GetBlog(id)
|
||||||
this.Layout = "layout.tpl"
|
this.Layout = "layout.tpl"
|
||||||
this.TplNames = "view.tpl"
|
this.TplNames = "view.tpl"
|
||||||
@@ -103,7 +103,7 @@ EditController
|
|||||||
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||||
this.Data["Post"] = models.GetBlog(id)
|
this.Data["Post"] = models.GetBlog(id)
|
||||||
this.Layout = "layout.tpl"
|
this.Layout = "layout.tpl"
|
||||||
this.TplNames = "new.tpl"
|
this.TplNames = "edit.tpl"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *EditController) Post() {
|
func (this *EditController) Post() {
|
||||||
@@ -124,8 +124,8 @@ DeleteController
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *DeleteController) Get() {
|
func (this *DeleteController) Get() {
|
||||||
id, _ := strconv.Atoi(this.Ctx.Input.Params(":id"))
|
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||||
blog := GetBlog(id int)
|
blog := models.GetBlog(id)
|
||||||
this.Data["Post"] = blog
|
this.Data["Post"] = blog
|
||||||
models.DelBlog(blog)
|
models.DelBlog(blog)
|
||||||
this.Ctx.Redirect(302, "/")
|
this.Ctx.Redirect(302, "/")
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ func (this *EditController) Get() {
|
|||||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
||||||
this.Data["Post"] = models.GetBlog(id)
|
this.Data["Post"] = models.GetBlog(id)
|
||||||
this.Layout = "layout.tpl"
|
this.Layout = "layout.tpl"
|
||||||
this.TplNames = "new.tpl"
|
this.TplNames = "edit.tpl"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *EditController) Post() {
|
func (this *EditController) Post() {
|
||||||
@@ -151,7 +151,9 @@ type DeleteController struct {
|
|||||||
|
|
||||||
func (this *DeleteController) Get() {
|
func (this *DeleteController) Get() {
|
||||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
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, "/")
|
this.Ctx.Redirect(302, "/")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user