优化自动登录,自动登录之后就改一下运行状态

This commit is contained in:
liuwei
2025-05-09 09:49:44 +08:00
parent bbc3757d38
commit 2fa51533d5

View File

@@ -310,8 +310,11 @@ class Robot(Job):
self.LOG.debug("心跳进行中")
else:
self.LOG.warning("心跳失败")
self.LOG.error(f"wechat_ipad heartbeat heartbeat twice_auto_auth ")
self.login_twice_auto_auth()
except Exception as e:
self.LOG.error(f"wechat_ipad heartbeat: {e}")
self.login_twice_auto_auth()
await asyncio.sleep(5)
async def _heartbeat_task_long(self):
@@ -324,13 +327,11 @@ class Robot(Job):
self.LOG.debug("长连接心跳进行中")
else:
self.LOG.warning("长连接心跳失败")
self.LOG.error(f"wechat_ipad heartbeat long twice_auto_auth ")
self.login_twice_auto_auth()
except Exception as e:
self.LOG.error(f"wechat_ipad heartbeat long: {e}")
success = await self.ipad_bot.twice_auto_auth()
if success:
self.LOG.debug("尝试二次登录成功")
else:
self.LOG.warning("尝试二次登录失败")
self.login_twice_auto_auth()
await asyncio.sleep(10)
async def _process_ipad_message(self, message: WxMessage):
@@ -592,6 +593,11 @@ class Robot(Job):
resp = self.ipad_bot.twice_auto_auth()
if resp:
self.LOG.info(f"定时二次登录成功!")
if self.ipad_running:
self.LOG.info(f"ipad_wechat running:{self.ipad_running}")
else:
self.ipad_running = True
self.LOG.info(f"ipad_wechat stopped change running:{self.ipad_running}")
else:
self.LOG.error(f"定时二次登录失败!")
except Exception as e: