Skip to content

Commit e22443e

Browse files
committed
fix: checkin 端点漏传 already_checked_in 字段
界面仍显示「签到成功,获得 — 积分」,抓 API 响应发现 already_checked_in 根本没在响应里——上一轮只改了前端判断, 但后端 checkin 端点是手写的 dict,漏了新加的字段。前端等不到它, 永远走不到「已签到」分支。 同时修掉一个连带 bug:已签到(没领到新积分)时也触发了额度重探测, 是无意义的上游请求。改为只在真正签到成功时探测。 后端 582 测试 / 覆盖 100%。浏览器复验: 提示「今天已签到,请明天再来」,不再出现「获得 — 积分」。
1 parent 17c1566 commit e22443e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/main.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,12 @@ async def checkin_credential(credential_id: str,
347347
if provider is None or data is None or not hasattr(provider, "checkin"):
348348
raise InvalidRequest("credential does not support checkin")
349349
result = await provider.checkin(data)
350-
if result.ok:
351-
schedule_probe(credential_id) # 签到发放积分 → 立即刷新额度
350+
if result.ok and not result.already_checked_in:
351+
schedule_probe(credential_id) # 只有真签到了才会发积分
352+
# already_checked_in 必须透传:前端靠它区分「刚签到」与「今天已签过」
352353
return {"ok": result.ok, "credit": result.credit, "code": result.code,
353-
"message": result.message}
354+
"message": result.message,
355+
"already_checked_in": result.already_checked_in}
354356

355357
@app.get("/api/credentials/{credential_id}/accounts")
356358
async def list_credential_accounts(credential_id: str,

0 commit comments

Comments
 (0)