替换字符串
()
| 40 | |
| 41 | // 替换字符串 |
| 42 | func (this *BookController) Replace() { |
| 43 | identify := this.GetString(":key") |
| 44 | src := this.GetString("src") |
| 45 | dst := this.GetString("dst") |
| 46 | |
| 47 | if this.Member.MemberId == 0 { |
| 48 | this.JsonResult(1, "请先登录") |
| 49 | } |
| 50 | |
| 51 | book, err := models.NewBookResult().FindByIdentify(identify, this.Member.MemberId) |
| 52 | if err != nil { |
| 53 | if err == orm.ErrNoRows { |
| 54 | this.JsonResult(1, "内容不存在") |
| 55 | } |
| 56 | this.JsonResult(1, err.Error()) |
| 57 | } |
| 58 | |
| 59 | models.NewBook().Replace(book.BookId, src, dst) |
| 60 | |
| 61 | this.JsonResult(0, "替换成功") |
| 62 | } |
| 63 | |
| 64 | func (this *BookController) Index() { |
| 65 | this.Data["SettingBook"] = true |
no test coverage detected