refactor(api): /v1/me 收敛 expire_at → 只发 expires_at(无 web 用户中心)

之前后端同时发 expire_at + expires_at(分别给 app + web 用户中心)。现已无 web 端,
双发是纯冗余,统一只用 expires_at:
- account.go:meResponse 删 ExpireAt 字段 + GetMe handler 不再赋值
- client me.dart:fromJson 删 (expires_at ?? expire_at) 别名回退
- 两端契约快照同步:Go meResponse 冻结集去 expire_at(12→11 key)、删 Dart 别名测试
- 验证:go test httpapi 绿、flutter test contract(14)绿、analyze EXIT 0、e2e 全链路绿

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-25 10:08:50 +08:00
parent dbd183ee00
commit 64f96fe018
4 changed files with 5 additions and 17 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ class Me {
bool get isFree => plan == 'free';
factory Me.fromJson(Map<String, dynamic> m) {
final exp = (m['expires_at'] ?? m['expire_at']) as String?;
final exp = m['expires_at'] as String?;
return Me(
email: m['email'] as String? ?? '',
plan: m['plan'] as String? ?? 'free',
@@ -87,14 +87,6 @@ void main() {
expect(me.weeklyGb, hasLength(7));
expect(me.totpEnabled, isTrue);
});
test('expires_at 接受别名 expire_at(后端历史兼容)', () {
final me = Me.fromJson({
..._meSample()..remove('expires_at'),
'expire_at': '2027-01-01T00:00:00Z',
});
expect(me.expiresAt, DateTime.tryParse('2027-01-01T00:00:00Z'));
});
});
group('/v1/usage 契约快照(UsagePoint)', () {