增加评论功能

This commit is contained in:
wangbin05
2021-04-03 17:40:08 +08:00
parent dc578c3b34
commit 7fb0e66ddc
11 changed files with 301 additions and 91 deletions

View File

@@ -112,3 +112,28 @@ func (p *Pagination) pageURL(page string) string {
return u.String()
}
type Page struct {
PageNo int `json:"PageNo"`
PageSize int `json:"PageSize"`
TotalPage int `json:"TotalPage"`
TotalCount int `json:"TotalCount"`
FirstPage bool `json:"FirstPage"`
LastPage bool `json:"LastPage"`
List interface{} `json:"List"`
}
func PageUtil(count int, pageNo int, pageSize int, list interface{}) Page {
tp := count / pageSize
if count%pageSize > 0 {
tp = count/pageSize + 1
}
return Page {
PageNo: pageNo,
PageSize: pageSize,
TotalPage: tp,
TotalCount: count,
FirstPage: pageNo == 1,
LastPage: pageNo == tp,
List: list,
}
}