将 mobile-app "联系客服" 弹窗的微信/QQ联系方式从硬编码改为
admin-web 后台动态配置,支持任意数量的联系方式管理。
## Backend (admin-service)
- 新增 Prisma 模型: ContactType 枚举(WECHAT/QQ) + CustomerServiceContact
- 新增迁移 SQL: 建表 + 2条索引 + 4条种子数据(保留现有硬编码联系方式)
- 新增双 Controller (参考 app-asset.controller.ts 模式):
- AdminCustomerServiceContactController (admin/customer-service-contacts)
GET 列表 / POST 新增 / PUT 更新 / DELETE 删除
- PublicCustomerServiceContactController (customer-service-contacts)
GET 仅返回 isEnabled=true,按 sortOrder 排序
- 注意: 公开 Controller 用 @Controller('customer-service-contacts')
避免与全局前缀 api/v1 双重叠加
## Kong 网关
- 新增路由 admin-customer-service-contacts-public
路径 /api/v1/customer-service-contacts → admin-service:3010
- Admin 端点由已有 admin-api 路由 (/api/v1/admin) 覆盖
## Admin-web
- endpoints.ts: 新增 CUSTOMER_SERVICE_CONTACTS 端点组
- customerServiceContactService.ts: CRUD 服务 (list/create/update/delete)
- settings/page.tsx: 新增"客服联系方式管理"区块
表格展示(排序/类型/标签/联系方式/启停/操作) + 内联新增/编辑表单
- settings.module.scss: contactTable / contactForm / contactFormFields 样式
## Flutter Mobile-app
- storage_keys.dart: 新增 cachedCustomerServiceContacts 缓存 key
- customer_service_contact_service.dart: API + 缓存服务
(内存5分钟TTL + SharedPreferences持久化 + 后台静默刷新)
- injection_container.dart: 注册 customerServiceContactServiceProvider
- profile_page.dart: _showCustomerServiceDialog() 从硬编码改为
动态 API 加载,contacts 为空时显示"暂无客服联系方式"占位符
## 文件清单 (4 新建 + 9 修改)
新建:
- backend/.../migrations/20260205100000_add_customer_service_contacts/migration.sql
- backend/.../controllers/customer-service-contact.controller.ts
- frontend/admin-web/src/services/customerServiceContactService.ts
- frontend/mobile-app/lib/core/services/customer_service_contact_service.dart
修改:
- backend/.../prisma/schema.prisma
- backend/.../src/app.module.ts
- backend/api-gateway/kong.yml
- frontend/admin-web/src/infrastructure/api/endpoints.ts
- frontend/admin-web/src/app/(dashboard)/settings/page.tsx
- frontend/admin-web/src/app/(dashboard)/settings/settings.module.scss
- frontend/mobile-app/lib/core/storage/storage_keys.dart
- frontend/mobile-app/lib/core/di/injection_container.dart
- frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| .claude | ||
| admin-service | ||
| auth-service | ||
| authorization-service | ||
| backup-service | ||
| blockchain-service | ||
| contribution-service | ||
| docs | ||
| identity-service | ||
| leaderboard-service | ||
| mining-admin-service | ||
| mining-blockchain-service | ||
| mining-service | ||
| mining-wallet-service | ||
| mpc-service | ||
| planting-service | ||
| presence-service | ||
| referral-service | ||
| reporting-service | ||
| reward-service | ||
| scripts | ||
| trading-service | ||
| wallet-service | ||
| .env.example | ||
| .gitignore | ||
| README.md | ||
| deploy-mining.sh | ||
| deploy.sh | ||
| docker-compose.2.0.yml | ||
| docker-compose.infra.yml | ||
| docker-compose.yml | ||
| init-multiple-dbs.sh | ||
README.md
RWA Backend Services
统一部署管理 RWA 后端微服务。
架构概览
┌─────────────────────────────────────────────────────────────────┐
│ 192.168.1.100 (Gateway) │
│ ┌─────────────┐ ┌─────────────────────────────────────────┐ │
│ │ Nginx │ │ MPC-System (Go) │ │
│ │ (Reverse │ │ - session-coordinator (:8081) │ │
│ │ Proxy) │ │ - message-router (:8082) │ │
│ │ │ │ - server-party-1/2/3 (:8083-8085) │ │
│ └─────────────┘ │ - account-service (:8080) │ │
│ └─────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
│ Internal Network
▼
┌─────────────────────────────────────────────────────────────────┐
│ 192.168.1.111 (Backend) │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Docker Compose Services │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ PostgreSQL │ │ Redis │ │ Kafka │ │ │
│ │ │ (:5432) │ │ (:6379) │ │ (:9092) │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ identity │ │ wallet │ │ backup │ │ │
│ │ │ (:3000) │ │ (:3001) │ │ (:3002) │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ planting │ │ referral │ │ reward │ │ │
│ │ │ (:3003) │ │ (:3004) │ │ (:3005) │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ mpc │ │ leaderboard │ │ reporting │ │ │
│ │ │ (:3006) │ │ (:3007) │ │ (:3008) │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │authorization│ │ admin │ │ │
│ │ │ (:3009) │ │ (:3010) │ │ │
│ │ └─────────────┘ └─────────────┘ │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
快速开始
1. 首次安装
# 进入服务目录
cd ~/rwadurian/backend/services
# 运行安装(自动生成安全密钥)
./deploy.sh install
2. 构建镜像
./deploy.sh build
3. 启动服务
./deploy.sh up
4. 检查状态
./deploy.sh status
./deploy.sh health
常用命令
| 命令 | 说明 |
|---|---|
./deploy.sh install |
首次安装,生成配置 |
./deploy.sh build |
构建所有 Docker 镜像 |
./deploy.sh up |
启动所有服务 |
./deploy.sh down |
停止所有服务 |
./deploy.sh restart |
重启所有服务 |
./deploy.sh status |
查看服务状态 |
./deploy.sh health |
检查服务健康 |
./deploy.sh logs |
查看所有日志 |
./deploy.sh logs <service> |
查看指定服务日志 |
./deploy.sh migrate |
运行数据库迁移 |
./deploy.sh rebuild-svc <name> |
重建指定服务 |
服务列表
| 服务 | 端口 | 说明 |
|---|---|---|
| identity-service | 3000 | 身份认证服务 |
| wallet-service | 3001 | 钱包账本服务 |
| backup-service | 3002 | MPC 备份服务 |
| planting-service | 3003 | 认种服务 |
| referral-service | 3004 | 推荐系统服务 |
| reward-service | 3005 | 奖励服务 |
| mpc-service | 3006 | MPC 中间层服务 |
| leaderboard-service | 3007 | 排行榜服务 |
| reporting-service | 3008 | 报表服务 |
| authorization-service | 3009 | 授权服务 |
| admin-service | 3010 | 管理后台服务 |
基础设施
| 服务 | 端口 | 说明 |
|---|---|---|
| PostgreSQL | 5432 | 主数据库 |
| Redis | 6379 | 缓存/会话 |
| Kafka | 9092 | 消息队列 |
| Zookeeper | 2181 | Kafka 协调 |
环境配置
配置文件 .env 由 ./deploy.sh install 自动生成,包含:
- 数据库密码
- JWT 密钥
- 加密密钥
- MPC 系统地址
重要: .env 文件包含敏感信息,请勿提交到 Git!
与 MPC-System 集成
mpc-service 需要连接到运行在 192.168.1.100 上的 MPC-System:
- Session Coordinator:
http://192.168.1.100:8081 - Message Router:
ws://192.168.1.100:8082
确保 192.168.1.111 能够访问 192.168.1.100 的这些端口。
故障排除
查看服务日志
./deploy.sh logs identity-service
重建单个服务
./deploy.sh rebuild-svc mpc-service
数据库连接问题
# 进入 postgres 容器
docker exec -it rwa-postgres psql -U rwa_user -d rwa_identity
清理重新开始
./deploy.sh clean # 删除所有容器和数据
./deploy.sh install
./deploy.sh build
./deploy.sh up