refactor: 将资产ID类型从MongoDB ObjectID改为int64
This commit is contained in:
@@ -14,14 +14,13 @@ import (
|
|||||||
commonApi "github.com/tiger1103/gfast/v3/api/v1/common"
|
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/consts"
|
||||||
"github.com/tiger1103/gfast/v3/internal/app/system/model"
|
"github.com/tiger1103/gfast/v3/internal/app/system/model"
|
||||||
"go.mongodb.org/mongo-driver/v2/bson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ModuleTenantAddReq 添加模块租户关系参数
|
// ModuleTenantAddReq 添加模块租户关系参数
|
||||||
type ModuleTenantAddReq struct {
|
type ModuleTenantAddReq struct {
|
||||||
g.Meta `path:"/moduleTenant/add" tags:"模块租户关系管理" method:"post" summary:"添加模块租户关系"`
|
g.Meta `path:"/moduleTenant/add" tags:"模块租户关系管理" method:"post" summary:"添加模块租户关系"`
|
||||||
TenantModuleType beans.TenantModuleType `p:"tenantModuleType"`
|
TenantModuleType beans.TenantModuleType `p:"tenantModuleType"`
|
||||||
AssetSkuId *bson.ObjectID `p:"assetSkuId" v:"required#资产SKU ID不能为空"`
|
AssetSkuId int64 `p:"assetSkuId" v:"required#资产SKU ID不能为空"`
|
||||||
commonApi.Author
|
commonApi.Author
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +63,6 @@ type AddRedisByTenantIdRes struct {
|
|||||||
|
|
||||||
// AssetSku 资产SKU实体
|
// AssetSku 资产SKU实体
|
||||||
type AssetSku struct {
|
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"` // 到期时间
|
ExpireAt *gtime.Time `bson:"expireAt" json:"expireAt"` // 到期时间
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ package moduleTenant
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"gitea.com/red-future/common/beans"
|
"gitea.com/red-future/common/beans"
|
||||||
"gitea.com/red-future/common/http"
|
"gitea.com/red-future/common/http"
|
||||||
"gitea.com/red-future/common/utils"
|
"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/model/entity"
|
||||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -70,7 +71,7 @@ func (s *sModuleTenant) Add(ctx context.Context, req *system.ModuleTenantAddReq)
|
|||||||
var moduleKey string
|
var moduleKey string
|
||||||
// 遍历 map 的所有键值对
|
// 遍历 map 的所有键值对
|
||||||
for key, value := range beans.ModuleAssetId {
|
for key, value := range beans.ModuleAssetId {
|
||||||
if value == assetSukRes.AssetId.Hex() {
|
if value == assetSukRes.AssetId {
|
||||||
moduleKey = key
|
moduleKey = key
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -103,8 +104,8 @@ func (s *sModuleTenant) Add(ctx context.Context, req *system.ModuleTenantAddReq)
|
|||||||
CreateBy: getUserInfo.UserName,
|
CreateBy: getUserInfo.UserName,
|
||||||
UpdateBy: getUserInfo.UserName,
|
UpdateBy: getUserInfo.UserName,
|
||||||
ModuleKey: moduleKey,
|
ModuleKey: moduleKey,
|
||||||
AssetId: assetSukRes.AssetId.Hex(),
|
AssetId: assetSukRes.AssetId,
|
||||||
AssetSkuId: req.AssetSkuId.Hex(),
|
AssetSkuId: req.AssetSkuId,
|
||||||
TenantId: getUserInfo.TenantId,
|
TenantId: getUserInfo.TenantId,
|
||||||
TenantModuleType: req.TenantModuleType,
|
TenantModuleType: req.TenantModuleType,
|
||||||
CertificationStatus: certificationStatus,
|
CertificationStatus: certificationStatus,
|
||||||
|
|||||||
Reference in New Issue
Block a user