by Robin at 20240717

This commit is contained in:
Leufolium 2024-07-17 12:53:42 +08:00
parent ca8536855c
commit 8fc078e3c9
4 changed files with 63 additions and 10 deletions

View File

@ -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())

View File

@ -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

View File

@ -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

View File

@ -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