by Robin at 20240227; when audit task is nil set its status = success

This commit is contained in:
Leufolium 2024-02-27 19:18:52 +08:00
parent 9e935ee8df
commit 4458e8228c
1 changed files with 20 additions and 8 deletions

View File

@ -1608,17 +1608,23 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe
// 封装动态审核任务
momentAuditTask := &dbstruct.MomentAuditTask{
AssociativeTableId: goproto.String(fmt.Sprint(util.DerefInt64(req.Moment.Id))),
ImageAuditTaskStatus: goproto.Int64(consts.MomentAudit_Created),
TextAuditTaskStatus: goproto.Int64(consts.MomentAudit_Created),
AuditedMedia: req.Moment.MediaComp,
AuditedText: req.Moment.Text,
AssociativeTableId: goproto.String(fmt.Sprint(util.DerefInt64(req.Moment.Id))),
//ImageAuditTaskStatus: goproto.Int64(consts.MomentAudit_Created),
//TextAuditTaskStatus: goproto.Int64(consts.MomentAudit_Created),
AuditedMedia: req.Moment.MediaComp,
AuditedText: req.Moment.Text,
}
if len(imageaudittasks) > 0 {
momentAuditTask.ImageAuditTaskId = imageaudittasks[0].Id
momentAuditTask.ImageAuditTaskStatus = goproto.Int64(consts.MomentAudit_Created)
} else {
momentAuditTask.ImageAuditTaskStatus = goproto.Int64(consts.MomentAudit_Passed)
}
if len(textaudittasks) > 0 {
momentAuditTask.TextAuditTaskId = textaudittasks[0].Id
momentAuditTask.TextAuditTaskStatus = goproto.Int64(consts.MomentAudit_Created)
} else {
momentAuditTask.TextAuditTaskStatus = goproto.Int64(consts.MomentAudit_Passed)
}
if err := _DefaultMomentAuditTask.OpCreate(ctx, &moment_audit_taskproto.OpCreateReq{
MomentAuditTask: momentAuditTask,
@ -1673,17 +1679,23 @@ func (s *Service) ApiUpdateMoment(ctx *gin.Context, req *momentproto.ApiUpdateRe
// 封装动态审核任务
momentAuditTask := &dbstruct.MomentAuditTask{
AssociativeTableId: goproto.String(fmt.Sprint(util.DerefInt64(req.Moment.Id))),
ImageAuditTaskStatus: goproto.Int64(consts.MomentAudit_Created),
TextAuditTaskStatus: goproto.Int64(consts.MomentAudit_Created),
AssociativeTableId: goproto.String(fmt.Sprint(util.DerefInt64(req.Moment.Id))),
//ImageAuditTaskStatus: goproto.Int64(consts.MomentAudit_Created),
//TextAuditTaskStatus: goproto.Int64(consts.MomentAudit_Created),
}
if len(imageaudittasks) > 0 {
momentAuditTask.AuditedMedia = imageaudittasks[0].AuditedMedia
momentAuditTask.ImageAuditTaskId = imageaudittasks[0].Id
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)
}
if err := _DefaultMomentAuditTask.OpCreate(ctx, &moment_audit_taskproto.OpCreateReq{
MomentAuditTask: momentAuditTask,