diff --git a/api/proto/imageaudittask/proto/imageaudittask_vo.go b/api/proto/imageaudittask/proto/imageaudittask_vo.go index 13f1f64e..ede50cb6 100644 --- a/api/proto/imageaudittask/proto/imageaudittask_vo.go +++ b/api/proto/imageaudittask/proto/imageaudittask_vo.go @@ -1,9 +1,13 @@ package proto -import "service/dbstruct" +import ( + accountproto "service/api/proto/account/proto" + "service/dbstruct" +) type ImageAuditTaskVO struct { *dbstruct.ImageAuditTask + Account *accountproto.OpListVO `JSON:"account"` ImageAudits []*dbstruct.ImageAudit `json:"image_audits"` } diff --git a/api/proto/textaudittask/proto/textaudittask_vo.go b/api/proto/textaudittask/proto/textaudittask_vo.go index 1aae1ba0..708f13cc 100644 --- a/api/proto/textaudittask/proto/textaudittask_vo.go +++ b/api/proto/textaudittask/proto/textaudittask_vo.go @@ -1,10 +1,14 @@ package proto -import "service/dbstruct" +import ( + accountproto "service/api/proto/account/proto" + "service/dbstruct" +) type TextAuditTaskVO struct { *dbstruct.TextAuditTask - TextAudit *dbstruct.TextAudit `json:"text_audit"` + Account *accountproto.OpListVO `json:"account"` + TextAudit *dbstruct.TextAudit `json:"text_audit"` } func (vo *TextAuditTaskVO) CopyTextAuditTask(textAuditTask *dbstruct.TextAuditTask) *TextAuditTaskVO { diff --git a/api/proto/video_moderation_task/proto/video_moderation_task_vo.go b/api/proto/video_moderation_task/proto/video_moderation_task_vo.go index a5db91d9..2745e738 100644 --- a/api/proto/video_moderation_task/proto/video_moderation_task_vo.go +++ b/api/proto/video_moderation_task/proto/video_moderation_task_vo.go @@ -1,9 +1,13 @@ package proto -import "service/dbstruct" +import ( + accountproto "service/api/proto/account/proto" + "service/dbstruct" +) type VideoModerationTaskVO struct { *dbstruct.VideoModerationTask + Account *accountproto.OpListVO `json:"account"` VideoModerations []*dbstruct.VideoModeration `json:"video_moderations"` } diff --git a/app/mix/service/imageauditservice.go b/app/mix/service/imageauditservice.go index 9166bda6..045ef1ec 100644 --- a/app/mix/service/imageauditservice.go +++ b/app/mix/service/imageauditservice.go @@ -24,6 +24,7 @@ func (s *Service) CreateUpdateAccountImageAudit(ctx *gin.Context, oldAccount *db tasks = make([]*dbstruct.ImageAuditTask, 0) tasks = append(tasks, &dbstruct.ImageAuditTask{ + Mid: newAccount.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("account"), AssociativeTableName: goproto.String("account"), @@ -43,6 +44,7 @@ func (s *Service) CreateUpdateStreamerImageAudit(ctx *gin.Context, oldStreamer * if newStreamer.Cover != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Cover.GetImageIds(), newStreamer.Cover.GetImageIds()) { tasks = append(tasks, &dbstruct.ImageAuditTask{ + Mid: newStreamer.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("streamer"), AssociativeTableName: goproto.String("streamer"), @@ -55,6 +57,7 @@ func (s *Service) CreateUpdateStreamerImageAudit(ctx *gin.Context, oldStreamer * if newStreamer.Album != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Album.GetImageIds(), newStreamer.Album.GetImageIds()) { tasks = append(tasks, &dbstruct.ImageAuditTask{ + Mid: newStreamer.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("streamer"), AssociativeTableName: goproto.String("streamer"), @@ -74,6 +77,7 @@ func (s *Service) CreateMomentImageAudit(ctx *gin.Context, newMoment *dbstruct.M if newMoment.MediaComp != nil && len(newMoment.MediaComp.GetImageIds()) > 0 { tasks = append(tasks, &dbstruct.ImageAuditTask{ + Mid: newMoment.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("moment"), AssociativeTableName: goproto.String("moment"), @@ -94,6 +98,7 @@ func (s *Service) CreateZoneMomentImageAudit(ctx *gin.Context, newZoneMoment *db if newZoneMoment.MediaComp != nil && len(newZoneMoment.MediaComp.GetImageIds()) > 0 { tasks = append(tasks, &dbstruct.ImageAuditTask{ + Mid: newZoneMoment.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("zone_moment"), AssociativeTableName: goproto.String("zone_moment"), diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 4b9f9741..ad1c8a3b 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -2762,10 +2762,12 @@ func (s *Service) OpGetImageAuditTaskVOList(ctx *gin.Context, req *imageaudittas } volist = make([]*imageaudittaskproto.ImageAuditTaskVO, len(list)) + mids := make([]int64, 0) for i, task := range list { volist[i] = &imageaudittaskproto.ImageAuditTaskVO{ ImageAuditTask: task, } + mids = append(mids, task.GetMid()) if err := s.utilFillImageAuditTaskVO(ctx, volist[i]); err != nil { logger.Error("utilFillImageAuditTaskVO fail, req: %v, err: %v", util.ToJson(req), err) ec = errcode.ErrCodeImageAuditSrvFail @@ -2773,6 +2775,18 @@ func (s *Service) OpGetImageAuditTaskVOList(ctx *gin.Context, req *imageaudittas } } + acctMp, err := _DefaultAccount.GetAccountMapByMids(ctx, mids) + if err != nil { + logger.Error("GetAccountMapByMids fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountSrvFail + return + } + + for _, vo := range volist { + vo.Account = &accountproto.OpListVO{} + vo.Account.CopyAccount(acctMp[vo.GetMid()]) + } + return } @@ -2840,10 +2854,12 @@ func (s *Service) OpGetTextAuditTaskVOList(ctx *gin.Context, req *textaudittaskp } volist = make([]*textaudittaskproto.TextAuditTaskVO, len(list)) + mids := make([]int64, 0) for i, task := range list { volist[i] = &textaudittaskproto.TextAuditTaskVO{ TextAuditTask: task, } + mids = append(mids, task.GetMid()) if err := s.utilFillTextAuditTaskVO(ctx, volist[i]); err != nil { logger.Error("utilFillTextAuditTaskVO fail, req: %v, err: %v", util.ToJson(req), err) ec = errcode.ErrCodeImageAuditSrvFail @@ -2851,6 +2867,18 @@ func (s *Service) OpGetTextAuditTaskVOList(ctx *gin.Context, req *textaudittaskp } } + acctMp, err := _DefaultAccount.GetAccountMapByMids(ctx, mids) + if err != nil { + logger.Error("GetAccountMapByMids fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountSrvFail + return + } + + for _, vo := range volist { + vo.Account = &accountproto.OpListVO{} + vo.Account.CopyAccount(acctMp[vo.GetMid()]) + } + return } @@ -2914,10 +2942,12 @@ func (s *Service) OpGetVideoModerationTaskVOList(ctx *gin.Context, req *videomod } volist = make([]*videomoderationtaskproto.VideoModerationTaskVO, len(list)) + mids := make([]int64, 0) for i, task := range list { volist[i] = &videomoderationtaskproto.VideoModerationTaskVO{ VideoModerationTask: task, } + mids = append(mids, task.GetMid()) if err := s.utilFillVideoModerationTaskVO(ctx, volist[i]); err != nil { logger.Error("utilFillVideoModerationTaskVO fail, req: %v, err: %v", util.ToJson(req), err) ec = errcode.ErrCodeImageAuditSrvFail @@ -2925,6 +2955,18 @@ func (s *Service) OpGetVideoModerationTaskVOList(ctx *gin.Context, req *videomod } } + acctMp, err := _DefaultAccount.GetAccountMapByMids(ctx, mids) + if err != nil { + logger.Error("GetAccountMapByMids fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountSrvFail + return + } + + for _, vo := range volist { + vo.Account = &accountproto.OpListVO{} + vo.Account.CopyAccount(acctMp[vo.GetMid()]) + } + return } diff --git a/app/mix/service/textauditservice.go b/app/mix/service/textauditservice.go index c7b08cbb..46834ae8 100644 --- a/app/mix/service/textauditservice.go +++ b/app/mix/service/textauditservice.go @@ -23,6 +23,7 @@ func (s *Service) CreateUpdateAccountTextAudit(ctx *gin.Context, oldAccount *dbs } tasks = append(tasks, &dbstruct.TextAuditTask{ + Mid: newAccount.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("account"), AssociativeTableName: goproto.String("account"), @@ -43,6 +44,7 @@ func (s *Service) CreateUpdateStreamerTextAudit(ctx *gin.Context, oldStreamer *d if newStreamer.Bio != nil && oldStreamer.GetBio() != newStreamer.GetBio() { tasks = append(tasks, &dbstruct.TextAuditTask{ + Mid: newStreamer.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("streamer"), AssociativeTableName: goproto.String("streamer"), @@ -56,6 +58,7 @@ func (s *Service) CreateUpdateStreamerTextAudit(ctx *gin.Context, oldStreamer *d if newStreamer.AutoResponseMessage != nil && oldStreamer.GetAutoResponseMessage() != newStreamer.GetAutoResponseMessage() { tasks = append(tasks, &dbstruct.TextAuditTask{ + Mid: newStreamer.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("streamer"), AssociativeTableName: goproto.String("streamer"), @@ -75,6 +78,7 @@ func (s *Service) CreateMomentTextAudit(ctx *gin.Context, oldMoment *dbstruct.Mo if newMoment.Text != nil { tasks = append(tasks, &dbstruct.TextAuditTask{ + Mid: newMoment.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("moment"), AssociativeTableName: goproto.String("moment"), @@ -95,6 +99,7 @@ func (s *Service) CreateZoneMomentTextAudit(ctx *gin.Context, newZoneMoment *dbs if newZoneMoment.Text != nil { tasks = append(tasks, &dbstruct.TextAuditTask{ + Mid: newZoneMoment.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("zone_moment"), AssociativeTableName: goproto.String("zone_moment"), diff --git a/app/mix/service/video_moderation_service.go b/app/mix/service/video_moderation_service.go index 95a35a4a..ff7a26e1 100644 --- a/app/mix/service/video_moderation_service.go +++ b/app/mix/service/video_moderation_service.go @@ -17,6 +17,7 @@ func (s *Service) CreateUpdateStreamerVideoModeration(ctx *gin.Context, oldStrea if newStreamer.Shorts != nil && !util.IsInt64SliceEqualAsSet(oldStreamer.Shorts.GetVideoIds(), newStreamer.Shorts.GetVideoIds()) { tasks = append(tasks, &dbstruct.VideoModerationTask{ + Mid: newStreamer.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("streamer"), AssociativeTableName: goproto.String("streamer"), @@ -36,6 +37,7 @@ func (s *Service) CreateMomentVideoModeration(ctx *gin.Context, newMoment *dbstr if newMoment.MediaComp != nil && len(newMoment.MediaComp.GetVideoIds()) > 0 { tasks = append(tasks, &dbstruct.VideoModerationTask{ + Mid: newMoment.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("moment"), AssociativeTableName: goproto.String("moment"), @@ -56,6 +58,7 @@ func (s *Service) CreateZoneMomentVideoModeration(ctx *gin.Context, newZoneMomen if newZoneMoment.MediaComp != nil && len(newZoneMoment.MediaComp.GetVideoIds()) > 0 { tasks = append(tasks, &dbstruct.VideoModerationTask{ + Mid: newZoneMoment.Mid, RouteUrl: goproto.String(ctx.Request.URL.Path), AssociativeDatabase: goproto.String("zone_moment"), AssociativeTableName: goproto.String("zone_moment"), diff --git a/dbstruct/imageaudittask.go b/dbstruct/imageaudittask.go index 73a81784..62d2e3de 100644 --- a/dbstruct/imageaudittask.go +++ b/dbstruct/imageaudittask.go @@ -6,6 +6,7 @@ import ( type ImageAuditTask struct { Id *string `json:"id" bson:"_id"` // 图像审核任务表id + Mid *int64 `json:"mid" bson:"mid"` // 用户id AuditedMedia *MediaComponent `json:"audited_media" bson:"audited_media"` // 待审核媒体内容(图像) OldMedia *MediaComponent `json:"old_media" bson:"old_media"` // 旧媒体内容 RouteUrl *string `json:"route_url" bson:"route_url"` // 路由URL @@ -36,6 +37,13 @@ func (p *ImageAuditTask) GetId() string { return *p.Id } +func (p *ImageAuditTask) GetMid() int64 { + if p == nil || p.Mid == nil { + return -1 + } + return *p.Mid +} + func (p *ImageAuditTask) GetStatus() int64 { if p == nil || p.Id == nil { return 0 diff --git a/dbstruct/textaudittask.go b/dbstruct/textaudittask.go index e8eee345..503f7ed3 100644 --- a/dbstruct/textaudittask.go +++ b/dbstruct/textaudittask.go @@ -6,6 +6,7 @@ import ( type TextAuditTask struct { Id *string `json:"id" bson:"_id"` // 文字审核任务表id + Mid *int64 `json:"mid" bson:"mid"` // 用户id AuditedText *string `json:"audited_text" bson:"audited_text"` // 待审核文字内容 OldText *string `json:"old_text" bson:"old_text"` // 旧文字内容 RouteUrl *string `json:"route_url" bson:"route_url"` // 路由URL @@ -32,6 +33,13 @@ func (p *TextAuditTask) GetId() string { return *p.Id } +func (p *TextAuditTask) GetMid() int64 { + if p == nil || p.Mid == nil { + return -1 + } + return *p.Mid +} + func (p *TextAuditTask) GetStatus() int64 { if p == nil || p.Id == nil { return 0 diff --git a/dbstruct/video_moderation_task.go b/dbstruct/video_moderation_task.go index 31d6e1d8..7296a0ec 100644 --- a/dbstruct/video_moderation_task.go +++ b/dbstruct/video_moderation_task.go @@ -2,6 +2,7 @@ package dbstruct type VideoModerationTask struct { Id *string `json:"id" bson:"_id"` // 视频审核任务表id + Mid *int64 `json:"mid" bson:"mid"` // 用户id AuditedMedia *MediaComponent `json:"audited_media" bson:"audited_media"` // 待审核媒体内容(视频) OldMedia *MediaComponent `json:"old_media" bson:"old_media"` // 旧媒体内容 RouteUrl *string `json:"route_url" bson:"route_url"` // 路由URL @@ -40,6 +41,13 @@ func (p *VideoModerationTask) GetId() string { return *p.Id } +func (p *VideoModerationTask) GetMid() int64 { + if p == nil || p.Mid == nil { + return -1 + } + return *p.Mid +} + func (p *VideoModerationTask) GetBatchId() string { if p == nil || p.BatchId == nil { return ""