This commit is contained in:
Leufolium 2024-07-30 12:08:21 +08:00
parent 8fcef422bb
commit 2e08c98384
4 changed files with 7 additions and 4 deletions

View File

@ -61,6 +61,7 @@ type OpListReq struct {
Limit int `json:"limit"`
Sort string
NotAlignedOpt int
IndexName string
}
type OpListData struct {

View File

@ -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

View File

@ -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)

View File

@ -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)