docs(sdk): 添加 Android SDK 架构总览文档
- 新增架构总览文档,包含整体架构图和依赖关系 - 详细描述初始化流程(ContentProvider 自动和手动两种方式) - 补充技术栈版本信息和发布说明 - 更新服务器端和Web端项目上下文文档 - 添加新模块 xuqm-log-service 的版本文件 - 在服务器端 POM 中注册 xuqm-log-service 模块 - 修复 Android SDK 字符串模板语法错误 - 修改服务器端 webhook 服务的 Redis 锁获取逻辑
这个提交包含在:
父节点
8951b72cca
当前提交
d0fe119999
107
CLAUDE.md
普通文件
107
CLAUDE.md
普通文件
@ -0,0 +1,107 @@
|
|||||||
|
# XuqmGroup-Server — Claude 项目上下文
|
||||||
|
|
||||||
|
## 项目定位
|
||||||
|
|
||||||
|
XuqmGroup 后端服务集合。Spring Boot 3.4.4 + Java 21 + Maven 多模块微服务架构。
|
||||||
|
|
||||||
|
- Git 远端:`https://xuqinmin.com/xuqmGroup/XuqmGroup-Server.git`
|
||||||
|
- 技术栈:Spring Boot 3.4.4,Java 21,Spring Security 6(JWT),Spring Data JPA,MySQL 8,Redis 7
|
||||||
|
|
||||||
|
## 模块结构
|
||||||
|
|
||||||
|
```
|
||||||
|
XuqmGroup-Server/
|
||||||
|
├── pom.xml # 父 POM,统一依赖版本
|
||||||
|
├── common/ # 公共库(ApiResponse、JWT、异常处理)
|
||||||
|
├── tenant-service/ # 租户服务 :8081
|
||||||
|
├── im-service/ # IM 服务 :8082
|
||||||
|
├── push-service/ # 推送服务 :8083
|
||||||
|
├── update-service/ # 版本管理服务 :8084
|
||||||
|
├── license-service/ # 证书授权服务 :8085
|
||||||
|
├── file-service/ # 文件服务
|
||||||
|
├── im-sdk/ # IM SDK(服务端封装)
|
||||||
|
└── demo-service/ # 演示服务
|
||||||
|
```
|
||||||
|
|
||||||
|
## 服务端口
|
||||||
|
|
||||||
|
| 服务 | 端口 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| tenant-service | 8081 | 租户管理、认证、应用管理 |
|
||||||
|
| im-service | 8082 | IM 消息、群组、WebSocket |
|
||||||
|
| push-service | 8083 | 推送 token 注册、推送发送 |
|
||||||
|
| update-service | 8084 | App/RN Bundle 版本管理 |
|
||||||
|
| license-service | 8085 | 证书授权 |
|
||||||
|
|
||||||
|
## 技术栈
|
||||||
|
|
||||||
|
| 组件 | 版本 |
|
||||||
|
|------|------|
|
||||||
|
| Spring Boot | 3.4.4 |
|
||||||
|
| Java | 21 |
|
||||||
|
| Spring Security | 6.x(JWT 无状态认证) |
|
||||||
|
| Spring Data JPA | Hibernate 6 |
|
||||||
|
| MySQL | 8.x |
|
||||||
|
| Redis | 7.x |
|
||||||
|
| JJWT | 0.12.6 |
|
||||||
|
| Spring WebSocket + STOMP | IM 实时通信 |
|
||||||
|
|
||||||
|
## 快速启动
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 前置:MySQL 8 + Redis 7 本地运行
|
||||||
|
cd XuqmGroup-Server
|
||||||
|
|
||||||
|
# 启动所有服务
|
||||||
|
cd tenant-service && mvn spring-boot:run &
|
||||||
|
cd im-service && mvn spring-boot:run &
|
||||||
|
cd push-service && mvn spring-boot:run &
|
||||||
|
cd update-service && mvn spring-boot:run &
|
||||||
|
```
|
||||||
|
|
||||||
|
首次启动自动建表(ddl-auto: update)。
|
||||||
|
默认管理员:`admin` / `Admin@123456`
|
||||||
|
|
||||||
|
## 核心 API 概览
|
||||||
|
|
||||||
|
### tenant-service(:8081)
|
||||||
|
|
||||||
|
- 认证:`/api/auth/login`、`/api/auth/register`、`/api/auth/captcha`
|
||||||
|
- 应用管理:`/api/apps` CRUD
|
||||||
|
- 功能服务:`/api/apps/{appKey}/services`(IM/Push/Update 开关)
|
||||||
|
- 子账号:`/api/sub-accounts`
|
||||||
|
- 运营平台:`/api/ops/tenants`、`/api/ops/statistics`
|
||||||
|
|
||||||
|
### im-service(:8082)
|
||||||
|
|
||||||
|
- 消息:`/api/im/messages/send`、`/api/im/messages/history/{toId}`
|
||||||
|
- 群组:`/api/im/groups` CRUD
|
||||||
|
- WebSocket:`ws://localhost:8082/ws/im?token=<jwt>`
|
||||||
|
- 关键词过滤、Webhook
|
||||||
|
|
||||||
|
### push-service(:8083)
|
||||||
|
|
||||||
|
- Token:`/api/push/register`、`/api/push/device/unregister`
|
||||||
|
- 推送:`/api/push/send`、`/api/push/internal/notify`
|
||||||
|
- 开关:`/api/push/receive-push`
|
||||||
|
|
||||||
|
### update-service(:8084)
|
||||||
|
|
||||||
|
- App 更新:`/api/v1/updates/app/check`、`/api/v1/updates/app/upload`
|
||||||
|
- RN Bundle:`/api/v1/rn/update/check`、`/api/v1/rn/upload`
|
||||||
|
|
||||||
|
## 待新增:xuqm-log-service
|
||||||
|
|
||||||
|
日志/错误追踪服务,Spring Boot 3.x + MySQL + Redis。
|
||||||
|
|
||||||
|
- 新建位置:`XuqmGroup-Server/xuqm-log-service/`
|
||||||
|
- 核心 API 前缀:`/log/v1/`
|
||||||
|
- 需要新增 `/api/sdk/config` 返回字段:`logApiUrl`、`logEnabled`
|
||||||
|
|
||||||
|
## 常用命令
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mvn spring-boot:run -pl tenant-service # 启动单个服务
|
||||||
|
mvn clean package # 打包所有模块
|
||||||
|
mvn clean package -pl tenant-service # 打包单个服务
|
||||||
|
```
|
||||||
1
VERSION.xuqm-log-service
普通文件
1
VERSION.xuqm-log-service
普通文件
@ -0,0 +1 @@
|
|||||||
|
1.0.0
|
||||||
1
pom.xml
1
pom.xml
@ -21,6 +21,7 @@
|
|||||||
<module>demo-service</module>
|
<module>demo-service</module>
|
||||||
<module>file-service</module>
|
<module>file-service</module>
|
||||||
<module>license-service</module>
|
<module>license-service</module>
|
||||||
|
<module>xuqm-log-service</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@ -54,10 +54,10 @@ public class WebhookService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String cooldownKey = COOLDOWN_KEY_PREFIX + webhook.getId() + ":" + issue.getFingerprint();
|
String cooldownKey = COOLDOWN_KEY_PREFIX + webhook.getId() + ":" + issue.getFingerprint();
|
||||||
Long acquired = redisTemplate.opsForValue()
|
Boolean acquired = redisTemplate.opsForValue()
|
||||||
.setIfAbsent(cooldownKey, "1", Duration.ofSeconds(webhook.getCooldownSec()));
|
.setIfAbsent(cooldownKey, "1", Duration.ofSeconds(webhook.getCooldownSec()));
|
||||||
|
|
||||||
if (acquired != null && acquired) {
|
if (Boolean.TRUE.equals(acquired)) {
|
||||||
sendWebhook(webhook, issue);
|
sendWebhook(webhook, issue);
|
||||||
} else {
|
} else {
|
||||||
log.debug("Webhook cooldown active: webhookId={}, fingerprint={}", webhook.getId(), issue.getFingerprint());
|
log.debug("Webhook cooldown active: webhookId={}, fingerprint={}", webhook.getId(), issue.getFingerprint());
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户