diff --git a/api/proto/imageaudittask/proto/imageaudittask_op.go b/api/proto/imageaudittask/proto/imageaudittask_op.go index 99b81dbb..edea796a 100644 --- a/api/proto/imageaudittask/proto/imageaudittask_op.go +++ b/api/proto/imageaudittask/proto/imageaudittask_op.go @@ -61,6 +61,7 @@ type OpListReq struct { Limit int `json:"limit"` Sort string NotAlignedOpt int + IndexName string } type OpListData struct { diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index 2c327b66..51370a72 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -3471,6 +3471,7 @@ func (m *Mongo) GetImageAuditTaskList(ctx *gin.Context, req *imageaudittaskproto if req.Sort != "" { sortClause = req.Sort } + opt := options2.Find().SetHint(req.IndexName) err := col.Find(ctx, query).Sort(sortClause).Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list) if err == qmgo.ErrNoSuchDocuments { err = nil diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 97361b59..93747f66 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3163,7 +3163,7 @@ func (s *Service) OpGetImageAuditTaskVOList(ctx *gin.Context, req *imageaudittas // 仅查询未对齐的任务 req.NotAlignedOpt = 1 - + req.IndexName = "idx_list" // 指定索引 list, err := _DefaultImageAuditTask.OpList(ctx, req) if err != nil { logger.Error("OpGetImageAuditTaskListByMid fail, req: %v, err: %v", util.ToJson(req), err) diff --git a/library/contentaudit/imageaudit/imageaudit.go b/library/contentaudit/imageaudit/imageaudit.go index b247281c..81ace85a 100644 --- a/library/contentaudit/imageaudit/imageaudit.go +++ b/library/contentaudit/imageaudit/imageaudit.go @@ -33,9 +33,10 @@ func Run(batchId string) (successNum int, failNum int, err error) { // 查询该批次所有审核任务 imageaudittasks, err := _DefaultImageAuditTask.OpList(&gin.Context{}, &imageaudittaskproto.OpListReq{ - BatchId: goproto.String(batchId), - Status: goproto.Int64(consts.ImageAudit_Created), - Sort: "ct", + BatchId: goproto.String(batchId), + Status: goproto.Int64(consts.ImageAudit_Created), + Sort: "ct", + IndexName: "idx_batch_id", }) if err != nil { logger.Info("_DefaultImageAuditTask OpList fail: %v", err)