From 88074a9b192aafcfd574fb94e8b53dfe4e71a8f3 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 17 Jul 2024 08:44:26 +0800 Subject: [PATCH] 1 --- app/mix/service/apiservice.go | 48 +++++++++++---------- app/mix/service/video_moderation_service.go | 19 ++++++++ 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index e002b913..339a1e2d 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -1067,30 +1067,32 @@ 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) - //执行更新 - if err := _DefaultStreamer.OpUpdate(ctx, &streamerproto.OpUpdateReq{ - Streamer: &dbstruct.Streamer{ - Mid: req.Streamer.Mid, - Gender: req.Streamer.Gender, - Bio: req.Streamer.Bio, - Cover: req.Streamer.Cover, - Shorts: req.Streamer.Shorts, - Album: req.Streamer.Album, - Age: req.Streamer.Age, - Height: req.Streamer.Height, - Weight: req.Streamer.Weight, - Constellation: req.Streamer.Constellation, - City: req.Streamer.City, - Tag: req.Streamer.Tag, - Fans: req.Streamer.Fans, - AutoResponseMessage: req.Streamer.AutoResponseMessage, - }, - }); err != nil { - logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeStreamerSrvFail - return - } + // 逻辑变更为先审后发,此处不再做更新 + // 执行更新 + // if err := _DefaultStreamer.OpUpdate(ctx, &streamerproto.OpUpdateReq{ + // Streamer: &dbstruct.Streamer{ + // Mid: req.Streamer.Mid, + // Gender: req.Streamer.Gender, + // Bio: req.Streamer.Bio, + // Cover: req.Streamer.Cover, + // Shorts: req.Streamer.Shorts, + // Album: req.Streamer.Album, + // Age: req.Streamer.Age, + // Height: req.Streamer.Height, + // Weight: req.Streamer.Weight, + // Constellation: req.Streamer.Constellation, + // City: req.Streamer.City, + // Tag: req.Streamer.Tag, + // Fans: req.Streamer.Fans, + // AutoResponseMessage: req.Streamer.AutoResponseMessage, + // }, + // }); err != nil { + // logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err) + // ec = errcode.ErrCodeStreamerSrvFail + // return + // } // 更新user_vas err = _DefaultVas.UpdateWechat(ctx, &vasproto.UpdateWechatReq{ BaseRequest: base.BaseRequest{ diff --git a/app/mix/service/video_moderation_service.go b/app/mix/service/video_moderation_service.go index bde4ff96..95a35a4a 100644 --- a/app/mix/service/video_moderation_service.go +++ b/app/mix/service/video_moderation_service.go @@ -13,6 +13,25 @@ import ( goproto "google.golang.org/protobuf/proto" ) +func (s *Service) CreateUpdateStreamerVideoModeration(ctx *gin.Context, oldStreamer *dbstruct.Streamer, newStreamer *dbstruct.Streamer) (tasks []*dbstruct.VideoModerationTask) { + + if newStreamer.Shorts != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Shorts.GetVideoIds(), newStreamer.Shorts.GetVideoIds()) { + tasks = append(tasks, &dbstruct.VideoModerationTask{ + RouteUrl: goproto.String(ctx.Request.URL.Path), + AssociativeDatabase: goproto.String("streamer"), + AssociativeTableName: goproto.String("streamer"), + AssociativeTableId: oldStreamer.Mid, + AssociativeTableColumn: goproto.String("shorts"), + AuditedMedia: newStreamer.Shorts, + OldMedia: oldStreamer.Shorts, + }) + } + + addVideoModerationTasks(ctx, tasks) + + return +} + func (s *Service) CreateMomentVideoModeration(ctx *gin.Context, newMoment *dbstruct.Moment) (tasks []*dbstruct.VideoModerationTask) { if newMoment.MediaComp != nil && len(newMoment.MediaComp.GetVideoIds()) > 0 {