fix: 后端连接失败自动重连重试;签到与每日计数改按本地日历日

1. 有时无法连接后端:
- 根因:请求连接失败直接抛错,运行中从不重新发现地址(睡眠唤醒后旧连接已死、后端换端口后必现)
- _send 对 GET 连接失败自动 rediscover + 重试 1 次;POST 不自动重试,避免签到/扣积分重复提交
- 启动重试从 5 次(约 31s)放宽到 10 次、间隔封顶 8s

2. 签到读日历,不按 24 小时:
- 根因:签到用 DateTime.UtcNow.Date,东八区要早上 8 点才翻篇,凌晨可同一天签到两次
- UserService(签到/人品值/二选一跨天计数)与 UserPayload 统一改 DateTime.Today 本地日历日
- 实测:本地 11-22 07:33(UTC 仍 11-21)时 last_sign_in=11-22,重复签到被拒,免费次数按本地日重置
This commit is contained in:
远影科技 committed 2026-11-22 07:33:56 +08:00
1 parent cfd6809714
commit 40d9da1c3d
5 files changed
+49 -8

No files matched your search

+2 -1
View File
@@ -242,7 +242,8 @@ public static class BackendServer
// 统一的用户响应体:前端一次拿齐签到 / 主题色需要的所有字段
object UserPayload(UserRecord r)
{
var today = DateTime.UtcNow.Date;
// 与 UserService 保持一致:本地日历日,不能用 UTC
var today = DateTime.Today;
int nextConsecutive;
if (!r.LastSignIn.HasValue) nextConsecutive = 1;
else