conf-245 #825
|
@ -4167,7 +4167,7 @@ func (m *Mongo) UpdateMomentAuditTaskByMomentIdsAndStatus(ctx *gin.Context, mome
|
|||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) TryToFinishyImageAuditTaskOfMoment(ctx *gin.Context, task *dbstruct.ImageAuditTask, opinion string) (*dbstruct.MomentAuditTask, error) {
|
||||
func (m *Mongo) TryToFinishImageAuditTaskOfMoment(ctx *gin.Context, task *dbstruct.ImageAuditTask, opinion string) (*dbstruct.MomentAuditTask, error) {
|
||||
col := m.getColMomentAuditTask()
|
||||
filter := qmgo.M{
|
||||
"image_audit_task_id": task.GetId(),
|
||||
|
|
|
@ -129,23 +129,36 @@ func (handler *ImageAuditTaskResultHandler) generateMomentMediaComponentUpdateFu
|
|||
// 20240703:同步动态审核表触发人审的逻辑改到handler实现
|
||||
// moment_audit_task有image_audit_task_id的索引,以该索引作为更新依据
|
||||
// image_audit_task有associative_table_id的内容,以该id去触发moment的更新
|
||||
// 通过逻辑只做恢复,不包含任何触发人审的操作
|
||||
|
||||
//20240403更新: 增加成功后处理的切面
|
||||
//20241122更新: 将广场动态机审逻辑完全改为空间动态机审逻辑
|
||||
if option == consts.ImageAuditTaskUpdate_Success {
|
||||
return tryToFinishImageAuditTaskOfMoment(ctx, task)
|
||||
}
|
||||
|
||||
if option == consts.ImageAuditTaskUpdate_Pass {
|
||||
return passMomentImageAuditTask(ctx, task)
|
||||
imageAuditOpinion := &strings.Builder{}
|
||||
if task.GetStatus() == consts.ImageAudit_ServiceFailed {
|
||||
imageAuditOpinion.WriteString("机审失败")
|
||||
} else {
|
||||
if err := rollbackMomentImageAuditTask(ctx, task); err != nil {
|
||||
// 写入具体原因
|
||||
for i, pass := range task.AuditedMediaResults {
|
||||
if !pass {
|
||||
imageaudit := task.ImageAudits[i]
|
||||
imageAuditOpinion.WriteString(fmt.Sprintf("图片%d:%s; ", i+1, strings.Join(imageaudit.NotPassScenes, ",")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err := _DefaultMomentAuditTask.OpUpdateByMomentIdsAndStatus(ctx, &dbstruct.MomentAuditTask{
|
||||
ImageAuditTaskStatus: task.Status,
|
||||
ImageAuditOpinion: goproto.String(imageAuditOpinion.String()),
|
||||
}, []string{fmt.Sprint(task.GetAssociativeTableId())}, consts.MomentManuallyReview_Waiting)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return tryToFinishImageAuditTaskOfMoment(ctx, task)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 私密动态表->图像内容,若不通过,则写入不通过的原因
|
||||
|
@ -300,62 +313,6 @@ func (handler *ImageAuditTaskResultHandler) generateStreamerAuthApprovalDetailsA
|
|||
}
|
||||
}
|
||||
|
||||
// 通过动态表图像
|
||||
func passMomentImageAuditTask(ctx *gin.Context, task *dbstruct.ImageAuditTask) (err error) {
|
||||
if err := _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{
|
||||
Moment: &dbstruct.Moment{
|
||||
Id: task.AssociativeTableId,
|
||||
MediaComp: task.AuditedMedia,
|
||||
DelFlag: goproto.Int64(consts.Exist),
|
||||
},
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := _DefaultMomentAuditTask.OpUpdateByImageAuditTaskIds(ctx, &dbstruct.MomentAuditTask{
|
||||
FinalMedia: task.AuditedMedia,
|
||||
}, []string{task.GetId()}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 回退动态表图像
|
||||
func rollbackMomentImageAuditTask(ctx *gin.Context, task *dbstruct.ImageAuditTask) (err error) {
|
||||
auditedImageIds := util.DerefInt64Slice(task.AuditedMedia.ImageIds)
|
||||
imageIds := make([]int64, 0)
|
||||
for i, pass := range task.AuditedMediaResults {
|
||||
if pass {
|
||||
imageIds = append(imageIds, auditedImageIds[i])
|
||||
}
|
||||
}
|
||||
if len(imageIds) != 0 {
|
||||
mediaComp := &dbstruct.MediaComponent{
|
||||
ImageIds: &imageIds,
|
||||
}
|
||||
|
||||
if err := _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{
|
||||
Moment: &dbstruct.Moment{
|
||||
Id: task.AssociativeTableId,
|
||||
MediaComp: mediaComp,
|
||||
Status: goproto.Int64(consts.Moment_AuditRejected),
|
||||
},
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := _DefaultMomentAuditTask.OpUpdateByImageAuditTaskIds(ctx, &dbstruct.MomentAuditTask{
|
||||
FinalMedia: mediaComp,
|
||||
}, []string{task.GetId()}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
} else {
|
||||
return _DefaultMoment.OpDelete(ctx, util.DerefInt64(task.AssociativeTableId))
|
||||
}
|
||||
}
|
||||
|
||||
// 尝试完成审核
|
||||
func tryToFinishImageAuditTaskOfMoment(ctx *gin.Context, task *dbstruct.ImageAuditTask) error {
|
||||
// 机审通过,尝试触发moment_audit_task的人审
|
||||
|
|
|
@ -92,9 +92,9 @@ func (p *MomentAuditTask) OpUpdateByMomentIdsAndStatus(ctx *gin.Context, moment_
|
|||
}
|
||||
|
||||
func (p *MomentAuditTask) TryToFinishImageAuditTask(ctx *gin.Context, task *dbstruct.ImageAuditTask, opinion string) (isFinished bool, err error) {
|
||||
instance, err := p.store.TryToFinishyImageAuditTaskOfMoment(ctx, task, opinion)
|
||||
instance, err := p.store.TryToFinishImageAuditTaskOfMoment(ctx, task, opinion)
|
||||
if err != nil {
|
||||
logger.Error("TryToFinishyImageAuditTaskOfMoment fail, err: %v", err)
|
||||
logger.Error("TryToFinishImageAuditTaskOfMoment fail, err: %v", err)
|
||||
return false, err
|
||||
}
|
||||
if instance == nil {
|
||||
|
|
|
@ -1509,15 +1509,12 @@ func (s *Service) OpReviewMoment(ctx *gin.Context, req *momentproto.OpReviewReq)
|
|||
return
|
||||
}
|
||||
|
||||
// 更新请求,如果是通过,则恢复删除标志
|
||||
// 更新请求
|
||||
updateReq := &momentproto.OpUpdateReq{
|
||||
Moment: &dbstruct.Moment{
|
||||
Status: goproto.Int64(finalMomentStatus),
|
||||
},
|
||||
}
|
||||
if req.OpType == consts.MomentManuallyReview_Pass {
|
||||
updateReq.Moment.DelFlag = goproto.Int64(consts.Exist)
|
||||
}
|
||||
|
||||
// 更新动态的状态
|
||||
err = _DefaultMoment.OpUpdateByIdsAndStatus(ctx, updateReq, req.MomentIds, consts.Moment_ManuallyReviewing)
|
||||
|
|
|
@ -153,31 +153,23 @@ func (handler *TextAuditTaskResultHandler) generateMomentTextUpdateFunc() {
|
|||
// 20240703:同步动态审核表触发人审的逻辑改到handler实现
|
||||
// moment_audit_task有text_audit_task_id的索引,以该索引作为更新依据
|
||||
// text_audit_task有associative_table_id的内容,以该id去触发moment的更新
|
||||
// 通过逻辑只做恢复,不包含任何触发人审的操作
|
||||
|
||||
//20240403更新: 增加成功后处理的切面
|
||||
if option == consts.TextAuditTaskUpdate_Success {
|
||||
return tryToFinishTextAuditTaskOfMoment(ctx, task)
|
||||
}
|
||||
|
||||
momentId := task.AssociativeTableId
|
||||
var text *string
|
||||
if option == consts.TextAuditTaskUpdate_Pass {
|
||||
text = task.AuditedText
|
||||
var textAuditOpinion string
|
||||
if task.GetStatus() == consts.TextAudit_ServiceFailed {
|
||||
textAuditOpinion = "机审失败"
|
||||
} else {
|
||||
text = task.OldText
|
||||
textAuditOpinion = fmt.Sprintf("%s;", strings.Join(task.TextAudit.NotPassScenes, ","))
|
||||
}
|
||||
if err := _DefaultMoment.OpUpdate(ctx, &momentproto.OpUpdateReq{
|
||||
Moment: &dbstruct.Moment{
|
||||
Id: momentId,
|
||||
Text: text,
|
||||
},
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := _DefaultMomentAuditTask.OpUpdateByTextAuditTaskIds(ctx, &dbstruct.MomentAuditTask{
|
||||
FinalText: text,
|
||||
}, []string{util.DerefString(task.Id)}); err != nil {
|
||||
err := _DefaultMomentAuditTask.OpUpdateByMomentIdsAndStatus(ctx, &dbstruct.MomentAuditTask{
|
||||
TextAuditTaskStatus: task.Status,
|
||||
TextAuditOpinion: goproto.String(textAuditOpinion),
|
||||
}, []string{fmt.Sprint(task.GetAssociativeTableId())}, consts.MomentManuallyReview_Waiting)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -82,15 +82,30 @@ func (handler *VideoModerationTaskResultHandler) generateMomentMediaComponentUpd
|
|||
return tryToFinishVideoModerationTaskOfMoment(ctx, task)
|
||||
}
|
||||
|
||||
if option == consts.ImageAuditTaskUpdate_Pass {
|
||||
//return passMomentVideoModerationTask(ctx, task)
|
||||
return nil
|
||||
|
||||
videoModerationOpinion := &strings.Builder{}
|
||||
if task.GetStatus() == consts.VideoModeration_ServiceFailed {
|
||||
videoModerationOpinion.WriteString("机审失败")
|
||||
} else {
|
||||
return tryToFinishVideoModerationTaskOfMoment(ctx, task)
|
||||
// 写入具体原因
|
||||
for i, pass := range task.AuditedMediaResults {
|
||||
if !pass {
|
||||
videoModerationOpinion.WriteString(fmt.Sprintf("视频%d:%s ", i+1, task.Description[i]))
|
||||
}
|
||||
}
|
||||
}
|
||||
task.BusinessOpinion = goproto.String(videoModerationOpinion.String())
|
||||
|
||||
err := _DefaultMomentAuditTask.OpUpdateByMomentIdsAndStatus(ctx, &dbstruct.MomentAuditTask{
|
||||
ImageAuditTaskStatus: task.Status,
|
||||
ImageAuditOpinion: goproto.String(videoModerationOpinion.String()),
|
||||
}, []string{fmt.Sprint(task.GetAssociativeTableId())}, consts.MomentManuallyReview_Waiting)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tryToFinishVideoModerationTaskOfMoment(ctx, task)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 私密动态表->图像内容,若不通过,则写入不通过的原因
|
||||
|
|
Loading…
Reference in New Issue