修复新闻工作台换号联动流程

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
LongtailandCopilot committed 2026-11-01 15:11:41 +08:00
1 parent 7ab0bc3485
commit fd9474d0e1
15 files changed
+203 -34

No files matched your search

+9 -3
View File
@@ -165,13 +165,19 @@ class Store:
self.run['owner'] = owner
if self.run['switch']:
switch = self.run['switch']
if account['uid'] != switch['from'] and data.get('extension', {}).get('idle') is True:
ext = data.get('extension') or {}
if ext.get('ready') is not True:
self.run.update(running=False, reason='换号插件联动接口未就绪,请在原安装目录更新并重新加载插件、刷新网站后继续;未重新抽号')
self._persist(db)
return dict(action='idle', run=self.run)
if account['uid'] != switch['from'] and ext.get('idle') is True:
self.run.update(batch=self._batch(account), switch=None)
self._persist(db)
else:
ext = data.get('extension', {})
# Pending means no click was issued. Time spent stopped, or
# waiting for the plugin, is not a failed login attempt.
elapsed = time.time() - switch.get('clicked_at', switch['created_at'])
if ext.get('paused') or (switch['state'] == 'clicked' and elapsed > 10 and ext.get('idle')) or elapsed > 120:
if ext.get('paused') or (switch['state'] == 'clicked' and (elapsed > 120 or (elapsed > 10 and ext.get('idle')))):
self.run.update(running=False, reason='换号已暂停、超时或账号未改变,请检查插件并人工恢复,禁止重复抽号')
self._persist(db)
return dict(action='idle', run=self.run)