Parcourir la source

update 新增任务完成度统计接口;新增用户行为检测接口;完善接口参数和返回值

Alvin il y a 8 mois
Parent
commit
7c5469819d

+ 64 - 1
game/game_cluster/nodes/webadmin/controller/synthesis.go

@@ -161,7 +161,19 @@ func (s *Synthesis) FindUserLevel(ctx *gin.Context) {
 
 // 综合统计
 func (s *Synthesis) Overview(ctx *gin.Context) {
-	// TODO Overview
+	var req entity.OverviewReq
+	if err := ctx.ShouldBindJSON(&req); err != nil {
+		common.PackOkResult(ctx, code.ParamError)
+		return
+	}
+
+	resp, err := s.sev.Overview(req)
+	if err != nil {
+		common.PackOkResult(ctx, err.Code)
+		return
+	}
+
+	common.PackOkResult(ctx, code.OK, resp)
 }
 
 // 活动统计
@@ -203,6 +215,23 @@ func (s *Synthesis) Assets(ctx *gin.Context) {
 	common.PackOkResult(ctx, code.OK, resp)
 }
 
+// 资产变动记录
+func (s *Synthesis) AssetsRecord(ctx *gin.Context) {
+	var req entity.AssetsRecordReq
+	if err := ctx.ShouldBindJSON(&req); err != nil {
+		common.PackOkResult(ctx, code.ParamError)
+		return
+	}
+
+	resp, err := s.sev.AssetsRecord(req)
+	if err != nil {
+		common.PackOkResult(ctx, err.Code)
+		return
+	}
+
+	common.PackOkResult(ctx, code.OK, resp)
+}
+
 // 邀请统计
 func (s *Synthesis) Invite(ctx *gin.Context) {
 	var req entity.InviteReq
@@ -253,3 +282,37 @@ func (s *Synthesis) Records(ctx *gin.Context) {
 
 	common.PackOkResult(ctx, code.OK, resp)
 }
+
+// 用户行为检测
+func (s *Synthesis) BehaviorMonitoring(ctx *gin.Context) {
+	var req entity.BehaviorMonitoringReq
+	if err := ctx.ShouldBindJSON(&req); err != nil {
+		common.PackOkResult(ctx, code.ParamError)
+		return
+	}
+
+	resp, err := s.sev.BehaviorMonitoring(req)
+	if err != nil {
+		common.PackOkResult(ctx, err.Code)
+		return
+	}
+
+	common.PackOkResult(ctx, code.OK, resp)
+}
+
+// 任务完成度统计
+func (s *Synthesis) TaskCompletion(ctx *gin.Context) {
+	var req entity.TaskCompletionReq
+	if err := ctx.ShouldBindJSON(&req); err != nil {
+		common.PackOkResult(ctx, code.ParamError)
+		return
+	}
+
+	resp, err := s.sev.TaskCompletion(req)
+	if err != nil {
+		common.PackOkResult(ctx, err.Code)
+		return
+	}
+
+	common.PackOkResult(ctx, code.OK, resp)
+}

+ 140 - 10
game/game_cluster/nodes/webadmin/entity/synthesis.go

@@ -1,10 +1,42 @@
 package entity
 
+type OverviewReq struct {
+	Page     int    `json:"page"`
+	Size     int    `json:"size"`
+	UserName string `json:"user_name"` // 用户名
+	OpenId   string `json:"openId"`    // 对应tgid
+}
+
+type OverviewResp struct {
+	Details []*OverviewDetail `json:"details"`
+	Total   int64             `json:"total"`
+}
+
+type OverviewDetail struct {
+	UserName                   string `json:"userName" bson:"userName"`             // 用户名 用户ID
+	OpenId                     string `json:"openId" bson:"openId"`                 // 对应tgid
+	FirstLoginDate             int64  `json:"firstLoginDate"`                       // 用户首次登录日期
+	CreateTime                 int64  `json:"createTime" bson:"createTime"`         // 用户注册时间
+	LastLoginTime              int64  `json:"lastLoginTime" bson:"loginTime"`       // 用户最后一次登录日期
+	MaxSuccessions             int    `json:"maxSuccessions" bson:"maxSuccessions"` // 用户累计登录天数
+	DieRoll                    int64  `json:"dieRoll"`                              // 用户骰子投掷次数
+	CurrentIntegral            int64  `json:"currentIntegral"`                      // 用户当前积分
+	SuccessfulInvitations      int64  `json:"successfulInvitations"`                // 用户邀请成功人数
+	Withdrawals                int64  `json:"withdrawals"`                          // 用户提现次数(USDT)
+	CumulativeWithdrawalAmount int64  `json:"cumulativeWithdrawalAmount"`           // 用户累计提现金额(USDT)
+	TurntableRuns              int64  `json:"turntableRuns"`                        // 用户转盘实际抽奖次数
+	PointsRanking              int64  `json:"pointsRanking"`                        // 用户积分排名
+	RankingOfDiceRolls         int64  `json:"rankingOfDiceRolls"`                   // 用户骰子投掷次数排名
+	InviteesRanking            int64  `json:"inviteesRanking"`                      // 用户邀请人数排名
+	TonValue                   int64  `json:"tonValue"`                             // 用户账户Ton值
+	UsdtValue                  int64  `json:"usdtValue"`                            // 用户账户USDT值
+}
+
 type UserListReq struct {
 	Page     int    `json:"page"`
 	Size     int    `json:"size"`
 	UserName string `json:"user_name"` // 用户名
-	NickName string `json:"nick_name"` // 昵称
+	OpenId   string `json:"openId"`    // 对应tgid
 }
 
 type UserListResp struct {
@@ -13,14 +45,21 @@ type UserListResp struct {
 }
 
 type UserListDetail struct {
-	// TODO UserListDetail 用户统计数据详情
+	UserName       string `json:"userName" bson:"userName"`       // 用户名 用户ID
+	OpenId         string `json:"openId" bson:"openId"`           // 对应tgid
+	CreateTime     int64  `json:"createTime" bson:"createTime"`   // 用户注册时间
+	FirstLoginDate int64  `json:"firstLoginDate"`                 // 用户首次登录日期
+	LoginIP        string `json:"loginIP" bson:"loginIP"`         // 登录IP
+	LastLoginTime  int64  `json:"lastLoginTime" bson:"loginTime"` // 用户最后一次登录日期
+	TonWall        string `json:"tonWall" bson:"tonWall"`         // 绑定钱包地址
+	Fingerprint    string `json:"fingerprint"`                    // 指纹数据
 }
 
 type TurntableReq struct {
 	Page     int    `json:"page"`
 	Size     int    `json:"size"`
 	UserName string `json:"user_name"` // 用户名
-	NickName string `json:"nick_name"` // 昵称
+	OpenId   string `json:"openId"`    // 对应tgid
 }
 
 type TurntableResp struct {
@@ -29,14 +68,18 @@ type TurntableResp struct {
 }
 
 type TurntableDetail struct {
-	// TODO TurntableDetail 转盘统计数据详情
+	UserName               string `json:"userName" bson:"userName"` // 用户名 用户ID
+	OpenId                 string `json:"openId" bson:"openId"`     // 对应tgid
+	TurntableExecutionTime int64  `json:"turntableExecutionTime"`   // 转盘执行时间
+	PrizeName              string `json:"prizeName"`                // 抽奖奖品名
+	PrizeNumber            int64  `json:"prizeNumber"`              // 抽奖奖品数量
 }
 
 type AssetsReq struct {
 	Page     int    `json:"page"`
 	Size     int    `json:"size"`
 	UserName string `json:"user_name"` // 用户名
-	NickName string `json:"nick_name"` // 昵称
+	OpenId   string `json:"openId"`    // 对应tgid
 }
 
 type AssetsResp struct {
@@ -45,14 +88,39 @@ type AssetsResp struct {
 }
 
 type AssetsDetail struct {
-	// TODO AssetsDetail 资产统计数据详情
+	UserName        string `json:"userName" bson:"userName"` // 用户名 用户ID
+	OpenId          string `json:"openId" bson:"openId"`     // 对应tgid
+	TonValue        int64  `json:"tonValue"`                 // 用户账户Ton值
+	UsdtValue       int64  `json:"usdtValue"`                // 用户账户USDT值
+	StatisticalDate int64  `json:"statisticalDate"`          // 统计日期
+}
+
+type AssetsRecordReq struct {
+	Page     int    `json:"page"`
+	Size     int    `json:"size"`
+	UserName string `json:"user_name"` // 用户名
+	OpenId   string `json:"openId"`    // 对应tgid
+}
+
+type AssetsRecordResp struct {
+	Details []*AssetsRecordDetail `json:"details"`
+	Total   int64                 `json:"total"`
+}
+
+type AssetsRecordDetail struct {
+	UserName                 string `json:"userName" bson:"userName"` // 用户名 用户ID
+	OpenId                   string `json:"openId" bson:"openId"`     // 对应tgid
+	AssetType                string `json:"assetType"`                // 资产增长类型
+	AssetsGrowth             int64  `json:"assetsGrowth"`             // 资产增长数量
+	AcquisitionTime          int64  `json:"acquisitionTime"`          // 获取资产时间
+	SourceOfAssetAcquisition string `json:"sourceOfAssetAcquisition"` // 资产获取来源
 }
 
 type InviteReq struct {
 	Page     int    `json:"page"`
 	Size     int    `json:"size"`
 	UserName string `json:"user_name"` // 用户名
-	NickName string `json:"nick_name"` // 昵称
+	OpenId   string `json:"openId"`    // 对应tgid
 }
 
 type InviteResp struct {
@@ -61,14 +129,22 @@ type InviteResp struct {
 }
 
 type InviteDetail struct {
-	// TODO InviteDetail 邀请统计数据详情
+	UserName                        string `json:"userName" bson:"userName"`        // 用户名 用户ID
+	OpenId                          string `json:"openId" bson:"openId"`            // 对应tgid
+	InvitationHits                  int64  `json:"invitationHits"`                  // 邀请按钮点击次数
+	InviteeID                       string `json:"inviteeID"`                       // 被邀请成功用户ID
+	IfInviteeVIP                    bool   `json:"ifInviteeVIP"`                    // 被邀请人是否为telegram会员
+	InviteTime                      int64  `json:"inviteTime"`                      // 邀请成功时间
+	SuccessfulInvitationsLV2        int64  `json:"successfulInvitationsLV2"`        // 被邀请成功用户lv>2的人数
+	CumulativesuccessfulInvitations int64  `json:"cumulativesuccessfulInvitations"` // 累计邀请成功人数
+	InvitationChannel               string `json:"invitationChannel"`               // 邀请渠道记录
 }
 
 type ActiveReq struct {
 	Page     int    `json:"page"`
 	Size     int    `json:"size"`
 	UserName string `json:"user_name"` // 用户名
-	NickName string `json:"nick_name"` // 昵称
+	OpenId   string `json:"openId"`    // 对应tgid
 }
 
 type ActiveResp struct {
@@ -77,5 +153,59 @@ type ActiveResp struct {
 }
 
 type ActiveDetail struct {
-	// TODO ActiveDetail 活跃统计数据详情
+	UserName                   string `json:"userName" bson:"userName"`             // 用户名 用户ID
+	OpenId                     string `json:"openId" bson:"openId"`                 // 对应tgid
+	IfUserVip                  bool   `json:"ifUserVip"`                            // 用户Telegram会员身份
+	CreateTime                 int64  `json:"createTime" bson:"createTime"`         // 用户注册时间
+	LastLoginTime              int64  `json:"lastLoginTime" bson:"loginTime"`       // 用户最后一次登录日期
+	MaxSuccessions             int    `json:"maxSuccessions" bson:"maxSuccessions"` // 用户累计登录天数
+	DieHits                    int64  `json:"dieHits"`                              // 用户骰子点击次数
+	InvitationHits             int64  `json:"invitationHits"`                       // 邀请按钮点击次数
+	SuccessfulInvitations      int64  `json:"successfulInvitations"`                // 用户邀请成功人数
+	Withdrawals                int64  `json:"withdrawals"`                          // 用户提现次数
+	CumulativeWithdrawalAmount int64  `json:"cumulativeWithdrawalAmount"`           // 用户累计提现金额
+	TurntableClicks            int64  `json:"turntableClicks"`                      // 用户转盘点击次数
+	TurntableRuns              int64  `json:"turntableRuns"`                        // 用户转盘实际抽奖次数
+}
+
+type TaskCompletionReq struct {
+	Page     int    `json:"page"`
+	Size     int    `json:"size"`
+	UserName string `json:"user_name"` // 用户名
+	OpenId   string `json:"openId"`    // 对应tgid
+}
+
+type TaskCompletionResp struct {
+	Details []*TaskCompletionDetail `json:"details"`
+	Total   int64                   `json:"total"`
+}
+
+type TaskCompletionDetail struct {
+	UserName        string `json:"userName" bson:"userName"` // 用户名 用户ID
+	OpenId          string `json:"openId" bson:"openId"`     // 对应tgid
+	DicePerDay      int64  `json:"dicePerDay"`               // 每日骰子数量
+	IsJoinTgChannel bool   `json:"isJoinTgChannel"`          // 是否加入TG频道
+	IsFollowTwitter bool   `json:"isFollowTwitter"`          // 是否关注推特
+	IsJoinDcChannel bool   `json:"isJoinDcChannel"`          // 是否加入DC频道
+	IsBindTwitter   bool   `json:"isBindTwitter"`            // 是否绑定推特
+	IsFollowYoutube bool   `json:"isFollowYoutube"`          // 是否关注Youtube账号
+	InviteNumber    int64  `json:"inviteNumber"`             // 邀请好友数量
+}
+
+type BehaviorMonitoringReq struct {
+	Page     int    `json:"page"`
+	Size     int    `json:"size"`
+	UserName string `json:"user_name"` // 用户名
+	OpenId   string `json:"openId"`    // 对应tgid
+}
+
+type BehaviorMonitoringResp struct {
+	Details []*BehaviorMonitoringDetail `json:"details"`
+	Total   int64                       `json:"total"`
+}
+
+type BehaviorMonitoringDetail struct {
+	UserName         string `json:"userName" bson:"userName"` // 用户名 用户ID
+	OpenId           string `json:"openId" bson:"openId"`     // 对应tgid
+	DieExecutionTime int64  `json:"dieExecutionTime"`         // 骰子游戏执行时间
 }

+ 8 - 1
game/game_cluster/nodes/webadmin/router/router.go

@@ -42,7 +42,7 @@ func (c *Controller) InitApiRouter(u *gin.RouterGroup) {
 	// 综合统计
 	u.POST("/statistics/overview", controller.NewSynthesis().Overview)
 
-	// 活动统计
+	// 活动统计 目前没有活动模块
 	u.POST("/statistics/activity", controller.NewSynthesis().Activity)
 
 	// 用户统计
@@ -54,10 +54,17 @@ func (c *Controller) InitApiRouter(u *gin.RouterGroup) {
 
 	// 资产统计
 	u.POST("/statistics/assets", controller.NewSynthesis().Assets)
+	u.POST("/statistics/assetsRecord", controller.NewSynthesis().AssetsRecord)
 
 	// 邀请统计
 	u.POST("/statistics/invite", controller.NewSynthesis().Invite)
 
+	// 任务完成度统计
+	u.POST("/statistics/taskCompletion", controller.NewSynthesis().TaskCompletion)
+
+	// 用户行为检测
+	u.POST("/user/behaviorMonitoring", controller.NewSynthesis().BehaviorMonitoring)
+
 	// 后台操作记录
 	u.POST("/user/log", controller.NewSynthesis().Records)
 

+ 470 - 16
game/game_cluster/nodes/webadmin/service/synthesis.go

@@ -31,8 +31,8 @@ func NewSynthesis() *Synthesis {
 	}
 }
 
-// 统计用户相关信息
-func (s *Synthesis) UserList(req entity.UserListReq) (*entity.UserListResp, *code.Result) {
+// 综合统计
+func (s *Synthesis) Overview(req entity.OverviewReq) (*entity.OverviewResp, *code.Result) {
 	page, pageSize := checkPageParam(req.Page, req.Size)
 
 	// 构建查询条件
@@ -40,8 +40,8 @@ func (s *Synthesis) UserList(req entity.UserListReq) (*entity.UserListResp, *cod
 	if req.UserName != "" {
 		filter["userName"] = req.UserName
 	}
-	if req.NickName != "" {
-		filter["nickName"] = req.NickName
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
 	}
 
 	// 设置分页选项
@@ -55,14 +55,66 @@ func (s *Synthesis) UserList(req entity.UserListReq) (*entity.UserListResp, *cod
 
 	collection := mdb.MDB.Collection(constant.CNamePlayer)
 
-	// 获取总数total
-	count, err := collection.CountDocuments(ctx, filter)
+	// 查询数据
+	var results []*entity.OverviewDetail
+	cursor, err := collection.Find(ctx, filter, findOptions)
 	if err != nil {
-		mhayaLogger.Warnf("UserList CountDocuments error:%v", err)
+		mhayaLogger.Warnf("Overview Find error:%v", err)
 		return nil, common.NewResult(code.InternalError)
 	}
 
-	// TODO UserList 统计用户相关信息
+	defer cursor.Close(ctx)
+	// 解析结果
+	for cursor.Next(ctx) {
+		var result entity.OverviewDetail
+		if err := cursor.Decode(&result); err != nil {
+			mhayaLogger.Warnf("Overview Decode error:%v", err)
+			return nil, common.NewResult(code.InternalError)
+		}
+
+		results = append(results, &result)
+	}
+
+	if err := cursor.Err(); err != nil {
+		mhayaLogger.Warnf("Overview cursor error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	// TODO 综合统计相关信息
+
+	// TODO 获取总数total
+	var count int64
+
+	return &entity.OverviewResp{
+		Details: results,
+		Total:   count,
+	}, nil
+}
+
+// 统计用户相关信息
+func (s *Synthesis) UserList(req entity.UserListReq) (*entity.UserListResp, *code.Result) {
+	page, pageSize := checkPageParam(req.Page, req.Size)
+
+	// 构建查询条件
+	filter := bson.M{}
+	if req.UserName != "" {
+		filter["userName"] = req.UserName
+	}
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
+	}
+
+	// 设置分页选项
+	findOptions := options.Find()
+	findOptions.SetSkip(int64((page - 1) * pageSize))
+	findOptions.SetLimit(int64(pageSize))
+	findOptions.SetSort(bson.D{{"createTime", -1}})
+
+	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
+	defer cancel()
+
+	collection := mdb.MDB.Collection(constant.CNamePlayer)
+
 	// 查询数据
 	var results []*entity.UserListDetail
 	cursor, err := collection.Find(ctx, filter, findOptions)
@@ -79,6 +131,7 @@ func (s *Synthesis) UserList(req entity.UserListReq) (*entity.UserListResp, *cod
 			mhayaLogger.Warnf("UserList Decode error:%v", err)
 			return nil, common.NewResult(code.InternalError)
 		}
+
 		results = append(results, &result)
 	}
 
@@ -87,6 +140,11 @@ func (s *Synthesis) UserList(req entity.UserListReq) (*entity.UserListResp, *cod
 		return nil, common.NewResult(code.InternalError)
 	}
 
+	// TODO UserList 统计用户相关信息
+
+	// TODO 获取总数total
+	var count int64
+
 	return &entity.UserListResp{
 		Details: results,
 		Total:   count,
@@ -732,24 +790,420 @@ func (s *Synthesis) RecordList(req entity.RecordListReq) (*entity.RecordListResp
 
 // 转盘统计
 func (s *Synthesis) Turntable(req entity.TurntableReq) (*entity.TurntableResp, *code.Result) {
-	// TODO Turntable 转盘统计
-	return nil, nil
+	page, pageSize := checkPageParam(req.Page, req.Size)
+
+	// 构建查询条件
+	filter := bson.M{}
+	if req.UserName != "" {
+		filter["userName"] = req.UserName
+	}
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
+	}
+
+	// 设置分页选项
+	findOptions := options.Find()
+	findOptions.SetSkip(int64((page - 1) * pageSize))
+	findOptions.SetLimit(int64(pageSize))
+	findOptions.SetSort(bson.D{{"createTime", -1}})
+
+	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
+	defer cancel()
+
+	collection := mdb.MDB.Collection(constant.CNamePlayer)
+
+	// 查询数据
+	var results []*entity.TurntableDetail
+	cursor, err := collection.Find(ctx, filter, findOptions)
+	if err != nil {
+		mhayaLogger.Warnf("Turntable Find error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	defer cursor.Close(ctx)
+	// 解析结果
+	for cursor.Next(ctx) {
+		var result entity.TurntableDetail
+		if err := cursor.Decode(&result); err != nil {
+			mhayaLogger.Warnf("Turntable Decode error:%v", err)
+			return nil, common.NewResult(code.InternalError)
+		}
+
+		results = append(results, &result)
+	}
+
+	if err := cursor.Err(); err != nil {
+		mhayaLogger.Warnf("Turntable cursor error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	// TODO 转盘统计相关信息
+
+	// TODO 获取总数total
+	var count int64
+
+	return &entity.TurntableResp{
+		Details: results,
+		Total:   count,
+	}, nil
 }
 
 // 资产统计
 func (s *Synthesis) Assets(req entity.AssetsReq) (*entity.AssetsResp, *code.Result) {
-	// TODO Assets 资产统计
-	return nil, nil
+	page, pageSize := checkPageParam(req.Page, req.Size)
+
+	// 构建查询条件
+	filter := bson.M{}
+	if req.UserName != "" {
+		filter["userName"] = req.UserName
+	}
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
+	}
+
+	// 设置分页选项
+	findOptions := options.Find()
+	findOptions.SetSkip(int64((page - 1) * pageSize))
+	findOptions.SetLimit(int64(pageSize))
+	findOptions.SetSort(bson.D{{"createTime", -1}})
+
+	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
+	defer cancel()
+
+	collection := mdb.MDB.Collection(constant.CNamePlayer)
+
+	// 查询数据
+	var results []*entity.AssetsDetail
+	cursor, err := collection.Find(ctx, filter, findOptions)
+	if err != nil {
+		mhayaLogger.Warnf("Assets Find error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	defer cursor.Close(ctx)
+	// 解析结果
+	for cursor.Next(ctx) {
+		var result entity.AssetsDetail
+		if err := cursor.Decode(&result); err != nil {
+			mhayaLogger.Warnf("Assets Decode error:%v", err)
+			return nil, common.NewResult(code.InternalError)
+		}
+
+		results = append(results, &result)
+	}
+
+	if err := cursor.Err(); err != nil {
+		mhayaLogger.Warnf("Assets cursor error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	// TODO Assets 统计相关信息
+
+	// TODO 获取总数total
+	var count int64
+
+	return &entity.AssetsResp{
+		Details: results,
+		Total:   count,
+	}, nil
+}
+
+// 资产变动记录
+func (s *Synthesis) AssetsRecord(req entity.AssetsRecordReq) (*entity.AssetsRecordResp, *code.Result) {
+	page, pageSize := checkPageParam(req.Page, req.Size)
+
+	// 构建查询条件
+	filter := bson.M{}
+	if req.UserName != "" {
+		filter["userName"] = req.UserName
+	}
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
+	}
+
+	// 设置分页选项
+	findOptions := options.Find()
+	findOptions.SetSkip(int64((page - 1) * pageSize))
+	findOptions.SetLimit(int64(pageSize))
+	findOptions.SetSort(bson.D{{"createTime", -1}})
+
+	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
+	defer cancel()
+
+	collection := mdb.MDB.Collection(constant.CNamePlayer)
+
+	// 查询数据
+	var results []*entity.AssetsRecordDetail
+	cursor, err := collection.Find(ctx, filter, findOptions)
+	if err != nil {
+		mhayaLogger.Warnf("AssetsRecord Find error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	defer cursor.Close(ctx)
+	// 解析结果
+	for cursor.Next(ctx) {
+		var result entity.AssetsRecordDetail
+		if err := cursor.Decode(&result); err != nil {
+			mhayaLogger.Warnf("AssetsRecord Decode error:%v", err)
+			return nil, common.NewResult(code.InternalError)
+		}
+
+		results = append(results, &result)
+	}
+
+	if err := cursor.Err(); err != nil {
+		mhayaLogger.Warnf("AssetsRecord cursor error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	// TODO 资产变动记录相关信息
+
+	// TODO 获取总数total
+	var count int64
+
+	return &entity.AssetsRecordResp{
+		Details: results,
+		Total:   count,
+	}, nil
 }
 
 // 邀请统计
 func (s *Synthesis) Invite(req entity.InviteReq) (*entity.InviteResp, *code.Result) {
-	// TODO Invite 邀请统计
-	return nil, nil
+	page, pageSize := checkPageParam(req.Page, req.Size)
+
+	// 构建查询条件
+	filter := bson.M{}
+	if req.UserName != "" {
+		filter["userName"] = req.UserName
+	}
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
+	}
+
+	// 设置分页选项
+	findOptions := options.Find()
+	findOptions.SetSkip(int64((page - 1) * pageSize))
+	findOptions.SetLimit(int64(pageSize))
+	findOptions.SetSort(bson.D{{"createTime", -1}})
+
+	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
+	defer cancel()
+
+	collection := mdb.MDB.Collection(constant.CNamePlayer)
+
+	// 查询数据
+	var results []*entity.InviteDetail
+	cursor, err := collection.Find(ctx, filter, findOptions)
+	if err != nil {
+		mhayaLogger.Warnf("Invite Find error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	defer cursor.Close(ctx)
+	// 解析结果
+	for cursor.Next(ctx) {
+		var result entity.InviteDetail
+		if err := cursor.Decode(&result); err != nil {
+			mhayaLogger.Warnf("Invite Decode error:%v", err)
+			return nil, common.NewResult(code.InternalError)
+		}
+
+		results = append(results, &result)
+	}
+
+	if err := cursor.Err(); err != nil {
+		mhayaLogger.Warnf("Invite cursor error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	// TODO 邀请统计相关信息
+
+	// TODO 获取总数total
+	var count int64
+
+	return &entity.InviteResp{
+		Details: results,
+		Total:   count,
+	}, nil
 }
 
 // 活跃统计
 func (s *Synthesis) Active(req entity.ActiveReq) (*entity.ActiveResp, *code.Result) {
-	// TODO Active 活跃统计
-	return nil, nil
+	page, pageSize := checkPageParam(req.Page, req.Size)
+
+	// 构建查询条件
+	filter := bson.M{}
+	if req.UserName != "" {
+		filter["userName"] = req.UserName
+	}
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
+	}
+
+	// 设置分页选项
+	findOptions := options.Find()
+	findOptions.SetSkip(int64((page - 1) * pageSize))
+	findOptions.SetLimit(int64(pageSize))
+	findOptions.SetSort(bson.D{{"createTime", -1}})
+
+	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
+	defer cancel()
+
+	collection := mdb.MDB.Collection(constant.CNamePlayer)
+
+	// 查询数据
+	var results []*entity.ActiveDetail
+	cursor, err := collection.Find(ctx, filter, findOptions)
+	if err != nil {
+		mhayaLogger.Warnf("Active Find error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	defer cursor.Close(ctx)
+	// 解析结果
+	for cursor.Next(ctx) {
+		var result entity.ActiveDetail
+		if err := cursor.Decode(&result); err != nil {
+			mhayaLogger.Warnf("Active Decode error:%v", err)
+			return nil, common.NewResult(code.InternalError)
+		}
+
+		results = append(results, &result)
+	}
+
+	if err := cursor.Err(); err != nil {
+		mhayaLogger.Warnf("Active cursor error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	// TODO Active 活跃统计相关信息
+
+	// TODO 获取总数total
+	var count int64
+
+	return &entity.ActiveResp{
+		Details: results,
+		Total:   count,
+	}, nil
+}
+
+// 任务完成度统计
+func (s *Synthesis) TaskCompletion(req entity.TaskCompletionReq) (*entity.TaskCompletionResp, *code.Result) {
+	page, pageSize := checkPageParam(req.Page, req.Size)
+
+	// 构建查询条件
+	filter := bson.M{}
+	if req.UserName != "" {
+		filter["userName"] = req.UserName
+	}
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
+	}
+
+	// 设置分页选项
+	findOptions := options.Find()
+	findOptions.SetSkip(int64((page - 1) * pageSize))
+	findOptions.SetLimit(int64(pageSize))
+	findOptions.SetSort(bson.D{{"createTime", -1}})
+
+	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
+	defer cancel()
+
+	collection := mdb.MDB.Collection(constant.CNamePlayer)
+
+	// 查询数据
+	var results []*entity.TaskCompletionDetail
+	cursor, err := collection.Find(ctx, filter, findOptions)
+	if err != nil {
+		mhayaLogger.Warnf("TaskCompletion Find error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	defer cursor.Close(ctx)
+	// 解析结果
+	for cursor.Next(ctx) {
+		var result entity.TaskCompletionDetail
+		if err := cursor.Decode(&result); err != nil {
+			mhayaLogger.Warnf("TaskCompletion Decode error:%v", err)
+			return nil, common.NewResult(code.InternalError)
+		}
+
+		results = append(results, &result)
+	}
+
+	if err := cursor.Err(); err != nil {
+		mhayaLogger.Warnf("TaskCompletion cursor error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	// TODO 任务完成度统计相关信息
+
+	// TODO 获取总数total
+	var count int64
+
+	return &entity.TaskCompletionResp{
+		Details: results,
+		Total:   count,
+	}, nil
+}
+
+// 用户行为检测
+func (s *Synthesis) BehaviorMonitoring(req entity.BehaviorMonitoringReq) (*entity.BehaviorMonitoringResp, *code.Result) {
+	page, pageSize := checkPageParam(req.Page, req.Size)
+
+	// 构建查询条件
+	filter := bson.M{}
+	if req.UserName != "" {
+		filter["userName"] = req.UserName
+	}
+	if req.OpenId != "" {
+		filter["openId"] = req.OpenId
+	}
+
+	// 设置分页选项
+	findOptions := options.Find()
+	findOptions.SetSkip(int64((page - 1) * pageSize))
+	findOptions.SetLimit(int64(pageSize))
+	findOptions.SetSort(bson.D{{"createTime", -1}})
+
+	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)
+	defer cancel()
+
+	collection := mdb.MDB.Collection(constant.CNamePlayer)
+
+	// 查询数据
+	var results []*entity.BehaviorMonitoringDetail
+	cursor, err := collection.Find(ctx, filter, findOptions)
+	if err != nil {
+		mhayaLogger.Warnf("BehaviorMonitoring Find error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	defer cursor.Close(ctx)
+	// 解析结果
+	for cursor.Next(ctx) {
+		var result entity.BehaviorMonitoringDetail
+		if err := cursor.Decode(&result); err != nil {
+			mhayaLogger.Warnf("BehaviorMonitoring Decode error:%v", err)
+			return nil, common.NewResult(code.InternalError)
+		}
+
+		results = append(results, &result)
+	}
+
+	if err := cursor.Err(); err != nil {
+		mhayaLogger.Warnf("BehaviorMonitoring cursor error:%v", err)
+		return nil, common.NewResult(code.InternalError)
+	}
+
+	// TODO 用户行为检测相关信息
+
+	// TODO 获取总数total
+	var count int64
+
+	return &entity.BehaviorMonitoringResp{
+		Details: results,
+		Total:   count,
+	}, nil
 }