fix: 参数校验和日志

This commit is contained in:
wangxinyu 2024-12-09 10:44:20 +08:00
parent 6dc5cbd36a
commit 4e4b603a43
3 changed files with 12 additions and 4 deletions

View File

@ -99,6 +99,11 @@ const (
RedisMomentPrefix = "moment:" //moment服务前缀 RedisMomentPrefix = "moment:" //moment服务前缀
) )
const (
Unaudited = 1 // 未审核
Audited = 2 // 已审核
)
//const PackageRootPath = "C:/Users/PC/Desktop/service" //const PackageRootPath = "C:/Users/PC/Desktop/service"
const PackageRootPath = "/app/wishpal-ironfan" const PackageRootPath = "/app/wishpal-ironfan"

View File

@ -132,7 +132,7 @@ func ZoneRefundV2(ctx *gin.Context) {
func ZoneRefundList(ctx *gin.Context) { func ZoneRefundList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*vasproto.ZoneRefundListReq) req := ctx.MustGet("client_req").(*vasproto.ZoneRefundListReq)
if req.Mid <= 0 { if req.Mid <= 0 || (req.AuditType != consts.Unaudited && req.AuditType != consts.Audited) {
logger.Error("ZoneRefundList, invalid param, req: %v", util.ToJson(req)) logger.Error("ZoneRefundList, invalid param, req: %v", util.ToJson(req))
ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam) ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam)
return return

View File

@ -4,6 +4,7 @@ import (
"database/sql" "database/sql"
"fmt" "fmt"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
"service/api/consts"
"service/api/errs" "service/api/errs"
vasproto "service/api/proto/vas/proto" vasproto "service/api/proto/vas/proto"
zone_collaborator_proto "service/api/proto/zone_collaborator/proto" zone_collaborator_proto "service/api/proto/zone_collaborator/proto"
@ -1095,13 +1096,14 @@ func (v *Vas) ZoneRefundV2(ctx *gin.Context, req *vasproto.ZoneRefundReq) error
// 退款审核列表页 // 退款审核列表页
func (v *Vas) ZoneRefundList(ctx *gin.Context, req *vasproto.ZoneRefundListReq) (list []*dbstruct.RefundInfo, err error) { func (v *Vas) ZoneRefundList(ctx *gin.Context, req *vasproto.ZoneRefundListReq) (list []*dbstruct.RefundInfo, err error) {
refundsStatusList := make([]int64, 0) refundsStatusList := make([]int64, 0)
if req.AuditType == 1 { if req.AuditType == consts.Unaudited {
refundsStatusList = append(refundsStatusList, dbstruct.RefundsAwaiting) refundsStatusList = append(refundsStatusList, dbstruct.RefundsAwaiting)
} else if req.AuditType == 2 { } else if req.AuditType == consts.Audited {
refundsStatusList = append(refundsStatusList, dbstruct.RefundsApproved, dbstruct.RefundsRejected, dbstruct.RefundsOvertime) refundsStatusList = append(refundsStatusList, dbstruct.RefundsApproved, dbstruct.RefundsRejected, dbstruct.RefundsOvertime)
} }
list, err = v.store.GetZoneRefundList(ctx, req.Mid, refundsStatusList) list, err = v.store.GetZoneRefundList(ctx, req.Mid, refundsStatusList)
if err != nil { if err != nil {
logger.Error("ZoneRefundList GetZoneRefundList fail, mid: %v, audit_type: %v, err: %v", req.Mid, req.AuditType, err)
return return
} }
return return
@ -1111,6 +1113,7 @@ func (v *Vas) ZoneRefundList(ctx *gin.Context, req *vasproto.ZoneRefundListReq)
func (v *Vas) ZoneRefundInfo(ctx *gin.Context, req *vasproto.ZoneRefundInfoReq) (info *dbstruct.RefundInfo, err error) { func (v *Vas) ZoneRefundInfo(ctx *gin.Context, req *vasproto.ZoneRefundInfoReq) (info *dbstruct.RefundInfo, err error) {
info, err = v.store.GetZoneRefundInfo(ctx, req.AuditId) info, err = v.store.GetZoneRefundInfo(ctx, req.AuditId)
if err != nil { if err != nil {
logger.Error("ZoneRefundInfo GetZoneRefundInfo fail, mid: %v, audit_id: %v, err: %v", req.Mid, req.AuditId, err)
return return
} }
return return
@ -1121,6 +1124,7 @@ func (v *Vas) ZoneRefundAudit(ctx *gin.Context, req *vasproto.ZoneRefundAuditReq
info, err := v.store.GetZoneRefundInfo(ctx, req.AuditId) info, err := v.store.GetZoneRefundInfo(ctx, req.AuditId)
if err != nil { if err != nil {
logger.Error("ZoneRefundAudit GetZoneRefundInfo fail, mid: %v, audit_id: %v, err: %v", req.Mid, req.AuditId, err)
return err return err
} }
@ -1146,7 +1150,6 @@ func (v *Vas) UserRefundAuditTimes(ctx *gin.Context) error {
list, err := v.store.GetRefundAudit(ctx) list, err := v.store.GetRefundAudit(ctx)
if err != nil { if err != nil {
logger.Error("UserRefundAuditTimes GetRefundAudit fail ", err) logger.Error("UserRefundAuditTimes GetRefundAudit fail ", err)
return err return err
} }
ids := make([]string, 0) ids := make([]string, 0)