ci(build-bot): 支持 version= 指定版本并加速 macOS 构建 #40
No files matched your search
@@ -317,3 +317,14 @@ mingw-w64 14.0.0_3 携带 GCC 16.2,与 Flutter 插件(flutter_inappwebview_w
|
||||
- 注册→签到(10分)→连摇27次:费用 0/0.1×5/0.2×5/0.5×15/1.0,余额始终精确到 0.01,10 分花到 0
|
||||
- 二选一首免、余额不足报「积分不足,本次需要 0.5 积分」(400)
|
||||
- 重启进程后 user.yaml 自动登录 + 当日计数持久化生效;测试账号 billtest 已删
|
||||
|
||||
### 提交与推送(21:50,cfd6809)
|
||||
- 单提交 57 文件(含 RELEASE-1.1.2.md 与工作日志),同时推:github → main、origin2(xhmcl) → feat/user-system(PR #39)
|
||||
|
||||
## 连接稳定性 + 签到日历日修复(11-22 07:30,用户反馈两项)
|
||||
1. 「有时无法连接后端」根因:_send 连接失败直接抛错,运行中从不 rediscover/重试(睡眠唤醒断连、后端换端口后必现)
|
||||
- 修:GET 连接失败自动 rediscover + 重试 1 次;POST 不自动重试(防签到/扣积分重复提交)
|
||||
- 启动重试 5 次(31s) → 10 次、间隔封顶 8s(约 70s)
|
||||
2. 签到用 DateTime.UtcNow.Date → 东八区早上 8 点才算新一天,7 点前可同日签到两次
|
||||
- 修:UserService 4 处 + UserPayload 1 处改 DateTime.Today(本地日历日);人品值/二选一跨天计数一并修
|
||||
- 实测(本地 07:33 / UTC 07-21):last_sign_in=2026-11-22,重复签到被拒,人品值按本地日重置
|
||||
@@ -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
|
||||
|
||||
@@ -396,7 +396,9 @@ public sealed class UserService
|
||||
return false;
|
||||
}
|
||||
|
||||
var today = DateTime.UtcNow.Date;
|
||||
// 本地日历日:签到按用户机器上的「今天」算(0 点翻篇),不能用 UTC——
|
||||
// 否则东八区用户要到早上 8 点才算新的一天,会出现同一天签到两次。
|
||||
var today = DateTime.Today;
|
||||
if (rec.LastSignIn.HasValue)
|
||||
{
|
||||
var diff = (today - rec.LastSignIn.Value.Date).Days;
|
||||
@@ -536,7 +538,9 @@ public sealed class UserService
|
||||
error = "";
|
||||
cost = 0;
|
||||
|
||||
var today = DateTime.UtcNow.Date;
|
||||
// 本地日历日:签到按用户机器上的「今天」算(0 点翻篇),不能用 UTC——
|
||||
// 否则东八区用户要到早上 8 点才算新的一天,会出现同一天签到两次。
|
||||
var today = DateTime.Today;
|
||||
// 跨天了先重置计数
|
||||
if (featureDate.HasValue && featureDate.Value.Date != today)
|
||||
featureCount = 0;
|
||||
@@ -572,7 +576,9 @@ public sealed class UserService
|
||||
return false;
|
||||
}
|
||||
|
||||
var today = DateTime.UtcNow.Date;
|
||||
// 本地日历日:签到按用户机器上的「今天」算(0 点翻篇),不能用 UTC——
|
||||
// 否则东八区用户要到早上 8 点才算新的一天,会出现同一天签到两次。
|
||||
var today = DateTime.Today;
|
||||
var count = rec.FortuneDate.HasValue && rec.FortuneDate.Value.Date == today
|
||||
? rec.FortuneCount : 0;
|
||||
|
||||
@@ -608,7 +614,9 @@ public sealed class UserService
|
||||
return false;
|
||||
}
|
||||
|
||||
var today = DateTime.UtcNow.Date;
|
||||
// 本地日历日:签到按用户机器上的「今天」算(0 点翻篇),不能用 UTC——
|
||||
// 否则东八区用户要到早上 8 点才算新的一天,会出现同一天签到两次。
|
||||
var today = DateTime.Today;
|
||||
var count = rec.PickDate.HasValue && rec.PickDate.Value.Date == today
|
||||
? rec.PickCount : 0;
|
||||
|
||||
|
||||
@@ -533,6 +533,26 @@ class GcApi {
|
||||
{Map<String, String>? query,
|
||||
Object? body,
|
||||
Duration? timeout}) async {
|
||||
try {
|
||||
return await _sendOnce(method, path,
|
||||
query: query, body: body, timeout: timeout);
|
||||
} on ApiException catch (e) {
|
||||
// HTTP 层错误(后端明确回了 4xx/5xx)不是连接问题,直接抛。
|
||||
if (e.statusCode != null) rethrow;
|
||||
// 连接层失败:可能是电脑睡眠唤醒后旧连接已死,或后端换了端口。
|
||||
// 重新解析地址后重试一次。只对 GET 自动重试——POST(签到/扣积分)
|
||||
// 在连接不确定的情况下重发可能重复计费,宁可让用户手动再点。
|
||||
if (method != 'GET') rethrow;
|
||||
if (!rediscover()) rethrow;
|
||||
return await _sendOnce(method, path,
|
||||
query: query, body: body, timeout: timeout);
|
||||
}
|
||||
}
|
||||
|
||||
Future<dynamic> _sendOnce(String method, String path,
|
||||
{Map<String, String>? query,
|
||||
Object? body,
|
||||
Duration? timeout}) async {
|
||||
final uri = _uri(path, query);
|
||||
final auth = _authHeaders;
|
||||
late http.Response response;
|
||||
|
||||
@@ -82,10 +82,11 @@ class ShellController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 后端没起来时自动重试(2s、4s、8s…最多 5 次),不必让用户手动点。
|
||||
/// 后端没起来时自动重试(1s、2s、4s、之后每次 8s,共 10 次 ≈ 70 秒),
|
||||
/// 不必让用户手动点。重试前 rediscover() 重新解析地址与令牌。
|
||||
void _scheduleRetry() {
|
||||
if (_retryAttempt >= 5) return;
|
||||
final seconds = 1 << _retryAttempt; // 1,2,4,8,16
|
||||
if (_retryAttempt >= 10) return;
|
||||
final seconds = 1 << _retryAttempt.clamp(0, 3); // 1,2,4,8,8,8…(封顶 8s)
|
||||
_retryAttempt++;
|
||||
_retryTimer?.cancel();
|
||||
_retryTimer = Timer(Duration(seconds: seconds), () {
|
||||
|
||||
Reference in new issue
Block a user