chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)

This commit is contained in:
MiFaZhan
2026-11-02 13:27:59 +08:00
1250 changed files with 154111 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
// Package cmd
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
package cmd
var (
Main = Http
)
+61
View File
@@ -0,0 +1,61 @@
// Package cmd
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
package cmd
import (
"context"
"errors"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/cache"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gmode"
)
// 系统初始化
func SystemInit(ctx context.Context) {
// 检查数据库连接
if err := CheckConnDB(ctx); err != nil {
panic(err)
}
// 设置gf运行模式
SetGFMode(ctx)
// 默认上海时区
if err := gtime.SetTimeZone("Asia/Shanghai"); err != nil {
g.Log().Fatalf(ctx, "时区设置异常 err: %+v", err)
return
}
// 设置缓存适配器
cache.SetAdapter(ctx)
}
// CheckConnDB 检查数据库连接
func CheckConnDB(ctx context.Context) error {
err := g.DB().PingMaster()
if err != nil {
return errors.New("连接到数据库失败")
}
return nil
}
// 设置gf运行模式
func SetGFMode(ctx context.Context) {
gfmode := g.Cfg().MustGet(ctx, "system.gfmode").String()
if len(gfmode) == 0 {
gfmode = gmode.NOT_SET
}
var modes = []string{gmode.DEVELOP, gmode.TESTING, gmode.STAGING, gmode.PRODUCT}
for _, mode := range modes {
if mode == gfmode {
gmode.Set(mode)
break
}
}
}
func DBHandle(ctx context.Context) {
}
+66
View File
@@ -0,0 +1,66 @@
package cmd
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/cmd/inithttp"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/exportcenter"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/rabbitmq"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/websocket"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/router"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/tasks"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcmd"
_ "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/queues/httpqueues"
)
func init() {
inithttp.RegisterHttpInitFunc("initJobTask", initJobTask)
inithttp.RegisterHttpInitFunc("exportCenter", initExportCenter)
inithttp.RegisterHttpCleanupFunc("rabbitmq", func(ctx context.Context) error {
return rabbitmq.Close()
})
}
// initExportCenter 导出中心:补偿上次进程遗留的任务,并启动过期文件清理。
func initExportCenter(ctx context.Context) error {
exportcenter.RecoverOnStart(ctx)
exportcenter.StartCleanup(ctx)
return nil
}
var Http = &gcmd.Command{
Name: "http",
Usage: "http",
Brief: "HTTP控制台服务",
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
g.Log().Infof(ctx, "Http init start")
serverWg.Add(1)
s := g.Server()
go func() {
waitServerClose(ctx)
websocket.StopWebSocket(ctx)
s.Shutdown()
serverWg.Done()
}()
err = inithttp.InitHttp(ctx)
if err != nil {
g.Log().Errorf(ctx, "http init error: %v", err)
return err
}
s.SetDumpRouterMap(true)
router.InitRouter(ctx, s)
websocket.StartWebSocket(ctx)
s.Run()
inithttp.CleanupHttp(ctx)
return nil
},
}
func initJobTask(ctx context.Context) error {
tasks.TasksInstance(ctx)
service.SysJob().InitRegister()
return nil
}
@@ -0,0 +1,46 @@
// Package cmd
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
package cmd
import (
"context"
"errors"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgen"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gmode"
)
var (
initFuncList map[string]func(ctx context.Context) error
)
func RegisterInitFunc(name string, fn func(ctx context.Context) error) {
if initFuncList == nil {
initFuncList = make(map[string]func(ctx context.Context) error)
}
initFuncList[name] = fn
}
func InitSystemDeferFunc(ctx context.Context) error {
for name, fn := range initFuncList {
if fn == nil {
g.Log().Errorf(ctx, "InitSystemDeferFunc %s fn is nil.", name)
return errors.New("func is nil")
}
err := fn(ctx)
if err != nil {
g.Log().Errorf(ctx, "InitSystemDeferFunc %s err: %v", name, err)
return err
}
g.Log().Infof(ctx, "InitSystemDeferFunc %s success.", name)
}
// 初始化生成代码配置
if !gmode.IsProduct() {
xgen.Init(ctx)
}
return nil
}
@@ -0,0 +1,59 @@
package inithttp
import (
"context"
"sync"
"github.com/gogf/gf/v2/frame/g"
)
var (
httpInitFunc map[string]func(ctx context.Context) error
httpCleanupFunc map[string]func(ctx context.Context) error
rwLock sync.RWMutex
)
func RegisterHttpInitFunc(name string, fn func(ctx context.Context) error) {
rwLock.Lock()
defer rwLock.Unlock()
if httpInitFunc == nil {
httpInitFunc = make(map[string]func(ctx context.Context) error)
}
httpInitFunc[name] = fn
}
func RegisterHttpCleanupFunc(name string, fn func(ctx context.Context) error) {
rwLock.Lock()
defer rwLock.Unlock()
if httpCleanupFunc == nil {
httpCleanupFunc = make(map[string]func(ctx context.Context) error)
}
httpCleanupFunc[name] = fn
}
func InitHttp(ctx context.Context) error {
rwLock.RLock()
defer rwLock.RUnlock()
for name, fn := range httpInitFunc {
if err := fn(ctx); err != nil {
g.Log().Errorf(ctx, "httpInitFunc %s error: %v", name, err)
return err
} else {
g.Log().Infof(ctx, "httpInitFunc %s success", name)
}
}
return nil
}
func CleanupHttp(ctx context.Context) error {
rwLock.RLock()
defer rwLock.RUnlock()
for name, fn := range httpCleanupFunc {
if err := fn(ctx); err != nil {
g.Log().Errorf(ctx, "httpCleanupFunc %s error: %v", name, err)
} else {
g.Log().Infof(ctx, "httpCleanupFunc %s success", name)
}
}
return nil
}
+74
View File
@@ -0,0 +1,74 @@
// Package cmd
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
package cmd
import (
"context"
"fmt"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/cmd/inithttp"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/websocket"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"time"
)
func init() {
inithttp.RegisterHttpInitFunc("InitMonitor", func(ctx context.Context) error {
InitMonitor()
return nil
})
}
func InitMonitor() {
go func() {
for {
RunMonitor()
time.Sleep(time.Second * 5)
}
}()
websocket.RegisterTagCallback(consts.WSTagMonitorServer, func(client *websocket.Client, tag string) {
RunMonitor()
})
}
func RunMonitor() {
ctx := context.Background()
hostInfo := service.MonitorServer().GetHostInfo(ctx)
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerHost),
Data: hostInfo,
})
sysLoad := service.MonitorServer().GetSysLoad(ctx)
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerSysLoad),
Data: sysLoad,
})
cpuInfo := service.MonitorServer().GetCpuInfo(ctx)
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerCpu),
Data: cpuInfo,
})
memInfo := service.MonitorServer().GetMemInfo(ctx)
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerMem),
Data: memInfo,
})
diskInfo := service.MonitorServer().GetDiskInfo(ctx)
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerDisk),
Data: diskInfo,
})
netInfo := service.MonitorServer().GetNetStatusInfo(ctx)
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerNet),
Data: netInfo,
})
goInfo := service.MonitorServer().GetGoInfo(ctx)
websocket.SendToTag(consts.WSTagMonitorServer, &websocket.WResponse{
Event: fmt.Sprintf(consts.WSEventMonitorServer, consts.MonitorServerGo),
Data: goInfo,
})
}
+58
View File
@@ -0,0 +1,58 @@
package cmd
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/event"
"os"
"sync"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gproc"
)
var (
serverCloseSignal = make(chan struct{}, 1)
serverWg = sync.WaitGroup{}
once sync.Once
)
// 等待接收服务关闭信号
func waitServerClose(ctx context.Context) {
signalListen(ctx, handleSignalClose)
<-serverCloseSignal
}
// 等待所有服务关闭
func waitAllServerClose(ctx context.Context) {
serverWg.Wait()
}
// 处理服务关闭信号
func handleSignalClose(sig os.Signal) {
serverCloseEvent(gctx.GetInitCtx())
serverCloseSignal <- struct{}{}
}
// 监听信号
func signalListen(ctx context.Context, handler ...gproc.SigHandler) {
g.Go(ctx, func(ctx context.Context) {
// syscall.SIGINT,
// syscall.SIGQUIT,
// syscall.SIGKILL,
// syscall.SIGTERM,
// syscall.SIGABRT.
gproc.AddSigHandlerShutdown(handler...)
gproc.Listen()
}, func(ctx context.Context, exception error) {
g.Log().Fatalf(ctx, "信号监听异常 err: %+v", exception)
})
}
// serverCloseEvent 关闭事件
func serverCloseEvent(ctx context.Context) {
once.Do(func() {
event.EventsInstance().Emit(ctx, consts.EventKeyServerClose, nil)
})
}
+234
View File
@@ -0,0 +1,234 @@
package consts
const (
BatchAsyncStatusCreated = 0
BatchAsyncStatusPending = 1
BatchAsyncStatusProcessing = 2
BatchAsyncStatusSuccess = 3
BatchAsyncStatusFailed = 4
BatchAsyncStatusPartialSuccess = 5
BatchAsyncStatusReview = 6
)
const (
BatchRunResultPending = 0
BatchRunResultRunning = 1
BatchRunResultSuccess = 2
BatchRunResultFailed = 3
BatchRunResultPartialSuccess = 4
BatchRunResultReview = 5
)
const (
BatchStatusNormal = 0
BatchStatusAbandoned = 1
)
const (
BatchDetailStatusPending = 0
BatchDetailStatusRunning = 1
BatchDetailStatusSuccess = 2
BatchDetailStatusFailed = 3
BatchDetailStatusUnknown = 4
BatchDetailStatusNotExecuted = 5
)
const (
BatchSourceTypeBatchSelect = 0
BatchSourceTypeRange = 1
BatchSourceTypeBatchInput = 2
BatchSourceTypeFile = 3
BatchSourceTypeScheduled = 4
)
const (
BatchTypeInbound = 1
BatchTypeOutbound = 2
BatchTypeAllocate = 3
BatchTypePrepare = 4
BatchTypeCardAddPackage = 11
BatchTypePoolAddPackage = 12
BatchTypeExport = 14 // 数据导出(仅写执行日志,不出现在批次管理页)
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"
BatchNoPrefixExport = "EXP"
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}
)
+41
View File
@@ -0,0 +1,41 @@
// Package consts
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @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 <xxx@example.com>
// @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 <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
package consts
const (
ContextKey = "ContextKey" // 上下文变量存储键名,前后端系统共享
)
+6
View File
@@ -0,0 +1,6 @@
package consts
const (
DBNameDefault = "default"
DBNameMemory = "memorydb"
)
+55
View File
@@ -0,0 +1,55 @@
// Package consts
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @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[],]
)
+14
View File
@@ -0,0 +1,14 @@
// Package consts
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @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 <xxx@example.com>
// @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
}
+49
View File
@@ -0,0 +1,49 @@
// Package consts
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @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"
// QueueDataReviewQuery carries the manual "sync upstream result" command.
// Worker only re-reads existing operationIds/jobIds, never resubmits.
QueueDataReviewQuery = "iotlcm.data.review.query"
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卡批量停用数据服务结果"
)
+146
View File
@@ -0,0 +1,146 @@
// Package consts
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @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"
)
+90
View File
@@ -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 <xxx@example.com>
// @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]
)
@@ -0,0 +1,71 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) DeptExport(ctx context.Context, req *v1.DeptExportReq) (*v1.DeptExportRes, error) {
return &v1.DeptExportRes{}, service.AgentDept().DeptExport(ctx, &req.AgentDeptListParam)
}
func (c *ControllerV1) DeptList(ctx context.Context, req *v1.DeptListReq) (res *v1.DeptListRes, err error) {
data, total, err := service.AgentDept().DeptList(ctx, &req.AgentDeptListParam)
if err != nil {
return nil, err
}
return &v1.DeptListRes{PageResult: response.PageResult{Page: req.Page, PageSize: req.PageSize, Total: total}, Data: data}, nil
}
func (c *ControllerV1) DeptView(ctx context.Context, req *v1.DeptViewReq) (res *v1.DeptViewRes, err error) {
data, err := service.AgentDept().DeptView(ctx, req.DeptId)
if err != nil {
return nil, err
}
return &v1.DeptViewRes{AgentEnterpriseCustomerModel: *data}, nil
}
func (c *ControllerV1) DeptSave(ctx context.Context, req *v1.DeptSaveReq) (res *v1.DeptSaveRes, err error) {
deptId, err := service.AgentDept().DeptSave(ctx, &req.AgentDeptSaveParam)
if err != nil {
return nil, err
}
return &v1.DeptSaveRes{DeptId: deptId}, nil
}
func (c *ControllerV1) DeptDelete(ctx context.Context, req *v1.DeptDeleteReq) (res *v1.DeptDeleteRes, err error) {
err = service.AgentDept().DeptDelete(ctx, req.DeptId)
return &v1.DeptDeleteRes{}, err
}
func (c *ControllerV1) DeptResetPassword(ctx context.Context, req *v1.DeptResetPasswordReq) (res *v1.DeptResetPasswordRes, err error) {
err = service.AgentDept().DeptResetPassword(ctx, req.DeptId, req.Password)
return &v1.DeptResetPasswordRes{}, err
}
func (c *ControllerV1) GetDeptApiInfo(ctx context.Context, req *v1.GetDeptApiInfoReq) (res *v1.GetDeptApiInfoRes, err error) {
data, err := service.AgentDept().GetDeptApiInfo(ctx)
if err != nil {
return nil, err
}
return &v1.GetDeptApiInfoRes{AgentDeptApiModel: *data}, nil
}
func (c *ControllerV1) Scope(ctx context.Context, req *v1.ScopeReq) (res *v1.ScopeRes, err error) {
deptIds, err := service.AgentScope().ScopeDeptIds(ctx)
if err != nil {
return nil, err
}
return &v1.ScopeRes{DeptIds: deptIds}, nil
}
func (c *ControllerV1) SubCompany(ctx context.Context, req *v1.SubCompanyReq) (res *v1.SubCompanyRes, err error) {
data, err := service.AgentDept().SubCompany(ctx)
if err != nil {
return nil, err
}
return &v1.SubCompanyRes{Data: data}, nil
}
@@ -0,0 +1,16 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) MenuTree(ctx context.Context, req *v1.MenuTreeReq) (res *v1.MenuTreeRes, err error) {
tree, menuIds, err := service.AgentMenu().AllowedMenuTree(ctx, 0)
if err != nil {
return nil, err
}
return &v1.MenuTreeRes{Items: tree, MenuIds: menuIds}, nil
}
@@ -0,0 +1,13 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package agent
import "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent"
type ControllerV1 struct{}
func NewV1() agent.IAgentV1 {
return &ControllerV1{}
}
@@ -0,0 +1,42 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error) {
data, total, err := service.AgentRole().RoleList(ctx, &req.AgentRoleListParam)
if err != nil {
return nil, err
}
return &v1.RoleListRes{PageResult: response.PageResult{Total: total}, Data: data}, nil
}
func (c *ControllerV1) RoleView(ctx context.Context, req *v1.RoleViewReq) (res *v1.RoleViewRes, err error) {
data, err := service.AgentRole().RoleView(ctx, req.RoleId)
if err != nil {
return nil, err
}
return &v1.RoleViewRes{AgentRoleViewModel: *data}, nil
}
func (c *ControllerV1) RoleSave(ctx context.Context, req *v1.RoleSaveReq) (res *v1.RoleSaveRes, err error) {
roleId, err := service.AgentRole().RoleSave(ctx, &req.AgentRoleSaveParam)
if err != nil {
return nil, err
}
return &v1.RoleSaveRes{RoleId: roleId}, nil
}
func (c *ControllerV1) RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error) {
roleIds := req.RoleIds
if req.RoleId != 0 {
roleIds = append(roleIds, req.RoleId)
}
err = service.AgentRole().RoleDelete(ctx, roleIds)
return &v1.RoleDeleteRes{}, err
}
@@ -0,0 +1,63 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) UserExport(ctx context.Context, req *v1.UserExportReq) (*v1.UserExportRes, error) {
return &v1.UserExportRes{}, service.AgentUser().UserExport(ctx, &req.AgentUserListParam)
}
func (c *ControllerV1) UserList(ctx context.Context, req *v1.UserListReq) (res *v1.UserListRes, err error) {
data, total, err := service.AgentUser().UserList(ctx, &req.AgentUserListParam)
if err != nil {
return nil, err
}
return &v1.UserListRes{PageResult: response.PageResult{Page: req.Page, PageSize: req.PageSize, Total: total}, Data: data}, nil
}
func (c *ControllerV1) UserView(ctx context.Context, req *v1.UserViewReq) (res *v1.UserViewRes, err error) {
data, err := service.AgentUser().UserView(ctx, req.UserId)
if err != nil {
return nil, err
}
return &v1.UserViewRes{AgentUserViewModel: *data}, nil
}
func (c *ControllerV1) UserAdd(ctx context.Context, req *v1.UserAddReq) (res *v1.UserAddRes, err error) {
data, err := service.AgentUser().UserSave(ctx, &req.SysUserAddModel)
if err != nil {
return nil, err
}
return &v1.UserAddRes{Data: data}, nil
}
func (c *ControllerV1) UserUpdate(ctx context.Context, req *v1.UserUpdateReq) (res *v1.UserUpdateRes, err error) {
err = service.AgentUser().UserUpdate(ctx, &req.SysUserUpdateModel)
if err != nil {
return nil, err
}
data, err := service.AgentUser().UserView(ctx, req.UserId)
if err != nil {
return nil, err
}
return &v1.UserUpdateRes{Data: data}, nil
}
func (c *ControllerV1) UserDelete(ctx context.Context, req *v1.UserDeleteReq) (res *v1.UserDeleteRes, err error) {
userIds := req.UserIds
if req.UserId != 0 {
userIds = append(userIds, req.UserId)
}
err = service.AgentUser().UserDelete(ctx, userIds)
return &v1.UserDeleteRes{}, err
}
func (c *ControllerV1) UserResetPassword(ctx context.Context, req *v1.UserResetPasswordReq) (res *v1.UserResetPasswordRes, err error) {
err = service.AgentUser().UserResetPassword(ctx, req.UserId, req.Password)
return &v1.UserResetPasswordRes{}, err
}
@@ -0,0 +1,57 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看企业客户单位信息列表
func (c *ControllerV1) TAgentEnterpriseList(ctx context.Context, req *v1.TAgentEnterpriseListReq) (res *v1.TAgentEnterpriseListRes, err error) {
list, totalCount, err := service.AgentEnterprise().List(ctx, &req.TAgentEnterpriseListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TAgentEnterpriseListModel{}
}
res = new(v1.TAgentEnterpriseListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出企业客户单位信息列表
func (c *ControllerV1) TAgentEnterpriseExport(ctx context.Context, req *v1.TAgentEnterpriseExportReq) (res *v1.TAgentEnterpriseExportRes, err error) {
err = service.AgentEnterprise().Export(ctx, &req.TAgentEnterpriseListParam)
return
}
// Edit 更新企业客户单位信息
func (c *ControllerV1) TAgentEnterpriseEdit(ctx context.Context, req *v1.TAgentEnterpriseEditReq) (res *v1.TAgentEnterpriseEditRes, err error) {
err = service.AgentEnterprise().Edit(ctx, &req.TAgentEnterpriseEditParam)
return
}
// View 获取指定企业客户单位信息信息
func (c *ControllerV1) TAgentEnterpriseView(ctx context.Context, req *v1.TAgentEnterpriseViewReq) (res *v1.TAgentEnterpriseViewRes, err error) {
data, err := service.AgentEnterprise().View(ctx, &req.TAgentEnterpriseViewParam)
if err != nil {
return
}
res = new(v1.TAgentEnterpriseViewRes)
res.TAgentEnterpriseViewModel = data
return
}
// Delete 删除企业客户单位信息
func (c *ControllerV1) TAgentEnterpriseDelete(ctx context.Context, req *v1.TAgentEnterpriseDeleteReq) (res *v1.TAgentEnterpriseDeleteRes, err error) {
err = service.AgentEnterprise().Delete(ctx, &req.TAgentEnterpriseDeleteParam)
return
}
@@ -0,0 +1,57 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看API集成列表
func (c *ControllerV1) TApiList(ctx context.Context, req *v1.TApiListReq) (res *v1.TApiListRes, err error) {
list, totalCount, err := service.AgentTApi().List(ctx, &req.TApiListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TApiListModel{}
}
res = new(v1.TApiListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出API集成列表
func (c *ControllerV1) TApiExport(ctx context.Context, req *v1.TApiExportReq) (res *v1.TApiExportRes, err error) {
err = service.AgentTApi().Export(ctx, &req.TApiListParam)
return
}
// Edit 更新API集成
func (c *ControllerV1) TApiEdit(ctx context.Context, req *v1.TApiEditReq) (res *v1.TApiEditRes, err error) {
err = service.AgentTApi().Edit(ctx, &req.TApiEditParam)
return
}
// View 获取指定API集成信息
func (c *ControllerV1) TApiView(ctx context.Context, req *v1.TApiViewReq) (res *v1.TApiViewRes, err error) {
data, err := service.AgentTApi().View(ctx, &req.TApiViewParam)
if err != nil {
return
}
res = new(v1.TApiViewRes)
res.TApiViewModel = data
return
}
// Delete 删除API集成
func (c *ControllerV1) TApiDelete(ctx context.Context, req *v1.TApiDeleteReq) (res *v1.TApiDeleteRes, err error) {
err = service.AgentTApi().Delete(ctx, &req.TApiDeleteParam)
return
}
@@ -0,0 +1,60 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// TApiGroupList 查询开放接口权限组列表。
func (c *ControllerV1) TApiGroupList(ctx context.Context, req *v1.TApiGroupListReq) (res *v1.TApiGroupListRes, err error) {
list, totalCount, err := service.AgentTApiGroup().List(ctx, &req.TApiGroupListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TApiGroupListModel{}
}
res = new(v1.TApiGroupListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// TApiGroupExport 导出开放接口权限组列表。
func (c *ControllerV1) TApiGroupExport(ctx context.Context, req *v1.TApiGroupExportReq) (res *v1.TApiGroupExportRes, err error) {
err = service.AgentTApiGroup().Export(ctx, &req.TApiGroupListParam)
return
}
// TApiGroupEdit 新增或修改开放接口权限组,并维护权限组绑定的接口资源。
func (c *ControllerV1) TApiGroupEdit(ctx context.Context, req *v1.TApiGroupEditReq) (res *v1.TApiGroupEditRes, err error) {
err = service.AgentTApiGroup().Edit(ctx, &req.TApiGroupEditParam)
return
}
// TApiGroupView 查询开放接口权限组详情。
func (c *ControllerV1) TApiGroupView(ctx context.Context, req *v1.TApiGroupViewReq) (res *v1.TApiGroupViewRes, err error) {
data, err := service.AgentTApiGroup().View(ctx, &req.TApiGroupViewParam)
if err != nil {
return
}
res = new(v1.TApiGroupViewRes)
res.TApiGroupViewModel = data
return
}
// TApiGroupDelete 删除开放接口权限组,并清理对应资源关联。
func (c *ControllerV1) TApiGroupDelete(ctx context.Context, req *v1.TApiGroupDeleteReq) (res *v1.TApiGroupDeleteRes, err error) {
err = service.AgentTApiGroup().Delete(ctx, &req.TApiGroupDeleteParam)
return
}
// TApiGroupStatus 更新开放接口权限组启停状态。
func (c *ControllerV1) TApiGroupStatus(ctx context.Context, req *v1.TApiGroupStatusReq) (res *v1.TApiGroupStatusRes, err error) {
err = service.AgentTApiGroup().Status(ctx, &req.TApiGroupStatusParam)
return
}
@@ -0,0 +1,69 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"github.com/gogf/gf/v2/frame/g"
)
// TApiResourceList 查询开放接口资源列表。
func (c *ControllerV1) TApiResourceList(ctx context.Context, req *v1.TApiResourceListReq) (res *v1.TApiResourceListRes, err error) {
list, totalCount, err := service.AgentTApiResource().List(ctx, &req.TApiResourceListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TApiResourceListModel{}
}
res = new(v1.TApiResourceListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// TApiResourceExport 导出开放接口资源列表。
func (c *ControllerV1) TApiResourceExport(ctx context.Context, req *v1.TApiResourceExportReq) (res *v1.TApiResourceExportRes, err error) {
err = service.AgentTApiResource().Export(ctx, &req.TApiResourceListParam)
return
}
// TApiResourceEdit 新增或修改开放接口资源。
func (c *ControllerV1) TApiResourceEdit(ctx context.Context, req *v1.TApiResourceEditReq) (res *v1.TApiResourceEditRes, err error) {
param := req.TApiResourceEditParam
g.Log().Info(ctx, "TApiResourceEdit", param)
if r := g.RequestFromCtx(ctx); r != nil {
if err = r.Parse(&param); err != nil {
return
}
}
err = service.AgentTApiResource().Edit(ctx, &param)
return
}
// TApiResourceView 查询开放接口资源详情。
func (c *ControllerV1) TApiResourceView(ctx context.Context, req *v1.TApiResourceViewReq) (res *v1.TApiResourceViewRes, err error) {
data, err := service.AgentTApiResource().View(ctx, &req.TApiResourceViewParam)
if err != nil {
return
}
res = new(v1.TApiResourceViewRes)
res.TApiResourceViewModel = data
return
}
// TApiResourceDelete 删除开放接口资源,并清理权限组资源关联。
func (c *ControllerV1) TApiResourceDelete(ctx context.Context, req *v1.TApiResourceDeleteReq) (res *v1.TApiResourceDeleteRes, err error) {
err = service.AgentTApiResource().Delete(ctx, &req.TApiResourceDeleteParam)
return
}
// TApiResourceStatus 更新开放接口资源启停状态。
func (c *ControllerV1) TApiResourceStatus(ctx context.Context, req *v1.TApiResourceStatusReq) (res *v1.TApiResourceStatusRes, err error) {
err = service.AgentTApiResource().Status(ctx, &req.TApiResourceStatusParam)
return
}
@@ -0,0 +1,63 @@
package agent
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/agent/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看客户提现账户表列表
func (c *ControllerV1) TCustWithdrawAccountList(ctx context.Context, req *v1.TCustWithdrawAccountListReq) (res *v1.TCustWithdrawAccountListRes, err error) {
list, totalCount, err := service.AgentTCustWithdrawAccount().List(ctx, &req.TCustWithdrawAccountListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TCustWithdrawAccountListModel{}
}
res = new(v1.TCustWithdrawAccountListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出客户提现账户表列表
func (c *ControllerV1) TCustWithdrawAccountExport(ctx context.Context, req *v1.TCustWithdrawAccountExportReq) (res *v1.TCustWithdrawAccountExportRes, err error) {
err = service.AgentTCustWithdrawAccount().Export(ctx, &req.TCustWithdrawAccountListParam)
return
}
// Edit 更新客户提现账户表
func (c *ControllerV1) TCustWithdrawAccountEdit(ctx context.Context, req *v1.TCustWithdrawAccountEditReq) (res *v1.TCustWithdrawAccountEditRes, err error) {
err = service.AgentTCustWithdrawAccount().Edit(ctx, &req.TCustWithdrawAccountEditParam)
return
}
// View 获取指定客户提现账户表信息
func (c *ControllerV1) TCustWithdrawAccountView(ctx context.Context, req *v1.TCustWithdrawAccountViewReq) (res *v1.TCustWithdrawAccountViewRes, err error) {
data, err := service.AgentTCustWithdrawAccount().View(ctx, &req.TCustWithdrawAccountViewParam)
if err != nil {
return
}
res = new(v1.TCustWithdrawAccountViewRes)
res.TCustWithdrawAccountViewModel = data
return
}
// Delete 删除客户提现账户表
func (c *ControllerV1) TCustWithdrawAccountDelete(ctx context.Context, req *v1.TCustWithdrawAccountDeleteReq) (res *v1.TCustWithdrawAccountDeleteRes, err error) {
err = service.AgentTCustWithdrawAccount().Delete(ctx, &req.TCustWithdrawAccountDeleteParam)
return
}
// Status 更新客户提现账户表状态
func (c *ControllerV1) TCustWithdrawAccountStatus(ctx context.Context, req *v1.TCustWithdrawAccountStatusReq) (res *v1.TCustWithdrawAccountStatusRes, err error) {
err = service.AgentTCustWithdrawAccount().Status(ctx, &req.TCustWithdrawAccountStatusParam)
return
}
@@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package common
@@ -0,0 +1,15 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package common
import (
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common"
)
type ControllerV1 struct{}
func NewV1() common.ICommonV1 {
return &ControllerV1{}
}
@@ -0,0 +1,63 @@
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) BatchExecutionLogList(ctx context.Context, req *v1.BatchExecutionLogListReq) (res *v1.BatchExecutionLogListRes, err error) {
list, totalCount, err := service.CommonBatchExecutionLog().List(ctx, &req.BatchExecutionLogListParam)
if err != nil {
return
}
if list == nil {
list = []*model.BatchExecutionLogListModel{}
}
res = new(v1.BatchExecutionLogListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
func (c *ControllerV1) BatchExecutionLogSummary(ctx context.Context, req *v1.BatchExecutionLogSummaryReq) (res *v1.BatchExecutionLogSummaryRes, err error) {
data, err := service.CommonBatchExecutionLog().Summary(ctx, &req.BatchExecutionLogDetailParam)
if err != nil {
return
}
res = new(v1.BatchExecutionLogSummaryRes)
res.BatchExecutionLogDetailModel = data
return
}
func (c *ControllerV1) BatchExecutionLogDetailList(ctx context.Context, req *v1.BatchExecutionLogDetailListReq) (res *v1.BatchExecutionLogDetailListRes, err error) {
list, totalCount, err := service.CommonBatchExecutionLog().DetailList(ctx, &req.BatchDetailListParam)
if err != nil {
return
}
if list == nil {
list = []*model.BatchDetailListModel{}
}
res = new(v1.BatchExecutionLogDetailListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
func (c *ControllerV1) BatchExecutionLogSyncReview(ctx context.Context, req *v1.BatchExecutionLogSyncReviewReq) (res *v1.BatchExecutionLogSyncReviewRes, err error) {
data, err := service.CommonBatchExecutionLog().SyncReview(ctx, &req.BatchExecutionLogSyncReviewParam)
if err != nil {
return
}
res = new(v1.BatchExecutionLogSyncReviewRes)
res.BatchExecutionLogSyncReviewModel = data
return
}
@@ -0,0 +1,114 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看批次主表列表
func (c *ControllerV1) BatchMainList(ctx context.Context, req *v1.BatchMainListReq) (res *v1.BatchMainListRes, err error) {
list, totalCount, err := service.CommonBatchMain().List(ctx, &req.BatchMainListParam)
if err != nil {
return
}
if list == nil {
list = []*model.BatchMainListModel{}
}
res = new(v1.BatchMainListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
func (c *ControllerV1) BatchMainSuccessList(ctx context.Context, req *v1.BatchMainSuccessListReq) (res *v1.BatchMainSuccessListRes, err error) {
list, totalCount, err := service.CommonBatchMain().SuccessList(ctx, &req.BatchMainSuccessListParam)
if err != nil {
return
}
if list == nil {
list = []*model.BatchMainSuccessListModel{}
}
res = new(v1.BatchMainSuccessListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
func (c *ControllerV1) BatchMainCards(ctx context.Context, req *v1.BatchMainCardsReq) (res *v1.BatchMainCardsRes, err error) {
list, totalCount, err := service.CommonBatchMain().ListCards(ctx, &req.BatchCardListParam)
if err != nil {
return
}
if list == nil {
list = []*model.BatchCardListModel{}
}
res = new(v1.BatchMainCardsRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// ExportWarehousing 导出入库批次列表(数据与入库管理页一致)
func (c *ControllerV1) BatchMainExportWarehousing(ctx context.Context, req *v1.BatchMainExportWarehousingReq) (res *v1.BatchMainExportWarehousingRes, err error) {
err = service.CommonBatchMain().ExportWarehousing(ctx, &req.BatchMainSuccessListParam)
return
}
// Export 导出批次主表列表
func (c *ControllerV1) BatchMainExport(ctx context.Context, req *v1.BatchMainExportReq) (res *v1.BatchMainExportRes, err error) {
err = service.CommonBatchMain().Export(ctx, &req.BatchMainListParam)
return
}
// Edit 更新批次主表
func (c *ControllerV1) BatchMainEdit(ctx context.Context, req *v1.BatchMainEditReq) (res *v1.BatchMainEditRes, err error) {
err = service.CommonBatchMain().Edit(ctx, &req.BatchMainEditParam)
return
}
// View 获取指定批次主表信息
func (c *ControllerV1) BatchMainView(ctx context.Context, req *v1.BatchMainViewReq) (res *v1.BatchMainViewRes, err error) {
data, err := service.CommonBatchMain().View(ctx, &req.BatchMainViewParam)
if err != nil {
return
}
res = new(v1.BatchMainViewRes)
res.BatchMainViewModel = data
return
}
// Delete 删除批次主表
func (c *ControllerV1) BatchMainDelete(ctx context.Context, req *v1.BatchMainDeleteReq) (res *v1.BatchMainDeleteRes, err error) {
err = service.CommonBatchMain().Delete(ctx, &req.BatchMainDeleteParam)
return
}
func (c *ControllerV1) BatchMainRequeue(ctx context.Context, req *v1.BatchMainRequeueReq) (res *v1.BatchMainRequeueRes, err error) {
data, err := service.CommonBatchMain().Requeue(ctx, &req.BatchMainRequeueParam)
if err != nil {
return nil, err
}
return &v1.BatchMainRequeueRes{BatchMainRequeueModel: data}, nil
}
@@ -0,0 +1,49 @@
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) DownloadCenterList(ctx context.Context, req *v1.DownloadCenterListReq) (res *v1.DownloadCenterListRes, err error) {
list, totalCount, err := service.CommonDownloadCenter().List(ctx, &req.DownloadCenterListParam)
if err != nil {
return
}
if list == nil {
list = []*model.DownloadCenterListModel{}
}
res = new(v1.DownloadCenterListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
func (c *ControllerV1) DownloadCenterRecent(ctx context.Context, req *v1.DownloadCenterRecentReq) (res *v1.DownloadCenterRecentRes, err error) {
data, err := service.CommonDownloadCenter().Recent(ctx, &req.DownloadCenterRecentParam)
if err != nil {
return
}
res = new(v1.DownloadCenterRecentRes)
res.DownloadCenterRecentModel = data
return
}
func (c *ControllerV1) DownloadCenterDownload(ctx context.Context, req *v1.DownloadCenterDownloadReq) (res *v1.DownloadCenterDownloadRes, err error) {
if err = service.CommonDownloadCenter().Download(ctx, &req.DownloadCenterTaskParam); err != nil {
return nil, err
}
return nil, nil
}
func (c *ControllerV1) DownloadCenterRemove(ctx context.Context, req *v1.DownloadCenterRemoveReq) (res *v1.DownloadCenterRemoveRes, err error) {
if err = service.CommonDownloadCenter().Remove(ctx, &req.DownloadCenterTaskParam); err != nil {
return nil, err
}
return new(v1.DownloadCenterRemoveRes), nil
}
@@ -0,0 +1,122 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看企业客户财务信息列表
func (c *ControllerV1) TAgentBalanceList(ctx context.Context, req *v1.TAgentBalanceListReq) (res *v1.TAgentBalanceListRes, err error) {
list, totalCount, err := service.CommonAgentBalance().List(ctx, &req.TAgentBalanceListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TAgentBalanceListModel{}
}
res = new(v1.TAgentBalanceListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出企业客户财务信息列表
func (c *ControllerV1) TAgentBalanceExport(ctx context.Context, req *v1.TAgentBalanceExportReq) (res *v1.TAgentBalanceExportRes, err error) {
err = service.CommonAgentBalance().Export(ctx, &req.TAgentBalanceListParam)
return
}
// Edit 更新企业客户财务信息
func (c *ControllerV1) TAgentBalanceEdit(ctx context.Context, req *v1.TAgentBalanceEditReq) (res *v1.TAgentBalanceEditRes, err error) {
err = service.CommonAgentBalance().Edit(ctx, &req.TAgentBalanceEditParam)
return
}
// View 获取指定企业客户财务信息信息
func (c *ControllerV1) TAgentBalanceView(ctx context.Context, req *v1.TAgentBalanceViewReq) (res *v1.TAgentBalanceViewRes, err error) {
data, err := service.CommonAgentBalance().View(ctx, &req.TAgentBalanceViewParam)
if err != nil {
return
}
res = new(v1.TAgentBalanceViewRes)
res.TAgentBalanceViewModel = data
return
}
// Delete 删除企业客户财务信息
func (c *ControllerV1) TAgentBalanceDelete(ctx context.Context, req *v1.TAgentBalanceDeleteReq) (res *v1.TAgentBalanceDeleteRes, err error) {
err = service.CommonAgentBalance().Delete(ctx, &req.TAgentBalanceDeleteParam)
return
}
// Status 更新企业客户财务信息状态
func (c *ControllerV1) TAgentBalanceStatus(ctx context.Context, req *v1.TAgentBalanceStatusReq) (res *v1.TAgentBalanceStatusRes, err error) {
err = service.CommonAgentBalance().Status(ctx, &req.TAgentBalanceStatusParam)
return
}
func (c *ControllerV1) TAgentBalanceAccountTrend(ctx context.Context, req *v1.TAgentBalanceAccountTrendReq) (res *v1.TAgentBalanceAccountTrendRes, err error) {
data, err := service.CommonAgentBalance().AccountTrend(ctx, &req.TAgentBalanceTrendParam)
if err != nil {
return
}
res = new(v1.TAgentBalanceAccountTrendRes)
res.TAgentBalanceChartData = data
return
}
func (c *ControllerV1) TAgentBalanceGetAccountBalance(ctx context.Context, req *v1.TAgentBalanceGetAccountBalanceReq) (res *v1.TAgentBalanceGetAccountBalanceRes, err error) {
data, err := service.CommonAgentBalance().GetAccountBalance(ctx, &req.TAgentBalanceTrendParam)
if err != nil {
return
}
res = new(v1.TAgentBalanceGetAccountBalanceRes)
res.TAgentBalanceChartData = data
return
}
func (c *ControllerV1) TAgentBalanceBalanceTransferApply(ctx context.Context, req *v1.TAgentBalanceBalanceTransferApplyReq) (res *v1.TAgentBalanceBalanceTransferApplyRes, err error) {
data, err := service.CommonAgentBalance().BalanceTransferApply(ctx, &req.TAgentBalanceTransferApplyParam)
if err != nil {
return
}
res = new(v1.TAgentBalanceBalanceTransferApplyRes)
res.TAgentBalanceTransferApplyModel = data
return
}
func (c *ControllerV1) TAgentBalanceBalanceTransferAudit(ctx context.Context, req *v1.TAgentBalanceBalanceTransferAuditReq) (res *v1.TAgentBalanceBalanceTransferAuditRes, err error) {
err = service.CommonAgentBalance().BalanceTransferAudit(ctx, &req.TAgentBalanceTransferAuditParam)
if err != nil {
return
}
res = new(v1.TAgentBalanceBalanceTransferAuditRes)
return
}
// TAgentBalanceSettleCommission 按账期区间结算分润并同步可提现金额。
func (c *ControllerV1) TAgentBalanceSettleCommission(ctx context.Context, req *v1.TAgentBalanceSettleCommissionReq) (res *v1.TAgentBalanceSettleCommissionRes, err error) {
data, err := service.CommonAgentBalance().SettleCommissionByPeriod(ctx, &model.TAgentBalanceCommissionSettlementParam{
StartPeriod: req.StartPeriod,
EndPeriod: req.EndPeriod,
})
if err != nil {
return
}
res = new(v1.TAgentBalanceSettleCommissionRes)
res.TAgentBalanceCommissionSettlementResult = data
return
}
@@ -0,0 +1,63 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看余额明细表列表
func (c *ControllerV1) TBalanceDetailList(ctx context.Context, req *v1.TBalanceDetailListReq) (res *v1.TBalanceDetailListRes, err error) {
list, totalCount, err := service.CommonTBalanceDetail().List(ctx, &req.TBalanceDetailListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TBalanceDetailListModel{}
}
res = new(v1.TBalanceDetailListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出余额明细表列表
func (c *ControllerV1) TBalanceDetailExport(ctx context.Context, req *v1.TBalanceDetailExportReq) (res *v1.TBalanceDetailExportRes, err error) {
err = service.CommonTBalanceDetail().Export(ctx, &req.TBalanceDetailListParam)
return
}
// Edit 更新余额明细表
func (c *ControllerV1) TBalanceDetailEdit(ctx context.Context, req *v1.TBalanceDetailEditReq) (res *v1.TBalanceDetailEditRes, err error) {
err = service.CommonTBalanceDetail().Edit(ctx, &req.TBalanceDetailEditParam)
return
}
// View 获取指定余额明细表信息
func (c *ControllerV1) TBalanceDetailView(ctx context.Context, req *v1.TBalanceDetailViewReq) (res *v1.TBalanceDetailViewRes, err error) {
data, err := service.CommonTBalanceDetail().View(ctx, &req.TBalanceDetailViewParam)
if err != nil {
return
}
res = new(v1.TBalanceDetailViewRes)
res.TBalanceDetailViewModel = data
return
}
// Delete 删除余额明细表
func (c *ControllerV1) TBalanceDetailDelete(ctx context.Context, req *v1.TBalanceDetailDeleteReq) (res *v1.TBalanceDetailDeleteRes, err error) {
err = service.CommonTBalanceDetail().Delete(ctx, &req.TBalanceDetailDeleteParam)
return
}
@@ -0,0 +1,87 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看消费账户月账单表列表
func (c *ControllerV1) TConsumeAccountMonthBillList(ctx context.Context, req *v1.TConsumeAccountMonthBillListReq) (res *v1.TConsumeAccountMonthBillListRes, err error) {
list, totalCount, err := service.CommonConsumeAccountMonthBill().List(ctx, &req.TConsumeAccountMonthBillListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TConsumeAccountMonthBillListModel{}
}
res = new(v1.TConsumeAccountMonthBillListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出消费账户月账单表列表
func (c *ControllerV1) TConsumeAccountMonthBillExport(ctx context.Context, req *v1.TConsumeAccountMonthBillExportReq) (res *v1.TConsumeAccountMonthBillExportRes, err error) {
err = service.CommonConsumeAccountMonthBill().Export(ctx, &req.TConsumeAccountMonthBillListParam)
return
}
// Edit 更新消费账户月账单表
func (c *ControllerV1) TConsumeAccountMonthBillEdit(ctx context.Context, req *v1.TConsumeAccountMonthBillEditReq) (res *v1.TConsumeAccountMonthBillEditRes, err error) {
err = service.CommonConsumeAccountMonthBill().Edit(ctx, &req.TConsumeAccountMonthBillEditParam)
return
}
// View 获取指定消费账户月账单表信息
func (c *ControllerV1) TConsumeAccountMonthBillView(ctx context.Context, req *v1.TConsumeAccountMonthBillViewReq) (res *v1.TConsumeAccountMonthBillViewRes, err error) {
data, err := service.CommonConsumeAccountMonthBill().View(ctx, &req.TConsumeAccountMonthBillViewParam)
if err != nil {
return
}
res = new(v1.TConsumeAccountMonthBillViewRes)
res.TConsumeAccountMonthBillViewModel = data
return
}
// Delete 删除消费账户月账单表
func (c *ControllerV1) TConsumeAccountMonthBillDelete(ctx context.Context, req *v1.TConsumeAccountMonthBillDeleteReq) (res *v1.TConsumeAccountMonthBillDeleteRes, err error) {
err = service.CommonConsumeAccountMonthBill().Delete(ctx, &req.TConsumeAccountMonthBillDeleteParam)
return
}
// Settle 按账期统计消费账户月账单
func (c *ControllerV1) TConsumeAccountMonthBillSettle(ctx context.Context, req *v1.TConsumeAccountMonthBillSettleReq) (res *v1.TConsumeAccountMonthBillSettleRes, err error) {
data, err := service.CommonConsumeAccountMonthBill().SettleConsumeAccountMonthBill(ctx, &req.TConsumeAccountMonthBillSettleParam)
if err != nil {
return
}
res = new(v1.TConsumeAccountMonthBillSettleRes)
res.TConsumeAccountMonthBillSettleResult = data
return
}
// GetConsumptionBillSummary 获取上月消费账单汇总信息
func (c *ControllerV1) TConsumeAccountMonthBillGetConsumptionBillSummary(ctx context.Context, req *v1.TConsumeAccountMonthBillGetConsumptionBillSummaryReq) (res *v1.TConsumeAccountMonthBillGetConsumptionBillSummaryRes, err error) {
data, err := service.CommonConsumeAccountMonthBill().GetConsumptionBillSummary(ctx, req.Month)
if err != nil {
return
}
res = new(v1.TConsumeAccountMonthBillGetConsumptionBillSummaryRes)
res.TConsumptionBillSummaryModel = data
return
}
@@ -0,0 +1,63 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看信用额度明细表列表
func (c *ControllerV1) TCreditDetailList(ctx context.Context, req *v1.TCreditDetailListReq) (res *v1.TCreditDetailListRes, err error) {
list, totalCount, err := service.CommonTCreditDetail().List(ctx, &req.TCreditDetailListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TCreditDetailListModel{}
}
res = new(v1.TCreditDetailListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出信用额度明细表列表
func (c *ControllerV1) TCreditDetailExport(ctx context.Context, req *v1.TCreditDetailExportReq) (res *v1.TCreditDetailExportRes, err error) {
err = service.CommonTCreditDetail().Export(ctx, &req.TCreditDetailListParam)
return
}
// Edit 更新信用额度明细表
func (c *ControllerV1) TCreditDetailEdit(ctx context.Context, req *v1.TCreditDetailEditReq) (res *v1.TCreditDetailEditRes, err error) {
err = service.CommonTCreditDetail().Edit(ctx, &req.TCreditDetailEditParam)
return
}
// View 获取指定信用额度明细表信息
func (c *ControllerV1) TCreditDetailView(ctx context.Context, req *v1.TCreditDetailViewReq) (res *v1.TCreditDetailViewRes, err error) {
data, err := service.CommonTCreditDetail().View(ctx, &req.TCreditDetailViewParam)
if err != nil {
return
}
res = new(v1.TCreditDetailViewRes)
res.TCreditDetailViewModel = data
return
}
// Delete 删除信用额度明细表
func (c *ControllerV1) TCreditDetailDelete(ctx context.Context, req *v1.TCreditDetailDeleteReq) (res *v1.TCreditDetailDeleteRes, err error) {
err = service.CommonTCreditDetail().Delete(ctx, &req.TCreditDetailDeleteParam)
return
}
@@ -0,0 +1,58 @@
package common
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
)
// List 查看财务申请表列表
func (c *ControllerV1) TFinanceApplyList(ctx context.Context, req *v1.TFinanceApplyListReq) (res *v1.TFinanceApplyListRes, err error) {
list, totalCount, err := service.CommonTFinanceApply().List(ctx, &req.TFinanceApplyListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TFinanceApplyListModel{}
}
res = new(v1.TFinanceApplyListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出财务申请表列表
func (c *ControllerV1) TFinanceApplyExport(ctx context.Context, req *v1.TFinanceApplyExportReq) (res *v1.TFinanceApplyExportRes, err error) {
err = service.CommonTFinanceApply().Export(ctx, &req.TFinanceApplyListParam)
return
}
// Edit 更新财务申请表
func (c *ControllerV1) TFinanceApplyEdit(ctx context.Context, req *v1.TFinanceApplyEditReq) (res *v1.TFinanceApplyEditRes, err error) {
err = service.CommonTFinanceApply().Edit(ctx, &req.TFinanceApplyEditParam)
return
}
// View 获取指定财务申请表信息
func (c *ControllerV1) TFinanceApplyView(ctx context.Context, req *v1.TFinanceApplyViewReq) (res *v1.TFinanceApplyViewRes, err error) {
data, err := service.CommonTFinanceApply().View(ctx, &req.TFinanceApplyViewParam)
if err != nil {
return
}
res = new(v1.TFinanceApplyViewRes)
res.TFinanceApplyViewModel = data
return
}
// Delete 删除财务申请表
func (c *ControllerV1) TFinanceApplyDelete(ctx context.Context, req *v1.TFinanceApplyDeleteReq) (res *v1.TFinanceApplyDeleteRes, err error) {
err = service.CommonTFinanceApply().Delete(ctx, &req.TFinanceApplyDeleteParam)
return
}
@@ -0,0 +1,58 @@
package common
import (
"context"
// v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/tfinanceauditrecord/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看财务审核记录表列表
func (c *ControllerV1) TFinanceAuditRecordList(ctx context.Context, req *v1.TFinanceAuditRecordListReq) (res *v1.TFinanceAuditRecordListRes, err error) {
list, totalCount, err := service.CommonTFinanceAuditRecord().List(ctx, &req.TFinanceAuditRecordListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TFinanceAuditRecordListModel{}
}
res = new(v1.TFinanceAuditRecordListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出财务审核记录表列表
func (c *ControllerV1) TFinanceAuditRecordExport(ctx context.Context, req *v1.TFinanceAuditRecordExportReq) (res *v1.TFinanceAuditRecordExportRes, err error) {
err = service.CommonTFinanceAuditRecord().Export(ctx, &req.TFinanceAuditRecordListParam)
return
}
// Edit 更新财务审核记录表
func (c *ControllerV1) TFinanceAuditRecordEdit(ctx context.Context, req *v1.TFinanceAuditRecordEditReq) (res *v1.TFinanceAuditRecordEditRes, err error) {
err = service.CommonTFinanceAuditRecord().Edit(ctx, &req.TFinanceAuditRecordEditParam)
return
}
// View 获取指定财务审核记录表信息
func (c *ControllerV1) TFinanceAuditRecordView(ctx context.Context, req *v1.TFinanceAuditRecordViewReq) (res *v1.TFinanceAuditRecordViewRes, err error) {
data, err := service.CommonTFinanceAuditRecord().View(ctx, &req.TFinanceAuditRecordViewParam)
if err != nil {
return
}
res = new(v1.TFinanceAuditRecordViewRes)
res.TFinanceAuditRecordViewModel = data
return
}
// Delete 删除财务审核记录表
func (c *ControllerV1) TFinanceAuditRecordDelete(ctx context.Context, req *v1.TFinanceAuditRecordDeleteReq) (res *v1.TFinanceAuditRecordDeleteRes, err error) {
err = service.CommonTFinanceAuditRecord().Delete(ctx, &req.TFinanceAuditRecordDeleteParam)
return
}
@@ -0,0 +1,87 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看分润明细表列表
func (c *ControllerV1) TFinCommissionDetailList(ctx context.Context, req *v1.TFinCommissionDetailListReq) (res *v1.TFinCommissionDetailListRes, err error) {
list, totalCount, err := service.CommonTFinCommissionDetail().List(ctx, &req.TFinCommissionDetailListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TFinCommissionDetailListModel{}
}
res = new(v1.TFinCommissionDetailListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出分润明细表列表
func (c *ControllerV1) TFinCommissionDetailExport(ctx context.Context, req *v1.TFinCommissionDetailExportReq) (res *v1.TFinCommissionDetailExportRes, err error) {
err = service.CommonTFinCommissionDetail().Export(ctx, &req.TFinCommissionDetailListParam)
return
}
// Edit 更新分润明细表
func (c *ControllerV1) TFinCommissionDetailEdit(ctx context.Context, req *v1.TFinCommissionDetailEditReq) (res *v1.TFinCommissionDetailEditRes, err error) {
err = service.CommonTFinCommissionDetail().Edit(ctx, &req.TFinCommissionDetailEditParam)
return
}
// View 获取指定分润明细表信息
func (c *ControllerV1) TFinCommissionDetailView(ctx context.Context, req *v1.TFinCommissionDetailViewReq) (res *v1.TFinCommissionDetailViewRes, err error) {
data, err := service.CommonTFinCommissionDetail().View(ctx, &req.TFinCommissionDetailViewParam)
if err != nil {
return
}
res = new(v1.TFinCommissionDetailViewRes)
res.TFinCommissionDetailViewModel = data
return
}
// Delete 删除分润明细表
func (c *ControllerV1) TFinCommissionDetailDelete(ctx context.Context, req *v1.TFinCommissionDetailDeleteReq) (res *v1.TFinCommissionDetailDeleteRes, err error) {
err = service.CommonTFinCommissionDetail().Delete(ctx, &req.TFinCommissionDetailDeleteParam)
return
}
// GetCommissionOverview 获取分层分润概览
func (c *ControllerV1) TFinCommissionDetailGetCommissionOverview(ctx context.Context, req *v1.TFinCommissionDetailGetCommissionOverviewReq) (res *v1.TFinCommissionDetailGetCommissionOverviewRes, err error) {
data, err := service.CommonTFinCommissionDetail().GetCommissionOverview(ctx, &req.TCommissionOverviewParam)
if err != nil {
return
}
res = new(v1.TFinCommissionDetailGetCommissionOverviewRes)
res.TCommissionOverviewModel = data
return
}
// GetLevelSummary 获取层级汇总表
func (c *ControllerV1) TFinCommissionDetailGetLevelSummary(ctx context.Context, req *v1.TFinCommissionDetailGetLevelSummaryReq) (res *v1.TFinCommissionDetailGetLevelSummaryRes, err error) {
data, err := service.CommonTFinCommissionDetail().GetLevelSummary(ctx, &req.TLevelSummaryParam)
if err != nil {
return
}
res = new(v1.TFinCommissionDetailGetLevelSummaryRes)
res.TLevelSummaryModel = data
return
}
@@ -0,0 +1,63 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看可提现变动明细表列表
func (c *ControllerV1) TFinWithdrawableChangeList(ctx context.Context, req *v1.TFinWithdrawableChangeListReq) (res *v1.TFinWithdrawableChangeListRes, err error) {
list, totalCount, err := service.CommonTFinWithdrawableChange().List(ctx, &req.TFinWithdrawableChangeListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TFinWithdrawableChangeListModel{}
}
res = new(v1.TFinWithdrawableChangeListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出可提现变动明细表列表
func (c *ControllerV1) TFinWithdrawableChangeExport(ctx context.Context, req *v1.TFinWithdrawableChangeExportReq) (res *v1.TFinWithdrawableChangeExportRes, err error) {
err = service.CommonTFinWithdrawableChange().Export(ctx, &req.TFinWithdrawableChangeListParam)
return
}
// Edit 更新可提现变动明细表
func (c *ControllerV1) TFinWithdrawableChangeEdit(ctx context.Context, req *v1.TFinWithdrawableChangeEditReq) (res *v1.TFinWithdrawableChangeEditRes, err error) {
err = service.CommonTFinWithdrawableChange().Edit(ctx, &req.TFinWithdrawableChangeEditParam)
return
}
// View 获取指定可提现变动明细表信息
func (c *ControllerV1) TFinWithdrawableChangeView(ctx context.Context, req *v1.TFinWithdrawableChangeViewReq) (res *v1.TFinWithdrawableChangeViewRes, err error) {
data, err := service.CommonTFinWithdrawableChange().View(ctx, &req.TFinWithdrawableChangeViewParam)
if err != nil {
return
}
res = new(v1.TFinWithdrawableChangeViewRes)
res.TFinWithdrawableChangeViewModel = data
return
}
// Delete 删除可提现变动明细表
func (c *ControllerV1) TFinWithdrawableChangeDelete(ctx context.Context, req *v1.TFinWithdrawableChangeDeleteReq) (res *v1.TFinWithdrawableChangeDeleteRes, err error) {
err = service.CommonTFinWithdrawableChange().Delete(ctx, &req.TFinWithdrawableChangeDeleteParam)
return
}
@@ -0,0 +1,86 @@
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看消息日志列表
func (c *ControllerV1) TMessageLogList(ctx context.Context, req *v1.TMessageLogListReq) (res *v1.TMessageLogListRes, err error) {
list, totalCount, err := service.CommonTMessageLog().List(ctx, &req.TMessageLogListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TMessageLogListModel{}
}
res = new(v1.TMessageLogListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出消息日志列表
func (c *ControllerV1) TMessageLogExport(ctx context.Context, req *v1.TMessageLogExportReq) (res *v1.TMessageLogExportRes, err error) {
err = service.CommonTMessageLog().Export(ctx, &req.TMessageLogListParam)
return
}
// Edit 更新消息日志
func (c *ControllerV1) TMessageLogEdit(ctx context.Context, req *v1.TMessageLogEditReq) (res *v1.TMessageLogEditRes, err error) {
err = service.CommonTMessageLog().Edit(ctx, &req.TMessageLogEditParam)
return
}
// View 获取指定消息日志信息
func (c *ControllerV1) TMessageLogView(ctx context.Context, req *v1.TMessageLogViewReq) (res *v1.TMessageLogViewRes, err error) {
data, err := service.CommonTMessageLog().View(ctx, &req.TMessageLogViewParam)
if err != nil {
return
}
res = new(v1.TMessageLogViewRes)
res.TMessageLogViewModel = data
return
}
// Delete 删除消息日志
func (c *ControllerV1) TMessageLogDelete(ctx context.Context, req *v1.TMessageLogDeleteReq) (res *v1.TMessageLogDeleteRes, err error) {
err = service.CommonTMessageLog().Delete(ctx, &req.TMessageLogDeleteParam)
return
}
// UnreadList 获取当前用户未读消息通知
func (c *ControllerV1) TMessageLogUnreadList(ctx context.Context, req *v1.TMessageLogUnreadListReq) (res *v1.TMessageLogUnreadListRes, err error) {
list, totalCount, err := service.CommonTMessageLog().UnreadList(ctx, &req.TMessageLogUnreadListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TMessageLogUnreadListModel{}
}
res = new(v1.TMessageLogUnreadListRes)
res.Items = list
res.Total = totalCount
return
}
// Read 标记当前用户指定消息已读
func (c *ControllerV1) TMessageLogRead(ctx context.Context, req *v1.TMessageLogReadReq) (res *v1.TMessageLogReadRes, err error) {
err = service.CommonTMessageLog().Read(ctx, &req.TMessageLogReadParam)
return
}
// ReadAll 标记当前用户全部消息已读
func (c *ControllerV1) TMessageLogReadAll(ctx context.Context, req *v1.TMessageLogReadAllReq) (res *v1.TMessageLogReadAllRes, err error) {
err = service.CommonTMessageLog().ReadAll(ctx, &req.TMessageLogReadAllParam)
return
}
@@ -0,0 +1,57 @@
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看通知日志列表
func (c *ControllerV1) TNotifyLogList(ctx context.Context, req *v1.TNotifyLogListReq) (res *v1.TNotifyLogListRes, err error) {
list, totalCount, err := service.CommonTNotifyLog().List(ctx, &req.TNotifyLogListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TNotifyLogListModel{}
}
res = new(v1.TNotifyLogListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出通知日志列表
func (c *ControllerV1) TNotifyLogExport(ctx context.Context, req *v1.TNotifyLogExportReq) (res *v1.TNotifyLogExportRes, err error) {
err = service.CommonTNotifyLog().Export(ctx, &req.TNotifyLogListParam)
return
}
// Edit 更新通知日志
func (c *ControllerV1) TNotifyLogEdit(ctx context.Context, req *v1.TNotifyLogEditReq) (res *v1.TNotifyLogEditRes, err error) {
err = service.CommonTNotifyLog().Edit(ctx, &req.TNotifyLogEditParam)
return
}
// View 获取指定通知日志信息
func (c *ControllerV1) TNotifyLogView(ctx context.Context, req *v1.TNotifyLogViewReq) (res *v1.TNotifyLogViewRes, err error) {
data, err := service.CommonTNotifyLog().View(ctx, &req.TNotifyLogViewParam)
if err != nil {
return
}
res = new(v1.TNotifyLogViewRes)
res.TNotifyLogViewModel = data
return
}
// Delete 删除通知日志
func (c *ControllerV1) TNotifyLogDelete(ctx context.Context, req *v1.TNotifyLogDeleteReq) (res *v1.TNotifyLogDeleteRes, err error) {
err = service.CommonTNotifyLog().Delete(ctx, &req.TNotifyLogDeleteParam)
return
}
@@ -0,0 +1,111 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看盈利账户月账单表列表
func (c *ControllerV1) TProfitAccountMonthBillList(ctx context.Context, req *v1.TProfitAccountMonthBillListReq) (res *v1.TProfitAccountMonthBillListRes, err error) {
list, totalCount, err := service.CommonProfitAccountMonthBill().List(ctx, &req.TProfitAccountMonthBillListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TProfitAccountMonthBillListModel{}
}
res = new(v1.TProfitAccountMonthBillListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出盈利账户月账单表列表
func (c *ControllerV1) TProfitAccountMonthBillExport(ctx context.Context, req *v1.TProfitAccountMonthBillExportReq) (res *v1.TProfitAccountMonthBillExportRes, err error) {
err = service.CommonProfitAccountMonthBill().Export(ctx, &req.TProfitAccountMonthBillListParam)
return
}
// Edit 更新盈利账户月账单表
func (c *ControllerV1) TProfitAccountMonthBillEdit(ctx context.Context, req *v1.TProfitAccountMonthBillEditReq) (res *v1.TProfitAccountMonthBillEditRes, err error) {
err = service.CommonProfitAccountMonthBill().Edit(ctx, &req.TProfitAccountMonthBillEditParam)
return
}
// View 获取指定盈利账户月账单表信息
func (c *ControllerV1) TProfitAccountMonthBillView(ctx context.Context, req *v1.TProfitAccountMonthBillViewReq) (res *v1.TProfitAccountMonthBillViewRes, err error) {
data, err := service.CommonProfitAccountMonthBill().View(ctx, &req.TProfitAccountMonthBillViewParam)
if err != nil {
return
}
res = new(v1.TProfitAccountMonthBillViewRes)
res.TProfitAccountMonthBillViewModel = data
return
}
// Delete 删除盈利账户月账单表
func (c *ControllerV1) TProfitAccountMonthBillDelete(ctx context.Context, req *v1.TProfitAccountMonthBillDeleteReq) (res *v1.TProfitAccountMonthBillDeleteRes, err error) {
err = service.CommonProfitAccountMonthBill().Delete(ctx, &req.TProfitAccountMonthBillDeleteParam)
return
}
// Settle 统计并写入盈利账户月账单
func (c *ControllerV1) TProfitAccountMonthBillSettle(ctx context.Context, req *v1.TProfitAccountMonthBillSettleReq) (res *v1.TProfitAccountMonthBillSettleRes, err error) {
data, err := service.CommonProfitAccountMonthBill().SettleProfitAccountMonthBill(ctx, &req.TProfitAccountMonthBillSettleParam)
if err != nil {
return
}
res = new(v1.TProfitAccountMonthBillSettleRes)
res.TProfitAccountMonthBillSettleResult = data
return
}
// GetProfitBillSummary 获取上月盈利账单汇总信息
func (c *ControllerV1) TProfitAccountMonthBillGetProfitBillSummary(ctx context.Context, req *v1.TProfitAccountMonthBillGetProfitBillSummaryReq) (res *v1.TProfitAccountMonthBillGetProfitBillSummaryRes, err error) {
data, err := service.CommonProfitAccountMonthBill().GetProfitBillSummary(ctx, req.Month)
if err != nil {
return
}
res = new(v1.TProfitAccountMonthBillGetProfitBillSummaryRes)
res.TProfitBillModel = data
return
}
// GetCoreFinancialData 获取核心财务指标
func (c *ControllerV1) TProfitAccountMonthBillGetCoreFinancialData(ctx context.Context, req *v1.TProfitAccountMonthBillGetCoreFinancialDataReq) (res *v1.TProfitAccountMonthBillGetCoreFinancialDataRes, err error) {
data, err := service.CommonProfitAccountMonthBill().GetCoreFinancialData(ctx, &req.TCommissionOverviewParam)
if err != nil {
return
}
res = new(v1.TProfitAccountMonthBillGetCoreFinancialDataRes)
res.TCoreFinancialDataModel = data
return
}
// GetFinancialTrend 获取财务趋势折线图
func (c *ControllerV1) TProfitAccountMonthBillGetFinancialTrend(ctx context.Context, req *v1.TProfitAccountMonthBillGetFinancialTrendReq) (res *v1.TProfitAccountMonthBillGetFinancialTrendRes, err error) {
data, err := service.CommonProfitAccountMonthBill().GetFinancialTrend(ctx, &req.TFinancialTrendParam)
if err != nil {
return
}
res = new(v1.TProfitAccountMonthBillGetFinancialTrendRes)
res.TFinancialTrendModel = data
return
}
@@ -0,0 +1,64 @@
package common
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
)
// TWoCommunicationList 查看工单问题沟通表列表
func (c *ControllerV1) TWoCommunicationList(ctx context.Context, req *v1.TWoCommunicationListReq) (res *v1.TWoCommunicationListRes, err error) {
list, totalCount, err := service.CommonTWoCommunication().List(ctx, &req.TWoCommunicationListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TWoCommunicationListModel{}
}
res = new(v1.TWoCommunicationListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// TWoCommunicationExport 导出工单问题沟通表列表
func (c *ControllerV1) TWoCommunicationExport(ctx context.Context, req *v1.TWoCommunicationExportReq) (res *v1.TWoCommunicationExportRes, err error) {
err = service.CommonTWoCommunication().Export(ctx, &req.TWoCommunicationListParam)
return
}
// TWoCommunicationEdit 更新工单问题沟通表
func (c *ControllerV1) TWoCommunicationEdit(ctx context.Context, req *v1.TWoCommunicationEditReq) (res *v1.TWoCommunicationEditRes, err error) {
err = service.CommonTWoCommunication().Edit(ctx, &req.TWoCommunicationEditParam)
return
}
func (c *ControllerV1) TWoCommunicationMessage(ctx context.Context, req *v1.TWoCommunicationMessageReq) (res *v1.TWoCommunicationMessageRes, err error) {
err = service.CommonTWoCommunication().Message(ctx, &req.TWoMainMessageParam)
return
}
// TWoCommunicationView 获取指定工单问题沟通表信息
func (c *ControllerV1) TWoCommunicationView(ctx context.Context, req *v1.TWoCommunicationViewReq) (res *v1.TWoCommunicationViewRes, err error) {
data, err := service.CommonTWoCommunication().View(ctx, &req.TWoCommunicationViewParam)
if err != nil {
return
}
res = new(v1.TWoCommunicationViewRes)
res.TWoCommunicationViewModel = data
return
}
// TWoCommunicationDelete 删除工单问题沟通表
func (c *ControllerV1) TWoCommunicationDelete(ctx context.Context, req *v1.TWoCommunicationDeleteReq) (res *v1.TWoCommunicationDeleteRes, err error) {
err = service.CommonTWoCommunication().Delete(ctx, &req.TWoCommunicationDeleteParam)
return
}
@@ -0,0 +1,84 @@
package common
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
)
// TWoMainList 查看工单主表列表
func (c *ControllerV1) TWoMainList(ctx context.Context, req *v1.TWoMainListReq) (res *v1.TWoMainListRes, err error) {
list, totalCount, err := service.CommonTWoMain().List(ctx, &req.TWoMainListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TWoMainListModel{}
}
res = new(v1.TWoMainListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// TWoMainExport 导出工单主表列表
func (c *ControllerV1) TWoMainExport(ctx context.Context, req *v1.TWoMainExportReq) (res *v1.TWoMainExportRes, err error) {
err = service.CommonTWoMain().Export(ctx, &req.TWoMainListParam)
return
}
// TWoMainEdit 更新工单主表
func (c *ControllerV1) TWoMainEdit(ctx context.Context, req *v1.TWoMainEditReq) (res *v1.TWoMainEditRes, err error) {
err = service.CommonTWoMain().Edit(ctx, &req.TWoMainEditParam)
return
}
func (c *ControllerV1) TWoMainTransfer(ctx context.Context, req *v1.TWoMainTransferReq) (res *v1.TWoMainTransferRes, err error) {
err = service.CommonTWoMain().Transfer(ctx, &req.TWoMainTransferParam)
return
}
func (c *ControllerV1) TWoMainResolve(ctx context.Context, req *v1.TWoMainResolveReq) (res *v1.TWoMainResolveRes, err error) {
err = service.CommonTWoMain().Resolve(ctx, &req.TWoMainResolveParam)
return
}
func (c *ControllerV1) TWoMainCancel(ctx context.Context, req *v1.TWoMainCancelReq) (res *v1.TWoMainCancelRes, err error) {
err = service.CommonTWoMain().Cancel(ctx, &req.TWoMainCancelParam)
return
}
func (c *ControllerV1) TWoMainClose(ctx context.Context, req *v1.TWoMainCloseReq) (res *v1.TWoMainCloseRes, err error) {
err = service.CommonTWoMain().Close(ctx, &req.TWoMainCloseParam)
return
}
func (c *ControllerV1) TWoMainEvaluate(ctx context.Context, req *v1.TWoMainEvaluateReq) (res *v1.TWoMainEvaluateRes, err error) {
err = service.CommonTWoMain().Evaluate(ctx, &req.TWoMainEvaluateParam)
return
}
// TWoMainView 获取指定工单主表信息
func (c *ControllerV1) TWoMainView(ctx context.Context, req *v1.TWoMainViewReq) (res *v1.TWoMainViewRes, err error) {
data, err := service.CommonTWoMain().View(ctx, &req.TWoMainViewParam)
if err != nil {
return
}
res = new(v1.TWoMainViewRes)
res.TWoMainViewModel = data
return
}
// TWoMainDelete 删除工单主表
func (c *ControllerV1) TWoMainDelete(ctx context.Context, req *v1.TWoMainDeleteReq) (res *v1.TWoMainDeleteRes, err error) {
err = service.CommonTWoMain().Delete(ctx, &req.TWoMainDeleteParam)
return
}
@@ -0,0 +1,59 @@
package common
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
)
// List 查看工单记录表列表
func (c *ControllerV1) TWoRecordList(ctx context.Context, req *v1.TWoRecordListReq) (res *v1.TWoRecordListRes, err error) {
list, totalCount, err := service.CommonTWoRecord().List(ctx, &req.TWoRecordListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TWoRecordListModel{}
}
res = new(v1.TWoRecordListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出工单记录表列表
func (c *ControllerV1) TWoRecordExport(ctx context.Context, req *v1.TWoRecordExportReq) (res *v1.TWoRecordExportRes, err error) {
err = service.CommonTWoRecord().Export(ctx, &req.TWoRecordListParam)
return
}
// Edit 更新工单记录表
func (c *ControllerV1) TWoRecordEdit(ctx context.Context, req *v1.TWoRecordEditReq) (res *v1.TWoRecordEditRes, err error) {
err = service.CommonTWoRecord().Edit(ctx, &req.TWoRecordEditParam)
return
}
// View 获取指定工单记录表信息
func (c *ControllerV1) TWoRecordView(ctx context.Context, req *v1.TWoRecordViewReq) (res *v1.TWoRecordViewRes, err error) {
data, err := service.CommonTWoRecord().View(ctx, &req.TWoRecordViewParam)
if err != nil {
return
}
res = new(v1.TWoRecordViewRes)
res.TWoRecordViewModel = data
return
}
// Delete 删除工单记录表
func (c *ControllerV1) TWoRecordDelete(ctx context.Context, req *v1.TWoRecordDeleteReq) (res *v1.TWoRecordDeleteRes, err error) {
err = service.CommonTWoRecord().Delete(ctx, &req.TWoRecordDeleteParam)
return
}
@@ -0,0 +1,30 @@
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) SysOssUpload(ctx context.Context, req *v1.SysOssUploadReq) (res *v1.SysOssUploadRes, err error) {
info, err := service.SysOss().Upload(ctx, req.SysOssUploadParam)
if err != nil {
return nil, err
}
res = &v1.SysOssUploadRes{
SysOssUploadModel: info,
}
return
}
func (c *ControllerV1) SysOssDownload(ctx context.Context, req *v1.SysOssDownloadReq) (res *v1.SysOssDownloadRes, err error) {
output, err := service.SysOss().Download(ctx, req.SysOssDownloadParam)
if err != nil {
return nil, err
}
res = &v1.SysOssDownloadRes{
SysOssDownloadModel: output,
}
return
}
@@ -0,0 +1,63 @@
// Package iot
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package common
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看村级行政区划表列表
func (c *ControllerV1) TDivisionCodeList(ctx context.Context, req *v1.TDivisionCodeListReq) (res *v1.TDivisionCodeListRes, err error) {
list, totalCount, err := service.IotTDivisionCode().List(ctx, &req.TDivisionCodeListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TDivisionCodeListModel{}
}
res = new(v1.TDivisionCodeListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出村级行政区划表列表
func (c *ControllerV1) TDivisionCodeExport(ctx context.Context, req *v1.TDivisionCodeExportReq) (res *v1.TDivisionCodeExportRes, err error) {
err = service.IotTDivisionCode().Export(ctx, &req.TDivisionCodeListParam)
return
}
// Edit 更新村级行政区划表
func (c *ControllerV1) TDivisionCodeEdit(ctx context.Context, req *v1.TDivisionCodeEditReq) (res *v1.TDivisionCodeEditRes, err error) {
err = service.IotTDivisionCode().Edit(ctx, &req.TDivisionCodeEditParam)
return
}
// View 获取指定村级行政区划表信息
func (c *ControllerV1) TDivisionCodeView(ctx context.Context, req *v1.TDivisionCodeViewReq) (res *v1.TDivisionCodeViewRes, err error) {
data, err := service.IotTDivisionCode().View(ctx, &req.TDivisionCodeViewParam)
if err != nil {
return
}
res = new(v1.TDivisionCodeViewRes)
res.TDivisionCodeViewModel = data
return
}
// Delete 删除村级行政区划表
func (c *ControllerV1) TDivisionCodeDelete(ctx context.Context, req *v1.TDivisionCodeDeleteReq) (res *v1.TDivisionCodeDeleteRes, err error) {
err = service.IotTDivisionCode().Delete(ctx, &req.TDivisionCodeDeleteParam)
return
}
@@ -0,0 +1,69 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2025 LiXiujie
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package gen
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/testdemo/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/genin"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
var (
TestDemo = cTestDemo{}
)
type cTestDemo struct{}
// List 查看测试单表列表
func (c *cTestDemo) TestDemoList(ctx context.Context, req *v1.TestDemoListReq) (res *v1.TestDemoListRes, err error) {
list, totalCount, err := service.GenTestDemo().List(ctx, &req.TestDemoListParam)
if err != nil {
return
}
if list == nil {
list = []*genin.TestDemoListModel{}
}
res = new(v1.TestDemoListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出测试单表列表
func (c *cTestDemo) TestDemoExport(ctx context.Context, req *v1.TestDemoExportReq) (res *v1.TestDemoExportRes, err error) {
err = service.GenTestDemo().Export(ctx, &req.TestDemoListParam)
return
}
// Edit 更新测试单表
func (c *cTestDemo) TestDemoEdit(ctx context.Context, req *v1.TestDemoEditReq) (res *v1.TestDemoEditRes, err error) {
err = service.GenTestDemo().Edit(ctx, &req.TestDemoEditParam)
return
}
// View 获取指定测试单表信息
func (c *cTestDemo) TestDemoView(ctx context.Context, req *v1.TestDemoViewReq) (res *v1.TestDemoViewRes, err error) {
data, err := service.GenTestDemo().View(ctx, &req.TestDemoViewParam)
if err != nil {
return
}
res = new(v1.TestDemoViewRes)
res.TestDemoViewModel = data
return
}
// Delete 删除测试单表
func (c *cTestDemo) TestDemoDelete(ctx context.Context, req *v1.TestDemoDeleteReq) (res *v1.TestDemoDeleteRes, err error) {
err = service.GenTestDemo().Delete(ctx, &req.TestDemoDeleteParam)
return
}
@@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package testdemo
@@ -0,0 +1,15 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package testdemo
import (
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/testdemo"
)
type ControllerV1 struct{}
func NewV1() testdemo.ITestdemoV1 {
return &ControllerV1{}
}
@@ -0,0 +1,26 @@
package testdemo
import (
"context"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen/testdemo/v1"
)
func (c *ControllerV1) TestDemoList(ctx context.Context, req *v1.TestDemoListReq) (res *v1.TestDemoListRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
func (c *ControllerV1) TestDemoExport(ctx context.Context, req *v1.TestDemoExportReq) (res *v1.TestDemoExportRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
func (c *ControllerV1) TestDemoView(ctx context.Context, req *v1.TestDemoViewReq) (res *v1.TestDemoViewRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
func (c *ControllerV1) TestDemoEdit(ctx context.Context, req *v1.TestDemoEditReq) (res *v1.TestDemoEditRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
func (c *ControllerV1) TestDemoDelete(ctx context.Context, req *v1.TestDemoDeleteReq) (res *v1.TestDemoDeleteRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
@@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package gen_codes
@@ -0,0 +1,15 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package gen_codes
import (
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen_codes"
)
type ControllerV1 struct{}
func NewV1() gen_codes.IGenCodesV1 {
return &ControllerV1{}
}
@@ -0,0 +1,127 @@
package gen_codes
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/gen_codes/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) SysGenTableList(ctx context.Context, req *v1.SysGenTableListReq) (res *v1.SysGenTableListRes, err error) {
items, total, err := service.SysGenTable().List(ctx, req.SysGenTableListParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableListRes{
Items: items,
PageResult: response.PageResult{
Page: req.Page,
PageSize: req.PageSize,
Total: total,
},
}
return res, nil
}
func (c *ControllerV1) SysGenTableView(ctx context.Context, req *v1.SysGenTableViewReq) (res *v1.SysGenTableViewRes, err error) {
item, err := service.SysGenTable().View(ctx, req.SysGenTableViewParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableViewRes{
SysGenTableViewModel: item,
}
return res, nil
}
func (c *ControllerV1) SysGenTableAdd(ctx context.Context, req *v1.SysGenTableAddReq) (res *v1.SysGenTableAddRes, err error) {
output, err := service.SysGenTable().Add(ctx, req.SysGenTableAddParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableAddRes{
SysGenTableAddModel: output,
}
return res, nil
}
func (c *ControllerV1) SysGenTableDelete(ctx context.Context, req *v1.SysGenTableDeleteReq) (res *v1.SysGenTableDeleteRes, err error) {
output, err := service.SysGenTable().Delete(ctx, req.SysGenTableDeleteParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableDeleteRes{
SysGenTableDeleteModel: output,
}
return res, nil
}
func (c *ControllerV1) SysGenTableSelects(ctx context.Context, req *v1.SysGenTableSelectsReq) (res *v1.SysGenTableSelectsRes, err error) {
output, err := service.SysGenTable().Selects(ctx)
if err != nil {
return nil, err
}
res = &v1.SysGenTableSelectsRes{
SelectsModel: output,
}
return res, nil
}
func (c *ControllerV1) SysGenTableTableSelect(ctx context.Context, req *v1.SysGenTableTableSelectReq) (res *v1.SysGenTableTableSelectRes, err error) {
output, err := service.SysGenTable().TableSelect(ctx, req.GenCodesTableSelectParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableTableSelectRes{
Items: output,
}
return res, nil
}
func (c *ControllerV1) SysGenTableColumnSelect(ctx context.Context, req *v1.SysGenTableColumnSelectReq) (res *v1.SysGenTableColumnSelectRes, err error) {
output, err := service.SysGenTable().ColumnSelect(ctx, req.GenCodesColumnSelectParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableColumnSelectRes{
Items: output,
}
return res, nil
}
func (c *ControllerV1) SysGenTablePreview(ctx context.Context, req *v1.SysGenTablePreviewReq) (res *v1.SysGenTablePreviewRes, err error) {
output, err := service.SysGenTable().Preview(ctx, req.GenCodesPreviewParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTablePreviewRes{
GenCodesPreviewModel: output,
}
return res, nil
}
func (c *ControllerV1) SysGenTableBuild(ctx context.Context, req *v1.SysGenTableBuildReq) (res *v1.SysGenTableBuildRes, err error) {
output, err := service.SysGenTable().Build(ctx, req.GenCodesBuildParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableBuildRes{
GenCodesBuildModel: output,
}
return res, nil
}
func (c *ControllerV1) SysGenTableColumnList(ctx context.Context, req *v1.SysGenTableColumnListReq) (res *v1.SysGenTableColumnListRes, err error) {
output, err := service.SysGenTable().ColumnList(ctx, req.GenCodesColumnListParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableColumnListRes{
Items: output,
}
return res, nil
}
func (c *ControllerV1) SysGenTableEdit(ctx context.Context, req *v1.SysGenTableEditReq) (res *v1.SysGenTableEditRes, err error) {
output, err := service.SysGenTable().Edit(ctx, req.SysGenTableEditParam)
if err != nil {
return nil, err
}
res = &v1.SysGenTableEditRes{
SysGenTableEditModel: output,
}
return res, nil
}
@@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package home
@@ -0,0 +1,15 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package home
import (
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/home"
)
type ControllerV1 struct{}
func NewV1() home.IHomeV1 {
return &ControllerV1{}
}
@@ -0,0 +1,51 @@
package home
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/home/v1"
)
func (c *ControllerV1) CardStatistics(ctx context.Context, req *v1.CardStatisticsReq) (res *v1.CardStatisticsRes, err error) {
result, err := service.Home().GetCardStatistics(ctx)
if err != nil {
return nil, gerror.NewCode(gcode.CodeInternalError, err.Error())
}
return &v1.CardStatisticsRes{CardStatistics: *result}, nil
}
func (c *ControllerV1) CardStatusStatistics(ctx context.Context, req *v1.CardStatusStatisticsReq) (res *v1.CardStatusStatisticsRes, err error) {
result, err := service.Home().GetCardStatusStatistics(ctx)
if err != nil {
return nil, gerror.NewCode(gcode.CodeInternalError, err.Error())
}
return &v1.CardStatusStatisticsRes{CardStatusStatistics: *result}, nil
}
func (c *ControllerV1) TopUsageCards(ctx context.Context, req *v1.TopUsageCardsReq) (res *v1.TopUsageCardsRes, err error) {
result, err := service.Home().GetTopUsageCardsYesterday(ctx)
if err != nil {
return nil, gerror.NewCode(gcode.CodeInternalError, err.Error())
}
return &v1.TopUsageCardsRes{Data: result}, nil
}
func (c *ControllerV1) FlowUsageChart(ctx context.Context, req *v1.FlowUsageChartReq) (res *v1.FlowUsageChartRes, err error) {
result, err := service.Home().GetDeptFlowUsageChart(ctx, req.Period)
if err != nil {
return nil, gerror.NewCode(gcode.CodeInternalError, err.Error())
}
return &v1.FlowUsageChartRes{FlowUsageChartData: *result}, nil
}
func (c *ControllerV1) FlowPoolUsage(ctx context.Context, req *v1.FlowPoolUsageReq) (res *v1.FlowPoolUsageRes, err error) {
result, err := service.Home().GetFlowPoolUsageList(ctx)
if err != nil {
return nil, gerror.NewCode(gcode.CodeInternalError, err.Error())
}
return &v1.FlowPoolUsageRes{Data: result}, nil
}
@@ -0,0 +1,281 @@
package iot
import (
"context"
"strings"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/dao"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry"
)
type FullSyncMonitorController struct {
client fullsyncretry.Client
}
func NewFullSyncMonitor() *FullSyncMonitorController {
return &FullSyncMonitorController{client: fullsyncretry.FromEnvironment()}
}
func (c *FullSyncMonitorController) List(ctx context.Context, req *v1.FullSyncRunsListReq) (*v1.FullSyncRunsListRes, error) {
result, err := c.client.ListRuns(ctx, req.SyncKind, req.Limit)
if err != nil {
return nil, err
}
return &v1.FullSyncRunsListRes{Items: result.Items, Total: result.Total}, nil
}
func (c *FullSyncMonitorController) Detail(ctx context.Context, req *v1.FullSyncRunDetailReq) (*v1.FullSyncRunDetailRes, error) {
view, err := c.client.Run(ctx, req.RunID)
if err != nil {
return nil, err
}
kind, name := fullSyncKindName(view.Run.Operation)
return &v1.FullSyncRunDetailRes{RunView: view, SyncKind: kind, SyncName: name}, nil
}
func (c *FullSyncMonitorController) Failures(ctx context.Context, req *v1.FullSyncRunFailuresReq) (*v1.FullSyncRunFailuresRes, error) {
page, err := c.client.Failures(ctx, req.RunID, req.Limit, req.Cursor)
if err != nil {
return nil, err
}
return &v1.FullSyncRunFailuresRes{Items: page.Items, NextCursor: page.NextCursor}, nil
}
func (c *FullSyncMonitorController) Start(ctx context.Context, req *v1.FullSyncRunStartReq) (*v1.FullSyncRunStartRes, error) {
userID := contexts.GetUserId(ctx)
if userID == 0 {
return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required")
}
if !fullsyncretry.ValidSyncKind(req.SyncKind) {
return nil, gerror.NewCode(gcode.CodeInvalidParameter, "Invalid full-sync type")
}
// A period field only applies to its own sync kind. Rejecting a stray field
// keeps an operator from believing a backfill was scheduled when it was not.
period, err := resolvePeriod(req)
if err != nil {
return nil, err
}
// Validate and canonicalize the channel scope before the active-run check so
// a malformed request fails fast without touching Worker state.
scope, err := model.NormalizeScope(&model.SyncScope{Channels: req.Channels, TriggerSource: model.TriggerSourceManual})
if err != nil {
return nil, gerror.NewCode(gcode.CodeInvalidParameter, err.Error())
}
list, err := c.client.ListRuns(ctx, req.SyncKind, 100)
if err != nil {
return nil, err
}
for _, item := range list.Items {
if item.Run.Status == "producing" || item.Run.Status == "running" {
return nil, gerror.NewCode(gcode.CodeInvalidParameter, "A full-sync run is already active")
}
}
var runID string
switch req.SyncKind {
case "traffic_usage":
runID, err = service.TrafficUsageMonthlySync().StartMonthlyRunScoped(ctx, scope)
case "sim_status":
runID, err = service.SimStatusQueue().StartFullSyncRunScoped(ctx, scope)
case "imei":
runID, err = service.ImeiQueue().StartImeiRunScoped(ctx, scope)
case "traffic_usage_daily":
runID, err = service.TrafficUsageDailySync().StartDailyRunScopedAt(ctx, scope, req.QueryDate)
case "traffic_usage_monthly":
runID, err = service.TrafficUsageMonthlySync().StartMonthlyHistoryRunScopedAt(ctx, scope, req.QueryMonth)
}
if err != nil {
g.Log().Warningf(ctx, "full_sync_manual_start rejected actor=%d syncKind=%s scopeChannels=%d period=%s error=%q", userID, req.SyncKind, scope.ChannelCount(), period, err.Error())
return nil, err
}
g.Log().Infof(ctx, "full_sync_manual_start accepted actor=%d syncKind=%s runId=%s scopeChannels=%d scopeSample=%s period=%s", userID, req.SyncKind, runID, scope.ChannelCount(), strings.Join(scope.ChannelSample(10), ","), period)
return &v1.FullSyncRunStartRes{RunID: runID, SyncKind: req.SyncKind, Status: "published", ScopeChannels: scope.ChannelCount(), QueryPeriod: period}, nil
}
// resolvePeriod returns the requested backfill period for req.SyncKind and
// rejects a period field that does not belong to that sync kind.
func resolvePeriod(req *v1.FullSyncRunStartReq) (string, error) {
if req.QueryDate != "" && req.SyncKind != "traffic_usage_daily" {
return "", gerror.NewCodef(gcode.CodeInvalidParameter, "queryDate is only valid for syncKind=traffic_usage_daily, got %s", req.SyncKind)
}
if req.QueryMonth != "" && req.SyncKind != "traffic_usage_monthly" {
return "", gerror.NewCodef(gcode.CodeInvalidParameter, "queryMonth is only valid for syncKind=traffic_usage_monthly, got %s", req.SyncKind)
}
switch req.SyncKind {
case "traffic_usage_daily":
return req.QueryDate, nil
case "traffic_usage_monthly":
return req.QueryMonth, nil
}
return "", nil
}
// Channels returns the channels a partial sync can target, with their card
// counts so an operator can judge the blast radius before selecting.
func (c *FullSyncMonitorController) Channels(ctx context.Context, _ *v1.FullSyncChannelOptionsReq) (*v1.FullSyncChannelOptionsRes, error) {
if contexts.GetUserId(ctx) == 0 {
return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required")
}
tenantID := contexts.GetTenantId(ctx)
type channelRow struct {
ChanKey string `orm:"chan_key"`
ChanName string `orm:"chan_name"`
TempKey string `orm:"temp_key"`
Operator int `orm:"operator"`
SyncEnabled int `orm:"sync_enabled"`
CardCount int64 `orm:"card_count"`
}
var rows []*channelRow
channels := dao.TSimChannels.Columns()
cards := dao.TSimCardInfo.Columns()
// Count cards per channel in one pass. The left join keeps channels that
// currently hold no cards so they stay selectable (and visibly empty), and
// both sides are tenant-scoped so the count cannot leak across tenants.
//
// The select list and the GROUP BY clause must be built from the same
// column set; see channelOptionsQuery for why.
query := channelOptionsQuery(channelQueryColumns{
ChanKey: channels.ChanKey,
ChanName: channels.ChanName,
TempKey: channels.TempKey,
Operator: channels.Operator,
SyncEnabled: channels.SyncEnabled,
TenantID: channels.TenantId,
}, cardQueryColumns{
Id: cards.Id,
ChanKey: cards.ChanKey,
TenantID: cards.TenantId,
}, tenantID)
err := dao.TSimChannels.Ctx(ctx).
As(query.alias).
LeftJoin(query.joinTable, query.joinOn).
Fields(query.fields...).
Where(query.tenantWhere, query.tenantID).
Group(query.groupBy...).
OrderAsc(query.orderBy).
Scan(&rows)
if err != nil {
return nil, gerror.Wrap(err, "load full-sync channel options failed")
}
items := make([]v1.FullSyncChannelOption, 0, len(rows))
for _, row := range rows {
if row == nil {
continue
}
items = append(items, v1.FullSyncChannelOption{
ChanKey: row.ChanKey,
ChanName: row.ChanName,
TempKey: row.TempKey,
Operator: row.Operator,
CardCount: row.CardCount,
SyncEnabled: row.SyncEnabled == 1,
})
}
return &v1.FullSyncChannelOptionsRes{Items: items}, nil
}
func fullSyncKindName(operation string) (string, string) {
switch operation {
case "current_month_usage_full_sync":
return "traffic_usage", "流量全量同步"
case "sim_status_queue_full_sync":
return "sim_status", "卡状态全量同步"
case "previous_day_usage_full_sync":
return "traffic_usage_daily", "日流量全量同步"
case "previous_month_usage_full_sync":
return "traffic_usage_monthly", "月流量历史全量同步"
case "imei_full_sync":
return "imei", "IMEI 全量同步"
default:
return "", operation
}
}
// channelQueryColumns / cardQueryColumns carry the physical column names the
// channel-options query needs. They keep the builder a pure function so its
// SQL shape can be asserted in a unit test.
type channelQueryColumns struct {
ChanKey string
ChanName string
TempKey string
Operator string
SyncEnabled string
TenantID string
}
type cardQueryColumns struct {
Id string
ChanKey string
TenantID string
}
// channelOptionsQueryShape holds the assembled pieces of the channel-options query
// so the SQL shape can be asserted without a database.
type channelOptionsQueryShape struct {
alias string
joinTable string
joinOn string
fields []any
groupBy []any
orderBy string
tenantWhere string
tenantID string
}
// channelOptionsQuery builds the channel candidate query.
//
// IMPORTANT: every non-aggregate column in the select list must also appear in
// GROUP BY. MySQL runs with ONLY_FULL_GROUP_BY, and GoFrame sends the tenant
// filter as a prepared-statement parameter. A bound parameter is not a
// constant, so MySQL cannot use the unique key uk_key(tenant_id, chan_key) to
// prove that chan_name/temp_key/operator/sync_enabled are functionally
// dependent on the grouped column. Grouping by chan_key alone therefore fails
// in production with:
//
// Error 1055: Expression #2 of SELECT list is not in GROUP BY clause and
// contains nonaggregated column 'db_iotlcm.c.chan_name' which is not
// functionally dependent on columns in GROUP BY clause
//
// Adding the remaining columns keeps the grouping semantically identical
// because (tenant_id, chan_key) is unique, and it satisfies the SQL mode.
func channelOptionsQuery(channels channelQueryColumns, cards cardQueryColumns, tenantID string) channelOptionsQueryShape {
const alias = "c"
const joinAlias = "ci"
// Single source of truth: the non-aggregate columns that are both selected
// and grouped.
nonAggregate := []struct{ column, out string }{
{channels.ChanKey, "chan_key"},
{channels.ChanName, "chan_name"},
{channels.TempKey, "temp_key"},
{channels.Operator, "operator"},
{channels.SyncEnabled, "sync_enabled"},
}
fields := make([]any, 0, len(nonAggregate)+1)
groupBy := make([]any, 0, len(nonAggregate))
for _, column := range nonAggregate {
fields = append(fields, alias+"."+column.column+" AS "+column.out)
groupBy = append(groupBy, alias+"."+column.column)
}
fields = append(fields, "COUNT("+joinAlias+"."+cards.Id+") AS card_count")
return channelOptionsQueryShape{
alias: alias,
joinTable: dao.TSimCardInfo.Table() + " AS " + joinAlias,
joinOn: alias + "." + channels.ChanKey + " = " + joinAlias + "." + cards.ChanKey +
" AND " + joinAlias + "." + cards.TenantID + " = " + alias + "." + channels.TenantID,
fields: fields,
groupBy: groupBy,
orderBy: alias + "." + channels.ChanKey,
tenantWhere: alias + "." + channels.TenantID,
tenantID: tenantID,
}
}
@@ -0,0 +1,144 @@
package iot
import (
"strings"
"testing"
)
// testChannelColumns mirrors the physical column names of t_sim_channels.
func testChannelColumns() channelQueryColumns {
return channelQueryColumns{
ChanKey: "chan_key",
ChanName: "chan_name",
TempKey: "temp_key",
Operator: "operator",
SyncEnabled: "sync_enabled",
TenantID: "tenant_id",
}
}
func testCardColumns() cardQueryColumns {
return cardQueryColumns{Id: "id", ChanKey: "chan_key", TenantID: "tenant_id"}
}
// TestChannelOptionsQueryGroupsEverySelectedNonAggregateColumn guards a
// production regression.
//
// MySQL runs with ONLY_FULL_GROUP_BY and GoFrame binds the tenant filter as a
// prepared-statement parameter. A bound parameter is not a constant, so MySQL
// cannot use the unique key uk_key(tenant_id, chan_key) to prove that the
// selected columns are functionally dependent on the grouped column. Grouping
// by chan_key alone therefore fails on the real database with:
//
// Error 1055: Expression #2 of SELECT list is not in GROUP BY clause and
// contains nonaggregated column 'db_iotlcm.c.chan_name' ...
//
// Every selected non-aggregate column must therefore be grouped.
func TestChannelOptionsQueryGroupsEverySelectedNonAggregateColumn(t *testing.T) {
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
// Derive the selected non-aggregate columns from the built select list, so
// this test fails if someone adds a column to the query without grouping it.
selected := make(map[string]string, len(query.fields))
for _, field := range query.fields {
expression, ok := field.(string)
if !ok {
t.Fatalf("unexpected non-string field %#v", field)
}
if strings.Contains(expression, "COUNT(") {
continue // aggregate, does not belong in GROUP BY
}
// "c.chan_key AS chan_key" -> physical column "chan_key"
physical := strings.TrimSpace(strings.Split(expression, " AS ")[0])
physical = strings.TrimPrefix(physical, query.alias+".")
selected[physical] = expression
}
if len(selected) == 0 {
t.Fatal("query selects no non-aggregate columns; test would be vacuous")
}
grouped := make(map[string]struct{}, len(query.groupBy))
for _, column := range query.groupBy {
name, ok := column.(string)
if !ok {
t.Fatalf("unexpected non-string group column %#v", column)
}
grouped[strings.TrimPrefix(name, query.alias+".")] = struct{}{}
}
for physical, expression := range selected {
if _, ok := grouped[physical]; !ok {
t.Errorf("column %q is selected (%s) but not in GROUP BY; "+
"MySQL ONLY_FULL_GROUP_BY will reject this query with Error 1055",
physical, expression)
}
}
if len(grouped) != len(selected) {
t.Errorf("grouped %d columns but selected %d non-aggregate columns", len(grouped), len(selected))
}
}
// TestChannelOptionsQueryGroupsChanKeyAloneRegression pins the exact broken
// shape: a GROUP BY that contains only chan_key.
func TestChannelOptionsQueryGroupsChanKeyAloneRegression(t *testing.T) {
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
if len(query.groupBy) == 1 {
t.Fatalf("GROUP BY contains only %v; grouping by chan_key alone fails under "+
"ONLY_FULL_GROUP_BY with a bound tenant parameter (Error 1055)", query.groupBy)
}
}
// TestChannelOptionsQueryGroupsExpectedColumns locks the concrete clause so a
// refactor cannot silently drop a column.
func TestChannelOptionsQueryGroupsExpectedColumns(t *testing.T) {
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
got := make([]string, 0, len(query.groupBy))
for _, column := range query.groupBy {
got = append(got, column.(string))
}
want := []string{
"c.chan_key",
"c.chan_name",
"c.temp_key",
"c.operator",
"c.sync_enabled",
}
if strings.Join(got, ",") != strings.Join(want, ",") {
t.Fatalf("GROUP BY = %v, want %v", got, want)
}
}
// TestChannelOptionsQueryCountsCardsWithAggregate ensures the count column is
// present and is not accidentally grouped.
func TestChannelOptionsQueryCountsCardsWithAggregate(t *testing.T) {
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
var found bool
for _, field := range query.fields {
if strings.Contains(field.(string), "COUNT(ci.id) AS card_count") {
found = true
}
}
if !found {
t.Fatalf("card_count aggregate missing from fields: %v", query.fields)
}
for _, column := range query.groupBy {
if strings.Contains(column.(string), "COUNT") {
t.Fatalf("aggregate must not appear in GROUP BY: %v", query.groupBy)
}
}
}
// TestChannelOptionsQueryScopesBothSidesToTenant keeps the tenant isolation
// guarantee: the join condition and the WHERE clause must both be tenant-scoped.
func TestChannelOptionsQueryScopesBothSidesToTenant(t *testing.T) {
query := channelOptionsQuery(testChannelColumns(), testCardColumns(), "000000")
if !strings.Contains(query.joinOn, "ci.tenant_id = c.tenant_id") {
t.Errorf("join must scope both sides by tenant, got %q", query.joinOn)
}
if query.tenantWhere != "c.tenant_id" {
t.Errorf("tenant where = %q, want c.tenant_id", query.tenantWhere)
}
if query.tenantID != "000000" {
t.Errorf("tenant id = %q, want 000000", query.tenantID)
}
}
@@ -0,0 +1,292 @@
package iot
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"reflect"
"testing"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts"
_ "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/logic/imeiqueue"
_ "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/logic/simstatusqueue"
_ "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/logic/trafficusage"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry"
)
type scopedStarter func(context.Context, *model.SyncScope) (string, error)
// periodStarter is the shape of the *At starters: a scope plus a yyyyMMdd or
// yyyyMM period.
type periodStarter func(context.Context, *model.SyncScope, string) (string, error)
type monthlyStarterStub struct {
service.ITrafficUsageMonthlySync
current scopedStarter
history scopedStarter
at periodStarter
}
func (s monthlyStarterStub) StartMonthlyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
return s.current(ctx, scope)
}
func (s monthlyStarterStub) StartMonthlyHistoryRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
return s.history(ctx, scope)
}
func (s monthlyStarterStub) StartMonthlyHistoryRunScopedAt(ctx context.Context, scope *model.SyncScope, queryMonth string) (string, error) {
return s.at(ctx, scope, queryMonth)
}
type dailyStarterStub struct {
service.ITrafficUsageDailySync
start scopedStarter
at periodStarter
}
func (s dailyStarterStub) StartDailyRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
return s.start(ctx, scope)
}
func (s dailyStarterStub) StartDailyRunScopedAt(ctx context.Context, scope *model.SyncScope, queryDate string) (string, error) {
return s.at(ctx, scope, queryDate)
}
type statusStarterStub struct {
service.ISimStatusQueue
start scopedStarter
}
func (s statusStarterStub) StartFullSyncRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
return s.start(ctx, scope)
}
type imeiStarterStub struct {
service.IImeiQueue
start scopedStarter
}
func (s imeiStarterStub) StartImeiRunScoped(ctx context.Context, scope *model.SyncScope) (string, error) {
return s.start(ctx, scope)
}
func installFullSyncStarters(t *testing.T, start func(kind string, scope *model.SyncScope, periods ...string) (string, error)) {
t.Helper()
var (
monthly = service.TrafficUsageMonthlySync()
daily = service.TrafficUsageDailySync()
status = service.SimStatusQueue()
imei = service.ImeiQueue()
)
t.Cleanup(func() {
service.RegisterTrafficUsageMonthlySync(monthly)
service.RegisterTrafficUsageDailySync(daily)
service.RegisterSimStatusQueue(status)
service.RegisterImeiQueue(imei)
})
forKind := func(kind string) scopedStarter {
return func(_ context.Context, scope *model.SyncScope) (string, error) { return start(kind, scope) }
}
forKindAt := func(kind string) periodStarter {
return func(_ context.Context, scope *model.SyncScope, period string) (string, error) {
return start(kind, scope, period)
}
}
service.RegisterTrafficUsageMonthlySync(monthlyStarterStub{current: forKind("traffic_usage"), history: forKind("traffic_usage_monthly"), at: forKindAt("traffic_usage_monthly")})
service.RegisterTrafficUsageDailySync(dailyStarterStub{start: forKind("traffic_usage_daily"), at: forKindAt("traffic_usage_daily")})
service.RegisterSimStatusQueue(statusStarterStub{start: forKind("sim_status")})
service.RegisterImeiQueue(imeiStarterStub{start: forKind("imei")})
}
func fullSyncActorContext() context.Context {
return contexts.Set(context.Background(), &model.Context{User: &model.Identity{BaseClaims: model.BaseClaims{ID: 42}}})
}
func TestFullSyncStartAndMonitorAllFiveKinds(t *testing.T) {
var started []string
var periods []string
installFullSyncStarters(t, func(kind string, scope *model.SyncScope, period ...string) (string, error) {
started = append(started, kind)
if scope.TriggerSource != model.TriggerSourceManual || !reflect.DeepEqual(scope.Channels, []string{"a", "b"}) {
t.Errorf("%s scope = %+v", kind, scope)
}
// Without a period field the *At starters must receive an empty period,
// i.e. the run keeps its historical default window.
periods = append(periods, period...)
return "run-" + kind, nil
})
var filters []string
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet || r.URL.Path != "/internal/v1/full-sync-runs" || r.URL.Query().Get("limit") != "100" {
t.Errorf("unexpected active-run request: %s %s", r.Method, r.URL)
}
filters = append(filters, r.URL.Query().Get("syncKind"))
_, _ = w.Write([]byte(`{"items":[],"total":0}`))
}))
defer server.Close()
controller := &FullSyncMonitorController{client: fullsyncretry.Client{BaseURL: server.URL}}
tests := []struct{ kind, operation string }{
{"traffic_usage", "current_month_usage_full_sync"},
{"sim_status", "sim_status_queue_full_sync"},
{"imei", "imei_full_sync"},
{"traffic_usage_daily", "previous_day_usage_full_sync"},
{"traffic_usage_monthly", "previous_month_usage_full_sync"},
}
for _, tt := range tests {
t.Run(tt.kind, func(t *testing.T) {
var req v1.FullSyncRunStartReq
body, _ := json.Marshal(map[string]any{"syncKind": tt.kind, "channels": []string{"b", "a", "b"}})
if err := json.Unmarshal(body, &req); err != nil {
t.Fatal(err)
}
res, err := controller.Start(fullSyncActorContext(), &req)
if err != nil || res.RunID != "run-"+tt.kind || res.SyncKind != tt.kind || res.Status != "published" || res.ScopeChannels != 2 {
t.Fatalf("start = %+v, err = %v", res, err)
}
if res.QueryPeriod != "" {
t.Fatalf("%s queryPeriod = %q, want empty for the default period", tt.kind, res.QueryPeriod)
}
if got, name := fullSyncKindName(tt.operation); got != tt.kind || name == "" {
t.Fatalf("operation %q maps to %q, %q", tt.operation, got, name)
}
if _, err := controller.List(context.Background(), &v1.FullSyncRunsListReq{SyncKind: tt.kind, Limit: 100}); err != nil {
t.Fatal(err)
}
})
}
if len(started) != 5 || len(filters) != 10 {
t.Fatalf("starts = %v, filters = %v", started, filters)
}
// Only the daily and monthly-history kinds go through a period-aware starter.
if len(periods) != 2 || periods[0] != "" || periods[1] != "" {
t.Fatalf("periods = %v, want two empty periods", periods)
}
for i, tt := range tests {
if started[i] != tt.kind || filters[2*i] != tt.kind || filters[2*i+1] != tt.kind {
t.Fatalf("incorrect kind routing: starts = %v, filters = %v", started, filters)
}
}
}
func TestFullSyncStartRejectsInvalidAndActiveRequests(t *testing.T) {
starts, queries := 0, 0
installFullSyncStarters(t, func(string, *model.SyncScope, ...string) (string, error) {
starts++
return "unexpected", nil
})
active := "running"
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
queries++
_ = json.NewEncoder(w).Encode(fullsyncretry.RunList{Items: []fullsyncretry.RunView{{Run: fullsyncretry.RunMeta{Status: active}}}})
}))
defer server.Close()
controller := &FullSyncMonitorController{client: fullsyncretry.Client{BaseURL: server.URL}}
if _, err := controller.Start(context.Background(), &v1.FullSyncRunStartReq{SyncKind: "imei"}); gerror.Code(err) != gcode.CodeNotAuthorized {
t.Fatalf("anonymous start = %v", err)
}
for _, req := range []v1.FullSyncRunStartReq{
{SyncKind: ""}, {SyncKind: "unknown"}, {SyncKind: "imei", Channels: []string{"bad/channel"}},
} {
if _, err := controller.Start(fullSyncActorContext(), &req); gerror.Code(err) != gcode.CodeInvalidParameter {
t.Fatalf("invalid request %+v = %v", req, err)
}
}
if queries != 0 {
t.Fatal("invalid request queried Worker")
}
for _, kind := range []string{"traffic_usage", "sim_status", "imei", "traffic_usage_daily", "traffic_usage_monthly"} {
for _, active = range []string{"running", "producing"} {
if _, err := controller.Start(fullSyncActorContext(), &v1.FullSyncRunStartReq{SyncKind: kind}); gerror.Code(err) != gcode.CodeInvalidParameter {
t.Fatalf("%s/%s active run = %v", kind, active, err)
}
}
}
if starts != 0 || queries != 10 {
t.Fatalf("starts = %d, queries = %d", starts, queries)
}
}
// TestFullSyncStartForwardsQueryPeriod pins the backfill wiring: the requested
// period must reach the period-aware starter, and the response must echo it so
// the operator can see which window the run covers.
func TestFullSyncStartForwardsQueryDate(t *testing.T) {
assertFullSyncPeriodForwarded(t, "traffic_usage_daily", "20261014")
}
func TestFullSyncStartForwardsQueryMonth(t *testing.T) {
assertFullSyncPeriodForwarded(t, "traffic_usage_monthly", "202604")
}
func assertFullSyncPeriodForwarded(t *testing.T, syncKind, period string) {
t.Helper()
type call struct{ kind, period string }
var calls []call
installFullSyncStarters(t, func(kind string, _ *model.SyncScope, periods ...string) (string, error) {
calls = append(calls, call{kind: kind, period: periods[0]})
return "run-" + kind, nil
})
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(`{"items":[],"total":0}`))
}))
defer server.Close()
controller := &FullSyncMonitorController{client: fullsyncretry.Client{BaseURL: server.URL}}
req := &v1.FullSyncRunStartReq{SyncKind: syncKind}
if syncKind == "traffic_usage_daily" {
req.QueryDate = period
} else {
req.QueryMonth = period
}
res, err := controller.Start(fullSyncActorContext(), req)
if err != nil {
t.Fatalf("start = %v", err)
}
if res.QueryPeriod != period {
t.Fatalf("queryPeriod = %q, want %q", res.QueryPeriod, period)
}
if len(calls) != 1 || calls[0].kind != syncKind || calls[0].period != period {
t.Fatalf("starter calls = %+v, want one %s call with period %s", calls, syncKind, period)
}
}
// TestFullSyncStartRejectsMismatchedPeriodField keeps a stray period field from
// silently doing nothing: queryMonth on a daily run is a caller mistake.
func TestFullSyncStartRejectsMismatchedPeriodField(t *testing.T) {
starts := 0
installFullSyncStarters(t, func(string, *model.SyncScope, ...string) (string, error) {
starts++
return "unexpected", nil
})
queries := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
queries++
_, _ = w.Write([]byte(`{"items":[],"total":0}`))
}))
defer server.Close()
controller := &FullSyncMonitorController{client: fullsyncretry.Client{BaseURL: server.URL}}
for _, req := range []v1.FullSyncRunStartReq{
{SyncKind: "traffic_usage_daily", QueryMonth: "202604"},
{SyncKind: "traffic_usage_monthly", QueryDate: "20261014"},
{SyncKind: "imei", QueryDate: "20261014"},
{SyncKind: "sim_status", QueryMonth: "202604"},
{SyncKind: "traffic_usage", QueryMonth: "202604"},
} {
if _, err := controller.Start(fullSyncActorContext(), &req); gerror.Code(err) != gcode.CodeInvalidParameter {
t.Fatalf("mismatched request %+v = %v, want invalid parameter", req, err)
}
}
if starts != 0 {
t.Fatalf("starters called %d times for rejected requests", starts)
}
if queries != 0 {
t.Fatal("rejected request queried Worker")
}
}
@@ -0,0 +1,45 @@
package iot
import (
"context"
"strconv"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/contexts"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry"
)
type FullSyncReplayController struct{ client fullsyncretry.Client }
func NewFullSyncReplay() *FullSyncReplayController {
return &FullSyncReplayController{client: fullsyncretry.FromEnvironment()}
}
func (c *FullSyncReplayController) Replay(ctx context.Context, req *v1.FullSyncReplayReq) (*v1.FullSyncReplayRes, error) {
userID := contexts.GetUserId(ctx)
if userID == 0 {
return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required")
}
receipt, err := c.client.Replay(ctx, req.SourceRunID, strconv.FormatInt(userID, 10), req.MaxRounds)
if err != nil {
g.Log().Warningf(ctx, "full_sync_replay rejected actor=%d sourceRunId=%s maxRounds=%d", userID, req.SourceRunID, req.MaxRounds)
return nil, err
}
g.Log().Infof(ctx, "full_sync_replay accepted actor=%d sourceRunId=%s maxRounds=%d replayRunId=%s", userID, req.SourceRunID, req.MaxRounds, receipt.ReplayRunID)
return &v1.FullSyncReplayRes{ReplayRunID: receipt.ReplayRunID, Status: receipt.Status}, nil
}
func (c *FullSyncReplayController) Status(ctx context.Context, req *v1.FullSyncReplayStatusReq) (*v1.FullSyncReplayStatusRes, error) {
if contexts.GetUserId(ctx) == 0 {
return nil, gerror.NewCode(gcode.CodeNotAuthorized, "Login required")
}
status, err := c.client.Get(ctx, req.ReplayRunID)
if err != nil {
return nil, err
}
return &v1.FullSyncReplayStatusRes{ReplayRunID: status.ReplayRunID, SourceRunID: status.SourceRunID, Status: status.Status, Enqueued: status.Enqueued, Remaining: status.Remaining, RunStatus: status.RunStatus, Error: status.Error}, nil
}
@@ -0,0 +1,83 @@
package iot
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/fullsyncretry"
)
func TestFullSyncReplayRequestMaxRoundsThroughController(t *testing.T) {
var bodies []map[string]any
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost || r.URL.Path != "/internal/v1/full-sync-runs/source/replay" || r.Header.Get("Content-Type") != "application/json" {
t.Errorf("unexpected Worker request: %s %s", r.Method, r.URL)
}
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Error(err)
}
bodies = append(bodies, body)
w.WriteHeader(http.StatusAccepted)
_, _ = w.Write([]byte(`{"replayRunId":"replay-1","status":"accepted"}`))
}))
defer server.Close()
controller := &FullSyncReplayController{client: fullsyncretry.Client{BaseURL: server.URL}}
tests := []struct {
body string
rounds int
}{
{`{"sourceRunId":"source"}`, 0},
{`{"sourceRunId":"source","maxRounds":0}`, 0},
{`{"sourceRunId":"source","maxRounds":1}`, 1},
{`{"sourceRunId":"source","maxRounds":3}`, 3},
{`{"sourceRunId":"source","maxRounds":7}`, 7},
{`{"sourceRunId":"source","maxRounds":100}`, 100},
}
for i, tt := range tests {
var req v1.FullSyncReplayReq
if err := json.Unmarshal([]byte(tt.body), &req); err != nil {
t.Fatal(err)
}
if err := g.Validator().Data(req).Run(context.Background()); err != nil {
t.Fatalf("valid request %s: %v", tt.body, err)
}
res, err := controller.Replay(fullSyncActorContext(), &req)
if err != nil || res.ReplayRunID != "replay-1" || res.Status != "accepted" {
t.Fatalf("replay = %+v, err = %v", res, err)
}
body := bodies[i]
if body["requestedBy"] != "42" {
t.Fatalf("actor not forwarded: %+v", body)
}
if tt.rounds == 0 {
if len(body) != 1 {
t.Fatalf("legacy Worker must receive no extra field: %+v", body)
}
} else if len(body) != 2 || body["maxRounds"] != float64(tt.rounds) {
t.Fatalf("rounds not forwarded: %+v", body)
}
}
for _, rounds := range []int{-1, 101} {
req := v1.FullSyncReplayReq{SourceRunID: "source", MaxRounds: rounds}
if err := g.Validator().Data(req).Run(context.Background()); err == nil {
t.Fatalf("API accepted maxRounds=%d", rounds)
}
if _, err := controller.Replay(fullSyncActorContext(), &req); gerror.Code(err) != gcode.CodeInvalidParameter {
t.Fatalf("controller accepted maxRounds=%d: %v", rounds, err)
}
}
if _, err := controller.Replay(context.Background(), &v1.FullSyncReplayReq{SourceRunID: "source", MaxRounds: 3}); gerror.Code(err) != gcode.CodeNotAuthorized {
t.Fatalf("anonymous replay = %v", err)
}
if len(bodies) != len(tests) {
t.Fatalf("invalid/anonymous request reached Worker: %d calls", len(bodies))
}
}
@@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package iot
@@ -0,0 +1,13 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package iot
import "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot"
type ControllerV1 struct{}
func NewV1() iot.IIotV1 {
return &ControllerV1{}
}
@@ -0,0 +1,90 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/response"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimWarningConfigExcelTemplate(ctx context.Context, req *v1.TSimWarningConfigExcelTemplateReq) (res *v1.TSimWarningConfigExcelTemplateRes, err error) {
err = service.IotTSimWarningConfig().DownloadExcelTemplate(ctx, req.ItemType)
return
}
func (c *ControllerV1) TSimWarningConfigEmailCode(ctx context.Context, req *v1.TSimWarningConfigEmailCodeReq) (res *v1.TSimWarningConfigEmailCodeRes, err error) {
if err = service.IotTSimWarningConfig().SendEmailCode(ctx, &req.TSimWarningConfigEmailCodeParam); err != nil {
return nil, err
}
return &v1.TSimWarningConfigEmailCodeRes{}, nil
}
func (c *ControllerV1) TSimWarningConfigExcelSubmit(ctx context.Context, req *v1.TSimWarningConfigExcelSubmitReq) (res *v1.TSimWarningConfigExcelSubmitRes, err error) {
data, err := service.IotTSimWarningConfig().SubmitExcel(ctx, &req.TSimWarningConfigExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimWarningConfigExcelSubmitRes{TSimWarningConfigExcelSubmitRes: data}, nil
}
func (c *ControllerV1) TSimWarningConfigInputSubmit(ctx context.Context, req *v1.TSimWarningConfigInputSubmitReq) (res *v1.TSimWarningConfigInputSubmitRes, err error) {
data, err := service.IotTSimWarningConfig().SubmitInput(ctx, &req.TSimWarningConfigInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimWarningConfigInputSubmitRes{TSimWarningConfigInputSubmitRes: data}, nil
}
func (c *ControllerV1) TSimWarningConfigRangeSubmit(ctx context.Context, req *v1.TSimWarningConfigRangeSubmitReq) (res *v1.TSimWarningConfigRangeSubmitRes, err error) {
data, err := service.IotTSimWarningConfig().SubmitRange(ctx, &req.TSimWarningConfigRangeSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimWarningConfigRangeSubmitRes{TSimWarningConfigRangeSubmitRes: data}, nil
}
func (c *ControllerV1) SimWarningConfigList(ctx context.Context, req *v1.SimWarningConfigListReq) (res *v1.SimWarningConfigListRes, err error) {
list, totalCount, err := service.SimWarning().ConfigList(ctx, &req.SimWarningConfigListParam)
if err != nil {
return nil, err
}
if list == nil {
list = []*model.SimWarningConfigModel{}
}
return &v1.SimWarningConfigListRes{
PageResult: response.PageResult{
Page: req.Page,
PageSize: req.PageSize,
Total: totalCount,
},
Items: list,
}, nil
}
func (c *ControllerV1) SimWarningConfigView(ctx context.Context, req *v1.SimWarningConfigViewReq) (res *v1.SimWarningConfigViewRes, err error) {
data, err := service.SimWarning().ConfigView(ctx, &req.SimWarningConfigViewParam)
if err != nil {
return nil, err
}
return &v1.SimWarningConfigViewRes{SimWarningConfigModel: data}, nil
}
func (c *ControllerV1) SimWarningConfigSave(ctx context.Context, req *v1.SimWarningConfigSaveReq) (res *v1.SimWarningConfigSaveRes, err error) {
data, err := service.SimWarning().ConfigSave(ctx, &req.SimWarningConfigSaveParam)
if err != nil {
return nil, err
}
return &v1.SimWarningConfigSaveRes{SimWarningConfigSaveModel: data}, nil
}
func (c *ControllerV1) SimWarningConfigStatus(ctx context.Context, req *v1.SimWarningConfigStatusReq) (res *v1.SimWarningConfigStatusRes, err error) {
err = service.SimWarning().ConfigStatus(ctx, &req.SimWarningConfigStatusParam)
return &v1.SimWarningConfigStatusRes{}, err
}
func (c *ControllerV1) SimWarningConfigDelete(ctx context.Context, req *v1.SimWarningConfigDeleteReq) (res *v1.SimWarningConfigDeleteRes, err error) {
err = service.SimWarning().ConfigDelete(ctx, &req.SimWarningConfigDeleteParam)
return &v1.SimWarningConfigDeleteRes{}, err
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataCutExcelSubmit(ctx context.Context, req *v1.TSimCardDataCutExcelSubmitReq) (res *v1.TSimCardDataCutExcelSubmitRes, err error) {
data, err := service.IotTSimCardDataCut().SubmitExcel(ctx, &req.TSimCardDataCutExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardDataCutExcelSubmitRes{TSimCardDataCutExcelSubmitRes: data}, nil
}
@@ -0,0 +1,13 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataCutExcelTemplate(ctx context.Context, req *v1.TSimCardDataCutExcelTemplateReq) (res *v1.TSimCardDataCutExcelTemplateRes, err error) {
err = service.IotTSimCardDataCut().DownloadExcelTemplate(ctx)
return
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataCutInputSubmit(ctx context.Context, req *v1.TSimCardDataCutInputSubmitReq) (res *v1.TSimCardDataCutInputSubmitRes, err error) {
data, err := service.IotTSimCardDataCut().SubmitInput(ctx, &req.TSimCardDataCutInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardDataCutInputSubmitRes{TSimCardDataCutInputSubmitRes: data}, nil
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataStartExcelSubmit(ctx context.Context, req *v1.TSimCardDataStartExcelSubmitReq) (res *v1.TSimCardDataStartExcelSubmitRes, err error) {
data, err := service.IotTSimCardDataStart().SubmitExcel(ctx, &req.TSimCardDataStartExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardDataStartExcelSubmitRes{TSimCardDataStartSubmitRes: data}, nil
}
@@ -0,0 +1,13 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataStartExcelTemplate(ctx context.Context, req *v1.TSimCardDataStartExcelTemplateReq) (res *v1.TSimCardDataStartExcelTemplateRes, err error) {
err = service.IotTSimCardDataStart().DownloadExcelTemplate(ctx)
return
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataStartInputSubmit(ctx context.Context, req *v1.TSimCardDataStartInputSubmitReq) (res *v1.TSimCardDataStartInputSubmitRes, err error) {
data, err := service.IotTSimCardDataStart().SubmitInput(ctx, &req.TSimCardDataStartInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardDataStartInputSubmitRes{TSimCardDataStartSubmitRes: data}, nil
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataStopExcelSubmit(ctx context.Context, req *v1.TSimCardDataStopExcelSubmitReq) (res *v1.TSimCardDataStopExcelSubmitRes, err error) {
data, err := service.IotTSimCardDataStop().SubmitExcel(ctx, &req.TSimCardDataStopExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardDataStopExcelSubmitRes{TSimCardDataStopSubmitRes: data}, nil
}
@@ -0,0 +1,13 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataStopExcelTemplate(ctx context.Context, req *v1.TSimCardDataStopExcelTemplateReq) (res *v1.TSimCardDataStopExcelTemplateRes, err error) {
err = service.IotTSimCardDataStop().DownloadExcelTemplate(ctx)
return
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardDataStopInputSubmit(ctx context.Context, req *v1.TSimCardDataStopInputSubmitReq) (res *v1.TSimCardDataStopInputSubmitRes, err error) {
data, err := service.IotTSimCardDataStop().SubmitInput(ctx, &req.TSimCardDataStopInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardDataStopInputSubmitRes{TSimCardDataStopSubmitRes: data}, nil
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardRestartExcelSubmit(ctx context.Context, req *v1.TSimCardRestartExcelSubmitReq) (res *v1.TSimCardRestartExcelSubmitRes, err error) {
data, err := service.IotTSimCardRestart().SubmitExcel(ctx, &req.TSimCardRestartExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardRestartExcelSubmitRes{TSimCardRestartExcelSubmitRes: data}, nil
}
@@ -0,0 +1,13 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardRestartExcelTemplate(ctx context.Context, req *v1.TSimCardRestartExcelTemplateReq) (res *v1.TSimCardRestartExcelTemplateRes, err error) {
err = service.IotTSimCardRestart().DownloadExcelTemplate(ctx)
return
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardRestartInputSubmit(ctx context.Context, req *v1.TSimCardRestartInputSubmitReq) (res *v1.TSimCardRestartInputSubmitRes, err error) {
data, err := service.IotTSimCardRestart().SubmitInput(ctx, &req.TSimCardRestartInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardRestartInputSubmitRes{TSimCardRestartInputSubmitRes: data}, nil
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardStartExcelSubmit(ctx context.Context, req *v1.TSimCardStartExcelSubmitReq) (res *v1.TSimCardStartExcelSubmitRes, err error) {
data, err := service.IotTSimCardStart().SubmitExcel(ctx, &req.TSimCardStartExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardStartExcelSubmitRes{TSimCardStartExcelSubmitRes: data}, nil
}
@@ -0,0 +1,13 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardStartExcelTemplate(ctx context.Context, req *v1.TSimCardStartExcelTemplateReq) (res *v1.TSimCardStartExcelTemplateRes, err error) {
err = service.IotTSimCardStart().DownloadExcelTemplate(ctx)
return
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardStartInputSubmit(ctx context.Context, req *v1.TSimCardStartInputSubmitReq) (res *v1.TSimCardStartInputSubmitRes, err error) {
data, err := service.IotTSimCardStart().SubmitInput(ctx, &req.TSimCardStartInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardStartInputSubmitRes{TSimCardStartInputSubmitRes: data}, nil
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardStopExcelSubmit(ctx context.Context, req *v1.TSimCardStopExcelSubmitReq) (res *v1.TSimCardStopExcelSubmitRes, err error) {
data, err := service.IotTSimCardStop().SubmitExcel(ctx, &req.TSimCardStopExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardStopExcelSubmitRes{TSimCardStopExcelSubmitRes: data}, nil
}
@@ -0,0 +1,13 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardStopExcelTemplate(ctx context.Context, req *v1.TSimCardStopExcelTemplateReq) (res *v1.TSimCardStopExcelTemplateRes, err error) {
err = service.IotTSimCardStop().DownloadExcelTemplate(ctx)
return
}
@@ -0,0 +1,16 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardStopInputSubmit(ctx context.Context, req *v1.TSimCardStopInputSubmitReq) (res *v1.TSimCardStopInputSubmitRes, err error) {
data, err := service.IotTSimCardStop().SubmitInput(ctx, &req.TSimCardStopInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardStopInputSubmitRes{TSimCardStopInputSubmitRes: data}, nil
}
@@ -0,0 +1,58 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
)
// List 查看SIM流量池套餐配置表列表
func (c *ControllerV1) TFlowPackageConfigList(ctx context.Context, req *v1.TFlowPackageConfigListReq) (res *v1.TFlowPackageConfigListRes, err error) {
list, totalCount, err := service.IotTFlowPackageConfig().List(ctx, &req.TFlowPackageConfigListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TFlowPackageConfigListModel{}
}
res = new(v1.TFlowPackageConfigListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出SIM流量池套餐配置表列表
func (c *ControllerV1) TFlowPackageConfigExport(ctx context.Context, req *v1.TFlowPackageConfigExportReq) (res *v1.TFlowPackageConfigExportRes, err error) {
err = service.IotTFlowPackageConfig().Export(ctx, &req.TFlowPackageConfigListParam)
return
}
// Edit 更新SIM流量池套餐配置表
func (c *ControllerV1) TFlowPackageConfigEdit(ctx context.Context, req *v1.TFlowPackageConfigEditReq) (res *v1.TFlowPackageConfigEditRes, err error) {
err = service.IotTFlowPackageConfig().Edit(ctx, &req.TFlowPackageConfigEditParam)
return
}
// View 获取指定SIM流量池套餐配置表信息
func (c *ControllerV1) TFlowPackageConfigView(ctx context.Context, req *v1.TFlowPackageConfigViewReq) (res *v1.TFlowPackageConfigViewRes, err error) {
data, err := service.IotTFlowPackageConfig().View(ctx, &req.TFlowPackageConfigViewParam)
if err != nil {
return
}
res = new(v1.TFlowPackageConfigViewRes)
res.TFlowPackageConfigViewModel = data
return
}
// Delete 删除SIM流量池套餐配置表
func (c *ControllerV1) TFlowPackageConfigDelete(ctx context.Context, req *v1.TFlowPackageConfigDeleteReq) (res *v1.TFlowPackageConfigDeleteRes, err error) {
err = service.IotTFlowPackageConfig().Delete(ctx, &req.TFlowPackageConfigDeleteParam)
return
}
@@ -0,0 +1,78 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
)
// List 查看订单主表列表
func (c *ControllerV1) TOrderList(ctx context.Context, req *v1.TOrderListReq) (res *v1.TOrderListRes, err error) {
list, totalCount, err := service.IotTOrder().List(ctx, &req.TOrderListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TOrderListModel{}
}
res = new(v1.TOrderListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出订单主表列表
func (c *ControllerV1) TOrderExport(ctx context.Context, req *v1.TOrderExportReq) (res *v1.TOrderExportRes, err error) {
err = service.IotTOrder().Export(ctx, &req.TOrderListParam)
return
}
// Edit 更新订单主表
func (c *ControllerV1) TOrderEdit(ctx context.Context, req *v1.TOrderEditReq) (res *v1.TOrderEditRes, err error) {
err = service.IotTOrder().Edit(ctx, &req.TOrderEditParam)
return
}
// View 获取指定订单主表信息
func (c *ControllerV1) TOrderView(ctx context.Context, req *v1.TOrderViewReq) (res *v1.TOrderViewRes, err error) {
data, err := service.IotTOrder().View(ctx, &req.TOrderViewParam)
if err != nil {
return
}
res = new(v1.TOrderViewRes)
res.TOrderViewModel = data
return
}
// Delete 删除订单主表
func (c *ControllerV1) TOrderDelete(ctx context.Context, req *v1.TOrderDeleteReq) (res *v1.TOrderDeleteRes, err error) {
err = service.IotTOrder().Delete(ctx, &req.TOrderDeleteParam)
return
}
// SellList 查看销售订单列表
func (c *ControllerV1) TOrderSellList(ctx context.Context, req *v1.TOrderSellListReq) (res *v1.TOrderSellListRes, err error) {
list, totalCount, err := service.IotTOrder().SellList(ctx, &req.TOrderListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TOrderListModel{}
}
res = new(v1.TOrderSellListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
@@ -0,0 +1,49 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardAllocateExcelTemplate(ctx context.Context, req *v1.TSimCardAllocateExcelTemplateReq) (res *v1.TSimCardAllocateExcelTemplateRes, err error) {
err = service.IotTSimCardAllocate().DownloadExcelTemplate(ctx)
return nil, err
}
func (c *ControllerV1) TSimCardAllocateTargetList(ctx context.Context, req *v1.TSimCardAllocateTargetListReq) (res *v1.TSimCardAllocateTargetListRes, err error) {
items, err := service.IotTSimCardAllocate().ListTargets(ctx, &req.TSimCardAllocateTargetListParam)
if err != nil {
return nil, err
}
return &v1.TSimCardAllocateTargetListRes{Items: items, MaxInputRows: model.SimCardAllocateMaxInputRows}, nil
}
func (c *ControllerV1) TSimCardAllocateInputPrepare(ctx context.Context, req *v1.TSimCardAllocateInputPrepareReq) (res *v1.TSimCardAllocateInputPrepareRes, err error) {
if err = req.ValidateInput(); err != nil {
return nil, err
}
data, err := service.IotTSimCardAllocate().PrepareInput(ctx, &req.TSimCardAllocatePrepareParam)
if err != nil {
return nil, err
}
return &v1.TSimCardAllocateInputPrepareRes{TSimCardAllocateBatchModel: data}, nil
}
func (c *ControllerV1) TSimCardAllocateExcelSubmit(ctx context.Context, req *v1.TSimCardAllocateExcelSubmitReq) (res *v1.TSimCardAllocateExcelSubmitRes, err error) {
data, err := service.IotTSimCardAllocate().PrepareExcel(ctx, &req.TSimCardAllocateExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardAllocateExcelSubmitRes{TSimCardAllocateBatchModel: data}, nil
}
func (c *ControllerV1) TSimCardAllocateBatchSubmit(ctx context.Context, req *v1.TSimCardAllocateBatchSubmitReq) (res *v1.TSimCardAllocateBatchSubmitRes, err error) {
data, err := service.IotTSimCardAllocate().SubmitBatch(ctx, &req.TSimCardAllocateBatchSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardAllocateBatchSubmitRes{TSimCardAllocateBatchModel: data}, nil
}
@@ -0,0 +1,168 @@
package iot
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
// List 查看订购表列表
func (c *ControllerV1) TSimCardBindPkgList(ctx context.Context, req *v1.TSimCardBindPkgListReq) (res *v1.TSimCardBindPkgListRes, err error) {
list, totalCount, err := service.IotTSimCardBindPkg().List(ctx, &req.TSimCardBindPkgListParam)
if err != nil {
return
}
if list == nil {
list = []*model.TSimCardBindPkgListModel{}
}
res = new(v1.TSimCardBindPkgListRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// Export 导出订购表列表
func (c *ControllerV1) TSimCardBindPkgExport(ctx context.Context, req *v1.TSimCardBindPkgExportReq) (res *v1.TSimCardBindPkgExportRes, err error) {
err = service.IotTSimCardBindPkg().Export(ctx, &req.TSimCardBindPkgListParam)
return
}
// Edit 更新订购表
func (c *ControllerV1) TSimCardBindPkgEdit(ctx context.Context, req *v1.TSimCardBindPkgEditReq) (res *v1.TSimCardBindPkgEditRes, err error) {
err = service.IotTSimCardBindPkg().Edit(ctx, &req.TSimCardBindPkgEditParam)
return
}
// View 获取指定订购表信息
func (c *ControllerV1) TSimCardBindPkgView(ctx context.Context, req *v1.TSimCardBindPkgViewReq) (res *v1.TSimCardBindPkgViewRes, err error) {
data, err := service.IotTSimCardBindPkg().View(ctx, &req.TSimCardBindPkgViewParam)
if err != nil {
return
}
res = new(v1.TSimCardBindPkgViewRes)
res.TSimCardBindPkgViewModel = data
return
}
// Delete 删除订购表
func (c *ControllerV1) TSimCardBindPkgDelete(ctx context.Context, req *v1.TSimCardBindPkgDeleteReq) (res *v1.TSimCardBindPkgDeleteRes, err error) {
err = service.IotTSimCardBindPkg().Delete(ctx, &req.TSimCardBindPkgDeleteParam)
return
}
// GetPkgInfo 套餐详情查询
func (c *ControllerV1) TSimCardBindPkgGetPkgInfo(ctx context.Context, req *v1.TSimCardBindPkgGetPkgInfoReq) (res *v1.TSimCardBindPkgGetPkgInfoRes, err error) {
list, totalCount, err := service.IotTSimCardBindPkg().GetPkgInfo(ctx, &req.TSimCardBindPkgInfoParam)
if err != nil {
return
}
if list == nil {
list = []*model.TSimCardBindPkgListModel{}
}
res = new(v1.TSimCardBindPkgGetPkgInfoRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
// GetChangePkg 变更套餐查询
func (c *ControllerV1) TSimCardBindPkgGetChangePkg(ctx context.Context, req *v1.TSimCardBindPkgGetChangePkgReq) (res *v1.TSimCardBindPkgGetChangePkgRes, err error) {
list, totalCount, err := service.IotTSimCardBindPkg().GetChangePkg(ctx, &req.TSimCardBindPkgInfoParam)
if err != nil {
return
}
if list == nil {
list = []*model.TSimCardBindPkgListModel{}
}
res = new(v1.TSimCardBindPkgGetChangePkgRes)
res.Items = list
res.PageResult.Page = req.Page
res.PageResult.PageSize = req.PageSize
res.PageResult.Total = totalCount
return
}
func (c *ControllerV1) TSimCardBindPkgAddPackagePaymentContext(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePaymentContextReq) (res *v1.TSimCardBindPkgAddPackagePaymentContextRes, err error) {
data, err := service.IotTSimCardBindPkg().AddPackagePaymentContext(ctx)
if err != nil {
return nil, err
}
if data == nil {
data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}}
}
return &v1.TSimCardBindPkgAddPackagePaymentContextRes{TSimAddPackageOptionsRes: data}, nil
}
func (c *ControllerV1) TSimCardBindPkgAddPackageOptions(ctx context.Context, req *v1.TSimCardBindPkgAddPackageOptionsReq) (res *v1.TSimCardBindPkgAddPackageOptionsRes, err error) {
data, err := service.IotTSimCardBindPkg().AddPackageOptions(ctx, &req.TSimCardAddPackageOptionsParam)
if err != nil {
return nil, err
}
if data == nil {
data = &model.TSimAddPackageOptionsRes{Items: []*model.TSimAddPackageOptionModel{}}
}
if data.Items == nil {
data.Items = []*model.TSimAddPackageOptionModel{}
}
return &v1.TSimCardBindPkgAddPackageOptionsRes{TSimAddPackageOptionsRes: data}, nil
}
func (c *ControllerV1) TSimCardBindPkgDownloadExcelTemplate(ctx context.Context, req *v1.TSimCardBindPkgDownloadExcelTemplateReq) (res *v1.TSimCardBindPkgDownloadExcelTemplateRes, err error) {
err = service.IotTSimCardBindPkg().DownloadExcelTemplate(ctx)
return
}
func (c *ControllerV1) TSimCardBindPkgSubmitExcel(ctx context.Context, req *v1.TSimCardBindPkgSubmitExcelReq) (res *v1.TSimCardBindPkgSubmitExcelRes, err error) {
data, err := service.IotTSimCardBindPkg().SubmitExcel(ctx, &req.TSimCardBindPkgAddPackageExcelSubmitParam)
if err != nil {
return
}
res = &v1.TSimCardBindPkgSubmitExcelRes{TSimCardBindPkgAddPackageExcelSubmitRes: data}
return
}
func (c *ControllerV1) TSimCardBindPkgSubmitInput(ctx context.Context, req *v1.TSimCardBindPkgSubmitInputReq) (res *v1.TSimCardBindPkgSubmitInputRes, err error) {
data, err := service.IotTSimCardBindPkg().SubmitInput(ctx, &req.TSimCardBindPkgAddPackageInputSubmitParam)
if err != nil {
return
}
res = &v1.TSimCardBindPkgSubmitInputRes{TSimCardBindPkgAddPackageInputSubmitRes: data}
return
}
func (c *ControllerV1) TSimCardBindPkgAddPackageInputPrepare(ctx context.Context, req *v1.TSimCardBindPkgAddPackageInputPrepareReq) (res *v1.TSimCardBindPkgAddPackageInputPrepareRes, err error) {
data, err := service.IotTSimCardBindPkg().PrepareInput(ctx, &req.TSimCardBindPkgAddPackageInputPrepareParam)
if err != nil {
return nil, err
}
return &v1.TSimCardBindPkgAddPackageInputPrepareRes{TSimCardBindPkgAddPackageInputPrepareRes: data}, nil
}
func (c *ControllerV1) TSimCardBindPkgAddPackagePrepareResult(ctx context.Context, req *v1.TSimCardBindPkgAddPackagePrepareResultReq) (res *v1.TSimCardBindPkgAddPackagePrepareResultRes, err error) {
data, err := service.IotTSimCardBindPkg().PrepareResult(ctx, req.BatchNo)
if err != nil {
return nil, err
}
return &v1.TSimCardBindPkgAddPackagePrepareResultRes{TSimCardBindPkgAddPackagePrepareResultRes: data}, nil
}
func (c *ControllerV1) TSimCardBindPkgAddPackageBatchConfirm(ctx context.Context, req *v1.TSimCardBindPkgAddPackageBatchConfirmReq) (res *v1.TSimCardBindPkgAddPackageBatchConfirmRes, err error) {
data, err := service.IotTSimCardBindPkg().ConfirmBatch(ctx, &req.TSimCardBindPkgAddPackageBatchConfirmParam)
if err != nil {
return nil, err
}
return &v1.TSimCardBindPkgAddPackageBatchConfirmRes{TSimCardBindPkgAddPackageBatchConfirmRes: data}, nil
}
@@ -0,0 +1,29 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardCancelExcelTemplate(ctx context.Context, req *v1.TSimCardCancelExcelTemplateReq) (res *v1.TSimCardCancelExcelTemplateRes, err error) {
err = service.IotTSimCardCancel().DownloadExcelTemplate(ctx)
return
}
func (c *ControllerV1) TSimCardCancelExcelSubmit(ctx context.Context, req *v1.TSimCardCancelExcelSubmitReq) (res *v1.TSimCardCancelExcelSubmitRes, err error) {
data, err := service.IotTSimCardCancel().SubmitExcel(ctx, &req.TSimCardCancelExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardCancelExcelSubmitRes{TSimCardCancelExcelSubmitRes: data}, nil
}
func (c *ControllerV1) TSimCardCancelInputSubmit(ctx context.Context, req *v1.TSimCardCancelInputSubmitReq) (res *v1.TSimCardCancelInputSubmitRes, err error) {
data, err := service.IotTSimCardCancel().SubmitInput(ctx, &req.TSimCardCancelInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardCancelInputSubmitRes{TSimCardCancelInputSubmitRes: data}, nil
}
@@ -0,0 +1,31 @@
package iot
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardCancellationList(ctx context.Context, req *v1.TSimCardCancellationListReq) (res *v1.TSimCardCancellationListRes, err error) {
list, total, err := service.IotTSimCardCancellation().List(ctx, &req.TSimCardCancellationListParam)
if err != nil {
return nil, err
}
if list == nil {
list = []*model.TSimCardCancellationListModel{}
}
res = &v1.TSimCardCancellationListRes{Items: list}
res.Page = req.Page
res.PageSize = req.PageSize
res.Total = total
return res, nil
}
func (c *ControllerV1) TSimCardCancellationExport(ctx context.Context, req *v1.TSimCardCancellationExportReq) (res *v1.TSimCardCancellationExportRes, err error) {
if err = service.IotTSimCardCancellation().Export(ctx, &req.TSimCardCancellationFilter); err != nil {
return nil, err
}
return nil, nil
}
@@ -0,0 +1,70 @@
package iot
import (
"context"
"strings"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardChangeExcelTemplate(ctx context.Context, req *v1.TSimCardChangeExcelTemplateReq) (res *v1.TSimCardChangeExcelTemplateRes, err error) {
err = service.IotTSimCardChange().DownloadExcelTemplate(ctx)
return nil, err
}
func (c *ControllerV1) TSimCardChangeExcelSubmit(ctx context.Context, req *v1.TSimCardChangeExcelSubmitReq) (res *v1.TSimCardChangeExcelSubmitRes, err error) {
data, err := service.IotTSimCardChange().SubmitExcel(ctx, &req.TSimCardChangeExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardChangeExcelSubmitRes{TSimCardChangeExcelSubmitRes: data}, nil
}
func (c *ControllerV1) TSimCardChangeInputOptions(ctx context.Context, req *v1.TSimCardChangeInputOptionsReq) (res *v1.TSimCardChangeInputOptionsRes, err error) {
data, err := service.IotTSimCardChange().InputOptions(ctx, &req.TSimCardChangeInputOptionsParam)
if err != nil {
return nil, err
}
return &v1.TSimCardChangeInputOptionsRes{TSimCardChangeOptionsRes: data}, nil
}
func (c *ControllerV1) TSimCardChangeRangeOptions(ctx context.Context, req *v1.TSimCardChangeRangeOptionsReq) (res *v1.TSimCardChangeRangeOptionsRes, err error) {
data, err := service.IotTSimCardChange().RangeOptions(ctx, &req.TSimCardChangeRangeOptionsParam)
if err != nil {
return nil, err
}
return &v1.TSimCardChangeRangeOptionsRes{TSimCardChangeOptionsRes: data}, nil
}
func (c *ControllerV1) TSimCardChangeInputPrepare(ctx context.Context, req *v1.TSimCardChangeInputPrepareReq) (res *v1.TSimCardChangeInputPrepareRes, err error) {
data, err := service.IotTSimCardChange().PrepareInput(ctx, &req.TSimCardChangeInputPrepareParam)
if err != nil {
return nil, err
}
return &v1.TSimCardChangeInputPrepareRes{TSimCardChangeBatchPrepareRes: data}, nil
}
func (c *ControllerV1) TSimCardChangeRangePrepare(ctx context.Context, req *v1.TSimCardChangeRangePrepareReq) (res *v1.TSimCardChangeRangePrepareRes, err error) {
data, err := service.IotTSimCardChange().PrepareRange(ctx, &req.TSimCardChangeRangePrepareParam)
if err != nil {
return nil, err
}
return &v1.TSimCardChangeRangePrepareRes{TSimCardChangeBatchPrepareRes: data}, nil
}
func (c *ControllerV1) TSimCardChangeBatchSubmit(ctx context.Context, req *v1.TSimCardChangeBatchSubmitReq) (res *v1.TSimCardChangeBatchSubmitRes, err error) {
data, err := service.IotTSimCardChange().SubmitBatch(ctx, &req.TSimCardChangeBatchSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardChangeBatchSubmitRes{TSimCardChangeBatchSubmitRes: data}, nil
}
func (c *ControllerV1) TSimCardChangePrepareResult(ctx context.Context, req *v1.TSimCardChangePrepareResultReq) (res *v1.TSimCardChangePrepareResultRes, err error) {
data, err := service.IotTSimCardChange().PrepareResult(ctx, strings.TrimSpace(req.BatchNo))
if err != nil {
return nil, err
}
return &v1.TSimCardChangePrepareResultRes{TSimCardChangePrepareResultRes: data}, nil
}
@@ -0,0 +1,83 @@
package iot
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardOutboundExcelTemplate(ctx context.Context, req *v1.TSimCardOutboundExcelTemplateReq) (res *v1.TSimCardOutboundExcelTemplateRes, err error) {
err = service.IotTSimCardOutbound().DownloadExcelTemplate(ctx)
return nil, err
}
func (c *ControllerV1) TSimCardOutboundExcelSubmit(ctx context.Context, req *v1.TSimCardOutboundExcelSubmitReq) (res *v1.TSimCardOutboundExcelSubmitRes, err error) {
data, err := service.IotTSimCardOutbound().SubmitExcel(ctx, &req.TSimCardOutboundExcelSubmitParam)
if err != nil {
return
}
res = &v1.TSimCardOutboundExcelSubmitRes{
TSimCardOutboundExcelSubmitRes: data,
}
return
}
func (c *ControllerV1) TSimCardOutboundRangeSubmit(ctx context.Context, req *v1.TSimCardOutboundRangeSubmitReq) (res *v1.TSimCardOutboundRangeSubmitRes, err error) {
data, err := service.IotTSimCardOutbound().SubmitRange(ctx, &req.TSimCardOutboundRangeSubmitParam)
if err != nil {
return
}
res = &v1.TSimCardOutboundRangeSubmitRes{
TSimCardOutboundRangeSubmitRes: data,
}
return
}
func (c *ControllerV1) TSimCardOutboundInputSubmit(ctx context.Context, req *v1.TSimCardOutboundInputSubmitReq) (res *v1.TSimCardOutboundInputSubmitRes, err error) {
data, err := service.IotTSimCardOutbound().SubmitInput(ctx, &req.TSimCardOutboundInputSubmitParam)
if err != nil {
return
}
res = &v1.TSimCardOutboundInputSubmitRes{
TSimCardOutboundInputSubmitRes: data,
}
return
}
func (c *ControllerV1) TSimCardOutboundInboundBatchList(ctx context.Context, req *v1.TSimCardOutboundInboundBatchListReq) (res *v1.TSimCardOutboundInboundBatchListRes, err error) {
data, err := service.IotTSimCardOutbound().ListInboundBatches(ctx, &req.TSimCardOutboundInboundBatchListParam)
if err != nil {
return
}
res = &v1.TSimCardOutboundInboundBatchListRes{
TSimCardOutboundInboundBatchListRes: data,
}
return
}
func (c *ControllerV1) TSimCardOutboundInboundBatchCards(ctx context.Context, req *v1.TSimCardOutboundInboundBatchCardsReq) (res *v1.TSimCardOutboundInboundBatchCardsRes, err error) {
data, err := service.IotTSimCardOutbound().ListInboundBatchCards(ctx, &req.TSimCardOutboundInboundBatchCardsParam)
if err != nil {
return
}
res = &v1.TSimCardOutboundInboundBatchCardsRes{
TSimCardOutboundInboundBatchCardsRes: data,
}
return
}
func (c *ControllerV1) TSimCardOutboundBatchSubmit(ctx context.Context, req *v1.TSimCardOutboundBatchSubmitReq) (res *v1.TSimCardOutboundBatchSubmitRes, err error) {
data, err := service.IotTSimCardOutbound().SubmitBatch(ctx, &req.TSimCardOutboundBatchSubmitParam)
if err != nil {
return
}
res = &v1.TSimCardOutboundBatchSubmitRes{
TSimCardOutboundBatchSubmitRes: data,
}
return
}
func (c *ControllerV1) TSimCardOutboundCustomerBalance(ctx context.Context, req *v1.TSimCardOutboundCustomerBalanceReq) (res *v1.TSimCardOutboundCustomerBalanceRes, err error) {
data, err := service.IotTSimCardOutbound().CustomerBalance(ctx, &req.TSimCardOutboundCustomerBalanceParam)
if err != nil {
return
}
res = &v1.TSimCardOutboundCustomerBalanceRes{
TSimCardOutboundCustomerBalanceRes: data,
}
return
}
@@ -0,0 +1,58 @@
package iot
import (
"context"
"strings"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardRenewInputPrepare(ctx context.Context, req *v1.TSimCardRenewInputPrepareReq) (res *v1.TSimCardRenewInputPrepareRes, err error) {
data, err := service.IotTSimCardRenew().PrepareInput(ctx, &req.TSimCardRenewInputPrepareParam)
if err != nil {
return nil, err
}
res = &v1.TSimCardRenewInputPrepareRes{
TSimCardRenewBatchPrepareRes: data,
}
return
}
func (c *ControllerV1) TSimCardRenewExcelTemplate(ctx context.Context, req *v1.TSimCardRenewExcelTemplateReq) (res *v1.TSimCardRenewExcelTemplateRes, err error) {
err = service.IotTSimCardRenew().DownloadExcelTemplate(ctx)
return nil, err
}
func (c *ControllerV1) TSimCardRenewExcelSubmit(ctx context.Context, req *v1.TSimCardRenewExcelSubmitReq) (res *v1.TSimCardRenewExcelSubmitRes, err error) {
data, err := service.IotTSimCardRenew().SubmitExcel(ctx, &req.TSimCardRenewExcelSubmitParam)
if err != nil {
return nil, err
}
res = &v1.TSimCardRenewExcelSubmitRes{
TSimCardRenewExcelSubmitRes: data,
}
return
}
func (c *ControllerV1) TSimCardRenewBatchConfirm(ctx context.Context, req *v1.TSimCardRenewBatchConfirmReq) (res *v1.TSimCardRenewBatchConfirmRes, err error) {
data, err := service.IotTSimCardRenew().ConfirmBatch(ctx, &req.TSimCardRenewBatchConfirmParam)
if err != nil {
return nil, err
}
res = &v1.TSimCardRenewBatchConfirmRes{
TSimCardRenewBatchConfirmRes: data,
}
return
}
func (c *ControllerV1) TSimCardRenewPrepareResult(ctx context.Context, req *v1.TSimCardRenewPrepareResultReq) (res *v1.TSimCardRenewPrepareResultRes, err error) {
data, err := service.IotTSimCardRenew().PrepareResult(ctx, strings.TrimSpace(req.BatchNo))
if err != nil {
return nil, err
}
res = &v1.TSimCardRenewPrepareResultRes{
TSimCardRenewPrepareResultRes: data,
}
return
}
@@ -0,0 +1,66 @@
package iot
import (
"context"
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/iot/v1"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
)
func (c *ControllerV1) TSimCardTrafficCutoffExcelTemplate(ctx context.Context, req *v1.TSimCardTrafficCutoffExcelTemplateReq) (res *v1.TSimCardTrafficCutoffExcelTemplateRes, err error) {
err = service.IotTSimCardTrafficCutoff().DownloadExcelTemplate(ctx)
return
}
func (c *ControllerV1) TSimCardTrafficCutoffExcelSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffExcelSubmitReq) (res *v1.TSimCardTrafficCutoffExcelSubmitRes, err error) {
data, err := service.IotTSimCardTrafficCutoff().SubmitExcel(ctx, &req.TSimCardTrafficCutoffExcelSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardTrafficCutoffExcelSubmitRes{TSimCardTrafficCutoffExcelSubmitRes: data}, nil
}
func (c *ControllerV1) TSimCardTrafficCutoffInputSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffInputSubmitReq) (res *v1.TSimCardTrafficCutoffInputSubmitRes, err error) {
data, err := service.IotTSimCardTrafficCutoff().SubmitInput(ctx, &req.TSimCardTrafficCutoffInputSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardTrafficCutoffInputSubmitRes{TSimCardTrafficCutoffInputSubmitRes: data}, nil
}
func (c *ControllerV1) TSimCardTrafficCutoffRangeSubmit(ctx context.Context, req *v1.TSimCardTrafficCutoffRangeSubmitReq) (res *v1.TSimCardTrafficCutoffRangeSubmitRes, err error) {
data, err := service.IotTSimCardTrafficCutoff().SubmitRange(ctx, &req.TSimCardTrafficCutoffRangeSubmitParam)
if err != nil {
return nil, err
}
return &v1.TSimCardTrafficCutoffRangeSubmitRes{TSimCardTrafficCutoffRangeSubmitRes: data}, nil
}
func (c *ControllerV1) TSimCardTrafficCutoffList(ctx context.Context, req *v1.TSimCardTrafficCutoffListReq) (res *v1.TSimCardTrafficCutoffListRes, err error) {
list, total, err := service.IotTSimCardTrafficCutoff().List(ctx, &req.TSimCardTrafficCutoffListParam)
if err != nil {
return nil, err
}
if list == nil {
list = []*model.TSimCardInfoListModel{}
}
res = &v1.TSimCardTrafficCutoffListRes{Items: list}
res.Page = req.Page
res.PageSize = req.PageSize
res.Total = total
return res, nil
}
func (c *ControllerV1) TSimCardTrafficCutoffExport(ctx context.Context, req *v1.TSimCardTrafficCutoffExportReq) (res *v1.TSimCardTrafficCutoffExportRes, err error) {
err = service.IotTSimCardTrafficCutoff().Export(ctx, &req.TSimCardTrafficCutoffListParam)
return
}
func (c *ControllerV1) TSimCardTrafficCutoffEdit(ctx context.Context, req *v1.TSimCardTrafficCutoffEditReq) (res *v1.TSimCardTrafficCutoffEditRes, err error) {
err = service.IotTSimCardTrafficCutoff().Edit(ctx, &req.TSimCardTrafficCutoffEditParam)
return
}
func (c *ControllerV1) TSimCardTrafficCutoffDelete(ctx context.Context, req *v1.TSimCardTrafficCutoffDeleteReq) (res *v1.TSimCardTrafficCutoffDeleteRes, err error) {
err = service.IotTSimCardTrafficCutoff().Delete(ctx, &req.TSimCardTrafficCutoffDeleteParam)
return
}

Some files were not shown because too many files have changed in this diff Show More