Files
iotlcm/README.md
T
MiFaZhan 59eb34976a chore: 初始开源发布
iotlcm-admin-svr:管理后台服务。

- Go module:iotlcm → git.5iot.com/iotlcm-public/iotlcm-admin-svr(729 文件)
- 凭据与地址脱敏:JWT signingKey(含代码里的 MustGet 默认值)、
  MySQL DSN、Redis 口令、告警邮件发件人邮箱全部改为占位;
  私网 IP → 文档地址段;库名 xiujie_admin → iotlcm
- 真实手机号/邮箱 → 合法 11 位编造号 / example.com
- 移除内部资产:CI 触发器、过时 DDL(sql/db_iotlcm.sql)、
  私有依赖 go get 行、明文 registry 登录口令
- 启动 banner 统一 IOTLCM 方块字 + 社区惯例署名
- Dockerfile 改用公共基础镜像
- 拼错的 RADEME.md → README.md,README 重写
- 需要真实数据库的用例改为可用 IOTLCM_TEST_WITH_DB=1 显式启用
- 补 Apache-2.0 LICENSE,LF 行尾 + .gitattributes

数据库 schema 不随本仓发布(生产 DDL 已过时),README 已说明。
2026-10-23 14:48:30 +08:00

101 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# iotlcm-admin-svr
iotLCM 物联网卡全生命周期管理平台的**管理后台服务** —— 承载客户门户、卡信息管理、通信管理、资费管理、告警工单、统计分析与系统治理。
配套前端:[iotlcm-admin-ui](https://git.5iot.com/iotlcm-public/iotlcm-admin-ui)。
## 特性
- **卡资产管理**:卡信息、库存、安装、达量断网、批量开停复机
- **通信管理**:卡 / 模组 / 设备三域管理,通道与模板治理
- **资费与交易**:套餐、订单、账单、余额账户与结算批次
- **告警与工单**:报警、待办、故障、工单与规则引擎
- **账号治理**:组织、用户、角色、权限与 API 凭证
- **异步协作**:耗时操作投递到 RabbitMQ,由 [iotlcm-worker-svr](https://git.5iot.com/iotlcm-public/iotlcm-worker-svr) 执行
- **定时任务**:`sys_job` 表驱动的调度(流量同步、状态同步、账单等)
## 技术栈
- Go 1.25 + GoFrame v2
- MySQL(业务库)、Redis(缓存与队列)、RabbitMQ(异步任务)
- JWT(会话与接口鉴权)
## 快速开始
```bash
cd server
go mod tidy
go run .
```
默认监听 `:8199`。接口文档:
```text
http://127.0.0.1:8199/api.json # OpenAPI 契约
http://127.0.0.1:8199/swagger # SwaggerUI
```
## 配置
配置文件在 `server/config/config.yaml`(运行时)与 `server/config/config_default.yaml`(默认值)。**公开版里的凭据与地址全部是占位符**:
| 配置项 | 占位 | 说明 |
| --- | --- | --- |
| `jwt.signingKey` | `${JWT_SIGNING_KEY}` | 令牌签发密钥 |
| `database.default.link` | `${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST}:3306)` | 业务库 |
| `redis.default.address` / `pass` | `${REDIS_ADDR}` / `${REDIS_PASSWORD}` | 缓存 |
> ⚠️ **部署注意**:`jwt.signingKey` 若使用示例值,登录态与接口令牌将无法跨服务校验。正式部署务必通过环境变量注入真实密钥。
## 初始化数据
`server/storage/data/xiu_admin.sql` 是**框架基座初始化数据**(系统菜单、字典、角色、示例管理员),是运行起点的必要输入。
> **数据库 schema 不随本仓发布** —— 生产库的完整 DDL 已过时(见《项目清单》决策)。请按需自建表结构,或参考 [iotlcm-docs](https://git.5iot.com/iotlcm-public/iotlcm-docs) 中的接口契约。
## 目录结构
```text
iotlcm-admin-svr/
├── server/
│ ├── api/ # API 契约(system / iot / agent 等)
│ ├── internal/
│ │ ├── controller/ # 控制器
│ │ ├── logic/ # 业务逻辑
│ │ ├── service/ # 服务接口
│ │ ├── model/ consts/ # 模型与常量
│ │ ├── dao/ # 数据访问
│ │ └── library/ # 公共库
│ ├── utility/ # 工具(含启动 banner)
│ ├── config/ # 配置
│ ├── build/ # Dockerfile 与镜像内配置
│ └── storage/data/ # 初始化数据
└── docs/ # 补充说明
```
## 容器化构建
```bash
cd server
docker build -f build/Dockerfile -t iotlcm-admin-svr:latest .
```
镜像内不含任何凭据;`config/config.yaml` 以只读方式挂载覆盖。
## 测试
```bash
cd server
go test ./...
```
## 相关项目
- [iotlcm-admin-ui](https://git.5iot.com/iotlcm-public/iotlcm-admin-ui) —— 管理前端
- [iotlcm-openapi](https://git.5iot.com/iotlcm-public/iotlcm-openapi) —— 对外 API 网关
- [iotlcm-worker-svr](https://git.5iot.com/iotlcm-public/iotlcm-worker-svr) —— 异步执行
## License
[Apache License 2.0](./LICENSE)