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
+51
View File
@@ -0,0 +1,51 @@
package proxyrecordmod
import (
"fmt"
"time"
"91porn-server/common/db"
"91porn-server/common/log"
"91porn-server/models"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
)
const table = models.InviteLog
// initIndex 设置index
func initIndex() {
coll := coll(nil)
many := []mongo.IndexModel{
{
Keys: bson.D{{Key: "uid", Value: 1}},
},
{
Keys: bson.D{{Key: "promotionCode", Value: 1}},
},
{
Keys: bson.D{{Key: "createdAt", Value: 1}},
},
}
if _, err := coll.CreateIndex(many); err != nil {
panic(fmt.Sprintf("%s model set index err ==>[%+v]", table, err))
}
}
func coll(t *db.MongoTool) *db.MongoTool {
if t == nil {
return mdb.Coll(table)
}
return t.Coll(table)
}
// InsertInvitationRecord 推广记录插入
func InsertInvitationRecord(iR *InvitationRecord) (err error) {
iR.CreatedAt = time.Now()
if _, err = coll(nil).InsertOne(iR); err != nil {
log.Warn(fmt.Sprintf("[METHOD-%s]==> Model %s %s fail error:%+v:", "InsertInvitationRecord", table, "InsertOne", err))
return
}
return
}
+25
View File
@@ -0,0 +1,25 @@
package proxyrecordmod
import (
"time"
"91porn-server/common/db"
"go.mongodb.org/mongo-driver/bson/primitive"
)
var mdb *db.MongoDB
// InvitationRecord 邀请记录
type InvitationRecord struct {
ID primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"` //推广邀请id
UID uint64 `json:"uid" bson:"uid"` //邀请用户id
PromotionCode string `json:"promotionCode" bson:"promotionCode"` //邀请码
URL string `json:"url" bson:"url"`
CreatedAt time.Time `bson:"createdAt"`
}
func Init() {
mdb = db.Init(table)
initIndex()
}
+19
View File
@@ -0,0 +1,19 @@
package proxyrecordmod
import "time"
// Invitation 邀请关系
type InvitationQueryReq struct {
ID *string `form:"id" json:"_id,omitempty" bson:"_id,omitempty"` //推广邀请id
UID *uint64 `form:"uid" json:"uid,omitempty" bson:"uid"` //邀请用户id
Invitees *uint64 `form:"invitee" json:"invitee,omitempty" bson:"invitee"` //被邀请的用户id,也就是一级用户
PromotionCode *string `form:"promotionCode" bson:"promotionCode,omitempty" json:"promotionCode"` //邀请码
}
// InvitationWebRes 查询结构返回体
type InvitationWebRes struct {
UID uint64 `json:"uid"`
IID uint64 `json:"iid"`
Lv int `json:"lv"`
CreatedAt time.Time `json:"createdAt"`
}