Files
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

58 lines
1.3 KiB
Go

package vidtonesearcher
import (
"91porn-server/app/service/searcher"
"91porn-server/models/v/tonerecomod"
"91porn-server/models/v/vidmod"
)
// mostCommentsSearcher mostCommentsSearcher
type mostCommentsSearcher struct {
uid uint64
}
// newMostCommentsSearcher newMostCommentsSearcher
func newMostCommentsSearcher(uid uint64) searcher.Searcher {
return &mostCommentsSearcher{
uid: uid,
}
}
// Search Search
func (g *mostCommentsSearcher) Search(unuse searcher.KeyWorder, opt searcher.Opter) (result searcher.Resulter, err error) {
limit := opt.Limit()
limitEx1 := limit + 1
vidList, err := vidmod.VIDListSortByFakeCommentCount(opt.Skip(), limitEx1)
if err != nil {
return nil, err
}
if len(vidList) == 0 {
return &Result{
&Resp{
Theme: tonerecomod.MostComments,
List: []VideoRes{},
PlayCount: &zero,
HasNext: false,
},
}, nil
}
hasNext := false
if len(vidList) > int(limit) {
hasNext = true
vidList = vidList[:opt.Limit()]
}
videoResList, err := searcher.GetVideoResList(g.uid, vidList)
if err != nil {
return nil, err
}
mostCommentsPlayCount := GetToneValue().MostCommentsPlayCount
return &Result{
&Resp{
List: videoResList,
Theme: tonerecomod.MostComments,
PlayCount: &mostCommentsPlayCount,
HasNext: hasNext,
},
}, nil
}