Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
package statvidmod
import (
"time"
"91porn-server/common/pageopt"
)
type SumGroup struct {
Vid ObjectID `bson:"_id"`
Income int64 `bson:"income"` //收入
PayCount int64 `bson:"payCount"` //购买次数
PlayCount int64 `bson:"playCount"` //播放次数
PayPlayCount int64 `bson:"payPlayCount"` //付费播放次数
Tax float64 `bson:"tax"` //[未完成]税
}
// PlayCountGTMatch
type RecordAtGTEAndLTMatch struct {
GTE *time.Time
LT *time.Time
}
func (r *RecordAtGTEAndLTMatch) New() Matcher {
return pageopt.NewGTEAndLTMatch("recordAt", r.GTE, r.LT)
}
func Sum(matchs ...Matcher) ([]SumGroup, error) {
filter := pageopt.MergeM(matchs)
pipeline := []M{}
pipeline = append(pipeline, M{"$match": filter})
pipeline = append(pipeline, M{
"$group": M{
"_id": "$vid",
"income": M{"$sum": "$income"},
"payCount": M{"$sum": "$payCount"},
"playCount": M{"$sum": "$playCount"},
"payPlayCount": M{"$sum": "$payPlayCount"},
"tax": M{"$sum": "$tax"},
},
})
list := []SumGroup{}
return list, coll(nil).Aggregate(&list, pipeline)
}