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 deduction
import (
"91porn-server/models/l/payvidlgmod"
"91porn-server/models/v/usermod"
)
func StatPublisherDeduction(arg *Query) (*PublisherDeduction, error) {
res, err := payvidlgmod.PublisherVideoDeductionRange(*arg.UID, *arg.StartTime, *arg.EndTime)
if err != nil {
return nil, err
}
publisher, err := usermod.FindUserByUIDForNoCache(*arg.UID)
if err != nil {
return nil, err
}
// 避免脏数据引起的空指针
if publisher == nil {
publisher = &usermod.User{UID: *arg.UID}
}
deduction, deductionCount, totalAmount, totalCount := int64(0), int64(0), int64(0), int64(0)
for _, stat := range res {
if stat.IsVideoDeduction {
deduction = stat.TotalAmount
deductionCount = stat.VideoCount
}
totalAmount += stat.TotalAmount
totalCount += stat.VideoCount
}
ret := PublisherDeduction{
PublisherInfo: PublisherInfo{
UID: publisher.UID,
Name: publisher.Name,
VideoDeduction: publisher.VideoDeduction,
VideoDeducitonCount: publisher.VideoDeductionCount,
VideoDeductionPayCount: publisher.VideoDeductionPayCount,
},
AfterDeduction: totalAmount - deduction,
BeforeDeduction: totalAmount,
DeductionCount: deductionCount,
NonDeductionCount: totalCount - deductionCount,
}
return &ret, err
}