Merge branch 'fix/pyright-env-and-type-guards' into dev
This commit is contained in:
@@ -221,9 +221,11 @@ class ManualMixin:
|
||||
account.esports_opened = manual_type is not None and manual_type >= 1
|
||||
# 到期时间也落库 —— 否则界面只能显示"已开通",看不到什么时候到期
|
||||
expire_raw = result.get("expire_time")
|
||||
expire_int = (
|
||||
int(expire_raw) if str(expire_raw or "").strip().isdigit() else None
|
||||
)
|
||||
# 先规整成字符串再判 isdigit:原来写 `int(expire_raw) if str(expire_raw
|
||||
# or "").strip().isdigit()` —— 判的是 A、转的是 B,类型检查器收窄不了,
|
||||
# 而且同一份值取了两遍。规整到一个局部变量后两个问题一起没了。
|
||||
expire_text = str(expire_raw or "").strip()
|
||||
expire_int = int(expire_text) if expire_text.isdigit() else None
|
||||
# ⚠️ 斗鱼用 0 表示「没有到期时间」。直接存 0 的话界面会显示 1970/1/1
|
||||
# (这个坑在积分到期上踩过一次,这里别再踩)。
|
||||
account.esports_expire_time = (
|
||||
|
||||
Reference in New Issue
Block a user