|
@@ -12,6 +12,7 @@ from typing import Dict, List, Tuple
|
|
|
from feapder.db.mongodb import MongoDB
|
|
|
from feapder.pipelines import BasePipeline
|
|
|
from feapder.utils.log import log
|
|
|
+import feapder.utils.tools as tools
|
|
|
|
|
|
|
|
|
class MongoPipeline(BasePipeline):
|
|
@@ -92,17 +93,5 @@ class TaskPipeline(MongoPipeline):
|
|
|
@param str table: 表名
|
|
|
@param dict condition: 查询条件
|
|
|
@param limit: 查询数量
|
|
|
- @return:
|
|
|
"""
|
|
|
- items = self.to_db.find(table, condition, limit)
|
|
|
- datas = [{'_id': item['_id'], 'state': 1} for item in items]
|
|
|
- update_keys = ['state']
|
|
|
- try:
|
|
|
- self.to_db.add_batch(
|
|
|
- coll_name=table,
|
|
|
- datas=datas,
|
|
|
- update_columns=update_keys,
|
|
|
- )
|
|
|
- except Exception as e:
|
|
|
- log.exception(e)
|
|
|
- return items
|
|
|
+ return self.to_db.find(table, condition, limit)
|