Merge pull request 'by Robin at 20240127; fix op delete' (#82) from feat-IRONFANS-40-20240125-Robin into main
Reviewed-on: #82
This commit is contained in:
commit
13ec1265e3
|
@ -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)
|
||||
|
|
|
@ -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().
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue