feat: 增加任务批量勾选和重新上报 (#89)
This commit is contained in:
@@ -998,6 +998,25 @@ class TaskRepository:
|
||||
connection.close()
|
||||
return self._to_outbox(row) if row is not None else None
|
||||
|
||||
def latest_result_outbox(
|
||||
self, remote_task_id: str
|
||||
) -> Optional[OutboxEventRecord]:
|
||||
"""读取任务最新的成功结果事件,不返回失败上报事件。"""
|
||||
|
||||
connection = open_database(self._db_path)
|
||||
try:
|
||||
row = connection.execute(
|
||||
"SELECT o.* FROM outbox_events o"
|
||||
" JOIN pdd_tasks t ON t.id = o.task_id"
|
||||
" WHERE t.remote_task_id = ?"
|
||||
" AND o.event_type IN ('collect_result', 'purchase_result')"
|
||||
" ORDER BY o.id DESC LIMIT 1",
|
||||
(remote_task_id,),
|
||||
).fetchone()
|
||||
finally:
|
||||
connection.close()
|
||||
return self._to_outbox(row) if row is not None else None
|
||||
|
||||
def get_outbox_event(self, event_id: int) -> Optional[OutboxEventRecord]:
|
||||
connection = open_database(self._db_path)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user