From 8fc078e3c9b34b0e5b58511d9c33c75b6d62eadd Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 17 Jul 2024 12:53:42 +0800 Subject: [PATCH] by Robin at 20240717 --- app/mix/controller/init.go | 6 ++-- app/mix/service/apiservice.go | 53 ++++++++++++++++++++++++++++++----- dbstruct/imageaudittask.go | 7 +++++ dbstruct/textaudittask.go | 7 +++++ 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index e4dc1e39..f1b49e9e 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -459,17 +459,17 @@ func Init(r *gin.Engine) { // 图片审核任务 opImageAuditTaskGroup := r.Group("/op/image_audit_task", PrepareOp()) opImageAuditTaskGroup.POST("list", middleware.JSONParamValidator(imageaudittaskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetImageAuditTaskList) - opImageAuditTaskGroup.POST("pass_batch", middleware.JSONParamValidator(imageaudittaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewImageAuditTaskBatch) + opImageAuditTaskGroup.POST("review", middleware.JSONParamValidator(imageaudittaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewImageAuditTaskBatch) // 文字审核任务 opTextAuditTaskGroup := r.Group("/op/text_audit_task", PrepareOp()) opTextAuditTaskGroup.POST("list", middleware.JSONParamValidator(textaudittaskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetTextAuditTaskList) - opTextAuditTaskGroup.POST("pass_batch", middleware.JSONParamValidator(textaudittaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewTextAuditTaskBatch) + opTextAuditTaskGroup.POST("review", middleware.JSONParamValidator(textaudittaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewTextAuditTaskBatch) // 视频审核任务 opVideoModerationTaskGroup := r.Group("/op/video_moderation_task", PrepareOp()) opVideoModerationTaskGroup.POST("list", middleware.JSONParamValidator(videomoderationtaskproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetVideoModerationTaskList) - opVideoModerationTaskGroup.POST("pass_batch", middleware.JSONParamValidator(videomoderationtaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewVideoModerationTaskBatch) + opVideoModerationTaskGroup.POST("review", middleware.JSONParamValidator(videomoderationtaskproto.OpReviewBatchReq{}), middleware.JwtAuthenticator(), OpReviewVideoModerationTaskBatch) // 动态审核任务表 opMomentAuditTaskGroup := r.Group("/op/moment_audit_task", PrepareOp()) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index eefc5f84..5b849089 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -1065,13 +1065,12 @@ func (s *Service) ApiUpdateStreamer(ctx *gin.Context, req *streamerproto.ApiUpda } // 创建审核任务 - s.CreateUpdateStreamerImageAudit(ctx, oldStreamer, req.Streamer) - s.CreateUpdateStreamerTextAudit(ctx, oldStreamer, req.Streamer) - s.CreateUpdateStreamerVideoModeration(ctx, oldStreamer, req.Streamer) + imageaudittasks := s.CreateUpdateStreamerImageAudit(ctx, oldStreamer, req.Streamer) + textaudittasks := s.CreateUpdateStreamerTextAudit(ctx, oldStreamer, req.Streamer) + videomoderationtasks := s.CreateUpdateStreamerVideoModeration(ctx, oldStreamer, req.Streamer) - // 逻辑变更为先审后发,此处不再做媒体相关更新 - // 执行更新 - if err := _DefaultStreamer.OpUpdate(ctx, &streamerproto.OpUpdateReq{ + // 创建更新请求体,逻辑变更为先审后发,此处不再做媒体相关更新 + updateReq := &streamerproto.OpUpdateReq{ Streamer: &dbstruct.Streamer{ Mid: req.Streamer.Mid, Gender: req.Streamer.Gender, @@ -1083,7 +1082,47 @@ func (s *Service) ApiUpdateStreamer(ctx *gin.Context, req *streamerproto.ApiUpda Tag: req.Streamer.Tag, Fans: req.Streamer.Fans, }, - }); err != nil { + } + + // 初始化审核内容 + initAuditComp := &dbstruct.AuditComponent{ + AuditStatus: goproto.Int64(consts.ImageAudit_Created), + AuditOpinion: goproto.String("该字段有更新,正在等待机审"), + ReviewStatus: goproto.Int64(consts.ImageManuallyReview_Waiting), + ReviewOpinion: goproto.String("该字段有更新,正在等待人工复审"), + } + if len(imageaudittasks) > 0 { + for _, task := range imageaudittasks { + if task.GetAssociativeTableColumn() == "cover" { + updateReq.Streamer.CoverAudit = initAuditComp + } else if task.GetAssociativeTableColumn() == "album" { + updateReq.Streamer.AlbumAudit = initAuditComp + } + } + } + if len(textaudittasks) > 0 { + initAuditComp.AuditStatus = goproto.Int64(consts.TextAudit_Created) + initAuditComp.ReviewStatus = goproto.Int64(consts.TextManuallyReview_Waiting) + for _, task := range textaudittasks { + if task.GetAssociativeTableColumn() == "bio" { + updateReq.Streamer.BioAudit = initAuditComp + } else if task.GetAssociativeTableColumn() == "auto_response_message" { + updateReq.Streamer.AutoResponseMessageAudit = initAuditComp + } + } + } + if len(videomoderationtasks) > 0 { + initAuditComp.AuditStatus = goproto.Int64(consts.VideoModeration_Created) + initAuditComp.ReviewStatus = goproto.Int64(consts.VideoManuallyReview_Waiting) + for _, task := range videomoderationtasks { + if task.GetAssociativeTableColumn() == "shorts" { + updateReq.Streamer.ShortsAudit = initAuditComp + } + } + } + + // 执行更新 + if err := _DefaultStreamer.OpUpdate(ctx, updateReq); err != nil { logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err) ec = errcode.ErrCodeStreamerSrvFail return diff --git a/dbstruct/imageaudittask.go b/dbstruct/imageaudittask.go index f5ef46d7..73a81784 100644 --- a/dbstruct/imageaudittask.go +++ b/dbstruct/imageaudittask.go @@ -50,6 +50,13 @@ func (p *ImageAuditTask) GetAssociativeTableId() int64 { return *p.AssociativeTableId } +func (p *ImageAuditTask) GetAssociativeTableColumn() string { + if p == nil || p.AssociativeTableColumn == nil { + return "" + } + return *p.AssociativeTableColumn +} + func (p *ImageAuditTask) IsEmpty() bool { if p == nil { return true diff --git a/dbstruct/textaudittask.go b/dbstruct/textaudittask.go index b5cf6807..e8eee345 100644 --- a/dbstruct/textaudittask.go +++ b/dbstruct/textaudittask.go @@ -46,6 +46,13 @@ func (p *TextAuditTask) GetAssociativeTableId() int64 { return *p.AssociativeTableId } +func (p *TextAuditTask) GetAssociativeTableColumn() string { + if p == nil || p.AssociativeTableColumn == nil { + return "" + } + return *p.AssociativeTableColumn +} + func (p *TextAuditTask) IsEmpty() bool { if p == nil { return true