Browse Source

update 新增统计用户相关信息接口

Alvin 8 months ago
parent
commit
0a972dd4c8

+ 17 - 0
game/game_cluster/nodes/webadmin/controller/synthesis.go

@@ -18,6 +18,23 @@ func NewSynthesis() *Synthesis {
 	}
 }
 
+// 统计用户相关信息
+func (s *Synthesis) UserList(ctx *gin.Context) {
+	var req entity.UserListReq
+	if err := ctx.ShouldBindJSON(&req); err != nil {
+		common.PackOkResult(ctx, code.ParamError)
+		return
+	}
+
+	resp, err := s.sev.UserList(req)
+	if err != nil {
+		common.PackOkResult(ctx, err.Code)
+		return
+	}
+
+	common.PackOkResult(ctx, code.OK, resp)
+}
+
 // FindUserLogDaily 查询用户日活跃
 func (s *Synthesis) FindUserLogDaily(ctx *gin.Context) {
 	var req entity.UserLogDailyReq

+ 16 - 0
game/game_cluster/nodes/webadmin/entity/user_log_daily.go

@@ -30,3 +30,19 @@ type UserLogDailyReq struct {
 	Page      int    `json:"page"`
 	Size      int    `json:"size"`
 }
+
+type UserListReq struct {
+	Page     int    `json:"page"`
+	Size     int    `json:"size"`
+	UserName string `json:"user_name"` // 用户名
+	NickName string `json:"nick_name"` // 昵称
+}
+
+type UserListResp struct {
+	Details []*UserListDetail `json:"details"`
+	Total   int64             `json:"total"`
+}
+
+type UserListDetail struct {
+	// TODO UserListDetail 用户统计数据详情
+}

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

@@ -46,6 +46,7 @@ func (c *Controller) InitApiRouter(u *gin.RouterGroup) {
 	u.POST("/statistics/activity", controller.NewSynthesis().Activity)
 
 	// 用户统计
+	u.POST("/statistics/list", controller.NewSynthesis().UserList)
 	u.POST("/user/log/daily", controller.NewSynthesis().FindUserLogDaily)
 
 	// 转盘统计

+ 6 - 0
game/game_cluster/nodes/webadmin/service/synthesis.go

@@ -31,6 +31,12 @@ func NewSynthesis() *Synthesis {
 	}
 }
 
+// 统计用户相关信息
+func (s *Synthesis) UserList(req entity.UserListReq) (*entity.UserListResp, *code.Result) {
+	// TODO UserList 统计用户相关信息
+	return nil, nil
+}
+
 func (s *Synthesis) FindMDBUserLogDaily(req entity.UserLogDailyReq) (*entity.UserLogDailyResp, *code.Result) {
 	// 定义上下文
 	ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second)