From 4465f97312e43c23e8f1420a6334854b9f2e93b5 Mon Sep 17 00:00:00 2001 From: qhd <1766646056@qq.com> Date: Thu, 19 Mar 2026 17:51:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=86=E8=B5=84=E4=BA=A7ID?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=BB=8EMongoDB=20ObjectID=E6=94=B9=E4=B8=BA?= =?UTF-8?q?int64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/system/module_tenant.go | 7 +++---- internal/app/system/logic/moduleTenant/module_tenant.go | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/v1/system/module_tenant.go b/api/v1/system/module_tenant.go index 913c859..904befe 100644 --- a/api/v1/system/module_tenant.go +++ b/api/v1/system/module_tenant.go @@ -14,14 +14,13 @@ import ( commonApi "github.com/tiger1103/gfast/v3/api/v1/common" "github.com/tiger1103/gfast/v3/internal/app/system/consts" "github.com/tiger1103/gfast/v3/internal/app/system/model" - "go.mongodb.org/mongo-driver/v2/bson" ) // ModuleTenantAddReq 添加模块租户关系参数 type ModuleTenantAddReq struct { g.Meta `path:"/moduleTenant/add" tags:"模块租户关系管理" method:"post" summary:"添加模块租户关系"` TenantModuleType beans.TenantModuleType `p:"tenantModuleType"` - AssetSkuId *bson.ObjectID `p:"assetSkuId" v:"required#资产SKU ID不能为空"` + AssetSkuId int64 `p:"assetSkuId" v:"required#资产SKU ID不能为空"` commonApi.Author } @@ -64,6 +63,6 @@ type AddRedisByTenantIdRes struct { // AssetSku 资产SKU实体 type AssetSku struct { - AssetId *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID - ExpireAt *gtime.Time `bson:"expireAt" json:"expireAt"` // 到期时间 + AssetId int64 `bson:"assetId" json:"assetId"` // 关联资产ID + ExpireAt *gtime.Time `bson:"expireAt" json:"expireAt"` // 到期时间 } diff --git a/internal/app/system/logic/moduleTenant/module_tenant.go b/internal/app/system/logic/moduleTenant/module_tenant.go index 8c010bc..8af0819 100644 --- a/internal/app/system/logic/moduleTenant/module_tenant.go +++ b/internal/app/system/logic/moduleTenant/module_tenant.go @@ -10,6 +10,8 @@ package moduleTenant import ( "context" "fmt" + "time" + "gitea.com/red-future/common/beans" "gitea.com/red-future/common/http" "gitea.com/red-future/common/utils" @@ -24,7 +26,6 @@ import ( "github.com/tiger1103/gfast/v3/internal/app/system/model/entity" "github.com/tiger1103/gfast/v3/internal/app/system/service" "github.com/tiger1103/gfast/v3/library/liberr" - "time" ) func init() { @@ -70,7 +71,7 @@ func (s *sModuleTenant) Add(ctx context.Context, req *system.ModuleTenantAddReq) var moduleKey string // 遍历 map 的所有键值对 for key, value := range beans.ModuleAssetId { - if value == assetSukRes.AssetId.Hex() { + if value == assetSukRes.AssetId { moduleKey = key break } @@ -103,8 +104,8 @@ func (s *sModuleTenant) Add(ctx context.Context, req *system.ModuleTenantAddReq) CreateBy: getUserInfo.UserName, UpdateBy: getUserInfo.UserName, ModuleKey: moduleKey, - AssetId: assetSukRes.AssetId.Hex(), - AssetSkuId: req.AssetSkuId.Hex(), + AssetId: assetSukRes.AssetId, + AssetSkuId: req.AssetSkuId, TenantId: getUserInfo.TenantId, TenantModuleType: req.TenantModuleType, CertificationStatus: certificationStatus,