sync: 同步 v1.0.4 并脱敏配置与镜像

This commit is contained in:
MiFaZhan
2026-10-29 14:36:49 +08:00
parent 743e8e6e6e
commit 2206a393f7
516 changed files with 18119 additions and 2253 deletions
+38 -30
View File
@@ -1,7 +1,7 @@
// Package gen
// @Link https://github.com/xiujiecn/xiu-admin
// @Copyright Copyright (c) 2026 LiXiujie
// @Author Lxj <li@xiujie.cn>
// @Author Lxj <xxx@example.com>
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
// @AutoGenerate Version
package iot
@@ -9,10 +9,11 @@ package iot
import (
"context"
"crypto/rand"
"fmt"
"io"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
"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/library/exportcenter"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/rabbitmq"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgorm/handler"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/library/xgorm/hook"
@@ -21,15 +22,12 @@ import (
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model/do"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/convert"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/utility/excel"
"io"
"strings"
"time"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gconv"
)
@@ -90,7 +88,7 @@ func (s *sIotTSimChannels) List(ctx context.Context, in *model.TSimChannelsListP
}
// 查询通道名称
if in.ChanName != "" {
mod = mod.Where(dao.TSimChannels.Columns().ChanName+" LIKE ?", "%"+in.ChanName+"%")
mod = mod.Where(channelDisplayNameSQL(ctx, simChannels)+" LIKE ?", "%"+in.ChanName+"%")
}
// 查询通道别名
if in.ChanAlias != "" {
@@ -136,6 +134,12 @@ func (s *sIotTSimChannels) List(ctx context.Context, in *model.TSimChannelsListP
err = gerror.Wrap(err, "获取通道列表列表失败,请稍后重试!")
return
}
fullName := canViewChannelFullName(ctx)
for _, item := range list {
if item != nil {
item.ChanName = channelDisplayName(fullName, item.ChanName, item.ChanAlias)
}
}
return
}
@@ -193,31 +197,32 @@ func (s *sIotTSimChannels) RefreshCardCounts(ctx context.Context) error {
})
}
// Export 导出通道列表
// Export 导出通道管理(异步:提交任务后到下载中心取文件)
func (s *sIotTSimChannels) Export(ctx context.Context, in *model.TSimChannelsListParam) (err error) {
list, totalCount, err := s.List(ctx, in)
if err != nil {
return
}
// 字段的排序是依据tags的字段顺序,如果你不想使用默认的排序方式,可以直接定义 tags = []string{"字段名称", "字段名称2", ...}
tags, err := convert.GetEntityDescTags(model.TSimChannelsExportModel{})
if err != nil {
return
}
var (
fileName = "导出通道列表-" + gctx.CtxId(ctx)
sheetName = fmt.Sprintf("索引条件共%v行,共%v页,当前导出是第%v页,本页共%v行", totalCount, (totalCount+in.PageSize-1)/in.PageSize, in.Page, len(list))
exports []model.TSimChannelsExportModel
)
if err = gconv.Scan(list, &exports); err != nil {
return
}
err = excel.ExportByStructs(ctx, tags, exports, fileName, sheetName)
return
_, err = exportcenter.Submit(ctx, &exportcenter.Request{
BizKey: "tSimChannels",
BizName: "通道管理",
PermCode: "cpm:iot:tSimChannels:export",
QueryParam: in,
Tags: func() ([]string, error) {
return convert.GetEntityDescTags(model.TSimChannelsListModel{})
},
Fetch: func(ctx context.Context, page, pageSize int) (rows []interface{}, total int, err error) {
query := *in
query.Page = page
query.PageSize = pageSize
list, count, err := s.List(ctx, &query)
if err != nil {
return nil, 0, err
}
rows = make([]interface{}, 0, len(list))
for _, item := range list {
rows = append(rows, item)
}
return rows, count, nil
},
})
return err
}
// shouldGeneratePlatformAppKey reports whether a channel uses the shared-token
@@ -569,6 +574,9 @@ func (s *sIotTSimChannels) View(ctx context.Context, in *model.TSimChannelsViewP
err = gerror.Wrap(err, "获取通道列表信息,请稍后重试!")
return
}
if res != nil {
res.ChanName = channelDisplayName(canViewChannelFullName(ctx), res.ChanName, res.ChanAlias)
}
return
}