diff --git a/api/consts/notif_template.go b/api/consts/notif_template.go index d9b962f9..8a066c06 100644 --- a/api/consts/notif_template.go +++ b/api/consts/notif_template.go @@ -39,9 +39,9 @@ const ( AudNotifTemp_StreamerDetailsApplied = 1732523345 // 提交完善资料材料 AudNotifTemp_StreamerDetailsPassed = 1732523346 // 运营后台审核通过完善资料 AudNotifTemp_StreamerDetailsRejected = 1732523347 // 运营后台审核写上备注并未通过完善资料 - AudNotifTemp_WithdrawalInfoApplied = 1732523348 // 主播提交了申请提现相关的资料(todo) - AudNotifTemp_WithdrawalInfoPassed = 1732523349 // 运营后台操作了相关资料审核:通过 - AudNotifTemp_WithdrawalInfoRejected = 1732523350 // 运营后台操作了相关资料审核:拒绝 + AudNotifTemp_RealNameAuthenticationApplied = 1732523348 // 主播提交了申请提现相关的资料(todo) + AudNotifTemp_RealNameAuthenticationPassed = 1732523349 // 运营后台操作了相关资料审核:通过 + AudNotifTemp_RealNameAuthenticationRejected = 1732523350 // 运营后台操作了相关资料审核:拒绝 AudNotifTemp_StreamerDirectlyUpdated = 1732523351 // 主播在编辑主页时,仅修改选项内容后提交 AudNotifTemp_BioChangeApplied = 1732523352 // 主播在编辑主页时,修改个性签名后提交 AudNotifTemp_BioPassed = 1732523353 // 运营审核通过【个性签名】 diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index cb2aae97..21300269 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2043,6 +2043,9 @@ func (s *Service) ApiCreateRealNameAuthentication(ctx *gin.Context, req *realnam ec = errcode.ErrCodeRealNameAuthenticationSrvFail return } + + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_RealNameAuthenticationApplied)(req.RealNameAuthentication) + return } diff --git a/app/mix/service/logic/realname_authentication.go b/app/mix/service/logic/realname_authentication.go index 69f57dd0..938a776d 100644 --- a/app/mix/service/logic/realname_authentication.go +++ b/app/mix/service/logic/realname_authentication.go @@ -146,3 +146,12 @@ func (p *RealNameAuthentication) OpListByMid(ctx *gin.Context, req *realname_aut } return realname_authentication, nil } + +func (p *RealNameAuthentication) GetByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.RealNameAuthentication, error) { + list, err := p.store.GetRealNameAuthenticationListByIds(ctx, ids) + if err != nil { + logger.Error("GetRealNameAuthenticationListByIds fail, ids: %v, err: %v", ids, err) + return make([]*dbstruct.RealNameAuthentication, 0), err + } + return list, nil +} diff --git a/app/mix/service/notif_builder_handler.go b/app/mix/service/notif_builder_handler.go index 31f4211c..cb209f76 100644 --- a/app/mix/service/notif_builder_handler.go +++ b/app/mix/service/notif_builder_handler.go @@ -68,6 +68,9 @@ func (handler *NotifBuilderHandler) init() { handler.handleAudStreamerDetailsApplied() handler.handleAudStreamerDetailsPassed() handler.handleAudStreamerDetailsRejected() + handler.handleAudRealNameAuthenticationApplied() + handler.handleAudRealNameAuthenticationPassed() + handler.handleAudRealNameAuthenticationRejected() handler.handleAudBioChangeApplied() handler.handleAudBioPassed() handler.handleAudBioRejected() @@ -349,6 +352,29 @@ func (handler *NotifBuilderHandler) handleAudStreamerDetailsRejected() { } } +func (handler *NotifBuilderHandler) handleAudRealNameAuthenticationApplied() { + handler.handlerMap[consts.AudNotifTemp_RealNameAuthenticationApplied] = func(ctx *gin.Context, args ...any) { + realNameAuthentication := args[0].(*dbstruct.RealNameAuthentication) + if realNameAuthentication != nil { + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_RealNameAuthenticationApplied, realNameAuthentication.GetMid()) + } + } +} + +func (handler *NotifBuilderHandler) handleAudRealNameAuthenticationPassed() { + handler.handlerMap[consts.AudNotifTemp_RealNameAuthenticationPassed] = func(ctx *gin.Context, args ...any) { + mid := args[0].(int64) + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_RealNameAuthenticationPassed, mid) + } +} + +func (handler *NotifBuilderHandler) handleAudRealNameAuthenticationRejected() { + handler.handlerMap[consts.AudNotifTemp_RealNameAuthenticationRejected] = func(ctx *gin.Context, args ...any) { + mid := args[0].(int64) + DefaultService.utilWriteNotifInfo(ctx, consts.AudNotifTemp_RealNameAuthenticationRejected, mid) + } +} + func (handler *NotifBuilderHandler) handleAudBioChangeApplied() { handler.handlerMap[consts.AudNotifTemp_BioChangeApplied] = func(ctx *gin.Context, args ...any) { streamer := args[0].(*dbstruct.Streamer) diff --git a/app/mix/service/service.go b/app/mix/service/service.go index af407c40..e207989a 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3135,6 +3135,13 @@ func (s *Service) OpApproveRealNameAuthentication(ctx *gin.Context, req *realnam return } + list, err := _DefaultRealNameAuthentication.GetByIds(ctx, req.Ids) + if err != nil { + logger.Error("GetByIds fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeRealNameAuthenticationSrvFail + return + } + //2.若是审批失败,则更新之后直接删除,审批失败的信息将流转到历史表里保存 if util.DerefInt64(req.ApproveStatus) == consts.RealNameAuthentication_Rejected { err := _DefaultRealNameAuthentication.OpDeleteBatch(ctx, req.Ids) @@ -3143,9 +3150,18 @@ func (s *Service) OpApproveRealNameAuthentication(ctx *gin.Context, req *realnam ec = errcode.ErrCodeRealNameAuthenticationSrvFail return } + + for _, realnameauth := range list { + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_RealNameAuthenticationRejected)(realnameauth.GetMid()) + } + return } + for _, realnameauth := range list { + DefaultNotifBuilderHandler.Handle(ctx)(consts.AudNotifTemp_RealNameAuthenticationRejected)(realnameauth.GetMid()) + } + return } diff --git a/dbstruct/realname_authentication.go b/dbstruct/realname_authentication.go index b78761e1..ea0eb5fe 100644 --- a/dbstruct/realname_authentication.go +++ b/dbstruct/realname_authentication.go @@ -12,5 +12,11 @@ type RealNameAuthentication struct { Ct *int64 `json:"ct" bson:"ct"` // 创建时间 Ut *int64 `json:"ut" bson:"ut"` // 更新时间 DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 - +} + +func (p *RealNameAuthentication) GetMid() int64 { + if p != nil && p.Mid != nil { + return *p.Mid + } + return 0 }