init: hgmj server initial commit

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 16:50:13 +08:00
co-authored by Claude Opus 4.7
commit 625e89c15d
1870 changed files with 254090 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
package deduction
import (
"91jd-server/models/l/payvidlgmod"
"91jd-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
}