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 已说明。
This commit is contained in:
MiFaZhan
2026-10-23 14:46:05 +08:00
commit 59eb34976a
1132 changed files with 138197 additions and 0 deletions
+147
View File
@@ -0,0 +1,147 @@
// ================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"time"
)
type (
ITrafficUsage interface {
// WriteDaily 批量写入日流量数据。
// 每个 ICCID 会落到独立子表,子表通过 t_sim_card_usage_daily 超级表自动创建。
WriteDaily(ctx context.Context, items []model.TrafficUsageDailyItem) error
// WriteMonthly 批量写入月流量数据。
// 月流量和日流量共用同一个 TDengine database,但使用不同超级表。
WriteMonthly(ctx context.Context, items []model.TrafficUsageMonthlyItem) error
// WritePoolUsageDaily 批量写入流量池的流量使用记录。
// 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_usage_daily 超级表自动创建。
WritePoolUsageDaily(ctx context.Context, items []model.TrafficPoolUsageItem) error
// WritePoolUsageMonthly 批量写入流量池的流量使用记录。
// 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_usage_monthly 超级表自动创建。
WritePoolUsageMonthly(ctx context.Context, items []model.TrafficPoolUsageItem) error
// WritePoolCardCountDaily 批量写入流量池的卡数量记录。
// 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_card_count_daily 超级表自动创建。
WritePoolCardCountDaily(ctx context.Context, items []model.TrafficPoolCardCountItem) error
// WritePoolCardCountMonthly 批量写入流量池的卡数量记录。
// 每个 FlowPoolCode 会落到独立子表,子表通过 t_flow_pool_card_count_monthly 超级表自动创建。
WritePoolCardCountMonthly(ctx context.Context, items []model.TrafficPoolCardCountItem) error
// UpdateDaily 更新日流量数据。
UpdateDaily(ctx context.Context, items []model.TrafficUsageDailyItem) error
// UpdateMonthly 更新月流量数据。
UpdateMonthly(ctx context.Context, items []model.TrafficUsageMonthlyItem) error
// DeleteDaily 删除日流量数据。
DeleteDaily(ctx context.Context, input model.TrafficUsageDeleteInput) error
// DeleteMonthly 删除月流量数据。
DeleteMonthly(ctx context.Context, input model.TrafficUsageDeleteInput) error
// QueryDaily 查询日流量数据。
QueryDaily(ctx context.Context, input model.TrafficUsageQueryInput) ([]model.TrafficUsageDailyRecord, int, error)
// QueryMonthly 查询月流量数据。
QueryMonthly(ctx context.Context, input model.TrafficUsageQueryInput) ([]model.TrafficUsageMonthlyRecord, int, error)
// AggregatePoolUsageDaily 汇总日流量数据。
AggregatePoolUsageDaily(ctx context.Context, date time.Time, cards []model.TrafficPoolCard) ([]model.TrafficPoolUsageAggregate, error)
// AggregatePoolUsageMonthly 汇总月流量数据。
AggregatePoolUsageMonthly(ctx context.Context, month time.Time, cards []model.TrafficPoolCard) ([]model.TrafficPoolUsageAggregate, error)
// GetTopUsageCardsYesterday 查询前一天流量使用前五名的卡片
GetTopUsageCardsYesterday(ctx context.Context) ([]model.TopUsageCard, error)
}
ITrafficUsageDailySync interface {
// StartDaily publishes a command for Worker to run the previous-day usage
// full sync. This is the production entry point.
StartDaily(ctx context.Context) error
StartDailyRun(ctx context.Context) (string, error)
// StartDailyRunScoped narrows the run to a channel whitelist; a nil or
// empty scope is a full sync.
StartDailyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error)
// StartDailyRunScopedAt starts a run for a specific day (yyyyMMdd). An
// empty queryDate behaves exactly like StartDailyRunScoped.
StartDailyRunScopedAt(ctx context.Context, scope *model.SyncScope, queryDate string) (string, error)
// SyncDaily is the legacy in-process scan, kept only as the rollback path
// until the Worker chain is verified in production.
SyncDaily(ctx context.Context)
}
ITrafficUsageMonthlySync interface {
SyncMonthly(ctx context.Context)
// StartMonthly publishes a command for Worker to run the full monthly usage sync.
StartMonthly(ctx context.Context) error
StartMonthlyRun(ctx context.Context) (string, error)
// StartMonthlyRunScoped narrows the run to a channel whitelist; a nil or
// empty scope is a full sync.
StartMonthlyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error)
// StartMonthlyHistory publishes a command for Worker to backfill the
// previous month into the TDengine monthly table. This is distinct from
// StartMonthly, which fills the MySQL current-month snapshot.
StartMonthlyHistory(ctx context.Context) error
StartMonthlyHistoryRun(ctx context.Context) (string, error)
// StartMonthlyHistoryRunScoped narrows the run to a channel whitelist; a
// nil or empty scope is a full sync.
StartMonthlyHistoryRunScoped(ctx context.Context, scope *model.SyncScope) (string, error)
// StartMonthlyHistoryRunScopedAt starts a run for a specific month
// (yyyyMM). An empty queryMonth behaves exactly like
// StartMonthlyHistoryRunScoped.
StartMonthlyHistoryRunScopedAt(ctx context.Context, scope *model.SyncScope, queryMonth string) (string, error)
}
ITrafficPoolUsageSync interface {
// TODO: 流量池查询逻辑还未确定
// SyncDaily 同步流量池的流量使用记录
SyncDaily(ctx context.Context)
// SyncMonthly 同步流量池的流量使用记录
SyncMonthly(ctx context.Context)
}
)
var (
localTrafficUsage ITrafficUsage
localTrafficUsageDailySync ITrafficUsageDailySync
localTrafficUsageMonthlySync ITrafficUsageMonthlySync
localTrafficPoolUsageSync ITrafficPoolUsageSync
)
func TrafficUsage() ITrafficUsage {
if localTrafficUsage == nil {
panic("implement not found for interface ITrafficUsage, forgot register?")
}
return localTrafficUsage
}
func RegisterTrafficUsage(i ITrafficUsage) {
localTrafficUsage = i
}
func TrafficUsageDailySync() ITrafficUsageDailySync {
if localTrafficUsageDailySync == nil {
panic("implement not found for interface ITrafficUsageDailySync, forgot register?")
}
return localTrafficUsageDailySync
}
func RegisterTrafficUsageDailySync(i ITrafficUsageDailySync) {
localTrafficUsageDailySync = i
}
func TrafficUsageMonthlySync() ITrafficUsageMonthlySync {
if localTrafficUsageMonthlySync == nil {
panic("implement not found for interface ITrafficUsageMonthlySync, forgot register?")
}
return localTrafficUsageMonthlySync
}
func RegisterTrafficUsageMonthlySync(i ITrafficUsageMonthlySync) {
localTrafficUsageMonthlySync = i
}
func TrafficPoolUsageSync() ITrafficPoolUsageSync {
if localTrafficPoolUsageSync == nil {
panic("implement not found for interface ITrafficPoolUsageSync, forgot register?")
}
return localTrafficPoolUsageSync
}
func RegisterTrafficPoolUsageSync(i ITrafficPoolUsageSync) {
localTrafficPoolUsageSync = i
}