From 1943a4f53d9164f44d5f2b4218ec34ec5c413f76 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 19 Nov 2024 15:39:01 +0800 Subject: [PATCH 01/16] 1 --- app/mix/service/apiservice.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index f408b919..b83c13f6 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2248,6 +2248,7 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe err := _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{ Moment: &dbstruct.Moment{ + Id: req.Moment.Id, Status: req.Status, Text: req.Text, MediaComp: req.MediaComp, From 5b273b094917bf8a839670a8ca394107e697e19c Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 19 Nov 2024 15:56:46 +0800 Subject: [PATCH 02/16] 1 --- app/mix/service/apiservice.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index b83c13f6..a9a9507d 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2248,10 +2248,8 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe err := _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{ Moment: &dbstruct.Moment{ - Id: req.Moment.Id, - Status: req.Status, - Text: req.Text, - MediaComp: req.MediaComp, + Id: req.Moment.Id, + Status: goproto.Int64(consts.Moment_Auditing), }, }) if err == qmgo.ErrNoSuchDocuments { @@ -2285,7 +2283,7 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe if len(imageaudittasks) > 0 || len(textaudittasks) > 0 || len(videomoderationtasks) > 0 { // 封装动态审核任务 momentAuditTask := &dbstruct.MomentAuditTask{ - AssociativeTableId: goproto.String(fmt.Sprint(util.DerefInt64(req.Moment.Id))), + AssociativeTableId: goproto.String(fmt.Sprint(req.Moment.GetId())), ManuallyReviewStatus: goproto.Int64(consts.MomentManuallyReview_Waiting), } From 73b7488edf361e6ad3b1ba53cbcaa4ac5c91d5cb Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 19 Nov 2024 15:59:52 +0800 Subject: [PATCH 03/16] 1 --- app/mix/service/apiservice.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index a9a9507d..952dc3a6 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2284,6 +2284,7 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe // 封装动态审核任务 momentAuditTask := &dbstruct.MomentAuditTask{ AssociativeTableId: goproto.String(fmt.Sprint(req.Moment.GetId())), + Status: goproto.Int64(consts.MomentAudit_Created), ManuallyReviewStatus: goproto.Int64(consts.MomentManuallyReview_Waiting), } From 697fb1aa8b31f1783a978c0867afa9bec7fdfdc9 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 20 Nov 2024 15:20:17 +0800 Subject: [PATCH 04/16] 1 --- app/mix/dao/mongo.go | 16 ++++++++++++++++ app/mix/service/apiservice.go | 2 +- app/mix/service/logic/moment_audit_task.go | 9 +++++++++ app/mix/service/service.go | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index e5511fad..58575635 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -4194,6 +4194,22 @@ 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) 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 952dc3a6..d157e264 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2205,7 +2205,7 @@ 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), diff --git a/app/mix/service/logic/moment_audit_task.go b/app/mix/service/logic/moment_audit_task.go index f9fe2aac..34bb3239 100644 --- a/app/mix/service/logic/moment_audit_task.go +++ b/app/mix/service/logic/moment_audit_task.go @@ -129,3 +129,12 @@ 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 +} diff --git a/app/mix/service/service.go b/app/mix/service/service.go index c2a8a7ec..7a10907c 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3486,7 +3486,7 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t return } - req.ManuallyReviewStatus = goproto.Int64(consts.MomentManuallyReview_Waiting) + // req.ManuallyReviewStatus = goproto.Int64(consts.MomentManuallyReview_Waiting) list, err := _DefaultMomentAuditTask.OpList(ctx, req) if err != nil { logger.Error("OpGetMomentAuditTaskList fail, req: %v, err: %v", util.ToJson(req), err) From 067de8dcc439b3dbd9a77a778c7c4c9dd9418612 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 20 Nov 2024 16:45:58 +0800 Subject: [PATCH 05/16] by Robin at 20241120 --- api/consts/status.go | 8 +- .../proto/moment_audit_task_op.go | 11 +- app/mix/dao/mongo.go | 81 ++++++-------- app/mix/service/apiservice.go | 102 ++++++++++-------- app/mix/service/logic/moment.go | 9 ++ app/mix/service/logic/moment_audit_task.go | 9 ++ app/mix/service/service.go | 48 ++++----- 7 files changed, 138 insertions(+), 130 deletions(-) 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_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 58575635..52c7a447 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, + "del_flag": 0, + } + err := col.Find(ctx, query).Sort("-ct").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 @@ -4210,6 +4175,22 @@ func (m *Mongo) GetMomentAuditTaskListByIds(ctx *gin.Context, ids []int64) ([]*d return list, err } +func (m *Mongo) GetMomentAuditTaskByMomentIds(ctx *gin.Context, momentIds []int64) ([]*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).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 d157e264..3498495d 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2208,11 +2208,10 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe 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,23 +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{ - Id: req.Moment.Id, - Status: goproto.Int64(consts.Moment_Auditing), - }, - }) - 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 { @@ -2281,40 +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(req.Moment.GetId())), - Status: goproto.Int64(consts.MomentAudit_Created), - ManuallyReviewStatus: goproto.Int64(consts.MomentManuallyReview_Waiting), + + // 需要重新过机审 + req.Moment.Status = goproto.Int64(consts.Moment_Auditing) + + // 查出该动态的审核任务 + tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, []int64{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), + Remarks: 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 } 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 34bb3239..9f632987 100644 --- a/app/mix/service/logic/moment_audit_task.go +++ b/app/mix/service/logic/moment_audit_task.go @@ -138,3 +138,12 @@ func (p *MomentAuditTask) GetByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.M } return list, nil } + +func (p *MomentAuditTask) GetByMomentIds(ctx *gin.Context, momentIds []int64) ([]*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 7a10907c..237a2f50 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3486,10 +3486,29 @@ 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([]int64, 0) + momentMp := make(map[string]*dbstruct.Moment) + mids := make([]int64, 0) + midSet := make(map[int64]*dbstruct.Moment) + for _, moment := range moments { + momentIds = append(momentIds, 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 +3517,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 +3533,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) From 4d24482f259e5835c2d5e89927d07fd050eafa27 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 20 Nov 2024 17:04:43 +0800 Subject: [PATCH 06/16] 1 --- app/mix/service/service.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 237a2f50..24252e95 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3492,6 +3492,8 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t ec = errcode.ErrCodeMomentSrvFail return } + + logger.Info("moment length: %v", len(moments)) momentIds := make([]int64, 0) momentMp := make(map[string]*dbstruct.Moment) mids := make([]int64, 0) @@ -3506,6 +3508,7 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t } } + logger.Info("momentIds: %v", momentIds) list, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, momentIds) if err != nil { logger.Error("OpGetMomentAuditTaskListByIds fail, req: %v, err: %v", util.ToJson(req), err) @@ -3513,6 +3516,7 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t return } volist = make([]*moment_audit_taskproto.MomentAuditTaskVO, len(list)) + logger.Info("list length: %v", len(list)) // 收集图像和文字审核的id,分别查询出图像和文字审核的任务 imageAuditTaskIds := make([]string, 0) From eee2f2336726dc82f0ed71358b1ee9c1e68f2bed Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 20 Nov 2024 17:07:15 +0800 Subject: [PATCH 07/16] 1 --- app/mix/dao/mongo.go | 2 +- app/mix/service/apiservice.go | 2 +- app/mix/service/logic/moment_audit_task.go | 2 +- app/mix/service/service.go | 7 ++----- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index 52c7a447..bb64e7cf 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -4175,7 +4175,7 @@ func (m *Mongo) GetMomentAuditTaskListByIds(ctx *gin.Context, ids []int64) ([]*d return list, err } -func (m *Mongo) GetMomentAuditTaskByMomentIds(ctx *gin.Context, momentIds []int64) ([]*dbstruct.MomentAuditTask, error) { +func (m *Mongo) GetMomentAuditTaskByMomentIds(ctx *gin.Context, momentIds []string) ([]*dbstruct.MomentAuditTask, error) { list := make([]*dbstruct.MomentAuditTask, 0) col := m.getColMomentAuditTask() query := qmgo.M{ diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 3498495d..a1b76e52 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2268,7 +2268,7 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe req.Moment.Status = goproto.Int64(consts.Moment_Auditing) // 查出该动态的审核任务 - tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, []int64{req.Moment.GetId()}) + tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, []string{fmt.Sprint(req.Moment.GetId())}) if err == qmgo.ErrNoSuchDocuments { ec = errcode.ErrCodeMomentAuditTaskNotExist err = nil diff --git a/app/mix/service/logic/moment_audit_task.go b/app/mix/service/logic/moment_audit_task.go index 9f632987..da8addda 100644 --- a/app/mix/service/logic/moment_audit_task.go +++ b/app/mix/service/logic/moment_audit_task.go @@ -139,7 +139,7 @@ func (p *MomentAuditTask) GetByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.M return list, nil } -func (p *MomentAuditTask) GetByMomentIds(ctx *gin.Context, momentIds []int64) ([]*dbstruct.MomentAuditTask, error) { +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) diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 24252e95..1c3ea639 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3493,13 +3493,12 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t return } - logger.Info("moment length: %v", len(moments)) - momentIds := make([]int64, 0) + 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, moment.GetId()) + momentIds = append(momentIds, fmt.Sprint(moment.GetId())) momentMp[fmt.Sprint(moment.GetId())] = moment mid := moment.GetMid() if midSet[mid] == nil { @@ -3508,7 +3507,6 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t } } - logger.Info("momentIds: %v", momentIds) list, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, momentIds) if err != nil { logger.Error("OpGetMomentAuditTaskListByIds fail, req: %v, err: %v", util.ToJson(req), err) @@ -3516,7 +3514,6 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t return } volist = make([]*moment_audit_taskproto.MomentAuditTaskVO, len(list)) - logger.Info("list length: %v", len(list)) // 收集图像和文字审核的id,分别查询出图像和文字审核的任务 imageAuditTaskIds := make([]string, 0) From 72fca3c8caabe929a36e21bea7ff2133b4d7f135 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 20 Nov 2024 17:17:11 +0800 Subject: [PATCH 08/16] 1 --- app/mix/dao/mongo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index bb64e7cf..c40f8158 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -4183,7 +4183,7 @@ func (m *Mongo) GetMomentAuditTaskByMomentIds(ctx *gin.Context, momentIds []stri "$in": momentIds, }, } - err := col.Find(ctx, query).All(&list) + err := col.Find(ctx, query).Sort("-ct").All(&list) if err == qmgo.ErrNoSuchDocuments { err = nil return make([]*dbstruct.MomentAuditTask, 0), err From 5896407484271ce0908292dc2eaf4996c5b832de Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 20 Nov 2024 17:18:56 +0800 Subject: [PATCH 09/16] 1 --- app/mix/dao/mongo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index c40f8158..fc514018 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -1655,7 +1655,7 @@ func (m *Mongo) GetMomentListByStatus(ctx *gin.Context, status int64, limit, off "status": status, "del_flag": 0, } - err := col.Find(ctx, query).Sort("-ct").Skip(int64(offset)).Limit(int64(limit)).All(&list) + err := col.Find(ctx, query).Sort("-ut").Skip(int64(offset)).Limit(int64(limit)).All(&list) if err == qmgo.ErrNoSuchDocuments { err = nil return list, err @@ -4183,7 +4183,7 @@ func (m *Mongo) GetMomentAuditTaskByMomentIds(ctx *gin.Context, momentIds []stri "$in": momentIds, }, } - err := col.Find(ctx, query).Sort("-ct").All(&list) + err := col.Find(ctx, query).Sort("-ut").All(&list) if err == qmgo.ErrNoSuchDocuments { err = nil return make([]*dbstruct.MomentAuditTask, 0), err From 76fe6ef75e6be09054b0459b04e261448d2a3e36 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 20 Nov 2024 18:36:35 +0800 Subject: [PATCH 10/16] by Robin at 20241120 --- api/proto/moment/proto/moment_op.go | 1 + app/mix/service/service.go | 1 + 2 files changed, 2 insertions(+) diff --git a/api/proto/moment/proto/moment_op.go b/api/proto/moment/proto/moment_op.go index b7fe68fa..55d1ea2f 100644 --- a/api/proto/moment/proto/moment_op.go +++ b/api/proto/moment/proto/moment_op.go @@ -147,6 +147,7 @@ type OpReviewReq struct { base.BaseRequest MomentIds []int64 `json:"moment_ids"` OpType int64 `json:"op_type"` + Remarks string `json:"remarks"` } type OpReviewData struct { diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 1c3ea639..942db12c 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), + Remarks: goproto.String(req.Remarks), }, momentStrIds, consts.MomentManuallyReview_Waiting) if err != nil { logger.Error("_DefaultMomentAuditTask OpUpdateByMomentIdsAndStatus fail, req: %v, err: %v", util.ToJson(req), err) From 1ac849645cfd6511fea9bbc49e04f673fbbb1136 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Thu, 21 Nov 2024 14:15:55 +0800 Subject: [PATCH 11/16] by Robin at 20241121 --- api/proto/moment/proto/moment_api_vo_api.go | 9 +++-- api/proto/moment/proto/moment_api_vo_op.go | 5 ++- app/mix/service/utilservice.go | 38 +++++++++++++++++++-- dbstruct/moment_audit_task.go | 21 ++++++++++++ 4 files changed, 67 insertions(+), 6 deletions(-) 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/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index afb58243..2c816907 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())].GetRemarks() } @@ -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())].GetRemarks() } return diff --git a/dbstruct/moment_audit_task.go b/dbstruct/moment_audit_task.go index 1e2c8b83..2d711674 100644 --- a/dbstruct/moment_audit_task.go +++ b/dbstruct/moment_audit_task.go @@ -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) GetRemarks() string { + if p == nil || p.Remarks == nil { + return "" + } + return *p.Remarks +} From 235fab09406d99fdd4a362eae7fd08e1bafe78af Mon Sep 17 00:00:00 2001 From: Robin <7434053+warrior_of_light_robin@user.noreply.gitee.com> Date: Thu, 21 Nov 2024 14:44:44 +0800 Subject: [PATCH 12/16] 1 --- app/mix/service/utilservice.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 2c816907..4c1c775f 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -276,7 +276,7 @@ func (s *Service) utilFillMomentsWithApiVOInfo(ctx *gin.Context, list []*dbstruc return } - // 4.获取审核信息 + // 4.获取审核信息1 tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, momentIds) if err != nil { logger.Error("GetByMomentIds fail") From 660d6361417eba0391ad71c1cffad0fe8d818200 Mon Sep 17 00:00:00 2001 From: Robin <7434053+warrior_of_light_robin@user.noreply.gitee.com> Date: Thu, 21 Nov 2024 14:47:44 +0800 Subject: [PATCH 13/16] 1 --- api/proto/moment/proto/moment_op.go | 6 +++--- app/mix/service/apiservice.go | 2 +- app/mix/service/service.go | 2 +- app/mix/service/utilservice.go | 4 ++-- dbstruct/moment_audit_task.go | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api/proto/moment/proto/moment_op.go b/api/proto/moment/proto/moment_op.go index 55d1ea2f..f00cf956 100644 --- a/api/proto/moment/proto/moment_op.go +++ b/api/proto/moment/proto/moment_op.go @@ -145,9 +145,9 @@ type OpListByIdsResp struct { // op 复审 type OpReviewReq struct { base.BaseRequest - MomentIds []int64 `json:"moment_ids"` - OpType int64 `json:"op_type"` - Remarks string `json:"remarks"` + MomentIds []int64 `json:"moment_ids"` + OpType int64 `json:"op_type"` + ManuallyReviewOpinion string `json:"manually_review_opinion"` } type OpReviewData struct { diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index a1b76e52..75770958 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2285,7 +2285,7 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe Id: tasks[0].Id, ManuallyReviewStatus: goproto.Int64(consts.MomentManuallyReview_Waiting), ManuallyReviewOperator: goproto.Int64(0), - Remarks: goproto.String(""), + ManuallyReviewOpinion: goproto.String(""), } if len(imageaudittasks) > 0 { diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 942db12c..ec9c1c75 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -1504,7 +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), - Remarks: goproto.String(req.Remarks), + 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) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 4c1c775f..e4b3a8b3 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -305,7 +305,7 @@ func (s *Service) utilFillMomentsWithApiVOInfo(ctx *gin.Context, list []*dbstruc // 填充审核信息 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())].GetRemarks() + vo.ManuallyReviewOpinion = taskMp[fmt.Sprint(vo.Moment.GetId())].GetManuallyReviewOpinion() } @@ -358,7 +358,7 @@ func (s *Service) utilFillMomentsWithOpVOInfo(ctx *gin.Context, list []*dbstruct // 填充审核信息 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())].GetRemarks() + 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 2d711674..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"` // 删除标记 @@ -65,9 +65,9 @@ func (p *MomentAuditTask) GetTextAuditOpinion() string { return *p.TextAuditOpinion } -func (p *MomentAuditTask) GetRemarks() string { - if p == nil || p.Remarks == nil { +func (p *MomentAuditTask) GetManuallyReviewOpinion() string { + if p == nil || p.ManuallyReviewOpinion == nil { return "" } - return *p.Remarks + return *p.ManuallyReviewOpinion } From 1b3de32c39a97618111ba0071b32603ac262c1f5 Mon Sep 17 00:00:00 2001 From: Robin <7434053+warrior_of_light_robin@user.noreply.gitee.com> Date: Thu, 21 Nov 2024 16:19:58 +0800 Subject: [PATCH 14/16] by Robin at 20241121 --- app/mix/service/apiservice.go | 23 ++++++++++++++++++++++- app/mix/service/utilservice.go | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 75770958..590d350b 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2472,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) @@ -2484,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 @@ -2496,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/utilservice.go b/app/mix/service/utilservice.go index e4b3a8b3..0c80440b 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -276,7 +276,7 @@ func (s *Service) utilFillMomentsWithApiVOInfo(ctx *gin.Context, list []*dbstruc return } - // 4.获取审核信息1 + // 4.获取审核信息 tasks, err := _DefaultMomentAuditTask.GetByMomentIds(ctx, momentIds) if err != nil { logger.Error("GetByMomentIds fail") From 213d7b891c32671cbf59ac07974afb45308e83c8 Mon Sep 17 00:00:00 2001 From: Robin <7434053+warrior_of_light_robin@user.noreply.gitee.com> Date: Thu, 21 Nov 2024 17:16:32 +0800 Subject: [PATCH 15/16] 1 --- app/mix/dao/mongo.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index fc514018..6bac65ed 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -1652,8 +1652,7 @@ func (m *Mongo) GetMomentListByStatus(ctx *gin.Context, status int64, limit, off list := make([]*dbstruct.Moment, 0) col := m.getColMoment() query := qmgo.M{ - "status": status, - "del_flag": 0, + "status": status, } err := col.Find(ctx, query).Sort("-ut").Skip(int64(offset)).Limit(int64(limit)).All(&list) if err == qmgo.ErrNoSuchDocuments { From 3e7cdc97128bc7773455e2ebecb8856061c903fe Mon Sep 17 00:00:00 2001 From: Robin <7434053+warrior_of_light_robin@user.noreply.gitee.com> Date: Thu, 21 Nov 2024 17:44:53 +0800 Subject: [PATCH 16/16] 1 --- app/mix/dao/mongo.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index 6bac65ed..d418946f 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -1651,6 +1651,7 @@ func (m *Mongo) GetMomentList(ctx *gin.Context, req *momentproto.OpListReq) ([]* 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, }