Files
customer-im-client-dev/apps/im_app/lib/data/remote/verify_otp_request.dart
pp-bot e715a0673b feat(chat): 发收消息全量实现 (#25~#28)
- 移除 @riverpod/@freezed 注解依赖,全部改为手写 Provider(无需 build_runner)
  · LoginState 改为纯 Dart,LoginViewModel/ThemeViewModel/ChatViewModel 改为 Notifier
  · UserNotifier 改为 FamilyAsyncNotifier<User?,int>,mini_app_provider 改为手写 Provider
  · 15 个 StreamProvider/StreamProvider.family 从 @riverpod 迁移至手写

- 发送消息(#25)
  · SendMessageRequest/SendMessageResponse DTO
  · SendMessageUseCase:乐观写入 DB → HTTP POST → 更新 Chat 摘要

- 接收消息 WS(#26)
  · WsMessageService:监听 mode2 WS 帧 → HTTP 补拉 → DB 写入 → Chat 更新
  · FetchHistoryRequest/FetchHistoryResponse DTO(GET /app/api/chat/history)
  · FetchHistoryUseCase:拉取 → insertOrReplaceAll

- DI 装配(chat_service_providers.dart)
  · wsMessageServiceProvider、sendMessageUseCaseProvider、fetchHistoryUseCaseProvider

- 聊天列表页(#27)
  · ChatListViewModel(Notifier<void>)+ chat_page.dart 真实会话列表 UI
  · ListTile:头像首字母、最新消息摘要、未读角标、时间格式化

- 聊天详情页(#28)
  · ChatDetailViewModel(FamilyNotifier<ChatDetailState,int>)+ chat_detail_page.dart
  · 消息气泡(自己/他人分左右)、底部输入框、发送状态与错误提示

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 23:16:44 +09:00

65 lines
1.9 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:json_annotation/json_annotation.dart';
import 'package:networks_sdk/networks_sdk.dart';
import 'package:im_app/core/foundation/api_paths.dart';
part 'verify_otp_request.g.dart';
/// 校验验证码接口的响应(服务端 data 字段)。
///
/// `token` 是 vcode_token用于后续 login-user 请求换取 access_token。
/// 纯 Dart 类,无需任何注解。`_$VerifyOtpResponseFromJson` 由生成器自动推导生成。
class VerifyOtpResponse {
/// 验证令牌,传给登录接口换取 access_token
final String token;
const VerifyOtpResponse({required this.token});
factory VerifyOtpResponse.fromJson(Map<String, dynamic> json) =>
VerifyOtpResponse(token: json['token'] as String? ?? '');
}
/// # /app/api/auth/vcode/check — 校验手机验证码
///
/// 校验成功后返回 [VerifyOtpResponse.token](即 vcode_token
/// 用于 [LoginRequest] 的 `vcode_token` 字段。
///
/// ## 数据流位置
///
/// ```
/// AuthRepositoryImpl.verifyOtp(countryCode, contact, code)
/// → _client.executeRequest( ★ VerifyOtpRequest ★ ) ← 你在这里
/// → 服务端 POST /app/api/auth/vcode/check
/// → SDK 拆包 {code, message, data} envelope
/// ← ★ VerifyOtpResponse ★ — token 即 vcode_token
/// ```
@ApiRequest(
path: ApiPaths.authVerifyOtp,
method: HttpMethod.post,
responseType: VerifyOtpResponse,
requestType: ApiRequestType.login,
)
class VerifyOtpRequest extends ApiRequestable<VerifyOtpResponse>
with _$VerifyOtpRequestApi {
@JsonKey(name: 'country_code')
final String countryCode;
final String contact;
/// 邮箱(手机号登录传空字符串)
final String email;
/// 用户输入的验证码
final String code;
/// type=1 表示手机号验证
final int type;
VerifyOtpRequest({
required this.countryCode,
required this.contact,
required this.code,
this.email = '',
this.type = 1,
});
}