by Robin at 20240127; fix op delete
This commit is contained in:
parent
a1bae6eb21
commit
20c1a9bd69
|
@ -38,7 +38,7 @@ func OpUpdateMoment(ctx *gin.Context) {
|
||||||
|
|
||||||
func OpDeleteMoment(ctx *gin.Context) {
|
func OpDeleteMoment(ctx *gin.Context) {
|
||||||
req := ctx.MustGet("client_req").(*momentproto.OpDeleteReq)
|
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 {
|
if ec != errcode.ErrCodeMomentSrvOk {
|
||||||
logger.Error("OpDeleteMoment fail, req: %v, ec: %v", util.ToJson(req), ec)
|
logger.Error("OpDeleteMoment fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||||
ReplyErrCodeMsg(ctx, ec)
|
ReplyErrCodeMsg(ctx, ec)
|
||||||
|
|
|
@ -1167,10 +1167,10 @@ func (s *Service) OpUpdateMomentBusinessValidate(ctx *gin.Context, req *momentpr
|
||||||
return
|
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
|
ec = errcode.ErrCodeMomentSrvOk
|
||||||
// 1.业务校验
|
// 1.业务校验
|
||||||
result := businessvalidator.NewAuthBusinessValidator(ctx, nil).
|
result := businessvalidator.NewAuthBusinessValidator(ctx, req).
|
||||||
QueryAccount(_DefaultAccount.OpListByMid).
|
QueryAccount(_DefaultAccount.OpListByMid).
|
||||||
EnsureAccountExist().
|
EnsureAccountExist().
|
||||||
EnsureIsOpRole().
|
EnsureIsOpRole().
|
||||||
|
|
|
@ -1012,16 +1012,16 @@ func (s *Service) OpUpdateMoment(ctx *gin.Context, req *momentproto.OpUpdateReq)
|
||||||
return
|
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
|
ec = errcode.ErrCodeMomentSrvOk
|
||||||
|
|
||||||
if ec = s.OpDeleteMomentBusinessValidate(ctx, id); ec != errcode.ErrCodeMomentSrvOk {
|
if ec = s.OpDeleteMomentBusinessValidate(ctx, req); ec != errcode.ErrCodeMomentSrvOk {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := _DefaultMoment.OpDelete(ctx, id)
|
err := _DefaultMoment.OpDelete(ctx, util.DerefInt64(req.Id))
|
||||||
if err != nil {
|
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
|
ec = errcode.ErrCodeMomentSrvFail
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue