Merge branch 'dev' —— 完整昵称缓存测试与文档

This commit is contained in:
2026-10-19 11:16:06 +08:00
2 changed files with 20 additions and 1 deletions
+3
View File
@@ -186,6 +186,9 @@
- 读不到(没登录/没注册/设备离线)→ `200 {"ok":false,"error":"人话原因"}`;
设备端保留上次显示的值即可
- 平台侧有约 1.5 秒缓存,素材页每 2 秒轮询不会每次都跑 `dumpsys`
- **完整昵称优先**:平台广播下发过完整昵称后会记进 `device.cur_account_name`;
轮询时若 `dumpsys` 的打码名与它匹配(如 `锋哥苏***探访` ↔ `锋哥苏州百业探访`),
返回完整名(`masked=false`, `source=platform`),不会再被轮询覆盖成 `***`
- 完整未打码昵称仍用 u2 读「我」页(§5.5);这个接口只保证“快”和“免 root”
- 设备端「切换账号 / 读取本机账号名字」成功后仍会通过广播主动推一次(§5.5),
比轮询更快
+17 -1
View File
@@ -21,8 +21,9 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspa
os.chdir(sys.path[0])
from flask import Flask # noqa: E402
from core.models import db, init_db, DeviceAccount # noqa: E402
from core.models import db, init_db, DeviceAccount, Device # noqa: E402
from core import account_folder as af # noqa: E402
from core import account_probe as ap # noqa: E402
from core import device_pool # noqa: E402
from tasks.generic import task as gt # noqa: E402
@@ -177,6 +178,21 @@ check("元素不存在 = 没检出异常 → 写「正常」",
DeviceAccount.query.filter_by(nickname="周周苏州吃喝玩乐").first().account_status,
"正常")
print("▶ ⑥ 完整昵称缓存:轮询的打码名不覆盖完整名")
db.session.add(Device(serial="A11:5555", name="A11", enabled=True))
db.session.commit()
check("广播后记住完整名", ap.remember_name("A11:5555", "锋哥苏州百业探访"), True)
check("Device 行里是完整名",
Device.query.get("A11:5555").cur_account_name, "锋哥苏州百业探访")
ap.cache_names({"A11:5555": {"name": "锋哥苏***探访"}})
db.session.expire_all()
check("匹配的打码名不覆盖完整名",
Device.query.get("A11:5555").cur_account_name, "锋哥苏州百业探访")
ap.cache_names({"A11:5555": {"name": "周周苏***探访"}})
db.session.expire_all()
check("换了号(打码名对不上)→ 更新成新探测值",
Device.query.get("A11:5555").cur_account_name, "周周苏***探访")
print()
if fails:
print("❌ 失败 %d 项:%s" % (len(fails), "、".join(fails)))