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:
@@ -0,0 +1,228 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
BatchAsyncStatusCreated = 0
|
||||
BatchAsyncStatusPending = 1
|
||||
BatchAsyncStatusProcessing = 2
|
||||
BatchAsyncStatusSuccess = 3
|
||||
BatchAsyncStatusFailed = 4
|
||||
BatchAsyncStatusPartialSuccess = 5
|
||||
)
|
||||
|
||||
const (
|
||||
BatchRunResultPending = 0
|
||||
BatchRunResultRunning = 1
|
||||
BatchRunResultSuccess = 2
|
||||
BatchRunResultFailed = 3
|
||||
BatchRunResultPartialSuccess = 4
|
||||
)
|
||||
|
||||
const (
|
||||
BatchStatusNormal = 0
|
||||
BatchStatusAbandoned = 1
|
||||
)
|
||||
|
||||
const (
|
||||
BatchDetailStatusPending = 0
|
||||
BatchDetailStatusRunning = 1
|
||||
BatchDetailStatusSuccess = 2
|
||||
BatchDetailStatusFailed = 3
|
||||
)
|
||||
|
||||
const (
|
||||
BatchSourceTypeBatchSelect = 0
|
||||
BatchSourceTypeRange = 1
|
||||
BatchSourceTypeBatchInput = 2
|
||||
BatchSourceTypeFile = 3
|
||||
BatchSourceTypeScheduled = 4
|
||||
)
|
||||
|
||||
const (
|
||||
BatchTypeInbound = 1
|
||||
BatchTypeOutbound = 2
|
||||
BatchTypeAllocate = 3
|
||||
BatchTypePrepare = 4
|
||||
BatchTypeCardAddPackage = 11
|
||||
BatchTypePoolAddPackage = 12
|
||||
BatchTypeSimWarningConfig = 40
|
||||
BatchTypeTrafficCutoffConfig = 41
|
||||
|
||||
BatchTypeRenew = 101
|
||||
BatchTypeChange = 102
|
||||
BatchTypeStart = 103
|
||||
BatchTypeStop = 104
|
||||
BatchTypeRestart = 105
|
||||
BatchTypeCancel = 106
|
||||
BatchTypeDataCut = 107
|
||||
BatchTypeUnsub = 108
|
||||
BatchTypeDataStart = 109
|
||||
BatchTypeDataStop = 110
|
||||
)
|
||||
|
||||
const (
|
||||
BatchNoPrefixInbound = "INB"
|
||||
BatchNoPrefixOutbound = "OUT"
|
||||
BatchNoPrefixAllocate = "ALC"
|
||||
BatchNoPrefixCardAddPackage = "ADP"
|
||||
BatchNoPrefixPoolAddPackage = "PAP"
|
||||
BatchNoPrefixSimWarningConfig = "SWC"
|
||||
BatchNoPrefixTrafficCutoffConfig = "TCC"
|
||||
|
||||
BatchNoPrefixRenew = "REN"
|
||||
BatchNoPrefixChange = "CHG"
|
||||
BatchNoPrefixStart = "STR"
|
||||
BatchNoPrefixStop = "STP"
|
||||
BatchNoPrefixRestart = "RST"
|
||||
BatchNoPrefixCancel = "CAN"
|
||||
BatchNoPrefixDataCut = "DCT"
|
||||
BatchNoPrefixUnsub = "UNS"
|
||||
BatchNoPrefixDataStart = "DOP"
|
||||
BatchNoPrefixDataStop = "DST"
|
||||
)
|
||||
|
||||
const (
|
||||
BlankOutStatusYes = 0
|
||||
BlankOutStatusNo = 1
|
||||
)
|
||||
|
||||
const (
|
||||
DownloadStatusPending = 0
|
||||
DownloadStatusGenerated = 1
|
||||
DownloadStatusRunning = 2
|
||||
DownloadStatusFailed = 3
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceTypeExcel = 1
|
||||
ResourceExportSceneInbound = 1
|
||||
ResourceExportSceneOutbound = 2
|
||||
ResourceExportSceneAllocate = 3
|
||||
ResourceExportSceneCardAddPackage = 11
|
||||
ResourceExportScenePoolAddPackage = 12
|
||||
ResourceExportSceneSimWarningConfig = 40
|
||||
ResourceExportSceneTrafficCutoffConfig = 41
|
||||
ResourceExportSceneRenew = 101
|
||||
ResourceExportSceneChange = 102
|
||||
ResourceExportSceneCancel = 106
|
||||
ResourceExportSceneDataCut = 107
|
||||
ResourceExportSceneUnsub = 108
|
||||
ResourceExportSceneDataStart = 109
|
||||
ResourceExportSceneDataStop = 110
|
||||
)
|
||||
|
||||
const (
|
||||
ImportStatusSuccess = "success"
|
||||
ImportStatusFailed = "failed"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceBatchDownloadTaskSimCardInbound = "卡入库结果"
|
||||
ResourceBatchDownloadTaskSimCardOutbound = "卡出库结果"
|
||||
ResourceBatchDownloadTaskSimCardRenew = "卡续费结果"
|
||||
ResourceBatchDownloadTaskSimCardChange = "卡变更套餐结果"
|
||||
ResourceBatchDownloadTaskSimCardCancel = "卡销户结果"
|
||||
ResourceBatchDownloadTaskSimCardUnsub = "卡退订结果"
|
||||
ResourceBatchDownloadTaskSimCardAddPackage = "单卡加油包结果"
|
||||
ResourceBatchDownloadTaskSimPoolAddPackage = "流量池加油包结果"
|
||||
ResourceBatchDownloadTaskSimWarningConfig = "预警配置结果"
|
||||
ResourceBatchDownloadTaskTrafficCutoffConfig = "达量断网配置结果"
|
||||
ResourceBatchDownloadTaskSimCardDataCut = "SIM卡达量断网结果"
|
||||
|
||||
SimCardInboundMaxFileSize = 50 << 20
|
||||
SimCardInboundSubDirImportInput = "sim-card-inbound/import-input"
|
||||
SimCardInboundDefaultInputInlineMaxRows = 1000
|
||||
SimCardOutboundMaxFileSize = 50 << 20
|
||||
SimCardRenewMaxFileSize = 50 << 20
|
||||
SimCardChangeMaxFileSize = 50 << 20
|
||||
SimCardCancelMaxFileSize = 50 << 20
|
||||
SimCardUnsubMaxFileSize = 50 << 20
|
||||
SimCardAddPackageMaxFileSize = 50 << 20
|
||||
SimPoolAddPackageMaxFileSize = 50 << 20
|
||||
|
||||
SimCardInboundSubDirImportExcel = "sim-card-inbound/import"
|
||||
SimCardInboundSubDirResultExcel = "sim-card-inbound/result"
|
||||
SimCardOutboundSubDirImportExcel = "sim-card-outbound/import"
|
||||
SimCardOutboundSubDirResultExcel = "sim-card-outbound/result"
|
||||
SimCardRenewSubDirImportExcel = "sim-card-renew/import"
|
||||
SimCardRenewSubDirResultExcel = "sim-card-renew/result"
|
||||
SimCardChangeSubDirImportExcel = "sim-card-change/import"
|
||||
SimCardChangeSubDirResultExcel = "sim-card-change/result"
|
||||
SimCardCancelSubDirImportExcel = "sim-card-cancel/import"
|
||||
SimCardCancelSubDirResultExcel = "sim-card-cancel/result"
|
||||
SimCardUnsubSubDirImportExcel = "sim-card-unsub/import"
|
||||
SimCardUnsubSubDirResultExcel = "sim-card-unsub/result"
|
||||
SimCardAddPackageSubDirImportExcel = "sim-card-add-package/import"
|
||||
SimCardAddPackageSubDirResultExcel = "sim-card-add-package/result"
|
||||
SimPoolAddPackageSubDirImportExcel = "sim-pool-add-package/import"
|
||||
SimPoolAddPackageSubDirResultExcel = "sim-pool-add-package/result"
|
||||
|
||||
SimCardDataStartMaxFileSize = 50 << 20
|
||||
SimCardDataStopMaxFileSize = 50 << 20
|
||||
|
||||
// 业务受理-开停数据 / 停复机(自主复机、重启)单次导入的条数上限,Excel 与批量输入统一生效
|
||||
SimCardBatchMaxRows = 20000
|
||||
SimCardDataStartSubDirImportExcel = "sim-card-data-start/import"
|
||||
SimCardDataStartSubDirResultExcel = "sim-card-data-start/result"
|
||||
SimCardDataStopSubDirImportExcel = "sim-card-data-stop/import"
|
||||
SimCardDataStopSubDirResultExcel = "sim-card-data-stop/result"
|
||||
|
||||
SimWarningConfigMaxFileSize = 50 << 20
|
||||
SimWarningConfigSubDirImportExcel = "sim-warning-config/import"
|
||||
SimWarningConfigSubDirResultExcel = "sim-warning-config/result"
|
||||
SimCardTrafficCutoffConfigMaxFileSize = 50 << 20
|
||||
SimCardTrafficCutoffConfigSubDirImportExcel = "sim-card-traffic-cutoff-config/import"
|
||||
SimCardTrafficCutoffConfigSubDirResultExcel = "sim-card-traffic-cutoff-config/result"
|
||||
SimCardDataCutMaxFileSize = 50 << 20
|
||||
SimCardDataCutSubDirImportExcel = "sim-card-data-cut/import"
|
||||
SimCardDataCutSubDirResultExcel = "sim-card-data-cut/result"
|
||||
)
|
||||
|
||||
const (
|
||||
OrderTypeCardSubscribe = 1
|
||||
OrderTypeCardRenew = 2
|
||||
OrderTypeCardChange = 3
|
||||
|
||||
OrderStatusCompleted = 5
|
||||
|
||||
CustomerTypeAgent = 1
|
||||
|
||||
PayTypeOffline = 3
|
||||
PayTypeBalance = 4
|
||||
|
||||
PayStatusPaid = 2
|
||||
|
||||
ProductTypeCard = 1
|
||||
|
||||
PayModeYearMonth = 1
|
||||
|
||||
PackageBusinessTypeSubscribe = 0
|
||||
PackageBusinessTypeChange = 1
|
||||
PackageBusinessTypeRenew = 2
|
||||
|
||||
// Package types: formal card/pool packages and their add-on packages.
|
||||
PackageTypeCard = 101
|
||||
PackageTypePool = 102
|
||||
PackageTypeCardAddPackage = 103
|
||||
PackageTypePoolAddPackage = 104
|
||||
|
||||
OrderReturnStatusNone = 0
|
||||
OrderReturnStatusPending = 1
|
||||
OrderReturnStatusRunning = 2
|
||||
OrderReturnStatusPartial = 3
|
||||
OrderReturnStatusSuccess = 4
|
||||
)
|
||||
|
||||
const (
|
||||
PackageStatusNone = 0
|
||||
PackageStatusPending = 1
|
||||
PackageStatusEffective = 2
|
||||
PackageStatusExpired = 3
|
||||
)
|
||||
|
||||
const (
|
||||
EffectiveStatusPending = 0
|
||||
EffectiveStatusEffective = 1
|
||||
EffectiveStatusExpired = 2
|
||||
EffectiveStatusTerminated = 3
|
||||
EffectiveStatusVoided = 4
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
// Package consts 定义缓存键模板。
|
||||
package consts
|
||||
|
||||
const (
|
||||
KeySysAuthToken = "login:%d:%s" // 系统认证token缓存 login:{userId}:{uuid}
|
||||
KeySysAuthTokenReject = "login_reject:%d:%s:" // 系统认证token拒绝缓存 login_reject:{userId}:{uuid}
|
||||
KeyLoginScanWechat = "login:scan:wechat:%d" // 系统二维码登录缓存 hash Key:SceneId field:tempUserId value:QrcodeCacheModel
|
||||
KeyUserBindWechat = "user:bind:wechat:%d" // 系统二维码绑定缓存 hash Key:SceneId field:userId value:QrcodeCacheModel
|
||||
KeyUserMfaCode = "user:mfa:%s" // 用户mfa验证码缓存 user:mfa:{uuid}
|
||||
)
|
||||
@@ -0,0 +1,41 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
import "github.com/gogf/gf/v2/errors/gcode"
|
||||
|
||||
var (
|
||||
// 账号不存在
|
||||
CodeUserNotFound = gcode.New(10001, "账号不存在", nil)
|
||||
// 账号已删除
|
||||
CodeUserDeleted = gcode.New(10002, "账号已删除", nil)
|
||||
// 密码错误
|
||||
CodeUserPasswordError = gcode.New(10003, "密码错误", nil)
|
||||
// 账号已禁用
|
||||
CodeUserDisabled = gcode.New(10004, "账号已禁用", nil)
|
||||
// 账号已锁定
|
||||
CodeUserLocked = gcode.New(10005, "账号已锁定", nil)
|
||||
// 账号已过期
|
||||
CodeUserExpired = gcode.New(10006, "账号已过期", nil)
|
||||
// 验证码错误
|
||||
CodeCaptchaError = gcode.New(10007, "验证码错误", nil)
|
||||
// 用户名已存在
|
||||
CodeUserExists = gcode.New(10008, "用户名已存在", nil)
|
||||
// 部门不存在
|
||||
CodeDeptNotFound = gcode.New(10009, "部门不存在", nil)
|
||||
// 手机号已存在
|
||||
CodePhoneExists = gcode.New(10010, "手机号已存在", nil)
|
||||
// 邮箱已存在
|
||||
CodeEmailExists = gcode.New(10011, "邮箱已存在", nil)
|
||||
// 登录已过期
|
||||
CodeLoginExpired = gcode.New(10012, "登录已过期", nil)
|
||||
// 部门下有子部门,不能删除
|
||||
CodeDeptHasSub = gcode.New(10013, "部门下有子部门,不能删除", nil)
|
||||
// 没有权限
|
||||
CodeNoPermission = gcode.New(10014, "没有权限", nil)
|
||||
// 无效Token
|
||||
CodeInvalidToken = gcode.New(10015, "无效Token", nil)
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
ConfigOssUrlPath = "sys.oss.urlPath" // 上传文件Url路径 "http://ab.com/" 或 "/" 或 "resource/upload|http://ab.com/upload"
|
||||
ConfigOssFileTypeKey = "sys.oss.fileType" // 上传文件类型
|
||||
ConfigOssImgTypeKey = "sys.oss.imgType" // 上传图片类型
|
||||
ConfigOssFileSizeKey = "sys.oss.fileSize" // 上传文件大小
|
||||
ConfigOssImgSizeKey = "sys.oss.imgSize" // 上传图片大小
|
||||
ConfigOnlineForceLogout = "sys.online.forceLogout" // 在线用户强制退出
|
||||
ConfigOssNewFileTypePath = "sys.oss.newFileTypePath.%d" // 上传文件类型路径 ${newFileType}
|
||||
)
|
||||
|
||||
const (
|
||||
ConfigOnlineForceLogoutTrue = "true" // 在线用户强制退出
|
||||
ConfigOnlineForceLogoutFalse = "false" // 在线用户强制退出
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
ContextKey = "ContextKey" // 上下文变量存储键名,前后端系统共享
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
DBNameDefault = "default"
|
||||
DBNameMemory = "memorydb"
|
||||
)
|
||||
@@ -0,0 +1,55 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
EventKeyServerClose = "server_close" // 服务关闭 args=[]
|
||||
)
|
||||
|
||||
const (
|
||||
EventKeyUserLogin = "user_login" // 用户登录 args=[uid,]
|
||||
EventKeyUserLogout = "user_logout" // 用户退出 args=[uid,]
|
||||
EventKeyUserCreate = "user_create" // 用户创建 args=[uid,]
|
||||
EventKeyUserDelete = "user_delete" // 用户删除 args=[uidArray,]
|
||||
EventKeyUserUpdate = "user_update" // 用户更新 args=[uid,]
|
||||
)
|
||||
const (
|
||||
EventKeyDBSysConfigUpdate = "db.sys_config_update" // 系统配置创建更新删除 args=[configId, tenantId,key?]
|
||||
EventKeyDBSysConfigCreate = "db.sys_config_create" // 系统配置创建 args=[configId, tenantId,key?]
|
||||
EventKeyDBSysConfigDelete = "db.sys_config_delete" // 系统配置删除 args=[configId, tenantId]
|
||||
)
|
||||
|
||||
const (
|
||||
EventKeyDBSysDeptCreate = "db.sys_dept_create" // 系统部门创建 args=[deptId,]
|
||||
EventKeyDBSysDeptUpdate = "db.sys_dept_update" // 系统部门更新 args=[deptId,]
|
||||
EventKeyDBSysDeptDelete = "db.sys_dept_delete" // 系统部门删除 args=[deptId[],]
|
||||
)
|
||||
|
||||
const (
|
||||
EventKeyDBSysTenantCreate = "db.sys_tenant_create" // 租户创建 args=[pk,]
|
||||
EventKeyDBSysTenantUpdate = "db.sys_tenant_update" // 租户更新 args=[pk,]
|
||||
EventKeyDBSysTenantDelete = "db.sys_tenant_delete" // 租户删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysRoleCreate = "db.sys_role_create" // 角色创建 args=[pk,]
|
||||
EventKeyDBSysRoleUpdate = "db.sys_role_update" // 角色更新 args=[pk,]
|
||||
EventKeyDBSysRoleDelete = "db.sys_role_delete" // 角色删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysMenuCreate = "db.sys_menu_create" // 菜单创建 args=[pk,]
|
||||
EventKeyDBSysMenuUpdate = "db.sys_menu_update" // 菜单更新 args=[pk,]
|
||||
EventKeyDBSysMenuDelete = "db.sys_menu_delete" // 菜单删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysPostCreate = "db.sys_post_create" // 岗位创建 args=[pk,]
|
||||
EventKeyDBSysPostUpdate = "db.sys_post_update" // 岗位更新 args=[pk,]
|
||||
EventKeyDBSysPostDelete = "db.sys_post_delete" // 岗位删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysDictDataCreate = "db.sys_dict_data_create" // 字典数据创建 args=[pk,]
|
||||
EventKeyDBSysDictDataUpdate = "db.sys_dict_data_update" // 字典数据更新 args=[pk,]
|
||||
EventKeyDBSysDictDataDelete = "db.sys_dict_data_delete" // 字典数据删除 args=[pk[],]
|
||||
|
||||
EventKeyDBSysDictTypeCreate = "db.sys_dict_type_create" // 字典类型创建 args=[pk,]
|
||||
EventKeyDBSysDictTypeUpdate = "db.sys_dict_type_update" // 字典类型更新 args=[pk,]
|
||||
EventKeyDBSysDictTypeDelete = "db.sys_dict_type_delete" // 字典类型删除 args=[pk[],]
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
HTTPContentTypeXml = "text/xml"
|
||||
HTTPContentTypeHtml = "text/html"
|
||||
HTTPContentTypeStream = "text/event-stream"
|
||||
HTTPContentTypeJson = "application/json"
|
||||
HTTPContentTypeExcel = "application/octet-stream"
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// 内存缓存KEY常量 注明 key组成和 过期时间 清理方式
|
||||
const (
|
||||
MemCacheDeptName = "dept_name_%d" // 部门名称缓存 部门id:name 24小时过期
|
||||
MemCacheUserInfo = "user_info_%d" // 用户信息缓存 用户id:miniinfo 24小时过期 用户修改是清理
|
||||
MemCacheUserAccessCodeList = "user_access_code_list_%d" // 用户访问码列表缓存 用户id:access_code_list 24小时过期 用户退出清理
|
||||
MemCacheUserRoleDataAccessCodeList = "user_role_data_access_code_list_%d" // 用户角色数据访问码列表缓存 用户id:role_id:data_access_code_list 24小时过期 用户退出清理
|
||||
MemCacheSystemConfig = "system_config_%s" // 系统配置缓存 租户ID:map[key]value 24小时过期
|
||||
)
|
||||
@@ -0,0 +1,42 @@
|
||||
package consts
|
||||
|
||||
import "strings"
|
||||
|
||||
const (
|
||||
BillingMethodMonth = 1
|
||||
BillingMethodYear = 2
|
||||
|
||||
RenewDurationUnitMonth = "month"
|
||||
RenewDurationUnitYear = "year"
|
||||
)
|
||||
|
||||
func BillingMethodDurationUnit(billingMethod int) string {
|
||||
if billingMethod == BillingMethodMonth {
|
||||
return RenewDurationUnitMonth
|
||||
}
|
||||
return RenewDurationUnitYear
|
||||
}
|
||||
|
||||
func NormalizeRenewDurationUnit(unit string) string {
|
||||
if strings.EqualFold(strings.TrimSpace(unit), RenewDurationUnitMonth) {
|
||||
return RenewDurationUnitMonth
|
||||
}
|
||||
return RenewDurationUnitYear
|
||||
}
|
||||
|
||||
func RenewDurationUnitText(unit string) string {
|
||||
if NormalizeRenewDurationUnit(unit) == RenewDurationUnitMonth {
|
||||
return "个月"
|
||||
}
|
||||
return "年"
|
||||
}
|
||||
|
||||
func DurationValueToMonths(unit string, value int) int {
|
||||
if value <= 0 {
|
||||
return 0
|
||||
}
|
||||
if NormalizeRenewDurationUnit(unit) == RenewDurationUnitMonth {
|
||||
return value
|
||||
}
|
||||
return value * 12
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
const (
|
||||
QueueSysOptLog = "queue:sys_opt_log"
|
||||
QueueTrafficUsageDailyRetry = "iotlcm.traffic_usage.daily.retry"
|
||||
QueueTrafficUsageMonthlyRetry = "iotlcm.traffic_usage.monthly.retry"
|
||||
// QueueTrafficUsageMonthlyStart carries one command per full monthly usage run.
|
||||
// Worker consumes it and owns database scanning and Redis production.
|
||||
QueueTrafficUsageMonthlyStart = "iotlcm.traffic_usage.monthly.start"
|
||||
// QueueTrafficUsageDailyStart carries one command per full daily usage run.
|
||||
// Worker consumes it and owns database scanning and Redis production.
|
||||
QueueTrafficUsageDailyStart = "iotlcm.traffic_usage.daily.start"
|
||||
// QueueTrafficUsageMonthlyHistoryStart carries one command per full monthly
|
||||
// usage history run (the TDengine monthly table).
|
||||
QueueTrafficUsageMonthlyHistoryStart = "iotlcm.traffic_usage.monthly_history.start"
|
||||
QueueSimStatusQueueStart = "iotlcm.sim_status.queue.start"
|
||||
QueueImeiQueueStart = "iotlcm.imei.queue.start"
|
||||
QueueSimStatusQueueTask = "iotlcm.sim_status.queue.task"
|
||||
QueueWorkOrderAutoClose = "iotlcm.work_order.auto_close"
|
||||
QueueWorkOrderAutoCloseDelay = "iotlcm.work_order.auto_close.delay"
|
||||
QueueWorkerDiagnostic = "iotlcm.worker.diagnostic"
|
||||
QueueBatchExecute = "iotlcm.batch.execute"
|
||||
QueueBatchOutboundExecute = "iotlcm.batch.outbound.execute"
|
||||
QueueBalanceRechargeTimeout = "iotlcm.balance.recharge.timeout"
|
||||
QueueBalanceRechargeDelay = "iotlcm.balance.recharge.delay"
|
||||
QueuePackageCustomerSync = "iotlcm.package_customer.sync"
|
||||
QueueChannelRefresh = "iotlcm.channel.refresh"
|
||||
QueueAgentRoleSync = "iotlcm.agent.role.sync"
|
||||
QueueAgentRoleSyncRetry = "iotlcm.agent.role.sync.retry"
|
||||
QueueAgentRoleSyncDeadLetter = "iotlcm.agent.role.sync.dlq"
|
||||
)
|
||||
|
||||
// 数据库变动类型
|
||||
const (
|
||||
DbChgTypeAdd = "add" // 数据库变动新增
|
||||
DbChgTypeEdit = "edit" // 数据库变动编辑
|
||||
DbChgTypeDel = "del" // 数据库变动删除
|
||||
)
|
||||
const (
|
||||
BroadcastDbChg = "broadcast:db:chg" // 数据库配置表变动更新广播消息 obj{table_name,pk,type:add/edit/del,data:{主要字段数据}}
|
||||
)
|
||||
@@ -0,0 +1,34 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
SimCardStatusOperTypeStop = "0"
|
||||
SimCardStatusOperTypeStart = "1"
|
||||
|
||||
ResourceExportSceneStart = 103
|
||||
ResourceExportSceneStop = 104
|
||||
ResourceExportSceneRestart = 105
|
||||
|
||||
ResourceBatchDownloadTaskSimCardStart = "SIM卡批量复机结果"
|
||||
ResourceBatchDownloadTaskSimCardStop = "SIM卡批量停机结果"
|
||||
ResourceBatchDownloadTaskSimCardRestart = "SIM卡批量重启结果"
|
||||
SimCardLifecycleMaxFileSize = 50 << 20
|
||||
SimCardStartSubDirImportExcel = "sim-card-start/import"
|
||||
SimCardStartSubDirResultExcel = "sim-card-start/result"
|
||||
SimCardStopSubDirImportExcel = "sim-card-stop/import"
|
||||
SimCardStopSubDirResultExcel = "sim-card-stop/result"
|
||||
SimCardRestartSubDirImportExcel = "sim-card-restart/import"
|
||||
SimCardRestartSubDirResultExcel = "sim-card-restart/result"
|
||||
)
|
||||
|
||||
const (
|
||||
SimCardDataOperTypeStart = 0
|
||||
SimCardDataOperTypeStop = 1
|
||||
|
||||
SimCardDataApnName = "CMIOT"
|
||||
|
||||
DataOperationStart = "dataStart"
|
||||
DataOperationStop = "dataStop"
|
||||
|
||||
ResourceBatchDownloadTaskSimCardDataStart = "SIM卡批量开通数据服务结果"
|
||||
ResourceBatchDownloadTaskSimCardDataStop = "SIM卡批量停用数据服务结果"
|
||||
)
|
||||
@@ -0,0 +1,146 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
var (
|
||||
// 默认系统租客编号,禁止修改编号
|
||||
DefaultSystemTenantCode = "000000"
|
||||
SuperAdminRoleId = int64(1)
|
||||
)
|
||||
|
||||
var (
|
||||
// 状态: 0正常 1停用
|
||||
SysStatusNormal = "0"
|
||||
SysStatusDisable = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 菜单状态: 0正常 1停用
|
||||
SysMenuStatusNormal = "0"
|
||||
SysMenuStatusDisable = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 菜单类型: M目录 C菜单 F按钮
|
||||
SysMenuTypeDir = "M"
|
||||
SysMenuTypeMenu = "C"
|
||||
SysMenuTypeBtn = "F"
|
||||
)
|
||||
|
||||
var (
|
||||
// 菜单可见: 0显示 1隐藏
|
||||
SysMenuVisibleShow = "0"
|
||||
SysMenuVisibleHide = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 菜单是否为外链: 0是 1否
|
||||
SysMenuIsFrameNo = 1
|
||||
SysMenuIsFrameYes = 0
|
||||
)
|
||||
|
||||
var (
|
||||
// 用户状态: 0正常 1停用
|
||||
SysUserStatusNormal = "0"
|
||||
SysUserStatusDisable = "1"
|
||||
SysUserStatusLocked = "2"
|
||||
SysUserStatusExpired = "3"
|
||||
SysUserStatusDeleted = "4"
|
||||
)
|
||||
|
||||
var (
|
||||
// 角色数据范围: 1全部数据权限 2自定数据权限 3本部门数据权限 4本部门及以下数据权限 5仅本人数据权限 6本部门及以下或本人数据权限 7本组织及本组织下一级数据权限 8本组织下一级数据权限
|
||||
SysRoleMenuDataScopeRole = "0"
|
||||
SysRoleDataScopeAll = "1"
|
||||
SysRoleDataScopeCustom = "2"
|
||||
SysRoleDataScopeDept = "3"
|
||||
SysRoleDataScopeDeptAndBelow = "4"
|
||||
SysRoleDataScopePersonal = "5"
|
||||
SysRoleDataScopeDeptAndBelowOrPersonal = "6"
|
||||
SysRoleDataScopeOrgAndNextLevel = "7"
|
||||
SysRoleDataScopeOrgNextLevel = "8"
|
||||
)
|
||||
|
||||
var (
|
||||
// 上传文件类型: 1文件 2图片
|
||||
SysUploadFileTypeFile = "file"
|
||||
SysUploadFileTypeImg = "img"
|
||||
)
|
||||
|
||||
var (
|
||||
// 新文件类型
|
||||
SysUploadNewFileTypeUserFile = 1 // 用户文件
|
||||
SysUploadNewFileTypeUserImg = 2 // 用户图片
|
||||
SysUploadNewFileTypeDeviceFile = 3 // 设备文件 ${device_key}
|
||||
)
|
||||
var (
|
||||
// 新文件类型路径
|
||||
SysUploadNewFileTypePathUserFile = "user/file" // 用户文件
|
||||
SysUploadNewFileTypePathUserImg = "user/img" // 用户图片
|
||||
SysUploadNewFileTypePathDeviceFile = "device" // 设备文件 ${device_key}
|
||||
)
|
||||
var (
|
||||
// 用户性别: 0男 1女 2未知
|
||||
SysUserSexMale = "0"
|
||||
SysUserSexFemale = "1"
|
||||
SysUserSexUnknown = "2"
|
||||
)
|
||||
|
||||
var (
|
||||
// 用户类型: pc端 app端
|
||||
SysUserTypeSys = "sys_user"
|
||||
SysUserTypeAPP = "app_user"
|
||||
)
|
||||
|
||||
var (
|
||||
// 部门状态: 0正常 1停用
|
||||
SysDeptStatusNormal = "0"
|
||||
SysDeptStatusDisable = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 任务状态: 0正常 1停用
|
||||
SysJobStatusNormal = "0"
|
||||
SysJobStatusDisable = "1"
|
||||
)
|
||||
|
||||
var (
|
||||
// 计划执行策略 0不限制并发 1限制并发
|
||||
SysJobMisfirePolicyMulty = 1
|
||||
SysJobMisfirePolicyOnce = 2
|
||||
)
|
||||
var (
|
||||
// 权限码前缀 x-check-permission
|
||||
SysCheckPermissionPrefix = "cp"
|
||||
SysCheckPermissionRolePrefix = "cpr:" // 角色权限码前缀+角色权限
|
||||
SysCheckPermissionMenuPrefix = "cpm:" // 菜单权限码前缀+菜单权限
|
||||
SysCheckPermissionDeptPrefix = "cpd:" // 部门权限码前缀+部门编码
|
||||
SysCheckPermissionPostPrefix = "cpp:" // 岗位权限码前缀+岗位编码
|
||||
SysCheckPermissionUserPrefix = "cpu:" // 用户权限码前缀+用户名
|
||||
SysCheckPermissionCurrentUser = "cpc:current:user" // 当前登录用户默认权限
|
||||
)
|
||||
var StatusSlice = []int{0, 1}
|
||||
|
||||
// MethodSlice HTTP请求方法
|
||||
var MethodSlice = []int{1, 2, 3, 4}
|
||||
|
||||
var (
|
||||
// 公告范围: 1全部 2指定组织 3指定用户
|
||||
NoticeRangeAll = 1
|
||||
NoticeRangeDept = 2
|
||||
NoticeRangeUser = 3
|
||||
)
|
||||
|
||||
var (
|
||||
// 租户配置
|
||||
ConfigKeyTenantDefaultRegisterDeptId = "iot.register.dept"
|
||||
ConfigKeyTenantDefaultRegisterRoleId = "iot.register.role"
|
||||
)
|
||||
|
||||
var (
|
||||
// 微信平台
|
||||
SourceWechatMp = "wechat_mp"
|
||||
)
|
||||
@@ -0,0 +1,90 @@
|
||||
package consts
|
||||
|
||||
// V3 API enum labels are centralized here for urgent compatibility work.
|
||||
// Move domain enum values to their own const files when the compatibility layer stabilizes.
|
||||
|
||||
const (
|
||||
V3ApiSimAccessTypeIPv4 = 1
|
||||
V3ApiSimAccessTypeIPv6 = 2
|
||||
V3ApiSimAccessTypeIPv4IPv6 = 3
|
||||
)
|
||||
|
||||
var V3ApiSimAccessTypeNameMap = map[int]string{
|
||||
V3ApiSimAccessTypeIPv4: "IPV4",
|
||||
V3ApiSimAccessTypeIPv6: "IPV6",
|
||||
V3ApiSimAccessTypeIPv4IPv6: "IPV4/IPV6",
|
||||
}
|
||||
|
||||
const (
|
||||
V3ApiSimBossCardStatusPendingActivate = 1
|
||||
V3ApiSimBossCardStatusActivated = 2
|
||||
V3ApiSimBossCardStatusStopped = 4
|
||||
V3ApiSimBossCardStatusTestable = 6
|
||||
V3ApiSimBossCardStatusStock = 7
|
||||
V3ApiSimBossCardStatusPreCancel = 8
|
||||
V3ApiSimBossCardStatusCanceled = 9
|
||||
)
|
||||
|
||||
var V3ApiSimBossCardStatusNameMap = map[int]string{
|
||||
V3ApiSimBossCardStatusPendingActivate: "待激活",
|
||||
V3ApiSimBossCardStatusActivated: "已激活",
|
||||
V3ApiSimBossCardStatusStopped: "已停机",
|
||||
V3ApiSimBossCardStatusTestable: "可测试",
|
||||
V3ApiSimBossCardStatusStock: "库存",
|
||||
V3ApiSimBossCardStatusPreCancel: "预销户",
|
||||
V3ApiSimBossCardStatusCanceled: "已销户",
|
||||
}
|
||||
|
||||
const (
|
||||
V3ApiSimCardTypePlug = 1
|
||||
V3ApiSimCardType5X6 = 2
|
||||
V3ApiSimCardType2X2 = 3
|
||||
V3ApiSimCardTypeMP1 = 4
|
||||
V3ApiSimCardTypeMP2 = 5
|
||||
V3ApiSimCardTypeMS0 = 6
|
||||
V3ApiSimCardTypeMS1 = 7
|
||||
)
|
||||
|
||||
var V3ApiSimCardTypeNameMap = map[int]string{
|
||||
V3ApiSimCardTypePlug: "插拔",
|
||||
V3ApiSimCardType5X6: "贴片卡5X6",
|
||||
V3ApiSimCardType2X2: "贴片卡2X2",
|
||||
V3ApiSimCardTypeMP1: "插拔卡(MP1)",
|
||||
V3ApiSimCardTypeMP2: "插拔卡(MP2)",
|
||||
V3ApiSimCardTypeMS0: "贴片卡(MS0)",
|
||||
V3ApiSimCardTypeMS1: "贴片卡(MS1)",
|
||||
}
|
||||
|
||||
const (
|
||||
V3ApiSimNetModel3G = 1
|
||||
V3ApiSimNetModel2G = 2
|
||||
V3ApiSimNetModel4G = 3
|
||||
V3ApiSimNetModel5G = 4
|
||||
V3ApiSimNetModelNBIoT = 5
|
||||
V3ApiSimNetModel5GSA = 6
|
||||
V3ApiSimNetModel5GNSA = 7
|
||||
V3ApiSimNetModel2G3G = 8
|
||||
V3ApiSimNetModelTelecomNB = 9
|
||||
V3ApiSimNetModelMobile4G = 10
|
||||
V3ApiSimNetModelUnicomNB = 11
|
||||
V3ApiSimNetModelUnicom4G = 12
|
||||
V3ApiSimNetModelTelecom4G = 13
|
||||
V3ApiSimNetModelRedCap = 14
|
||||
)
|
||||
|
||||
var V3ApiSimNetModelNameMap = map[int]string{
|
||||
V3ApiSimNetModel3G: "3G",
|
||||
V3ApiSimNetModel2G: "2G",
|
||||
V3ApiSimNetModel4G: "4G",
|
||||
V3ApiSimNetModel5G: "5G",
|
||||
V3ApiSimNetModelNBIoT: "NB-IOT",
|
||||
V3ApiSimNetModel5GSA: "5G-SA",
|
||||
V3ApiSimNetModel5GNSA: "5G-NSA",
|
||||
V3ApiSimNetModel2G3G: "2G/3G",
|
||||
V3ApiSimNetModelTelecomNB: "电信NB",
|
||||
V3ApiSimNetModelMobile4G: "移动4G",
|
||||
V3ApiSimNetModelUnicomNB: "联通NB",
|
||||
V3ApiSimNetModelUnicom4G: "联通4G",
|
||||
V3ApiSimNetModelTelecom4G: "电信4G",
|
||||
V3ApiSimNetModelRedCap: "RedCap",
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
WarningWechatTemplateIDDefault = "DMDP2PKktdtG1ES_3Ic1JcR0LGELQmWE6LunYyerHCY"
|
||||
WarningWechatSource = "wechat_mp"
|
||||
)
|
||||
@@ -0,0 +1,23 @@
|
||||
// Package consts
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package consts
|
||||
|
||||
// 服务器监控信息
|
||||
const (
|
||||
MonitorServerHost = "host"
|
||||
MonitorServerSysLoad = "sysLoad"
|
||||
MonitorServerCpu = "cpu"
|
||||
MonitorServerMem = "mem"
|
||||
MonitorServerDisk = "disk"
|
||||
MonitorServerNet = "net"
|
||||
MonitorServerGo = "go"
|
||||
)
|
||||
|
||||
// WEBSOCKET订阅Tag 服务器监控信息
|
||||
const (
|
||||
WSTagMonitorServer = "ws:tag:monitor:server" // WEBSOCKET订阅Tag 服务器监控信息
|
||||
WSEventMonitorServer = "ws:event:monitor:server:%s" // WEBSOCKET订阅 服务器监控信息 %s in [host,sysLoad,cpu,disk,net,go]
|
||||
)
|
||||
Reference in New Issue
Block a user