by Robin at 20240719

This commit is contained in:
Leufolium 2024-07-19 08:32:59 +08:00
parent 494d798351
commit ea7d25b0a9
10 changed files with 95 additions and 4 deletions

View File

@ -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"`
}

View File

@ -1,9 +1,13 @@
package proto
import "service/dbstruct"
import (
accountproto "service/api/proto/account/proto"
"service/dbstruct"
)
type TextAuditTaskVO struct {
*dbstruct.TextAuditTask
Account *accountproto.OpListVO `json:"account"`
TextAudit *dbstruct.TextAudit `json:"text_audit"`
}

View File

@ -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"`
}

View File

@ -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"),

View File

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

View File

@ -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"),

View File

@ -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"),

View File

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

View File

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

View File

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