111
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/// 资产总览模型
|
||||
/// 資產總覽模型
|
||||
class AssetOverview {
|
||||
final String totalAsset;
|
||||
final String fundBalance;
|
||||
@@ -22,7 +22,7 @@ class AssetOverview {
|
||||
}
|
||||
}
|
||||
|
||||
/// 资金账户模型
|
||||
/// 資金賬戶模型
|
||||
class AccountFund {
|
||||
final int id;
|
||||
final int userId;
|
||||
@@ -51,7 +51,7 @@ class AccountFund {
|
||||
}
|
||||
}
|
||||
|
||||
/// 交易账户模型(持仓)
|
||||
/// 交易賬戶模型(持倉)
|
||||
class AccountTrade {
|
||||
final int id;
|
||||
final int userId;
|
||||
@@ -78,7 +78,7 @@ class AccountTrade {
|
||||
});
|
||||
|
||||
factory AccountTrade.fromJson(Map<String, dynamic> json) {
|
||||
// 后端返回 value(当前价值),前端用 currentValue
|
||||
// 後端返回 value(當前價值),前端用 currentValue
|
||||
final quantityNum =
|
||||
double.tryParse(json['quantity']?.toString() ?? '0') ?? 0;
|
||||
final avgPriceNum =
|
||||
@@ -108,7 +108,7 @@ class AccountTrade {
|
||||
);
|
||||
}
|
||||
|
||||
/// 格式化盈亏率
|
||||
/// 格式化盈虧率
|
||||
String get formattedProfitRate {
|
||||
final prefix = profitRate >= 0 ? '+' : '';
|
||||
return '$prefix${profitRate.toStringAsFixed(2)}%';
|
||||
@@ -118,7 +118,7 @@ class AccountTrade {
|
||||
bool get isProfit => profitRate >= 0;
|
||||
}
|
||||
|
||||
/// 资金流水模型
|
||||
/// 資金流水模型
|
||||
class AccountFlow {
|
||||
final int id;
|
||||
final int userId;
|
||||
@@ -155,26 +155,26 @@ class AccountFlow {
|
||||
);
|
||||
}
|
||||
|
||||
/// 流水类型文字
|
||||
/// 流水類型文字
|
||||
String get flowTypeText {
|
||||
switch (flowType) {
|
||||
case '1':
|
||||
return '充值';
|
||||
case '2':
|
||||
return '提现';
|
||||
return '提現';
|
||||
case '3':
|
||||
return '转入交易账户';
|
||||
return '轉入交易賬戶';
|
||||
case '4':
|
||||
return '从交易账户转出';
|
||||
return '從交易賬戶轉出';
|
||||
case '5':
|
||||
return '卖出收入';
|
||||
return '賣出收入';
|
||||
case '6':
|
||||
return '买入支出';
|
||||
return '買入支出';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
|
||||
/// 是否为收入
|
||||
/// 是否為收入
|
||||
bool get isIncome => ['1', '3', '5'].contains(flowType);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// 币种模型
|
||||
/// 幣種模型
|
||||
class Coin {
|
||||
final int id;
|
||||
final String code;
|
||||
@@ -7,7 +7,7 @@ class Coin {
|
||||
final double price;
|
||||
final double? priceUsd;
|
||||
final double? priceCny;
|
||||
final int priceType; // 1=实时价格, 2=管理员设置
|
||||
final int priceType; // 1=實時價格, 2=管理員設置
|
||||
final double change24h;
|
||||
final double? high24h;
|
||||
final double? low24h;
|
||||
@@ -70,7 +70,7 @@ class Coin {
|
||||
};
|
||||
}
|
||||
|
||||
/// 显示图标(Unicode 符号)
|
||||
/// 顯示圖標(Unicode 符號)
|
||||
String get displayIcon {
|
||||
const icons = {
|
||||
'BTC': '\u20BF',
|
||||
@@ -85,22 +85,22 @@ class Coin {
|
||||
return icons[code] ?? '\u25CF';
|
||||
}
|
||||
|
||||
/// 格式化价格显示
|
||||
/// 格式化價格顯示
|
||||
String get formattedPrice {
|
||||
if (price >= 1000) return price.toStringAsFixed(2);
|
||||
if (price >= 1) return price.toStringAsFixed(4);
|
||||
return price.toStringAsFixed(6);
|
||||
}
|
||||
|
||||
/// 格式化涨跌幅
|
||||
/// 格式化漲跌幅
|
||||
String get formattedChange {
|
||||
final prefix = change24h >= 0 ? '+' : '';
|
||||
return '$prefix${change24h.toStringAsFixed(2)}%';
|
||||
}
|
||||
|
||||
/// 是否上涨
|
||||
/// 是否上漲
|
||||
bool get isUp => change24h >= 0;
|
||||
|
||||
/// 是否为实时价格
|
||||
/// 是否為實時價格
|
||||
bool get isRealtime => priceType == 1;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/// 交易订单模型
|
||||
/// 交易訂單模型
|
||||
class OrderTrade {
|
||||
final int id;
|
||||
final String orderNo;
|
||||
final int userId;
|
||||
final String coinCode;
|
||||
final int direction; // 1=买入, 2=卖出
|
||||
final int direction; // 1=買入, 2=賣出
|
||||
final String price;
|
||||
final String quantity;
|
||||
final String amount;
|
||||
final int status; // 1=待处理, 2=已完成, 3=已取消
|
||||
final int status; // 1=待處理, 2=已完成, 3=已取消
|
||||
final DateTime? createTime;
|
||||
final DateTime? updateTime;
|
||||
|
||||
@@ -47,13 +47,13 @@ class OrderTrade {
|
||||
}
|
||||
|
||||
/// 方向文字
|
||||
String get directionText => direction == 1 ? '买入' : '卖出';
|
||||
String get directionText => direction == 1 ? '買入' : '賣出';
|
||||
|
||||
/// 状态文字
|
||||
/// 狀態文字
|
||||
String get statusText {
|
||||
switch (status) {
|
||||
case 1:
|
||||
return '待处理';
|
||||
return '待處理';
|
||||
case 2:
|
||||
return '已完成';
|
||||
case 3:
|
||||
@@ -63,33 +63,33 @@ class OrderTrade {
|
||||
}
|
||||
}
|
||||
|
||||
/// 是否为买入
|
||||
/// 是否為買入
|
||||
bool get isBuy => direction == 1;
|
||||
}
|
||||
|
||||
/// 充提订单模型
|
||||
/// 充提訂單模型
|
||||
class OrderFund {
|
||||
final int id;
|
||||
final String orderNo;
|
||||
final int userId;
|
||||
final String username;
|
||||
final int type; // 1=充值, 2=提现
|
||||
final int type; // 1=充值, 2=提現
|
||||
final String amount;
|
||||
final String? fee; // 手续费
|
||||
final String? receivableAmount; // 应收款项
|
||||
final String? fee; // 手續費
|
||||
final String? receivableAmount; // 應收款項
|
||||
final int status;
|
||||
// 充值状态: 1=待付款, 2=待确认, 3=已完成, 4=已驳回, 5=已取消
|
||||
// 提现状态: 1=待审批, 2=已出款, 3=已驳回, 4=已取消, 5=待财务审核
|
||||
final int? walletId; // 冷钱包ID(充值)
|
||||
final String? walletAddress; // 钱包地址(充值/提现)
|
||||
final String? network; // 提现网络类型
|
||||
final String? withdrawContact; // 提现联系方式
|
||||
// 充值狀態: 1=待付款, 2=待確認, 3=已完成, 4=已駁回, 5=已取消
|
||||
// 提現狀態: 1=待審批, 2=已出款, 3=已駁回, 4=已取消, 5=待財務審核
|
||||
final int? walletId; // 冷錢包ID(充值)
|
||||
final String? walletAddress; // 錢包地址(充值/提現)
|
||||
final String? network; // 提現網絡類型
|
||||
final String? withdrawContact; // 提現聯繫方式
|
||||
final String remark;
|
||||
final String? rejectReason;
|
||||
final String? adminRemark;
|
||||
final DateTime? createTime;
|
||||
final DateTime? payTime; // 用户确认打款时间
|
||||
final DateTime? confirmTime; // 管理员确认时间
|
||||
final DateTime? payTime; // 用戶確認打款時間
|
||||
final DateTime? confirmTime; // 管理員確認時間
|
||||
|
||||
OrderFund({
|
||||
required this.id,
|
||||
@@ -143,72 +143,72 @@ class OrderFund {
|
||||
);
|
||||
}
|
||||
|
||||
/// 订单类型文字
|
||||
String get typeText => type == 1 ? '充值' : '提现';
|
||||
/// 訂單類型文字
|
||||
String get typeText => type == 1 ? '充值' : '提現';
|
||||
|
||||
/// 状态文字 (根据类型区分)
|
||||
/// 狀態文字 (根據類型區分)
|
||||
String get statusText {
|
||||
if (type == 1) {
|
||||
// 充值状态
|
||||
// 充值狀態
|
||||
switch (status) {
|
||||
case 1:
|
||||
return '待付款';
|
||||
case 2:
|
||||
return '待确认';
|
||||
return '待確認';
|
||||
case 3:
|
||||
return '已完成';
|
||||
case 4:
|
||||
return '已驳回';
|
||||
return '已駁回';
|
||||
case 5:
|
||||
return '已取消';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
} else {
|
||||
// 提现状态
|
||||
// 提現狀態
|
||||
switch (status) {
|
||||
case 1:
|
||||
return '待审批';
|
||||
return '待審批';
|
||||
case 2:
|
||||
return '已出款';
|
||||
case 3:
|
||||
return '已驳回';
|
||||
return '已駁回';
|
||||
case 4:
|
||||
return '已取消';
|
||||
case 5:
|
||||
return '待财务审核';
|
||||
return '待財務審核';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 是否为充值
|
||||
/// 是否為充值
|
||||
bool get isDeposit => type == 1;
|
||||
|
||||
/// 是否可取消
|
||||
/// 充值: 仅待付款可取消
|
||||
/// 提现: 仅待审批可取消
|
||||
/// 充值: 僅待付款可取消
|
||||
/// 提現: 僅待審批可取消
|
||||
bool get canCancel {
|
||||
if (type == 1) {
|
||||
return status == 1; // 充值待付款
|
||||
} else {
|
||||
return status == 1; // 提现待审批
|
||||
return status == 1; // 提現待審批
|
||||
}
|
||||
}
|
||||
|
||||
/// 是否可确认打款 (仅充值待付款)
|
||||
/// 是否可確認打款 (僅充值待付款)
|
||||
bool get canConfirmPay => type == 1 && status == 1;
|
||||
}
|
||||
|
||||
/// 冷钱包模型
|
||||
/// 冷錢包模型
|
||||
class ColdWallet {
|
||||
final int id;
|
||||
final String name;
|
||||
final String address;
|
||||
final String network;
|
||||
final bool isDefault;
|
||||
final int status; // 0=禁用, 1=启用
|
||||
final int status; // 0=禁用, 1=啟用
|
||||
final DateTime? createTime;
|
||||
|
||||
ColdWallet({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// 用户模型
|
||||
/// 用戶模型
|
||||
class User {
|
||||
final int id;
|
||||
final String username;
|
||||
@@ -62,21 +62,21 @@ class User {
|
||||
};
|
||||
}
|
||||
|
||||
/// 获取头像显示文字(用户名首字母)
|
||||
/// 獲取頭像顯示文字(用戶名首字母)
|
||||
String get avatarText =>
|
||||
username.isNotEmpty ? username.substring(0, 1).toUpperCase() : 'U';
|
||||
|
||||
/// KYC 状态文字
|
||||
/// KYC 狀態文字
|
||||
String get kycStatusText {
|
||||
switch (kycStatus) {
|
||||
case 0:
|
||||
return '未认证';
|
||||
return '未認證';
|
||||
case 1:
|
||||
return '审核中';
|
||||
return '審核中';
|
||||
case 2:
|
||||
return '已认证';
|
||||
return '已認證';
|
||||
case 3:
|
||||
return '认证失败';
|
||||
return '認證失敗';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ import '../../core/network/api_response.dart';
|
||||
import '../../core/network/dio_client.dart';
|
||||
import '../models/account_models.dart';
|
||||
|
||||
/// 资产服务
|
||||
/// 資產服務
|
||||
class AssetService {
|
||||
final DioClient _client;
|
||||
|
||||
AssetService(this._client);
|
||||
|
||||
/// 获取资产总览
|
||||
/// 獲取資產總覽
|
||||
Future<ApiResponse<AssetOverview>> getOverview() async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.assetOverview,
|
||||
@@ -21,17 +21,17 @@ class AssetService {
|
||||
response.message,
|
||||
);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取资产总览失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取資產總覽失敗');
|
||||
}
|
||||
|
||||
/// 获取资金账户
|
||||
/// 獲取資金賬戶
|
||||
Future<ApiResponse<AccountFund>> getFundAccount() async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.fundAccount,
|
||||
);
|
||||
|
||||
if (response.success && response.data != null) {
|
||||
// 后端返回格式: {"fund": {...}}
|
||||
// 後端返回格式: {"fund": {...}}
|
||||
final fundData = response.data!['fund'] as Map<String, dynamic>?;
|
||||
if (fundData != null) {
|
||||
return ApiResponse.success(
|
||||
@@ -40,25 +40,25 @@ class AssetService {
|
||||
);
|
||||
}
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取资金账户失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取資金賬戶失敗');
|
||||
}
|
||||
|
||||
/// 获取交易账户
|
||||
/// 獲取交易賬戶
|
||||
Future<ApiResponse<List<AccountTrade>>> getTradeAccount() async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.tradeAccount,
|
||||
);
|
||||
|
||||
if (response.success && response.data != null) {
|
||||
// 后端返回格式: {"positions": [...]}
|
||||
// 後端返回格式: {"positions": [...]}
|
||||
final list = response.data!['positions'] as List?;
|
||||
final accounts = list?.map((e) => AccountTrade.fromJson(e as Map<String, dynamic>)).toList() ?? [];
|
||||
return ApiResponse.success(accounts, response.message);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取交易账户失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取交易賬戶失敗');
|
||||
}
|
||||
|
||||
/// 资金划转
|
||||
/// 資金劃轉
|
||||
Future<ApiResponse<void>> transfer({
|
||||
required int direction,
|
||||
required String amount,
|
||||
@@ -72,7 +72,7 @@ class AssetService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取资金流水
|
||||
/// 獲取資金流水
|
||||
Future<ApiResponse<Map<String, dynamic>>> getFlow({
|
||||
int? flowType,
|
||||
int pageNum = 1,
|
||||
@@ -90,7 +90,7 @@ class AssetService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取每日盈亏数据
|
||||
/// 獲取每日盈虧數據
|
||||
Future<ApiResponse<Map<String, dynamic>>> getDailyProfit({
|
||||
required int year,
|
||||
required int month,
|
||||
@@ -102,6 +102,6 @@ class AssetService {
|
||||
if (response.success && response.data != null) {
|
||||
return ApiResponse.success(response.data!, response.message);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取每日盈亏数据失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取每日盈虧數據失敗');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ import '../../core/constants/api_endpoints.dart';
|
||||
import '../../core/network/api_response.dart';
|
||||
import '../../core/network/dio_client.dart';
|
||||
|
||||
/// 福利中心服务
|
||||
/// 福利中心服務
|
||||
class BonusService {
|
||||
final DioClient _client;
|
||||
|
||||
BonusService(this._client);
|
||||
|
||||
/// 获取福利中心状态
|
||||
/// 獲取福利中心狀態
|
||||
Future<ApiResponse<Map<String, dynamic>>> getWelfareStatus() async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.bonusWelfare,
|
||||
@@ -16,10 +16,10 @@ class BonusService {
|
||||
if (response.success && response.data != null) {
|
||||
return ApiResponse.success(response.data!, response.message);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取福利状态失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取福利狀態失敗');
|
||||
}
|
||||
|
||||
/// 领取首充福利
|
||||
/// 領取首充福利
|
||||
Future<ApiResponse<Map<String, dynamic>>> claimNewUserBonus() async {
|
||||
return _client.post<Map<String, dynamic>>(
|
||||
ApiEndpoints.bonusClaim,
|
||||
@@ -27,7 +27,7 @@ class BonusService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 领取推广奖励
|
||||
/// 領取推廣獎勵
|
||||
Future<ApiResponse<Map<String, dynamic>>> claimReferralBonus(
|
||||
int referredUserId,
|
||||
int milestone,
|
||||
@@ -41,4 +41,21 @@ class BonusService {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// 領取間接推廣獎勵
|
||||
Future<ApiResponse<Map<String, dynamic>>> claimIndirectReferralBonus(
|
||||
int directReferralId,
|
||||
int indirectReferredUserId,
|
||||
int milestone,
|
||||
) async {
|
||||
return _client.post<Map<String, dynamic>>(
|
||||
ApiEndpoints.bonusClaim,
|
||||
data: {
|
||||
'type': 'indirect_referral',
|
||||
'directReferralId': directReferralId,
|
||||
'indirectReferredUserId': indirectReferredUserId,
|
||||
'milestone': milestone,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ import '../../core/network/api_response.dart';
|
||||
import '../../core/network/dio_client.dart';
|
||||
import '../models/order_models.dart';
|
||||
|
||||
/// 充提服务
|
||||
/// 充提服務
|
||||
class FundService {
|
||||
final DioClient _client;
|
||||
|
||||
FundService(this._client);
|
||||
|
||||
/// 获取默认钱包地址
|
||||
/// 獲取默認錢包地址
|
||||
Future<ApiResponse<ColdWallet>> getDefaultWallet() async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.defaultWallet,
|
||||
@@ -21,10 +21,10 @@ class FundService {
|
||||
response.message,
|
||||
);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取钱包地址失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取錢包地址失敗');
|
||||
}
|
||||
|
||||
/// 申请充值
|
||||
/// 申請充值
|
||||
/// 返回包含 orderNo, amount, status, walletAddress, walletNetwork 的信息
|
||||
Future<ApiResponse<Map<String, dynamic>>> deposit({
|
||||
required String amount,
|
||||
@@ -39,7 +39,7 @@ class FundService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 用户确认已打款
|
||||
/// 用戶確認已打款
|
||||
Future<ApiResponse<void>> confirmPay(String orderNo) async {
|
||||
return _client.post<void>(
|
||||
ApiEndpoints.confirmPay,
|
||||
@@ -47,7 +47,7 @@ class FundService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 申请提现
|
||||
/// 申請提現
|
||||
Future<ApiResponse<Map<String, dynamic>>> withdraw({
|
||||
required String amount,
|
||||
required String withdrawAddress,
|
||||
@@ -67,7 +67,7 @@ class FundService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取可用的提现网络列表
|
||||
/// 獲取可用的提現網絡列表
|
||||
Future<ApiResponse<List<String>>> getWalletNetworks() async {
|
||||
final response = await _client.get<List<dynamic>>(
|
||||
ApiEndpoints.walletNetworks,
|
||||
@@ -78,10 +78,10 @@ class FundService {
|
||||
response.message,
|
||||
);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取网络列表失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取網絡列表失敗');
|
||||
}
|
||||
|
||||
/// 取消订单
|
||||
/// 取消訂單
|
||||
Future<ApiResponse<void>> cancelOrder(String orderNo) async {
|
||||
return _client.post<void>(
|
||||
ApiEndpoints.cancelOrder,
|
||||
@@ -89,7 +89,7 @@ class FundService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取充提记录
|
||||
/// 獲取充提記錄
|
||||
Future<ApiResponse<Map<String, dynamic>>> getOrders({
|
||||
int? type,
|
||||
int pageNum = 1,
|
||||
@@ -107,7 +107,7 @@ class FundService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 解析充提记录列表
|
||||
/// 解析充提記錄列表
|
||||
List<OrderFund> parseOrderList(List<dynamic>? list) {
|
||||
if (list == null) return [];
|
||||
return list.map((e) => OrderFund.fromJson(e as Map<String, dynamic>)).toList();
|
||||
|
||||
@@ -3,13 +3,13 @@ import '../../core/network/api_response.dart';
|
||||
import '../../core/network/dio_client.dart';
|
||||
import '../models/coin.dart';
|
||||
|
||||
/// 行情服务
|
||||
/// 行情服務
|
||||
class MarketService {
|
||||
final DioClient _client;
|
||||
|
||||
MarketService(this._client);
|
||||
|
||||
/// 获取币种列表
|
||||
/// 獲取幣種列表
|
||||
Future<ApiResponse<List<Coin>>> getCoinList() async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.coinList,
|
||||
@@ -20,10 +20,10 @@ class MarketService {
|
||||
final coins = list?.map((e) => Coin.fromJson(e as Map<String, dynamic>)).toList() ?? [];
|
||||
return ApiResponse.success(coins, response.message);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取币种列表失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取幣種列表失敗');
|
||||
}
|
||||
|
||||
/// 获取币种详情
|
||||
/// 獲取幣種詳情
|
||||
Future<ApiResponse<Coin>> getCoinDetail(String code) async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.coinDetail,
|
||||
@@ -36,10 +36,10 @@ class MarketService {
|
||||
response.message,
|
||||
);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取币种详情失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取幣種詳情失敗');
|
||||
}
|
||||
|
||||
/// 搜索币种
|
||||
/// 搜索幣種
|
||||
Future<ApiResponse<List<Coin>>> searchCoins(String keyword) async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.coinSearch,
|
||||
@@ -51,6 +51,6 @@ class MarketService {
|
||||
final coins = list?.map((e) => Coin.fromJson(e as Map<String, dynamic>)).toList() ?? [];
|
||||
return ApiResponse.success(coins, response.message);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '搜索失败');
|
||||
return ApiResponse.fail(response.message ?? '搜索失敗');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ import '../../core/network/api_response.dart';
|
||||
import '../../core/network/dio_client.dart';
|
||||
import '../models/order_models.dart';
|
||||
|
||||
/// 交易服务
|
||||
/// 交易服務
|
||||
class TradeService {
|
||||
final DioClient _client;
|
||||
|
||||
TradeService(this._client);
|
||||
|
||||
/// 买入
|
||||
/// 買入
|
||||
Future<ApiResponse<Map<String, dynamic>>> buy({
|
||||
required String coinCode,
|
||||
required String price,
|
||||
@@ -25,7 +25,7 @@ class TradeService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 卖出
|
||||
/// 賣出
|
||||
Future<ApiResponse<Map<String, dynamic>>> sell({
|
||||
required String coinCode,
|
||||
required String price,
|
||||
@@ -41,7 +41,7 @@ class TradeService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取交易记录
|
||||
/// 獲取交易記錄
|
||||
Future<ApiResponse<Map<String, dynamic>>> getOrders({
|
||||
String? coinCode,
|
||||
int? direction,
|
||||
@@ -61,7 +61,7 @@ class TradeService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取订单详情
|
||||
/// 獲取訂單詳情
|
||||
Future<ApiResponse<OrderTrade>> getOrderDetail(String orderNo) async {
|
||||
final response = await _client.get<Map<String, dynamic>>(
|
||||
ApiEndpoints.tradeOrderDetail,
|
||||
@@ -74,6 +74,6 @@ class TradeService {
|
||||
response.message,
|
||||
);
|
||||
}
|
||||
return ApiResponse.fail(response.message ?? '获取订单详情失败');
|
||||
return ApiResponse.fail(response.message ?? '獲取訂單詳情失敗');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@ import '../../core/network/api_response.dart';
|
||||
import '../../core/network/dio_client.dart';
|
||||
import '../models/user.dart';
|
||||
|
||||
/// 用户服务
|
||||
/// 用戶服務
|
||||
class UserService {
|
||||
final DioClient _client;
|
||||
|
||||
UserService(this._client);
|
||||
|
||||
/// 用户登录
|
||||
/// 用戶登錄
|
||||
Future<ApiResponse<Map<String, dynamic>>> login(
|
||||
String username,
|
||||
String password,
|
||||
@@ -22,7 +22,7 @@ class UserService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 用户注册(multipart:含身份证图片和可选推广码)
|
||||
/// 用戶註冊(multipart:含身份證圖片和可選推廣碼)
|
||||
Future<ApiResponse<Map<String, dynamic>>> register(
|
||||
String username,
|
||||
String password, {
|
||||
@@ -43,7 +43,7 @@ class UserService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 获取用户信息
|
||||
/// 獲取用戶信息
|
||||
Future<ApiResponse<User>> getUserInfo() async {
|
||||
return _client.get<User>(
|
||||
ApiEndpoints.userInfo,
|
||||
@@ -51,8 +51,8 @@ class UserService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 上传 KYC 资料(身份证正反面图片字节)
|
||||
/// 使用 fromBytes 以兼容 Web 和移动端
|
||||
/// 上傳 KYC 資料(身份證正反面圖片字節)
|
||||
/// 使用 fromBytes 以兼容 Web 和移動端
|
||||
Future<ApiResponse<void>> uploadKyc(
|
||||
Uint8List frontBytes,
|
||||
Uint8List backBytes,
|
||||
@@ -67,7 +67,7 @@ class UserService {
|
||||
);
|
||||
}
|
||||
|
||||
/// 退出登录
|
||||
/// 退出登錄
|
||||
Future<ApiResponse<void>> logout() async {
|
||||
return _client.post<void>(ApiEndpoints.logout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user