Selaa lähdekoodia

update 完善参数校验

Alvin 8 kuukautta sitten
vanhempi
commit
a5a5f420f7

+ 15 - 15
game/game_cluster/nodes/webadmin/entity/user_withdrawal.go

@@ -23,21 +23,21 @@ type UserWithdrawalDetail 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
-	Address        string `json:"address"`                     // 地址
-	Currency       string `json:"currency" binding:"required"` // 货币类型
-	StartTime      int64  `json:"start_time"`                  // 开始时间
-	EndTime        int64  `json:"end_time"`                    // 结束时间
-	Page           int    `json:"page" binding:"required"`     // 页码
-	Size           int    `json:"size" binding:"required"`     // 每页数量
-	State          int    `json:"state"`                       // 服务器是否已经处理 0 未处理 1已处理
-	Withdrawal     int    `json:"withdrawal"`                  // 提现 0 :未体现 1:提现成功 2:提现中 3:提现失败 4:拒绝提现
-	AmountMin      int    `json:"amount_min"`                  // 提现金额最小值
-	AmountMax      int    `json:"amount_max"`                  // 提现金额最大值
-	AfterAmountMin int    `json:"after_amount_min"`            // 提现后金额最小值
-	AfterAmountMax int    `json:"after_amount_max"`            // 提现后金额最大值
+	UserName       string `json:"user_name" bson:"user_name"` // 用户ID
+	NickName       string `json:"nick_name" bson:"nick_name"` // 昵称
+	ID             string `json:"id" bson:"id"`               // ID
+	Address        string `json:"address"`                    // 地址
+	Currency       string `json:"currency"`                   // 货币类型
+	StartTime      int64  `json:"start_time"`                 // 开始时间
+	EndTime        int64  `json:"end_time"`                   // 结束时间
+	Page           int    `json:"page" binding:"required"`    // 页码
+	Size           int    `json:"size" binding:"required"`    // 每页数量
+	State          int    `json:"state"`                      // 服务器是否已经处理 0 未处理 1已处理
+	Withdrawal     int    `json:"withdrawal"`                 // 提现 0 :未体现 1:提现成功 2:提现中 3:提现失败 4:拒绝提现
+	AmountMin      int    `json:"amount_min"`                 // 提现金额最小值
+	AmountMax      int    `json:"amount_max"`                 // 提现金额最大值
+	AfterAmountMin int    `json:"after_amount_min"`           // 提现后金额最小值
+	AfterAmountMax int    `json:"after_amount_max"`           // 提现后金额最大值
 }
 
 type UserWithdrawalExportReq struct {

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

@@ -411,7 +411,7 @@ func (s *Synthesis) FindMDBUserLogDaily(req entity.UserLogDailyReq) (*entity.Use
 func (s *Synthesis) FindWithdrawal(req entity.UserWithdrawalReq) (*entity.UserWithdrawalResp, *code.Result) {
 	page, pageSize := checkPageParam(req.Page, req.Size)
 
-	if !constant.CurrencyValid(req.Currency) {
+	if req.Currency != "" && !constant.CurrencyValid(req.Currency) {
 		mhayaLogger.Warnf("FindWithdrawal unknow currency:%v", req.Currency)
 		return nil, common.NewResult(code.ParamError)
 	}
@@ -1065,12 +1065,12 @@ func (s *Synthesis) getAsset(userName string) (*entity.AssetsDetail, *code.Resul
 func (s *Synthesis) AssetsRecord(req entity.AssetsRecordReq) (*entity.AssetsRecordResp, *code.Result) {
 	page, pageSize := checkPageParam(req.Page, req.Size)
 
-	if !constant.CurrencyValid(req.Currency) {
+	if req.Currency != "" && !constant.CurrencyValid(req.Currency) {
 		mhayaLogger.Warnf("AssetsRecord unknow currency:%v", req.Currency)
 		return nil, common.NewResult(code.ParamError)
 	}
 
-	if req.OperationType != string(constant.IncreaseOp) && req.OperationType != string(constant.DecreaseOp) {
+	if req.OperationType != "" && req.OperationType != string(constant.IncreaseOp) && req.OperationType != string(constant.DecreaseOp) {
 		mhayaLogger.Warnf("AssetsRecord unknow OperationType:%v", req.OperationType)
 		return nil, common.NewResult(code.ParamError)
 	}