feat(welfare): 完成不活跃清零-邀请金不清 + 预警编排 + worker + admin口径统一
- 清零改两桶(金币 + 折算现金);邀请奖励金物理隔离、不清(产品红线),仅快照入审计 - 预警编排 select_warn_candidates / run_warn_once / run_once(分档 + streak 去重); notifier.warn 去掉 invite 参数(邀请金不清、不预警) - 预警逐用户 try/except 隔离 + run_once 保证预警故障绝不阻塞清零(接真推送前必备) - 每日 worker inactivity_reset_worker(文件锁 + 北京日守卫 + RUN_HOUR 门槛 + 总闸默认关) + main.py lifespan 接线 - admin 最近活跃口径改用共享 activity(移除 last_login_at、纳入 home_view 占位) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,9 +15,10 @@ logger = logging.getLogger("shagua.inactivity")
|
||||
class InactivityNotifier(Protocol):
|
||||
channel: str
|
||||
|
||||
def warn(self, *, user_id: int, coin: int, cash_cents: int, invite_cash_cents: int,
|
||||
def warn(self, *, user_id: int, coin: int, cash_cents: int,
|
||||
stage: int, days_until_reset: int) -> str:
|
||||
"""发预警,返回状态:'sent' / 'failed' / 'placeholder'。"""
|
||||
"""发预警(只涉及会被清的金币 + 折算现金;邀请现金不清、不预警)。
|
||||
返回状态:'sent' / 'failed' / 'placeholder'。"""
|
||||
...
|
||||
|
||||
|
||||
@@ -26,12 +27,11 @@ class LogNotifier:
|
||||
|
||||
channel = "log"
|
||||
|
||||
def warn(self, *, user_id: int, coin: int, cash_cents: int, invite_cash_cents: int,
|
||||
def warn(self, *, user_id: int, coin: int, cash_cents: int,
|
||||
stage: int, days_until_reset: int) -> str:
|
||||
logger.warning(
|
||||
"[inactivity-warn] user=%s coin=%s cash_cents=%s invite_cash_cents=%s "
|
||||
"stage=T-%s days_until_reset=%s",
|
||||
user_id, coin, cash_cents, invite_cash_cents, stage, days_until_reset,
|
||||
"[inactivity-warn] user=%s coin=%s cash_cents=%s stage=T-%s days_until_reset=%s",
|
||||
user_id, coin, cash_cents, stage, days_until_reset,
|
||||
)
|
||||
return "placeholder"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user