refactor: 将资产ID类型从MongoDB ObjectID改为int64
This commit is contained in:
@@ -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
|
||||
AssetId int64 `bson:"assetId" json:"assetId"` // 关联资产ID
|
||||
ExpireAt *gtime.Time `bson:"expireAt" json:"expireAt"` // 到期时间
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user