Go to file
hailin 8adead23b6 feat: 设备推送系统 — FCM/APNs/HMS/小米/OPPO/vivo 多通道推送 + PROMOTION广告类型
新增设备推送通道架构,支持6大推送平台的多通道路由:

【SQL迁移】
- 039_create_device_tokens.sql: device_tokens表 (userId, platform, channel, token, deviceId等)
- announcements表新增 PROMOTION 类型约束

【Domain层 — 实体/接口/端口】
- DeviceToken实体: DevicePlatform枚举(ANDROID/IOS) + PushChannel枚举(FCM/APNS/HMS/XIAOMI/OPPO/VIVO)
- IDeviceTokenRepository: 6个仓储方法 (findActive/upsert/deactivate/countByChannel)
- IPushChannelProvider端口: PushPayload/PushResult类型 + 6个DI Symbol
- AnnouncementType枚举: 新增 PROMOTION (广告/促销推送)

【Infrastructure层 — 持久化/推送通道】
- DeviceTokenRepositoryImpl: TypeORM实现,支持批量IN查询(每批500)、token upsert
- 6个推送通道Provider (mock骨架,结构完整可直接替换为真实SDK):
  · FcmPushProvider — Google FCM (firebase-admin)
  · ApnsPushProvider — Apple APNs (HTTP/2直连,中国区必需)
  · HmsPushProvider — 华为HMS Push Kit
  · XiaomiPushProvider — 小米Mi Push
  · OppoPushProvider — OPPO Push
  · VivoPushProvider — vivo Push
- PushNotificationProvider重构: 从mock改为委托PushDispatcherService

【Application层 — 服务】
- PushDispatcherService: 核心调度器
  · sendToUser/sendToUsers → 查device tokens → 按channel分组 → 路由到对应provider
  · 自动清理无效token (shouldDeactivateToken)
- DeviceTokenService: 设备token注册/注销/查询
- AnnouncementService: 公告创建后自动触发设备推送
  · BY_TAG → 解析tag对应userIds → pushDispatcher.sendToUsers
  · SPECIFIC → 直接推送指定userIds

【Interface层 — DTO/Controller】
- RegisterDeviceTokenDto/UnregisterDeviceTokenDto: Swagger + class-validator
- DeviceTokenController: POST/DELETE/GET /device-tokens (JWT认证)

【Module注册】
- notification.module.ts: 新增DeviceToken实体、DEVICE_TOKEN_REPOSITORY、
  6个push channel provider DI绑定、PushDispatcherService、DeviceTokenService、
  DeviceTokenController

推送链路: 公告创建 → triggerPush → PushDispatcher → 查token → 按channel分组 → FCM/APNs/HMS/小米/OPPO/vivo

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 23:48:52 -08:00
backend feat: 设备推送系统 — FCM/APNs/HMS/小米/OPPO/vivo 多通道推送 + PROMOTION广告类型 2026-02-12 23:48:52 -08:00
docs refactor: 遥测与版本管理拆分为独立微服务 (telemetry-service + admin-service) 2026-02-12 18:30:39 -08:00
frontend refactor: 全项目清除MVP字样,统一为正式系统用语 2026-02-12 18:13:47 -08:00
.gitignore chore: Ignore Claude Code config and Flutter auto-generated files 2026-02-11 07:28:02 -08:00
README.md Update company names and structure (Inc. for West, Ltd. for Asia) 2026-01-28 00:15:01 -08:00

README.md

Global Coupon Exchange

Website: gogenex.com

Brand Naming Strategy

This project adopts a regional branding strategy, using different brand names for different markets while maintaining brand family consistency.

Brand Structure

Market Brand Abbr Description
Western (US/Europe) Genex GNX Derived from Generation + Exchange, familiar Western naming style
Asian (including China) Gensen / 券信 GS "Gensen" from Cantonese pronunciation of Chinese characters "券信"

Unified Domain

  • gogenex.com - Single global domain for all markets
  • Subdomains or paths for regional content (e.g., gogenex.com/cn, gogenex.com/asia)

Naming Logic

Genex (Western Markets)

  • Gen = Generation / Generic / Genesis
  • ex = Exchange
  • Natural pronunciation, similar to well-known Western brands like FedEx, Amex
  • Professional, modern, and trustworthy fintech image

Gensen / 券信 (Asian Markets)

  • 券 (Quan) = Coupon / Voucher
  • 信 (Xin) = Trust / Credit
  • Gensen = Romanization of Cantonese pronunciation "gyun seon"
  • Use Chinese characters "券信" in Mainland China
  • Use romanized "Gensen" in other Asian regions
  • Two characters conveying core values: coupon trading + trust guarantee

Brand Consistency

Genex    ←── "Gen-" prefix ──→  Gensen
   ↑                              ↑
   └─────── Same brand family ────┘
                   ↓
                 券信 (Chinese localization)
  • Genex and Gensen share the "Gen-" prefix, establishing brand family recognition
  • Gensen directly transliterates to 券信, providing seamless connection
  • Global users can recognize these as regional versions of the same platform

Usage Scenarios

Scenario Western Markets Asian Markets (non-China) China Market
Company Name GoGenex Inc. Gensen Asia Ltd. 券信科技有限公司
App Name Genex Gensen 券信
Domain gogenex.com gogenex.com/asia gogenex.com/cn
Social Media @gogenex @gensen_official @券信official

Note on Company Structure:

  • Inc. (Corporation) for Western markets: Better for VC funding, stock issuance, and potential IPO
  • Ltd. (Limited) for Asian markets: Common structure in Asia-Pacific region
  • Social media handles use variations to avoid conflicts with existing accounts

Due to varying financial regulations across countries, each regional brand will:

  • Operate as an independent legal entity
  • Comply with local regulatory requirements
  • Share core technology platform and philosophy
  • Establish brand association through parent company

Project Overview

Global Coupon Exchange (GCX) is a coupon asset trading platform designed to provide users with secure and convenient trading services for digital assets such as coupons, gift cards, and vouchers.

Core Features

  • Coupon asset listing and trading
  • Secure transaction matching mechanism
  • Multi-currency settlement support
  • User credit system

Tech Stack

TBD

Documentation

For detailed development documentation, please refer to the docs directory.

License

TBD