Browse Source

update 提现记录新增过滤字段;等级统计结果按照等级升序排序

Alvin 8 months ago
parent
commit
7120c47746

+ 10 - 7
game/game_cluster/nodes/webadmin/entity/user_withdrawal.go

@@ -17,13 +17,16 @@ type UserWithdrawalResp struct {
 }
 
 type UserWithdrawalReq struct {
-	UserName  string `json:"user_name" bson:"user_name"` // 用户ID
-	NickName  string `json:"nick_name" bson:"nick_name"` // 昵称
-	ID        string `json:"id" bson:"id"`               // ID
-	StartTime int64  `json:"start_time"`                 // 开始时间
-	EndTime   int64  `json:"end_time"`                   // 结束时间
-	Page      int    `json:"page"`                       // 页码
-	Size      int    `json:"size"`                       // 每页数量
+	UserName   string `json:"user_name" bson:"user_name"`   // 用户ID
+	NickName   string `json:"nick_name" bson:"nick_name"`   // 昵称
+	ID         string `json:"id" bson:"id"`                 // ID
+	StartTime  int64  `json:"start_time"`                   // 开始时间
+	EndTime    int64  `json:"end_time"`                     // 结束时间
+	Page       int    `json:"page"`                         // 页码
+	Size       int    `json:"size"`                         // 每页数量
+	Withdrawal string `json:"withdrawal" bson:"withdrawal"` // 提现 1:提现成功 2:提现中 3:提现失败 4:拒绝提现
+	Address    string `json:"address" bson:"address"`       // 地址
+	Status     string `json:"status" bson:"status"`         // 0:未审核 1:审核通过 2:审核失败
 }
 
 type UserWithdrawalStatus struct {

+ 27 - 3
game/game_cluster/nodes/webadmin/service/synthesis.go

@@ -5,6 +5,9 @@ import (
 	"errors"
 	"log"
 	"math"
+	"os"
+	"sort"
+	"strconv"
 	"time"
 
 	"github.com/mhaya/game/game_cluster/internal/constant"
@@ -145,6 +148,22 @@ func (s *Synthesis) FindWithdrawal(req *entity.UserWithdrawalReq) ([]*entity.Use
 		}
 	}
 
+	if req.Withdrawal != "" {
+		withdrawal, err := strconv.Atoi(req.Withdrawal)
+		if err != nil {
+			return nil, 0, os.ErrInvalid
+		}
+		filter["withdrawal"] = withdrawal
+	}
+
+	if req.Address != "" {
+		filter["address"] = req.Address
+	}
+
+	if req.Status != "" {
+		filter["status"] = req.Status
+	}
+
 	// 设置分页选项
 	findOptions := options.Find()
 	findOptions.SetSkip(int64((req.Page - 1) * req.Size))
@@ -411,10 +430,15 @@ func (s *Synthesis) FindUserLevel() ([]*entity.UserLevelCountResp, error) {
 			dataMap[key] += v1
 		}
 	}
-	for k, v := range dataMap {
+	keys := make([]string, 0, len(dataMap))
+	for k := range dataMap {
+		keys = append(keys, k)
+	}
+	sort.Strings(keys)
+	for _, v := range keys {
 		results = append(results, &entity.UserLevelCountResp{
-			Level:     cast.ToInt(k),
-			UserCount: v,
+			Level:     cast.ToInt(v),
+			UserCount: dataMap[v],
 		})
 	}