rwadurian/frontend/mining-app/lib/data/models/p2p_transfer_model.dart

62 lines
1.6 KiB
Dart

/// P2P转账记录模型
class P2pTransferModel {
final String transferNo;
final String fromAccountSequence;
final String toAccountSequence;
final String toPhone;
final String amount;
final String? memo;
final String status;
final DateTime createdAt;
P2pTransferModel({
required this.transferNo,
required this.fromAccountSequence,
required this.toAccountSequence,
required this.toPhone,
required this.amount,
this.memo,
required this.status,
required this.createdAt,
});
factory P2pTransferModel.fromJson(Map<String, dynamic> json) {
return P2pTransferModel(
transferNo: json['transferNo'] ?? '',
fromAccountSequence: json['fromAccountSequence'] ?? '',
toAccountSequence: json['toAccountSequence'] ?? '',
toPhone: json['toPhone'] ?? '',
amount: json['amount']?.toString() ?? '0',
memo: json['memo'],
status: json['status'] ?? 'PENDING',
createdAt: json['createdAt'] != null
? DateTime.parse(json['createdAt'])
: DateTime.now(),
);
}
}
/// 账户查询结果模型
class AccountLookupModel {
final String accountSequence;
final String phone;
final String? nickname;
final bool exists;
AccountLookupModel({
required this.accountSequence,
required this.phone,
this.nickname,
required this.exists,
});
factory AccountLookupModel.fromJson(Map<String, dynamic> json) {
return AccountLookupModel(
accountSequence: json['accountSequence'] ?? '',
phone: json['phone'] ?? '',
nickname: json['nickname'],
exists: json['exists'] ?? false,
);
}
}