8 Commits
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
ce9cc5b72e |
feat(telemetry): 完整实现 presence-service 迁移 + Flutter 遥测接入
## 后端 (backend/services/telemetry-service) ### 修复骨架中的关键缺陷 - 创建本地 JwtAuthGuard / AdminGuard,替换不存在的 @genex/common 包 - 修复 req.user.sub → req.user.id(与 JwtStrategy.validate() 返回值对齐) - 重写 Dockerfile,移除对不存在的 packages/common 目录的引用 - 更新 telemetry.module.ts,将 JwtAuthGuard / AdminGuard 注册为 providers - admin-telemetry.controller.ts 改用本地 AdminGuard(检查 role === 'admin') ### 新增功能 - GET /api/v1/telemetry/config:公开配置下发接口 Flutter TelemetryConfig.syncFromRemote() 每小时拉取,返回全局开关、采样率、 心跳间隔等配置,所有字段支持环境变量覆盖(TELEMETRY_GLOBAL_ENABLED 等) - 设备字段(deviceBrand/deviceModel/deviceOs/appVersion/locale)提升为顶层列 BatchEventsDto / TelemetryEvent 实体 / recordEvents() 全链路补齐 原因:JSONB 内字段无法走 B-tree 索引,千万级数据分组查询需独立列 ### DB 迁移 - 050_add_device_fields_to_telemetry_events.sql:为已有 telemetry_events 表 新增 5 个设备字段列和 device_brand / app_version 索引 ### docker-compose 环境变量 - telemetry-service 新增 TELEMETRY_GLOBAL_ENABLED / SAMPLING_RATE / HEARTBEAT_INTERVAL / CONFIG_VERSION 环境变量,支持生产环境热调整 ## 前端 ### genex-mobile (Flutter 消费者端) - 复制 lib/core/telemetry/ 模块(11个文件):TelemetryService、 HeartbeatService、SessionManager、TelemetryUploader、TelemetryStorage 等 - 修正 API 路径:presence/heartbeat → telemetry/heartbeat, analytics/events → telemetry/events - pubspec.yaml 新增依赖:uuid ^4.3.3、equatable ^2.0.5、device_info_plus ^10.1.0 - main.dart:initState 首帧回调初始化 TelemetryService(需 BuildContext 采集设备信息) 已登录时自动注入 accessToken - auth_service.dart:_setAuth() 登录成功后注入 userId + accessToken; _clearAuth() 退出时清除(同时覆盖 Token 过期自动清除场景) ### admin-app (Flutter 发行方控制台) - 复制 lib/core/telemetry/ 模块(同上) - pubspec.yaml 新增依赖:uuid、equatable、device_info_plus、shared_preferences - IssuerLoginPage:initState 首帧初始化 + 登录成功后注入 userId/token 使用 api.gogenex.cn(与 UpdateService 域名一致) - settings_page.dart:退出登录时调用 clearUserId() + clearAccessToken() ## 架构说明 - 在线人数:Redis Sorted Set (genex:presence:online),心跳 60s/次,180s 窗口判定在线 - DAU:app_session_start 事件写入 telemetry_events,每天凌晨 1 点聚合到 daily_active_stats 表,同时每小时滚动更新当日 DAU - 设备字段采用 Amplitude 风格:前端本地队列存 properties 内, toServerJson() 上传时自动提升为顶层字段,后端写入独立索引列 - 心跳需要 JWT 认证(未登录用户自动跳过,不报错) - 遥测完全异步,任何失败只打 debug 日志,不影响主流程 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
|
|
|
24400ad663 |
fix(admin-app): 消除UI层硬编码中文,补充i18n keys(zh/en/ja)
- 新增 29 个 i18n keys 到三语言文件(credit_score_unit, finance_confirm_withdraw, redemption_failed, store_no_stores, settings_confirm_logout, coupon_status_* 等) - 修复 10 个页面中的硬编码中文字符串: credit_page: 分数单位、权重、空状态 finance_page: 提现对话框、SnackBar、时间格式、空状态 redemption_page: 错误消息、批量结果、空状态、时间格式 store_management_page: 门店/员工空状态 settings_page: 退出确认对话框、层级权益描述 coupon_list_page: 状态徽章(在售/待审/售罄/下架) coupon_detail_page: 面值/发行价标签 ai_agent_page: 错误回复消息 issuer_dashboard_page: 信用分单位 - 剩余中文仅存于 /// 注释和 mock 数据数组中(将被真实API数据替换) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
|
|
|
3a57b0fd4d |
feat: 全平台API对齐 — 4个前端应用55+页面接入真实后端API
跨越 genex-mobile、admin-app、admin-web、miniapp 四个前端应用,
将所有页面从 mock 硬编码数据替换为真实后端 API 调用,
同时补建后端缺失的 27+ 个端点,实现前后端完整联通。
## 后端新增 (4个微服务, 27+端点)
### issuer-service — 5个新Controller, 19个新文件
- IssuerStatsController: GET /issuers/me/stats, /credit (发行商仪表盘统计+信用)
- IssuerFinanceController: GET/POST balance/stats/transactions/withdraw/reconciliation
- IssuerStoreController: CRUD /issuers/me/stores + /employees (门店+员工管理)
- RedemptionController: POST scan/manual/batch, GET history/today-stats (核销)
- CouponBatchController: POST issue/recall/price-adjust, GET operations (批量操作)
- CouponController扩展: GET /search, /:id/nearby-stores, /:id/similar
- 新实体: Employee, Redemption; Store 增加 level/parentId
- 新迁移: 032_create_stores_employees_redemptions.sql
### trading-service (Go)
- GET /api/v1/trades/my/orders — 用户订单列表(分页+状态筛选)
- POST /api/v1/trades/coupons/:id/transfer — 券转赠
### user-service
- GET/PUT /api/v1/users/me/settings — 用户偏好设置(语言/货币/通知)
### auth-service
- POST /api/v1/auth/send-sms-code — 发送短信验证码(Redis存储, 5分钟TTL)
- POST /api/v1/auth/login-phone — 手机号+验证码登录(自动注册)
### Kong 路由
- 新增5条路由: issuers/me, redemptions, coupons/batch, trades/my, trades/coupons
## genex-mobile (Flutter, 2页)
- HomePage: 接入 CouponApiService.getFeaturedCoupons() + getHoldingsSummary()
- WalletCouponsPage: 接入持仓列表API, 支持Tab状态筛选
- 修复 NotificationService/PushService 7+2个路径缺少 /api/v1/ 前缀
- 新增 CouponApiService, CouponModel, HoldingsSummaryModel
## admin-app (Flutter发行商控制台, 11页 + router + i18n)
- 修复 NotificationService 7个路径 + PushService 2个路径前缀
- 新增9个Service: auth, issuer, coupon, finance, credit, store, redemption, analytics, ai_chat
- 11页全部从 StatelessWidget→StatefulWidget, mock→API:
IssuerLoginPage(SMS登录), Dashboard(统计), CouponList(分页+筛选),
CreateCoupon(提交审核), CouponDetail(详情), Redemption(扫码/手动/批量核销),
Finance(余额/流水/对账), Credit(评分), StoreManagement(门店+员工),
AiAgent(真实AI对话), Settings(资料+登出)
- 所有页面添加 loading/error/pull-to-refresh 状态
## admin-web (Next.js 15管理后台, 24页)
- 新建API基础设施: api-client.ts(axios), auth-context.tsx, use-api.ts(react-query)
- providers.tsx 接入 QueryClientProvider + AuthProvider
- 24页全部替换 useState(mockArray) 为 useApi<T>('/api/v1/admin/...'):
Dashboard, Users, Issuers, Coupons, Trading, Risk, Finance, System,
Compliance(SAR/SEC/License/SOX/Tax/IPO), Analytics(User/Coupon/MM/Consumer),
Disputes, Chain, Reports, Merchant, Agent, Insurance
- 所有页面添加 TypeScript 接口, loading/error 状态, 'use client' 指令
- 状态比较改用原始API字符串(非t()翻译值)
## miniapp (Taro/React小程序, 20页)
- 新建API基础设施: config/index.ts, utils/request.ts(Taro.request封装), store/auth.ts
- 新增8个Service: auth, coupon, my-coupon, user, trading, wallet, notification, ai
- 20页全部替换硬编码数据为Service调用:
Home, Search, Detail, Purchase, PaymentSuccess,
MyCoupons, MyCouponDetail, Redeem, Transfer,
Profile, Orders, Messages, Wallet, Settings, KYC, AIChat,
Login, H5Share, H5Activity, H5Register
- 统一 useState+useEffect 数据获取模式, 错误处理, 加载状态
## 统计
- 新建文件: ~51个 (后端26 + 前端25)
- 修改文件: ~93个 (后端24 + 前端69)
- 新增后端端点: 27+
- 前端页面接入API: 55+ (genex-mobile 2 + admin-app 11 + admin-web 24 + miniapp 20)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
|
|
295ebcdac7 |
feat(branding): 全平台品牌Logo替换 — 新双色渐变券印标识
## 概述
将全平台(5个前端应用)的品牌Logo从旧版钻石图标统一替换为新设计的
双色渐变券印标识(紫色#9B5CF6 + 品红#D946EF),体现券金融平台定位。
## 新Logo资源
- logo/genex-icon.svg: 纯图标(72x72),用于App图标和favicon
- logo/genex-04.svg: 带品牌名(380x72),用于启动画面和品牌展示
## 替换范围
### Flutter Apps(genex-mobile / admin-app / mobile)
- Android: 5个密度mipmap ic_launcher.png (48~192px)
- iOS: 15个AppIcon尺寸 (20~1024px) + 3个LaunchImage尺寸
- assets/images/: 新增 logo.png(760x144) + logo_icon.png(192x192)
- pubspec.yaml: 新增 assets 声明
- welcome_page.dart: Icons.diamond_rounded → Image.asset('logo_icon.png')
- issuer_login_page.dart: Icons.storefront_rounded → Image.asset('logo_icon.png')
- issuer_dashboard_page.dart: 同上
- settings_page.dart: 同上
### admin-web(Next.js 15)
- public/: favicon.ico/png, logo.png, logo_icon.png, icon-512.png, SVG源文件
- layout.tsx: 更新metadata icons配置
- AdminLayout.tsx: 侧栏inline "G"文字 → <img src="/logo_icon.png">
### miniapp(Taro/React 小程序)
- login/index.tsx: "G"文字Logo → CSS双色分割旋转方块
- share-card/index.tsx: 同上 + 品牌色从#6C5CE7更新为#9B5CF6/#D946EF
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
|
|
184a7d16db |
feat: 三端集成 App升级 + 内部推送 + FCM外部推送框架 (genex-mobile/admin-app/mobile)
从 rwadurian/frontend/mobile-app 移植升级系统和通知系统到 Genex 三个 Flutter 客户端, 适配目标项目轻量架构(ValueNotifier 替代 Riverpod,Dio HTTP 客户端,移除 screenutil)。 ## 新增核心模块 (每个 app 13 个 Dart 文件) ### 升级系统 (core/updater/) - UpdateService: 统一升级服务单例,支持 Google Play + 自建服务器双渠道 - VersionChecker: 版本检测器,调用 GET /api/app/version/check - DownloadManager: APK 下载管理,支持断点续传 + SHA256 校验 - ApkInstaller: APK 安装器 (Platform Channel) - AppMarketDetector: 应用市场来源检测 - SelfHostedUpdater: 自建服务器渠道更新对话框 (i18n 化) - GooglePlayUpdater: Google Play 应用内更新 ### 通知系统 (core/services/ + core/providers/) - NotificationService: 通知 + 公告 API 服务 - GET /notifications, /notifications/unread-count - PUT /notifications/:id/read - GET /announcements, /announcements/unread-count - PUT /announcements/:id/read, /announcements/read-all - NotificationBadgeManager: 未读徽章管理器 - ValueNotifier<int> 驱动 UI - 30秒定时自动刷新 + 前后台切换刷新 (WidgetsBindingObserver) ### FCM 推送框架 (core/push/) - PushService: Firebase 推送服务框架 - Firebase 代码注释保护,无配置文件时静默跳过 - 设备 token 注册 POST /device-tokens - 待 Firebase 配置文件就绪后取消注释即可启用 ### HTTP 客户端 (core/network/) - ApiClient: Dio 封装单例,baseUrl = https://api.gogenex.cn ## Android 原生配置 (每个 app) - AndroidManifest.xml: 添加 REQUEST_INSTALL_PACKAGES 权限 + FileProvider - res/xml/file_paths.xml: FileProvider 路径配置 - MainActivity.kt: APK 安装器 + 应用市场检测 MethodChannel ## UI 层改造 (每个 app) - main.dart: 异步启动,初始化 UpdateService/PushService/NotificationBadgeManager - MainShell: 消息 Tab 徽章改为 ValueListenableBuilder 动态未读数,进入后 3 秒检查更新 - SettingsPage: StatefulWidget 化,动态版本号 (PackageInfo),点击版本号手动检查更新 - MessagePage: 移除 mock 数据,接入 NotificationService API,4 Tab 分类 + 下拉刷新 + 标记已读 ## i18n 新增 (~35 keys/语言) - update.*: 25 个升级相关 keys - notification.*: 9 个通知相关 keys - genex-mobile: 4 语言 (zh_CN/zh_TW/en/ja) 分文件 - admin-app: 3 语言 (zh_CN/en_US/ja_JP) 内联单文件 - mobile: 4 语言 (zh_CN/zh_TW/en/ja) 分文件 ## 三端差异化配置 | App | MethodChannel 前缀 | applicationId | |-----|-------------------|---------------| | genex-mobile | cn.gogenex.consumer | cn.gogenex.consumer | | admin-app | cn.gogenex.issuer | cn.gogenex.issuer | | mobile | cn.gogenex.mobile | cn.gogenex.mobile | Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
|
|
|
3cdb6a5eb9 |
feat: 全部前端项目完成国际化(i18n),支持中/英/日三语言
- miniapp (Taro/React): 11个页面/组件,~300翻译键 - admin-app (Flutter): 19个页面,475翻译键 (zh_CN/en_US/ja_JP) - admin-web (Next.js): 25个视图+布局,2000+翻译键 - mobile (Flutter): 33+页面/组件,686翻译键 (zh_CN/zh_TW/en/ja) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
|
|
|
5abb614d03 |
feat: Wire all navigation callbacks across mobile and admin-app
Replace empty onPressed/onTap placeholder callbacks with actual Navigator route calls so all pages are navigable during testing. Mobile (16 pages): - Auth flow: welcome → login/register → main shell, forgot password - Home: search bar → /search, coupon cards → /coupon/detail, AI FAB → /ai-chat - Market: coupon cards → /coupon/detail - Coupon detail: buy → /order/confirm - Order confirm: payment auth → /payment - Payment: confirm → /payment/success (fixed route typo) - Payment success: buttons → /main (clear stack) - My coupons: cards → /coupon/mine/detail - My coupon detail: transfer → /transfer, sell → /sell - Search: result cards → /coupon/detail - Profile: KYC → /kyc, payment → /payment/manage, wallet → /wallet, trading → /trading, pro mode → /pro-mode, settings → /settings, logout → / (clear stack) - Settings: KYC → /kyc, logout → / (clear stack) - Wallet: deposit → /wallet/deposit, withdraw → /wallet/withdraw, records → /wallet/records - Messages: items → /message/detail Admin-app (13 pages): - Dashboard: AI insight → createCoupon, credit suggestion → credit - Coupon list: coupon cards → couponDetail, FAB → createCoupon - Create coupon: save draft → pop back - Settings: store mgmt, employee mgmt → storeManagement, AI assistant → aiAgent, tier upgrade → credit, logout → login - Financing analysis: AI recommendation → aiAgent - Onboarding: complete → main shell - Login: register link → onboarding - Fix: pass BuildContext to _buildTierCard in settings_page.dart Both apps verified building successfully (flutter build apk --debug). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
|
|
|
e450bef7cd |
feat: Complete all 4 frontend UI prototypes covering guides 00-04
Add 116 UI prototype files across 4 frontend applications, achieving ~95% coverage of all functional requirements from development guides. ## mobile/ (Flutter Consumer + Merchant App) — 48 files - Auth: welcome, login, register, forgot-password - Coupons: home, market, search, detail, my-coupons, my-coupon-detail, order-confirm, payment, payment-success, redeem-qr - Trading: trading, sell-order (AI pricing), transfer - Wallet: wallet, deposit, withdraw, transaction-records - Profile: profile, kyc (L0-L3), settings, payment-management, pro-mode (WalletConnect, chain address, tx hash, track selection) - AI Agent: agent-chat, ai-fab (floating button with unread count) - Merchant: merchant-home (scanner, confirm, success, history, dashboard), merchant-ai-assistant (redeem assist, traffic prediction, anomaly alerts) - Message: message-list, message-detail - Issuer: issuer-main-page - Shared widgets: coupon-card, price-tag, credit-badge, kyc-badge, status-tag, empty-state, skeleton-loader, confirm-sheet, genex-button, ai-confirm-dialog (3-level risk confirmation) - Theme: app-colors, app-typography, app-spacing, app-theme - i18n: zh-CN, en-US, ja-JP ## admin-app/ (Flutter Issuer Console) — 27 files - Auth: issuer-login - Onboarding: 5-step enterprise onboarding with AI compliance check - Dashboard: issuer-dashboard (stats, AI insight, credit/quota), user-portrait (age/geo/preference/repurchase/AI insight) - Coupon management: list, create (template-based, AI pricing), detail (recall/delist), batch-operations (issue/recall/price-adjust) - Redemption: scan-to-redeem with offline mode - Finance: overview, reconciliation (auto-reconcile, export PDF/Excel), financing-analysis (cost-benefit, liquidity, risk indicators, AI strategy) - Credit: credit-scoring (4-factor, tier progress, AI suggestions), quota-management (usage gauge, type breakdown, tier upgrade, increase requests) - AI Agent: full conversation UI with quick actions - Settings: account, notification, support, tier display - Store management: hierarchy (HQ/regional/store), employee roles - Shared: ai-suggestion-card - Theme: app-colors, app-theme, app-typography, app-spacing - i18n: zh-CN, en-US, ja-JP ## admin-web/ (React + Next.js Platform Admin) — 26 files - Layout: AdminLayout with collapsible sidebar, 10 nav sections - Dashboard: key metrics, transaction feed, system health - Users: user management with KYC filtering, risk tags - Issuers: issuer review with AI pre-screening, credit rating display - Trading: real-time monitor, order book, abnormal detection - Risk: risk dashboard, AI warnings, suspicious transactions, OFAC logs - Compliance: SAR/CTR management, audit logs, AI report generation - SEC Filing: S-1/10-K/10-Q/8-K tracker, filing timeline, auto-disclosure - License management: FinCEN MSB, BitLicense, MTL (48 states), renewal alerts - SOX compliance: ICFR/ITGC/access/change-mgmt controls, deficiency tracking - Tax compliance: Federal + 4 states, 8 IRS forms, tax calendar - IPO readiness: 28-item checklist (legal/financial/SOX/governance/insurance), blocker tracking, milestone timeline, category progress, key contacts - Finance: fee revenue, settlement queue, breakage tracking - Disputes: case management with SLA countdown, chain evidence - Analytics: user (DAU/MAU, cohort retention, geographic), coupon (category, breakage, secondary market), market-maker (TVL, spread, health, risk alerts), consumer-protection (complaints, CSAT, fund utilization, non-compliant issuers) - Insurance: consumer protection fund, claims, IPO checklist overview - Chain monitor: smart contract status, blockchain metrics - Reports: platform-wide report center - AI Agent panel: session stats, top questions, module accuracy - Merchant redemption: stats, store ranking, real-time feed - Design tokens: CSS custom properties (colors, typography, spacing, shadows) - i18n: zh-CN, en-US, ja-JP ## miniapp/ (Taro Mini Program + H5) — 15 files - Pages: home, detail, purchase, orders, my-coupons, login, redeem, profile - H5 pages: h5-share, h5-activity (countdown, featured coupons), h5-register (benefits, phone/SMS form, WeChat login) - Components: coupon-card, ai-guide (recommendation bar + purchase bubble), share-card (brand header, QR code, coupon info) - i18n: zh-CN, en-US, ja-JP ## Design System - Primary: #6C5CE7 (innovation purple), Material 3 style - Consistent design tokens across all platforms - Zero blockchain terminology — "我的券" not "NFT", "订单号" not "TX Hash" - Utility Track MVP only; Securities Track reserved as "coming soon" ## Not included (by design) - Data/Domain layers (API, state management, business logic) — UI prototypes only - Securities Track full UI — MVP focuses on Utility Track - P2 "求购" (want-to-buy) feature — marked as optional Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |