2 Star 4 Fork 5

联犀/中台模块

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
assemble.go 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
杨磊 提交于 2024-11-18 23:39 . feat: 支持模块菜单导入导出
package projectmanagelogic
import (
"context"
"gitee.com/unitedrhino/core/service/syssvr/internal/logic"
areamanagelogic "gitee.com/unitedrhino/core/service/syssvr/internal/logic/areamanage"
"gitee.com/unitedrhino/core/service/syssvr/internal/repo/relationDB"
"gitee.com/unitedrhino/core/service/syssvr/internal/svc"
"gitee.com/unitedrhino/core/service/syssvr/pb/sys"
"gitee.com/unitedrhino/share/oss/common"
"gitee.com/unitedrhino/share/utils"
"github.com/zeromicro/go-zero/core/logx"
"google.golang.org/protobuf/types/known/wrapperspb"
)
func ProjectInfoToPb(ctx context.Context, svcCtx *svc.ServiceContext, po *relationDB.SysProjectInfo) *sys.ProjectInfo {
if po == nil {
return nil
}
if po.ProjectImg != "" {
var err error
po.ProjectImg, err = svcCtx.OssClient.PrivateBucket().SignedGetUrl(ctx, po.ProjectImg, 24*60*60, common.OptionKv{})
if err != nil {
logx.WithContext(ctx).Errorf("%s.SignedGetUrl err:%v", utils.FuncName(), err)
}
}
pb := &sys.ProjectInfo{
TenantCode: string(po.TenantCode),
CreatedTime: po.CreatedTime.Unix(),
ProjectID: int64(po.ProjectID),
ProjectName: po.ProjectName,
ProjectImg: po.ProjectImg,
AdminUserID: po.AdminUserID,
IsSysCreated: po.IsSysCreated,
Ppsm: po.Ppsm,
Area: &wrapperspb.FloatValue{Value: po.Area},
Desc: utils.ToRpcNullString(po.Desc),
Position: logic.ToSysPoint(po.Position),
AreaCount: po.AreaCount,
Address: utils.ToRpcNullString(po.Address),
DeviceCount: utils.ToRpcNullInt64(po.DeviceCount),
Areas: areamanagelogic.AreaInfosToPb(ctx, svcCtx, po.Areas),
}
return pb
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/unitedrhino/core.git
git@gitee.com:unitedrhino/core.git
unitedrhino
core
中台模块
v1.2.1

搜索帮助