新增 AnalysisController 提供 6 个分析接口: - /admin/analysis/profit - 盈利分析(交易手续费/充提手续费/资金利差) - /admin/analysis/cash-flow - 资金流动趋势(按月统计充值/提现/净流入) - /admin/analysis/trade - 交易分析(买入/卖出统计+趋势) - /admin/analysis/coin-distribution - 币种交易分布 - /admin/analysis/user-growth - 用户增长分析(新增/活跃用户) - /admin/analysis/risk - 风险指标(大额交易/异常提现/KYC/冻结账户) - /admin/analysis/health - 综合健康度评分 更新 Mapper 添加分析查询方法: - OrderFundMapper: 手续费统计、时间范围查询、大额交易、异常提现 - OrderTradeMapper: 交易金额统计、活跃用户、币种分布 前端 API 对接: - 新增 6 个分析相关 Query hooks - 更新 analytics.vue 使用真实数据 - 动态决策建议基于实际数据
98 lines
2.6 KiB
Dart
98 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shadcn_ui/shadcn_ui.dart';
|
|
|
|
/// 币种卡片组件 - 用于显示币种信息
|
|
class CoinCard extends StatelessWidget {
|
|
final String code;
|
|
final String name;
|
|
final String price;
|
|
final String change;
|
|
final bool isUp;
|
|
final String? icon;
|
|
final VoidCallback? onTap;
|
|
|
|
// 颜色常量
|
|
static const upColor = Color(0xFF00C853);
|
|
static const downColor = Color(0xFFFF5252);
|
|
|
|
const CoinCard({
|
|
super.key,
|
|
required this.code,
|
|
required this.name,
|
|
required this.price,
|
|
required this.change,
|
|
this.isUp = true,
|
|
this.icon,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = ShadTheme.of(context);
|
|
|
|
return ShadCard(
|
|
padding: const EdgeInsets.all(16),
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
child: Row(
|
|
children: [
|
|
// 图标
|
|
Container(
|
|
width: 44,
|
|
height: 44,
|
|
decoration: BoxDecoration(
|
|
color: theme.colorScheme.primary.withOpacity(0.1),
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
icon ?? code.substring(0, 1),
|
|
style: TextStyle(
|
|
fontSize: 20,
|
|
color: theme.colorScheme.primary,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
// 名称
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'$code/USDT',
|
|
style: theme.textTheme.large.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Text(
|
|
name,
|
|
style: theme.textTheme.muted,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// 涨跌幅
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
|
decoration: BoxDecoration(
|
|
color: isUp ? upColor.withOpacity(0.2) : downColor.withOpacity(0.2),
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: Text(
|
|
change,
|
|
style: TextStyle(
|
|
color: isUp ? upColor : downColor,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|