Java 微服务架构深度分析报告
融合短剧平台(Drama Fusion Platform) 是一个面向 C 端用户的短剧观看 APP,聚合 CP 上传的短剧内容,通过推荐系统分发,集成广告变现、AI 弹幕互动、商品分销、虚拟打赏、金币激励等能力。
drama-fusion-platform/ ├── pom.xml (父 POM — Spring Boot 3.2.5) ├── drama-common/ (公共: Result, JwtUtil, RsaCrypto, EddClient, SpreeClient, RiskClient) ├── drama-gateway/ (API 网关: 8080 — Spring Cloud Gateway + JwtAuthFilter) ├── drama-user-service/ (用户: 8101 — 登录/CP/IM/钱包/画像/风控) ├── drama-content-service/ (内容: 8102 — 短剧/剧集/弹幕/审核/上传) ├── drama-rec-service/ (推荐: 8103 — Feed/热度/协同过滤) ├── drama-ad-service/ (广告: 8104 — GROMORE 广告联盟) ├── drama-ai-service/ (AI/IM: 8105 — WebSocket 弹幕/DeepSeek 对话) ├── drama-trade-service/ (交易: 8106 — 订单/打赏/CP 收益) ├── drama-coin-service/ (金币: 8107 — 签到/广告激励/充值/消费) ├── drama-risk-service/ (风控: 8108 — 规则引擎/设备指纹/黑名单) ├── drama-payment-service/ (支付: 8109 — 微信支付/渠道回调) ├── drama-frontend-admin/ (Vue3 + Arco Design CP 管理后台) ├── drama-frontend-h5/ (Vue3 + Video.js H5 播放器) ├── drama-frontend-admin-portal/ (Admin Portal) ├── drama-frontend-lemon/ (柠檬剧场兼容) ├── drama-frontend-seller/ (商家端) ├── drama-uniapp/ (UniApp 用户 APP) ├── docker/ (Docker Compose) └── docs/ (架构设计文档)
| 层级 | 技术选型 | 版本 |
|---|---|---|
| 编程语言 | Java | 17 |
| 微服务框架 | Spring Boot + Spring Cloud | 3.2.5 / 2023.0.1 |
| 注册/配置中心 | Nacos | 2.3.0 |
| API 网关 | Spring Cloud Gateway | 4.1 |
| ORM | MyBatis-Plus | 3.5.5 |
| 数据库 | MySQL 8.0 + Redis 7 | 8.0 / 7 |
| 消息队列 | RocketMQ | 5.1.4 |
| 对象存储 | 阿里云 OSS | - |
| JWT | jjwt (RS256) | 0.12.5 |
| 用户 APP | UniApp 3.0 + uView UI | - |
| CP 后台 | Vue3 + Arco Design | - |
| H5 播放器 | Vue3 + Video.js | - |
| 构建工具 | Maven | 3.9+ |
端口 8080 Spring Cloud Gateway 4.1
| 路由 ID | 路径 | 目标 | 端口 |
|---|---|---|---|
| user-service | /api/user/** | drama-user-service | 8101 |
| pno-service | /api/pno/**, /api/beacon/** | drama-user-service | 8101 |
| content-service | /api/content/** | drama-content-service | 8102 |
| rec-service | /api/rec/** | drama-rec-service | 8103 |
| ad-service | /api/ad/** | drama-ad-service | 8104 |
| ai-service | /api/ai/** | drama-ai-service | 8105 |
| trade-service | /api/trade/** | drama-trade-service | 8106 |
| coin-service | /api/coin/** | drama-coin-service | 8107 |
| risk-service | /api/risk/** | drama-risk-service | 8108 |
| payment-service | /api/payment/** | drama-payment-service | 8109 |
| product-sync | /api/sync/**, /admin/** | 直连 localhost:8089 | 8089 |
| legacy-compat | /api/advertising/** | drama-user-service | 8101 |
| spree-store | /api/store/**, /api/spree/** | 直连 172.16.0.62 | 80 |
无端口 共享工具包
| 包 | 类 | 职责 |
|---|---|---|
| result | Result<T> | 统一响应体 code/message/data |
| exception | BizException / GlobalExceptionHandler | 业务异常 + 全局 @RestControllerAdvice 处理 |
| utils | JwtUtil | RS256 JWT 签发/验证(7天过期) |
| utils | RsaCryptoUtil | RSA 加解密 + HMAC-SHA256 签名(兼容旧 PHP 系统) |
| client | EddClient | EDD 商城 REST 客户端 |
| client | SpreeClient | Spree Bridge 客户端(多商户/商品/订单) |
| client | RiskClient | 风控内部调用客户端, 7 种风控场景 |
8101 Spring Boot + MyBatis-Plus
Controller 汇总: UserController(登录/CP/IM/画像), WalletController, CartController, CommentController, ChannelController, KamiController, ShareController, FeedbackController, TaskController, RealnameController, DramaSocialController
核心实体: User, UserProfile, UserWallet, CoinTransaction, WithdrawConfig, AgentBank/Reward/Settlement, Kami, Task, Feedback, Notice, Permission, Role
IM 集成: OpenImClient(注册/好友/消息/WebHook)+ DeepSeekClient(大模型流式 SSE 对话)
8102 Spring Boot + MyBatis-Plus
Controller: ContentController(短剧CRUD/播放页), UploadController(OSS上传), OpsController(审核上下架), SystemConfigController(系统配置)
核心实体: Drama(~60字段含合规全套), Episode, BulletCommentary, DramaProductRel, ContentAuditLog, SystemConfig
外部客户端: ProductSyncClient, SunayingClient, RecommendSyncClient
8103 Spring Boot + Redis
8104 Spring Boot + GROMORE SDK
实体: AdPlacement, AdPool, AdWatchLog, AdCreateLog, AdEcpmLog, AdTransLog
集成: GROMORE 广告联盟,激励视频广告
8105 Spring Boot + WebSocket STOMP
8106 Spring Boot + MyBatis-Plus
实体: Order, VirtualGift | 下单/查询/打赏/CP收益,操作前 RiskClient 风控检查
8107 Spring Boot + Redis + MyBatis-Plus
实体: CoinAccount, CoinTransaction | 余额/签到/激励视频奖励/充值/消费/流水,风控检查
8108 Spring Boot + 规则引擎
8109 Spring Boot + MyBatis-Plus
实体: PaymentOrder, PaymentConfig | 创建支付/查询/渠道回调/配置管理
8089 Spring Boot + Thymeleaf
| 表 | 核心字段 |
|---|---|
| t_user | id, phone, openid, unionid, nickname, avatar, userType(NORMAL/CP/ADMIN), verifyStatus, eddWpUserId, parentId, inviteCode, channelLevel, status, lastLoginTime |
| t_user_profile | userId, tags(json), watchHistory(json), prefCategories |
| t_user_wallet | userId, coinBalance, totalEarned, totalSpent, totalRecharged |
| 表 | 核心字段 |
|---|---|
| t_drama | ~60+字段: id, cpUserId, title, cover, category, status, reviewStatus, hotScore, 三级审核字段, 合规字段全套 |
| t_episode | id, dramaId, epNum, title, videoUrl, duration |
| t_bullet_commentary | id, episodeId, timePoint(秒), content, type |
| t_drama_product_rel | id, dramaId, productId, timePoint |
| 域 | 核心表 |
|---|---|
| 行为 | t_watch_record, t_user_like, t_bullet_message, t_drama_comment |
| 交易 | t_order, t_virtual_gift, t_coin_transaction |
| 广告 | t_ad_placement, t_ad_watch_log, t_ad_pool, t_ad_ecpm_log |
| 风控 | t_device_fingerprint(~20字段), t_black_device, t_blacklist, t_risk_event, t_risk_rule, t_shielding_config |
| 系统 | 对接方式 | 接口 |
|---|---|---|
| 选品中台 | REST API | GET /api/sync/products, POST /callback/content-review |
| AI 弹幕系统 | REST API | POST /api/ai/bullet/generate |
| OpenIM | WebHook + REST | /callback/im-message, /msg/send_msg |
| GROMORE 广告 | SDK + REST | 激励视频广告展示/回调 |
| 用户画像推荐 | REST | 172.16.0.63:8000 |
| DeepSeek AI | REST (流式) | v1/chat/completions (deepseek-chat) |
| EDD/Spree 商城 | REST + WP Bridge | 172.16.0.62, /wp-json/drama/v1/* |
| 微信开放平台 | OAuth 2.0 | sns/oauth2/access_token |
| 阿里云 OSS | SDK | 视频/图片媒资存储 |
| 端面 | 技术 | 功能 |
|---|---|---|
| 用户 APP | UniApp 3.0 + uView UI | 首页/播放器/购物车/打赏/AI对话 |
| CP 管理后台 | Vue3 + Arco Design + ECharts | 上传/审核/数据分析/收益 |
| H5 播放器 | Vue3 + Video.js + WebSocket | 播放/弹幕/商品卡/AI对话 |
| Admin Portal | Vue3 | 平台运营管理 |
| 柠檬前端 | Vue3 | 柠檬剧场兼容 |
| 商家端 | Vue3 | 商家后台 |
H5 代理: drama-h5-proxy (Node.js) 独立部署
mysql:8.0 → 3306:3306 drama_fusion redis:7-alpine → 6379:6379 nacos:v2.3.0 → 8848:8848, 9848:9848 (Standalone) rocketmq:5.1.4 → 9876:9876 (NameServer) rocketmq:5.1.4 → 10909:10911 (Broker)
| 服务 | 端口 | Nacos | 备注 |
|---|---|---|---|
| Gateway | 8080 | 是 | 外部唯一入口 |
| User | 8101 | 是 | 含旧系统兼容 |
| Content | 8102 | 是 | - |
| Rec | 8103 | 是 | - |
| Ad | 8104 | 是 | GROMORE SDK |
| AI | 8105 | 是 | WebSocket |
| Trade | 8106 | 是 | - |
| Coin | 8107 | 是 | - |
| Risk | 8108 | 是 | - |
| Payment | 8109 | 是 | - |
| Product Sync | 8089 | 否 | Thymeleaf 后台 |
| EDD/Spree | 80 | 否 | 172.16.0.62 |
Generated by DeepSeek TUI v0.8.18 | 2026-07-21 | Source: /root/drama-fusion-platform