精简登录弹窗并明确864扫码成功提示
This commit is contained in:
30
robot.py
30
robot.py
@@ -572,23 +572,6 @@ class Robot:
|
||||
current_record["expires_at"] = now_ts + expires_in
|
||||
|
||||
with self._ipad_login_qr_lock:
|
||||
history_records = list(self.ipad_login_qr_state.get("history", []) or [])
|
||||
# 二维码历史只在“uuid 发生变化”时追加一条:
|
||||
# 1. 倒计时刷新会非常频繁,如果每次都入历史,前端会被大量重复记录淹没;
|
||||
# 2. 这里把历史理解为“最近几次生成过哪些二维码”,而不是每一秒状态快照;
|
||||
# 3. 这样首页既能展示多个二维码记录,也能保持列表简洁可读。
|
||||
if uuid_value:
|
||||
existing_index = next(
|
||||
(index for index, item in enumerate(history_records) if str(item.get("uuid", "") or "") == uuid_value),
|
||||
-1,
|
||||
)
|
||||
history_entry = dict(current_record)
|
||||
if existing_index >= 0:
|
||||
history_records[existing_index] = history_entry
|
||||
else:
|
||||
history_records.insert(0, history_entry)
|
||||
history_records = history_records[:3]
|
||||
|
||||
self.ipad_login_qr_state = {
|
||||
"logged_in": False,
|
||||
"active": status != "confirmed",
|
||||
@@ -599,7 +582,7 @@ class Robot:
|
||||
"login_required": login_required,
|
||||
"status_text": status_text,
|
||||
"current": current_record,
|
||||
"history": history_records,
|
||||
"history": [],
|
||||
"updated_at": now_ts,
|
||||
}
|
||||
|
||||
@@ -618,15 +601,6 @@ class Robot:
|
||||
login_required = bool((payload or {}).get("login_required", False))
|
||||
|
||||
with self._ipad_login_qr_lock:
|
||||
history_records = list(self.ipad_login_qr_state.get("history", []) or [])
|
||||
if cleared_uuid:
|
||||
for item in history_records:
|
||||
if str(item.get("uuid", "") or "") == cleared_uuid:
|
||||
item["status"] = status
|
||||
item["status_text"] = status_text
|
||||
item["updated_at"] = now_ts
|
||||
item["updated_at_text"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(now_ts))
|
||||
|
||||
self.ipad_login_qr_state = {
|
||||
"logged_in": status in {"confirmed", "logged_in"} or bool(self.wxid),
|
||||
"active": False,
|
||||
@@ -637,7 +611,7 @@ class Robot:
|
||||
"login_required": login_required,
|
||||
"status_text": status_text,
|
||||
"current": {},
|
||||
"history": history_records[:3],
|
||||
"history": [],
|
||||
"updated_at": now_ts,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user