diff --git a/api/consts/status.go b/api/consts/status.go index bc706c6c..ce9a131d 100644 --- a/api/consts/status.go +++ b/api/consts/status.go @@ -87,7 +87,7 @@ const ( VideoModeration_ServiceFailed = 10 //批次任务失败 ) -// 动态审核表状态 +// 动态审核表状态(弃用) const ( MomentAudit_Created = 0 //已创建 MomentAudit_Auditing = 1 //审核中 @@ -114,12 +114,12 @@ const ( // 动态表status状态 const ( Moment_Private = 0 //仅自己可见 - Moment_OpenToCircles = 1 //仅朋友圈可见 + Moment_OpenToCircles = 1 //仅朋友圈可见(弃用状态) Moment_Public = 2 //公开 Moment_Auditing = 3 //机审中 Moment_ManuallyReviewing = 4 //人工复审中 - Moment_AuditRejected = 5 //机审拒绝 - Moment_ManuallyReviewRejected = 6 //人工复审拒绝 + Moment_AuditRejected = 5 //机审拒绝 (中间态,实际上不关心) + Moment_ManuallyReviewRejected = 6 //人工复审拒绝(折衷方案,等价于空间动态的状态自见+人审拒绝) ) // 是否被关注 diff --git a/api/proto/moment/proto/moment_api_vo_api.go b/api/proto/moment/proto/moment_api_vo_api.go index dcb0df24..f3ec9b63 100644 --- a/api/proto/moment/proto/moment_api_vo_api.go +++ b/api/proto/moment/proto/moment_api_vo_api.go @@ -8,9 +8,12 @@ import ( type ApiMomentVO struct { *dbstruct.Moment - StreamerExt *streamerproto.ApiListExtVO `json:"streamer_ext"` - IsFollowed int64 `json:"is_followed"` - IsThumbedUp int64 `json:"is_thumbed_up"` + StreamerExt *streamerproto.ApiListExtVO `json:"streamer_ext"` + IsFollowed int64 `json:"is_followed"` + IsThumbedUp int64 `json:"is_thumbed_up"` + ImageAuditOpinion string `json:"image_audit_opinion"` + TextAuditOpinion string `json:"text_audit_opinion"` + ManuallyReviewOpinion string `json:"manually_review_opinion"` } func (vo *ApiMomentVO) CopyMoment(moment *dbstruct.Moment) { diff --git a/api/proto/moment/proto/moment_api_vo_op.go b/api/proto/moment/proto/moment_api_vo_op.go index da63129b..c88261b2 100644 --- a/api/proto/moment/proto/moment_api_vo_op.go +++ b/api/proto/moment/proto/moment_api_vo_op.go @@ -12,7 +12,10 @@ type MomentVO interface { type OpMomentVO struct { *dbstruct.Moment - StreamerExt *streamerproto.OpListExtVO `json:"streamer_ext"` + StreamerExt *streamerproto.OpListExtVO `json:"streamer_ext"` + ImageAuditOpinion string `json:"image_audit_opinion"` + TextAuditOpinion string `json:"text_audit_opinion"` + ManuallyReviewOpinion string `json:"manually_review_opinion"` } func (vo *OpMomentVO) CopyMoment(moment *dbstruct.Moment) { diff --git a/api/proto/moment/proto/moment_op.go b/api/proto/moment/proto/moment_op.go index b7fe68fa..f00cf956 100644 --- a/api/proto/moment/proto/moment_op.go +++ b/api/proto/moment/proto/moment_op.go @@ -145,8 +145,9 @@ type OpListByIdsResp struct { // op 复审 type OpReviewReq struct { base.BaseRequest - MomentIds []int64 `json:"moment_ids"` - OpType int64 `json:"op_type"` + MomentIds []int64 `json:"moment_ids"` + OpType int64 `json:"op_type"` + ManuallyReviewOpinion string `json:"manually_review_opinion"` } type OpReviewData struct { diff --git a/api/proto/moment_audit_task/proto/moment_audit_task_op.go b/api/proto/moment_audit_task/proto/moment_audit_task_op.go index b4a10cd5..79827ba4 100644 --- a/api/proto/moment_audit_task/proto/moment_audit_task_op.go +++ b/api/proto/moment_audit_task/proto/moment_audit_task_op.go @@ -50,14 +50,9 @@ type OpUpdateResp struct { // op 列表 type OpListReq struct { base.BaseRequest - AssociativeTableId *int64 `json:"associative_table_id"` - BatchId *string `json:"batch_id"` - ImageAuditTaskId *string `json:"image_audit_task_id"` - TextAuditTaskId *string `json:"text_audit_task_id"` - Status *int64 `json:"status"` - ManuallyReviewStatus *int64 `json:"manually_review_status"` - Offset int `json:"offset"` - Limit int `json:"limit"` + Status *int64 `json:"status"` + Offset int `json:"offset"` + Limit int `json:"limit"` } type OpListData struct { diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index e5511fad..d418946f 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -1648,6 +1648,21 @@ func (m *Mongo) GetMomentList(ctx *gin.Context, req *momentproto.OpListReq) ([]* return list, err } +func (m *Mongo) GetMomentListByStatus(ctx *gin.Context, status int64, limit, offset int) ([]*dbstruct.Moment, error) { + list := make([]*dbstruct.Moment, 0) + col := m.getColMoment() + // 这个接口是用来查审核任务的前置接口,所以必须要把删除的也查出来 + query := qmgo.M{ + "status": status, + } + err := col.Find(ctx, query).Sort("-ut").Skip(int64(offset)).Limit(int64(limit)).All(&list) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return list, err + } + return list, err +} + // 临时接口 func (m *Mongo) GetDeletedMomentList(ctx *gin.Context, req *momentproto.OpListReq) ([]*dbstruct.Moment, error) { list := make([]*dbstruct.Moment, 0) @@ -4003,56 +4018,6 @@ func (m *Mongo) GetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_taskp query := qmgo.M{ "del_flag": 0, } - if req.AssociativeTableId != nil { - query["associative_table_id"] = util.DerefInt64(req.AssociativeTableId) - } - if req.BatchId != nil { - query["batch_id"] = util.DerefString(req.BatchId) - } - if req.ImageAuditTaskId != nil { - query["image_audit_task_id"] = util.DerefString(req.ImageAuditTaskId) - } - if req.TextAuditTaskId != nil { - query["text_audit_task_id"] = util.DerefString(req.TextAuditTaskId) - } - if req.ManuallyReviewStatus != nil { - query["manually_review_status"] = util.DerefInt64(req.ManuallyReviewStatus) - } - if req.Status != nil { - // 若是审核通过,则图像和文字审核均必须通过 - // 若是人工审核通过,则图像和文字审核中至少要有一个人工审核通过,且剩下的均为通过或者人工审核通过 - // 其余状态只要图像和文字审核中有一个满足,即满足查询条件 - status := util.DerefInt64(req.Status) - switch status { - case consts.MomentAudit_Passed: - query["image_audit_task_status"] = consts.MomentAudit_Passed - query["text_audit_task_status"] = consts.MomentAudit_Passed - case consts.MomentAudit_ManuallyPassed: - orClause := make([]qmgo.M, 0) - orClause = append(orClause, qmgo.M{ - "image_audit_task_status": consts.MomentAudit_ManuallyPassed, - }) - orClause = append(orClause, qmgo.M{ - "text_audit_task_status": consts.MomentAudit_ManuallyPassed, - }) - query["$or"] = orClause - query["image_audit_task_status"] = qmgo.M{ - "$in": []int64{consts.MomentAudit_Passed, consts.MomentAudit_ManuallyPassed}, - } - query["text_audit_task_status"] = qmgo.M{ - "$in": []int64{consts.MomentAudit_Passed, consts.MomentAudit_ManuallyPassed}, - } - default: - orClause := make([]qmgo.M, 0) - orClause = append(orClause, qmgo.M{ - "image_audit_task_status": status, - }) - orClause = append(orClause, qmgo.M{ - "text_audit_task_status": status, - }) - query["$or"] = orClause - } - } err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list) if err == qmgo.ErrNoSuchDocuments { err = nil @@ -4194,6 +4159,38 @@ func (m *Mongo) TryToFinishVideoModerationTaskOfMoment(ctx *gin.Context, task *d return &instance, nil } +func (m *Mongo) GetMomentAuditTaskListByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.MomentAuditTask, error) { + list := make([]*dbstruct.MomentAuditTask, 0) + col := m.getColMomentAuditTask() + query := qmgo.M{ + "_id": qmgo.M{ + "$in": ids, + }, + } + err := col.Find(ctx, query).All(&list) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return list, err + } + return list, err +} + +func (m *Mongo) GetMomentAuditTaskByMomentIds(ctx *gin.Context, momentIds []string) ([]*dbstruct.MomentAuditTask, error) { + list := make([]*dbstruct.MomentAuditTask, 0) + col := m.getColMomentAuditTask() + query := qmgo.M{ + "associative_table_id": qmgo.M{ + "$in": momentIds, + }, + } + err := col.Find(ctx, query).Sort("-ut").All(&list) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return make([]*dbstruct.MomentAuditTask, 0), err + } + return list, err +} + // 联系客服对话表相关 func (m *Mongo) CreateContactCustomerServiceSession(ctx *gin.Context, contact_customer_service_session *dbstruct.ContactCustomerServiceSession) error { col := m.getColContactCustomerServiceSession() diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index f408b919..590d350b 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2205,14 +2205,13 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe // 封装动态审核任务 momentAuditTask := &dbstruct.MomentAuditTask{ - AssociativeTableId: goproto.String(fmt.Sprint(util.DerefInt64(req.Moment.Id))), + AssociativeTableId: goproto.String(fmt.Sprint(req.Moment.GetId())), AuditedMedia: req.Moment.MediaComp, AuditedText: req.Moment.Text, - Status: goproto.Int64(consts.MomentAudit_Created), ManuallyReviewStatus: goproto.Int64(consts.MomentManuallyReview_Waiting), } - momentAuditTask.ImageAuditTaskStatus = goproto.Int64(consts.MomentAudit_Created) + momentAuditTask.ImageAuditTaskStatus = goproto.Int64(consts.ImageAudit_Created) if len(imageaudittasks) > 0 { momentAuditTask.ImageAuditTaskId = imageaudittasks[0].Id } else if len(videomoderationtasks) > 0 { @@ -2223,9 +2222,9 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe } if len(textaudittasks) > 0 { momentAuditTask.TextAuditTaskId = textaudittasks[0].Id - momentAuditTask.TextAuditTaskStatus = goproto.Int64(consts.MomentAudit_Created) + momentAuditTask.TextAuditTaskStatus = goproto.Int64(consts.TextAudit_Created) } else { - momentAuditTask.TextAuditTaskStatus = goproto.Int64(consts.MomentAudit_Passed) + momentAuditTask.TextAuditTaskStatus = goproto.Int64(consts.TextAudit_Passed) } if err := _DefaultMomentAuditTask.OpCreate(ctx, &moment_audit_taskproto.OpCreateReq{ MomentAuditTask: momentAuditTask, @@ -2246,24 +2245,6 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe req.Moment.Mid = goproto.Int64(req.BaseRequest.Mid) - err := _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{ - Moment: &dbstruct.Moment{ - Status: req.Status, - Text: req.Text, - MediaComp: req.MediaComp, - }, - }) - if err == qmgo.ErrNoSuchDocuments { - ec = errcode.ErrCodeMomentNotExist - err = nil - return - } - if err != nil { - logger.Error("ApiUpdate fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeMomentSrvFail - return - } - //读取默认动态文字配置 defaultMomentText, err := apollo.GetStringValue(consts.DefaultMomentTextKey, apollo.ApolloOpts().SetNamespace("application")) if err != nil { @@ -2282,39 +2263,74 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe videomoderationtasks := s.CreateMomentVideoModeration(ctx, req.Moment) if len(imageaudittasks) > 0 || len(textaudittasks) > 0 || len(videomoderationtasks) > 0 { - // 封装动态审核任务 - momentAuditTask := &dbstruct.MomentAuditTask{ - AssociativeTableId: goproto.String(fmt.Sprint(util.DerefInt64(req.Moment.Id))), - ManuallyReviewStatus: goproto.Int64(consts.MomentManuallyReview_Waiting), + + // 需要重新过机审 + req.Moment.Status = goproto.Int64(consts.Moment_Auditing) + + // 查出该动态的审核任务 + tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, []string{fmt.Sprint(req.Moment.GetId())}) + if err == qmgo.ErrNoSuchDocuments { + ec = errcode.ErrCodeMomentAuditTaskNotExist + err = nil + return + } + if err != nil { + logger.Error("ApiUpdate fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeMomentAuditTaskSrvFail + return + } + + // 修改该动态的审核任务 + updateEntity := &dbstruct.MomentAuditTask{ + Id: tasks[0].Id, + ManuallyReviewStatus: goproto.Int64(consts.MomentManuallyReview_Waiting), + ManuallyReviewOperator: goproto.Int64(0), + ManuallyReviewOpinion: goproto.String(""), } if len(imageaudittasks) > 0 { - momentAuditTask.ImageAuditTaskId = imageaudittasks[0].Id - momentAuditTask.AuditedMedia = imageaudittasks[0].AuditedMedia - momentAuditTask.ImageAuditTaskStatus = goproto.Int64(consts.MomentAudit_Created) + updateEntity.ImageAuditTaskId = imageaudittasks[0].Id + updateEntity.AuditedMedia = imageaudittasks[0].AuditedMedia + updateEntity.ImageAuditTaskStatus = goproto.Int64(consts.ImageAudit_Created) + updateEntity.ImageAuditOpinion = goproto.String("") } else if len(videomoderationtasks) > 0 { - momentAuditTask.ImageAuditTaskId = videomoderationtasks[0].Id - momentAuditTask.AuditedMedia = videomoderationtasks[0].AuditedMedia - momentAuditTask.ImageAuditTaskStatus = goproto.Int64(consts.MomentAudit_Created) - } else { // 媒体内容未更新,默认设置为通过 - momentAuditTask.ImageAuditTaskStatus = goproto.Int64(consts.MomentAudit_Passed) - } - if len(textaudittasks) > 0 { - momentAuditTask.AuditedText = textaudittasks[0].AuditedText - momentAuditTask.TextAuditTaskId = textaudittasks[0].Id - momentAuditTask.TextAuditTaskStatus = goproto.Int64(consts.MomentAudit_Created) - } else { - momentAuditTask.TextAuditTaskStatus = goproto.Int64(consts.MomentAudit_Passed) + updateEntity.ImageAuditTaskId = videomoderationtasks[0].Id + updateEntity.AuditedMedia = videomoderationtasks[0].AuditedMedia + updateEntity.ImageAuditTaskStatus = goproto.Int64(consts.VideoModeration_Created) + updateEntity.ImageAuditOpinion = goproto.String("") } - if err := _DefaultMomentAuditTask.OpCreate(ctx, &moment_audit_taskproto.OpCreateReq{ - MomentAuditTask: momentAuditTask, + if len(textaudittasks) > 0 { + updateEntity.AuditedText = textaudittasks[0].AuditedText + updateEntity.TextAuditTaskId = textaudittasks[0].Id + updateEntity.TextAuditTaskStatus = goproto.Int64(consts.TextAudit_Created) + updateEntity.TextAuditOpinion = goproto.String("") + } + + // 修改该动态的审核任务 + if err := _DefaultMomentAuditTask.OpUpdate(ctx, &moment_audit_taskproto.OpUpdateReq{ + MomentAuditTask: updateEntity, }); err != nil { ec = errcode.ErrCodeMomentAuditTaskSrvFail return } } + // 更新动态 + err = _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{ + Moment: req.Moment, + }) + if err == qmgo.ErrNoSuchDocuments { + ec = errcode.ErrCodeMomentNotExist + err = nil + return + } + if err != nil { + logger.Error("ApiUpdate fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeMomentSrvFail + return + } + return } @@ -2456,6 +2472,10 @@ func (s *Service) ApiGetMomentListByIdsFromCreater(ctx *gin.Context, req *moment ec = errcode.ErrCodeZoneMomentSrvFail return } + momentIds := make([]string, 0) + for _, moment := range list { + momentIds = append(momentIds, fmt.Sprint(moment.GetId())) + } // 2.通过mid获取主播信息map ignoreMap := make(map[string]bool) @@ -2468,8 +2488,19 @@ func (s *Service) ApiGetMomentListByIdsFromCreater(ctx *gin.Context, req *moment } streamerExt := streamerExtMap[req.GetBaseRequest().Mid] + // 3.获取审核信息 + tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, momentIds) + if err != nil { + logger.Error("GetByMomentIds fail") + return + } + taskMp := make(map[string]*dbstruct.MomentAuditTask) + for _, task := range tasks { + taskMp[task.GetAssociativeTableId()] = task + } + volist = make([]*momentproto.ApiMomentVO, 0) - // 3.填充所有信息 + // 4.填充所有信息 for _, moment := range list { if moment.GetMid() != req.GetBaseRequest().Mid { volist, ec = make([]*momentproto.ApiMomentVO, 0), errcode.ErrCodeMomentNotHisOwn @@ -2480,6 +2511,12 @@ func (s *Service) ApiGetMomentListByIdsFromCreater(ctx *gin.Context, req *moment } // 主播信息 vo.CopyStreamerExt(streamerExt) + + // 填充审核信息 + vo.ImageAuditOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetImageAuditOpinion() + vo.TextAuditOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetTextAuditOpinion() + vo.ManuallyReviewOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetManuallyReviewOpinion() + volist = append(volist, vo) } diff --git a/app/mix/service/logic/moment.go b/app/mix/service/logic/moment.go index 86a9ed6e..73cda37a 100644 --- a/app/mix/service/logic/moment.go +++ b/app/mix/service/logic/moment.go @@ -186,3 +186,12 @@ func (p *Moment) GetByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.Moment, er } return list, nil } + +func (p *Moment) GetByStatus(ctx *gin.Context, status int64, limit, offset int) ([]*dbstruct.Moment, error) { + list, err := p.store.GetMomentListByStatus(ctx, status, limit, offset) + if err != nil { + logger.Error("GetMomentListByStatus fail, err: %v", err) + return make([]*dbstruct.Moment, 0), err + } + return list, nil +} diff --git a/app/mix/service/logic/moment_audit_task.go b/app/mix/service/logic/moment_audit_task.go index f9fe2aac..da8addda 100644 --- a/app/mix/service/logic/moment_audit_task.go +++ b/app/mix/service/logic/moment_audit_task.go @@ -129,3 +129,21 @@ func (p *MomentAuditTask) TryToFinishVideoModerationTask(ctx *gin.Context, task } return instance.GetImageAuditTaskStatus() != consts.ImageAudit_Created && instance.GetTextAuditTaskStatus() != consts.TextAudit_Created, nil } + +func (p *MomentAuditTask) GetByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.MomentAuditTask, error) { + list, err := p.store.GetMomentAuditTaskListByIds(ctx, ids) + if err != nil { + logger.Error("GetMomentAuditTaskListByIds fail, err: %v", err) + return make([]*dbstruct.MomentAuditTask, 0), err + } + return list, nil +} + +func (p *MomentAuditTask) GetByMomentIds(ctx *gin.Context, momentIds []string) ([]*dbstruct.MomentAuditTask, error) { + list, err := p.store.GetMomentAuditTaskByMomentIds(ctx, momentIds) + if err != nil { + logger.Error("GetMomentAuditTaskListByIds fail, err: %v", err) + return nil, err + } + return list, nil +} diff --git a/app/mix/service/service.go b/app/mix/service/service.go index c2a8a7ec..ec9c1c75 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -1504,6 +1504,7 @@ func (s *Service) OpReviewMoment(ctx *gin.Context, req *momentproto.OpReviewReq) err = _DefaultMomentAuditTask.OpUpdateByMomentIdsAndStatus(ctx, &dbstruct.MomentAuditTask{ ManuallyReviewStatus: goproto.Int64(finalMomentAuditTaskStatus), ManuallyReviewOperator: goproto.Int64(req.BaseRequest.Mid), + ManuallyReviewOpinion: goproto.String(req.ManuallyReviewOpinion), }, momentStrIds, consts.MomentManuallyReview_Waiting) if err != nil { logger.Error("_DefaultMomentAuditTask OpUpdateByMomentIdsAndStatus fail, req: %v, err: %v", util.ToJson(req), err) @@ -3486,10 +3487,30 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t return } - req.ManuallyReviewStatus = goproto.Int64(consts.MomentManuallyReview_Waiting) - list, err := _DefaultMomentAuditTask.OpList(ctx, req) + moments, err := _DefaultMoment.GetByStatus(ctx, util.DerefInt64(req.Status), req.Limit, req.Offset) if err != nil { - logger.Error("OpGetMomentAuditTaskList fail, req: %v, err: %v", util.ToJson(req), err) + logger.Error("GetByStatus fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeMomentSrvFail + return + } + + momentIds := make([]string, 0) + momentMp := make(map[string]*dbstruct.Moment) + mids := make([]int64, 0) + midSet := make(map[int64]*dbstruct.Moment) + for _, moment := range moments { + momentIds = append(momentIds, fmt.Sprint(moment.GetId())) + momentMp[fmt.Sprint(moment.GetId())] = moment + mid := moment.GetMid() + if midSet[mid] == nil { + midSet[mid] = &dbstruct.Moment{} + mids = append(mids, mid) + } + } + + list, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, momentIds) + if err != nil { + logger.Error("OpGetMomentAuditTaskListByIds fail, req: %v, err: %v", util.ToJson(req), err) ec = errcode.ErrCodeMomentAuditTaskSrvFail return } @@ -3498,16 +3519,9 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t // 收集图像和文字审核的id,分别查询出图像和文字审核的任务 imageAuditTaskIds := make([]string, 0) textAuditTaskIds := make([]string, 0) - momentIdSet := make(map[string]*dbstruct.Moment) - momentIds := make([]string, 0) for _, task := range list { imageAuditTaskIds = append(imageAuditTaskIds, util.DerefString(task.ImageAuditTaskId)) textAuditTaskIds = append(textAuditTaskIds, util.DerefString(task.TextAuditTaskId)) - momentId := task.GetAssociativeTableId() - if momentIdSet[momentId] == nil { - momentIdSet[momentId] = &dbstruct.Moment{} - momentIds = append(momentIds, momentId) - } } imageAuditTaskMap, err := _DefaultImageAuditTask.OpGetImageAuditTaskMapByIds(ctx, imageAuditTaskIds) if err != nil { @@ -3521,21 +3535,7 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t ec = errcode.ErrCodeTextAuditTaskSrvFail return } - momentMp, err := _DefaultMoment.GetMomentStringIdMapByIds(ctx, momentIds) - if err != nil { - logger.Error("GetMomentStringIdMapByIds fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeMomentSrvFail - return - } - midSet := make(map[int64]*dbstruct.Moment) - mids := make([]int64, 0) - for _, v := range momentMp { - mid := v.GetMid() - if midSet[mid] == nil { - midSet[mid] = &dbstruct.Moment{} - mids = append(mids, mid) - } - } + streamerMp, err := s.utilGetStreamerExtMapByMids(ctx, mids, consts.InterfaceType_Op) if err != nil { logger.Error("utilGetStreamerExtMapByMids fail, req: %v, err: %v", util.ToJson(req), err) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index afb58243..0c80440b 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -248,6 +248,7 @@ func (s *Service) utilFillMomentsWithApiVOInfo(ctx *gin.Context, list []*dbstruc volist = make([]*momentproto.ApiMomentVO, 0) midSet := make(map[int64]*dbstruct.Moment) mids := make([]int64, 0) + momentIds := make([]string, 0) for _, moment := range list { vo := &momentproto.ApiMomentVO{ Moment: moment, @@ -258,6 +259,7 @@ func (s *Service) utilFillMomentsWithApiVOInfo(ctx *gin.Context, list []*dbstruc midSet[mid] = &dbstruct.Moment{} mids = append(mids, mid) } + momentIds = append(momentIds, fmt.Sprint(moment.GetId())) } // 2.通过mids获取主播信息map @@ -274,7 +276,18 @@ func (s *Service) utilFillMomentsWithApiVOInfo(ctx *gin.Context, list []*dbstruc return } - // 4.填充所有信息 + // 4.获取审核信息 + tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, momentIds) + if err != nil { + logger.Error("GetByMomentIds fail") + return + } + taskMp := make(map[string]*dbstruct.MomentAuditTask) + for _, task := range tasks { + taskMp[task.GetAssociativeTableId()] = task + } + + // 5.填充所有信息 for _, vo := range volist { // 填充主播信息 @@ -289,7 +302,10 @@ func (s *Service) utilFillMomentsWithApiVOInfo(ctx *gin.Context, list []*dbstruc return } - // 填充七日内空间是否有更新 + // 填充审核信息 + vo.ImageAuditOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetImageAuditOpinion() + vo.TextAuditOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetTextAuditOpinion() + vo.ManuallyReviewOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetManuallyReviewOpinion() } @@ -302,6 +318,7 @@ func (s *Service) utilFillMomentsWithOpVOInfo(ctx *gin.Context, list []*dbstruct volist = make([]*momentproto.OpMomentVO, 0) midSet := make(map[int64]*dbstruct.Moment) mids := make([]int64, 0) + momentIds := make([]string, 0) for _, moment := range list { vo := &momentproto.OpMomentVO{ Moment: moment, @@ -312,6 +329,7 @@ func (s *Service) utilFillMomentsWithOpVOInfo(ctx *gin.Context, list []*dbstruct midSet[mid] = &dbstruct.Moment{} mids = append(mids, mid) } + momentIds = append(momentIds, fmt.Sprint(moment.GetId())) } // 2.通过mids获取主播信息map @@ -321,10 +339,26 @@ func (s *Service) utilFillMomentsWithOpVOInfo(ctx *gin.Context, list []*dbstruct return } + // 3.获取审核信息 + tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, momentIds) + if err != nil { + logger.Error("GetByMomentIds fail") + return + } + taskMp := make(map[string]*dbstruct.MomentAuditTask) + for _, task := range tasks { + taskMp[task.GetAssociativeTableId()] = task + } + // 4.填充所有信息 for _, vo := range volist { // 填充主播信息 vo.CopyStreamerExt(streamerExtMap[vo.GetMid()]) + + // 填充审核信息 + vo.ImageAuditOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetImageAuditOpinion() + vo.TextAuditOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetTextAuditOpinion() + vo.ManuallyReviewOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetManuallyReviewOpinion() } return diff --git a/dbstruct/moment_audit_task.go b/dbstruct/moment_audit_task.go index 1e2c8b83..e7c7c8ae 100644 --- a/dbstruct/moment_audit_task.go +++ b/dbstruct/moment_audit_task.go @@ -16,7 +16,7 @@ type MomentAuditTask struct { Status *int64 `json:"status" bson:"status"` // 是否已过期 ManuallyReviewStatus *int64 `json:"manually_review_status" bson:"manually_review_status"` // 人工复审状态 ManuallyReviewOperator *int64 `json:"manually_review_operator" bson:"manually_review_operator"` // 人工复审操作人 - Remarks *string `json:"remarks" bson:"remarks"` // 备注 + ManuallyReviewOpinion *string `json:"manually_review_opinion" bson:"manually_review_opinion"` // 备注 Ct *int64 `json:"ct" bson:"ct"` // 创建时间 Ut *int64 `json:"ut" bson:"ut"` // 更新时间 DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 @@ -50,3 +50,24 @@ func (p *MomentAuditTask) GetTextAuditTaskStatus() int64 { } return *p.TextAuditTaskStatus } + +func (p *MomentAuditTask) GetImageAuditOpinion() string { + if p == nil || p.ImageAuditOpinion == nil { + return "" + } + return *p.ImageAuditOpinion +} + +func (p *MomentAuditTask) GetTextAuditOpinion() string { + if p == nil || p.TextAuditOpinion == nil { + return "" + } + return *p.TextAuditOpinion +} + +func (p *MomentAuditTask) GetManuallyReviewOpinion() string { + if p == nil || p.ManuallyReviewOpinion == nil { + return "" + } + return *p.ManuallyReviewOpinion +}