From 20c1a9bd69e755df9946fafd02d1af7689ebe582 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Sat, 27 Jan 2024 02:04:17 +0800 Subject: [PATCH] by Robin at 20240127; fix op delete --- app/mix/controller/moment_op.go | 2 +- app/mix/service/opservice_business_validation.go | 4 ++-- app/mix/service/service.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/mix/controller/moment_op.go b/app/mix/controller/moment_op.go index 60948612..97082d8a 100644 --- a/app/mix/controller/moment_op.go +++ b/app/mix/controller/moment_op.go @@ -38,7 +38,7 @@ func OpUpdateMoment(ctx *gin.Context) { func OpDeleteMoment(ctx *gin.Context) { req := ctx.MustGet("client_req").(*momentproto.OpDeleteReq) - ec := service.DefaultService.OpDeleteMoment(ctx, util.DerefInt64(req.Id)) + ec := service.DefaultService.OpDeleteMoment(ctx, req) if ec != errcode.ErrCodeMomentSrvOk { logger.Error("OpDeleteMoment fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) diff --git a/app/mix/service/opservice_business_validation.go b/app/mix/service/opservice_business_validation.go index e81ba68e..b0c5ba85 100644 --- a/app/mix/service/opservice_business_validation.go +++ b/app/mix/service/opservice_business_validation.go @@ -1167,10 +1167,10 @@ func (s *Service) OpUpdateMomentBusinessValidate(ctx *gin.Context, req *momentpr return } -func (s *Service) OpDeleteMomentBusinessValidate(ctx *gin.Context, id int64) (ec errcode.ErrCode) { +func (s *Service) OpDeleteMomentBusinessValidate(ctx *gin.Context, req *momentproto.OpDeleteReq) (ec errcode.ErrCode) { ec = errcode.ErrCodeMomentSrvOk // 1.业务校验 - result := businessvalidator.NewAuthBusinessValidator(ctx, nil). + result := businessvalidator.NewAuthBusinessValidator(ctx, req). QueryAccount(_DefaultAccount.OpListByMid). EnsureAccountExist(). EnsureIsOpRole(). diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 042af0d6..0259a0cc 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -1012,16 +1012,16 @@ func (s *Service) OpUpdateMoment(ctx *gin.Context, req *momentproto.OpUpdateReq) return } -func (s *Service) OpDeleteMoment(ctx *gin.Context, id int64) (ec errcode.ErrCode) { +func (s *Service) OpDeleteMoment(ctx *gin.Context, req *momentproto.OpDeleteReq) (ec errcode.ErrCode) { ec = errcode.ErrCodeMomentSrvOk - if ec = s.OpDeleteMomentBusinessValidate(ctx, id); ec != errcode.ErrCodeMomentSrvOk { + if ec = s.OpDeleteMomentBusinessValidate(ctx, req); ec != errcode.ErrCodeMomentSrvOk { return } - err := _DefaultMoment.OpDelete(ctx, id) + err := _DefaultMoment.OpDelete(ctx, util.DerefInt64(req.Id)) if err != nil { - logger.Error("OpDelete fail, id: %v, err: %v", id, err) + logger.Error("OpDelete fail, id: %v, err: %v", req, err) ec = errcode.ErrCodeMomentSrvFail return }