保存前端调整前的当前状态
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
10 files changed
+204
-3
No files matched your search
@@ -366,6 +366,25 @@ class Store:
|
||||
self._persist(db)
|
||||
return {'ok': True}
|
||||
|
||||
def remove(self, data):
|
||||
"""Remove queue rows only; retain files, acceptance ledger and post bindings."""
|
||||
ids = data.get('ids')
|
||||
if not isinstance(ids, list) or not ids or not all(isinstance(id, str) and id for id in ids):
|
||||
raise ValueError('请选择要移除的文章')
|
||||
ids = list(dict.fromkeys(ids))
|
||||
with self.lock, self.db() as db:
|
||||
if self.run['running']:
|
||||
raise ValueError('请先暂停流程,再移除文章')
|
||||
# Validate the entire selection before deleting anything.
|
||||
for id in ids:
|
||||
job = self._job(db, id)
|
||||
if id == self.run['active']:
|
||||
raise ValueError('当前任务不能直接移除,请先通过“人工核对 / 处理”核对并移出')
|
||||
if job['state'] in SUBMITTED or (job.get('submitted_at') and job['state'] not in ACCEPTED):
|
||||
raise ValueError('文章提交结果尚未核对,请先核对并处理后再移除')
|
||||
db.executemany('DELETE FROM jobs WHERE id=?', [(id,) for id in ids])
|
||||
return {'ok': True, 'removed': len(ids)}
|
||||
|
||||
def takeover(self, data):
|
||||
with self.lock, self.db() as db:
|
||||
if self.run['running']:
|
||||
|
||||
Reference in new issue
Block a user