# 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.example.yaml` 复制为运行时的 `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)