Merge branch 'master' into new-beego-path

This commit is contained in:
roberChen
2021-04-01 11:33:19 +08:00
5 changed files with 62 additions and 56 deletions

View File

@@ -144,17 +144,22 @@ func (c *DocumentController) Read() {
doc.AttachList = attach
}
doc.IncrViewCount(doc.DocumentId)
c.Data["ViewCount"] = doc.ViewCount + 1
if c.IsAjax() {
var data struct {
DocTitle string `json:"doc_title"`
Body string `json:"body"`
Title string `json:"title"`
Version int64 `json:"version"`
ViewCount int `json:"view_count"`
}
data.DocTitle = doc.DocumentName
data.Body = doc.Release
data.Title = doc.DocumentName + " - Powered by MinDoc"
data.Version = doc.Version
data.ViewCount = doc.ViewCount + 1
c.JsonResult(0, "ok", data)
}