4 Commits
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
e8d9bdc2fb |
fix(api): 修复前后端 API 对接 — 响应结构+字段名对齐
端到端审查发现并修复 4 类前后端不匹配问题:
## 1. 响应结构嵌套不匹配
后端返回 `{ data: { user, tokens: { accessToken, refreshToken } } }`
但 miniapp/admin-app/admin-web 均按扁平结构解析
- miniapp services/auth.ts: 新增 AuthResponse→LoginResult 映射层
- miniapp store/auth.ts: 从 `resp.tokens.accessToken` 取 token
- admin-app auth_service.dart: LoginResult.fromJson 优先从 tokens 子对象取
- admin-web auth-context.tsx: 从 `result.tokens.accessToken` 取 token
## 2. 密码登录字段名不匹配
后端 LoginDto 字段为 `identifier`, 但 admin-app 发 `email`, admin-web 发 `email`
- admin-app: `'email' → 'identifier'`
- admin-web: `{ email, password } → { identifier: email, password }`
## 3. 注册 password 字段必填 vs 前端可选
miniapp h5-register 只收集手机+验证码, 不传 password, 会触发 400 校验
- backend RegisterDto: password 改为 @IsOptional
- auth.service.ts: 未传 password 时自动生成随机密码
## 4. miniapp LoginResult 类型导出
- 导出 LoginResult 接口供外部使用
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
|
|
c29067eee7 |
feat(miniapp+admin-app): 同步 SMS 认证 API 变更
Phase 7 — Taro miniapp + admin-app 前端同步后端 SMS 认证系统: miniapp (Taro/React): - auth.ts: 新增 SmsCodeType 类型,sendSmsCode 支持 type 参数 · 端点从 /auth/send-sms-code → /auth/sms/send · 新增 loginByPassword / resetPassword API · register 支持 password + nickname 可选参数 - store/auth.ts: sendSmsCode 同步 type 参数 + 新端点 - login/index.tsx: 发送验证码时指定 type='LOGIN' - h5-register/index.tsx: 发送验证码时指定 type='REGISTER' · 修复注册后 token 存储使用 config.TOKEN_KEY 而非硬编码 - i18n: 3语言新增 7 key (login_code_sent, login_error_*, register_success, register_error_agree) admin-app (Flutter): - auth_service.dart: 新增 SmsCodeType 枚举 · sendSmsCode 支持 type 参数,端点同步 /auth/sms/send · 返回 expiresIn (秒) - issuer_login_page.dart: 发送验证码时指定 SmsCodeType.login - i18n: 3语言新增 4 key (login_error_phone, login_error_code, login_error_network, login_code_sent) 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>
|
|
|
|
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> |