添加评论
()
| 1337 | |
| 1338 | // 添加评论 |
| 1339 | func (this *BookController) Comment() { |
| 1340 | if this.Member.MemberId == 0 { |
| 1341 | this.JsonResult(1, "请先登录在评论") |
| 1342 | } |
| 1343 | content := this.GetString("content") |
| 1344 | if l := len(content); l < 5 || l > 255 { |
| 1345 | this.JsonResult(1, "评论内容限 5 - 255 个字符") |
| 1346 | } |
| 1347 | bookId, _ := this.GetInt(":id") |
| 1348 | pid, _ := this.GetInt("pid") |
| 1349 | docId, _ := this.GetInt("doc_id") |
| 1350 | if bookId > 0 { |
| 1351 | if err := new(models.Comments).AddComments(this.Member.MemberId, bookId, pid, docId, content); err != nil { |
| 1352 | this.JsonResult(1, err.Error()) |
| 1353 | } |
| 1354 | this.JsonResult(0, "评论成功") |
| 1355 | } |
| 1356 | this.JsonResult(1, "书籍不存在") |
| 1357 | } |
| 1358 | |
| 1359 | // ExportMarkdown 将书籍导出为markdown |
| 1360 | // 注意:系统管理员和书籍参与者有权限导出 |
nothing calls this directly
no test coverage detected