fix: 埋点上传链路三处修复 + 注册手机号 +86 前缀
CI / flutter-gates (push) Successful in 1m3s

- events 上传地址接错:AnalyticsService 误用 auth(8081),实际端点在
  user 服务(8082),新增 patbondUserApiBaseUrl 并接线
- 冲刷时机:新增 flushNow(),SessionTracker 首次离开前台触发,
  修复低活跃用户凑不满 20 条事件永不上传
- 毒丸批次:4xx 永久性拒绝不再重回队列无限重试,丢弃并打日志
- Web/桌面 Platform API 降级(kIsWeb + _platformName)
- 注册手机号 UI 固定 +86 前缀、提交拼 E.164;AppTextField 支持 prefixText

51 测试全绿、analyze 0 问题;Linux 桌面实测注册成功,
curl 实测后端 /api/v1/events 校验行为符合契约。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-07 16:48:36 +08:00
parent 8ea6265046
commit 1afec6aad1
6 changed files with 53 additions and 4 deletions
+7
View File
@@ -10,6 +10,13 @@ const String patbondApiBaseUrl = String.fromEnvironment(
defaultValue: 'http://127.0.0.1:8081',
);
/// user 服务基地址(/api/v1/me、/api/v1/events):MVP 阶段 auth 与 user
/// 分端口直连(ADR-002 无网关),`--dart-define=PATBOND_USER_API_BASE_URL=...` 注入。
const String patbondUserApiBaseUrl = String.fromEnvironment(
'PATBOND_USER_API_BASE_URL',
defaultValue: 'http://127.0.0.1:8082',
);
/// 构建全局共用的 Dio 实例。
///
/// `validateStatus` 放行所有状态码:错误信封由 [ApiClient] 统一解析成
+6
View File
@@ -11,6 +11,7 @@ class AppTextField extends StatefulWidget {
super.key,
this.controller,
this.prefixIcon,
this.prefixText,
this.errorText,
this.helperText,
this.enabled = true,
@@ -25,6 +26,10 @@ class AppTextField extends StatefulWidget {
final String label;
final TextEditingController? controller;
final IconData? prefixIcon;
/// 固定前缀文本(如手机号的 '+86 '),仅展示与拼接语义,不进输入值。
final String? prefixText;
final String? errorText;
final String? helperText;
final bool enabled;
@@ -62,6 +67,7 @@ class _AppTextFieldState extends State<AppTextField> {
labelText: widget.label,
errorText: widget.errorText,
helperText: widget.helperText,
prefixText: widget.prefixText,
prefixIcon: widget.prefixIcon == null
? null
: Icon(widget.prefixIcon, color: AppColors.muted),