72 lines
2.5 KiB
Go
72 lines
2.5 KiB
Go
package commentser
|
|
|
|
import (
|
|
"91porn-server/common/stderr"
|
|
"91porn-server/models/commod"
|
|
"91porn-server/models/v/cmtmod"
|
|
"time"
|
|
)
|
|
|
|
// GetChildCmtList 获取子评论列表
|
|
func GetChildCmtList(uid uint64, objID ObjectID, cid ObjectID, fstID ObjectID, curTime time.Time, page commod.Page) (code stderr.Code, data []cmtmod.ChildRespList, err error) {
|
|
// 获取作者
|
|
//videoInfo, err := vidmod.GetVideoInfo(objID.Hex())
|
|
//if err != nil {
|
|
// code = stderr.CommentErrGetDataFail
|
|
// return
|
|
//}
|
|
skip, limit := getNewPageInfo(0, int64(page.PageNumber), int64(page.PageSize))
|
|
aTotal, aList, err := getAuthorChildCmtList(objID, cid, fstID, skip, limit, curTime)
|
|
if err != nil {
|
|
code = stderr.CommentErrGetDataFail
|
|
return
|
|
}
|
|
if len(aList) > int(page.PageSize) {
|
|
data, err = getChildCommentTackInfo(uid, aList)
|
|
code = stderr.Success
|
|
return
|
|
}
|
|
// 获取热评及其回复
|
|
skip, limit = getNewPageInfo(aTotal, int64(page.PageNumber), int64(page.PageSize))
|
|
_, hList, err := getHotChildCmtList(objID, cid, fstID, skip, limit, curTime)
|
|
if err != nil {
|
|
code = stderr.CommentErrGetDataFail
|
|
return
|
|
}
|
|
aList = append(aList, hList...)
|
|
//if len(aList) > page.PageSize {
|
|
data, err = getChildCommentTackInfo(uid, aList)
|
|
code = stderr.Success
|
|
return
|
|
//}
|
|
// 获取普通评论
|
|
//skip, limit = getNewPageInfo(aTotal+hTotal, int64(page.PageNumber), int64(page.PageSize))
|
|
//cList, err := getChildCmtList(objID, cid, fstID, skip, limit, curTime)
|
|
//if err != nil {
|
|
// return
|
|
//}
|
|
//aList = append(aList, cList...)
|
|
//data, err = getChildCommentTackInfo(uid, aList)
|
|
//if err != nil {
|
|
// code = stderr.CommentErrGetDataFail
|
|
// return
|
|
//}
|
|
//code = stderr.Success
|
|
//return
|
|
}
|
|
|
|
// 获取作者的子评论及其回复和数量
|
|
func getAuthorChildCmtList(objID ObjectID, cid ObjectID, fstId ObjectID, skip int64, limit int64, curTime time.Time) (total int64, data []cmtmod.Comment, err error) {
|
|
return cmtmod.GetAuthorChildCmtList(objID, cid, fstId, skip, limit, curTime)
|
|
}
|
|
|
|
// 获取热门的子评论及其回复和数量
|
|
func getHotChildCmtList(objID ObjectID, cid ObjectID, fstId ObjectID, skip int64, limit int64, curTime time.Time) (total int64, data []cmtmod.Comment, err error) {
|
|
return cmtmod.GetHotChildCmtList(objID, cid, fstId, skip, limit, curTime)
|
|
}
|
|
|
|
// 获取普通子评论
|
|
func getChildCmtList(objID ObjectID, cid ObjectID, fstId ObjectID, skip int64, limit int64, curTime time.Time) (data []cmtmod.Comment, err error) {
|
|
return cmtmod.GetChildCmtList(objID, cid, fstId, skip, limit, curTime)
|
|
}
|