优化模块租户检查逻辑,重构数据结构并简化代码
This commit is contained in:
@@ -19,27 +19,36 @@ var (
|
||||
TenantModuleAICs = ModuleAssetId["customerService"] // AI客服模块
|
||||
)
|
||||
|
||||
// TenantModuleType 租户类型
|
||||
type TenantModuleType struct {
|
||||
type TenantModuleType string
|
||||
|
||||
const (
|
||||
TenantModuleTypePlatform TenantModuleType = "platform"
|
||||
TenantModuleTypePrivate TenantModuleType = "private"
|
||||
TenantModuleTypeSupplier TenantModuleType = "supplier"
|
||||
TenantModuleTypeSmallShop TenantModuleType = "small_shop"
|
||||
)
|
||||
|
||||
// TenantModuleTypeKV 租户类型
|
||||
type TenantModuleTypeKV struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
// TenantModuleTypesAssets 资产模块租户类型
|
||||
var TenantModuleTypesAssets = []TenantModuleType{
|
||||
{Key: "private_cloud", Value: "私有云租户"},
|
||||
{Key: "supplier", Value: "供应商"},
|
||||
{Key: "small_shop", Value: "电商小店"},
|
||||
var TenantModuleTypesAssets = []TenantModuleTypeKV{
|
||||
{Key: string(TenantModuleTypePrivate), Value: "私域租户"},
|
||||
{Key: string(TenantModuleTypeSupplier), Value: "供应商"},
|
||||
{Key: string(TenantModuleTypeSmallShop), Value: "电商小店"},
|
||||
}
|
||||
|
||||
// TenantModuleTypesAd 广告模块租户类型(待定)
|
||||
var TenantModuleTypesAd []TenantModuleType
|
||||
var TenantModuleTypesAd []TenantModuleTypeKV
|
||||
|
||||
// TenantModuleTypesAICs AI客服模块租户类型(待定)
|
||||
var TenantModuleTypesAICs []TenantModuleType
|
||||
var TenantModuleTypesAICs []TenantModuleTypeKV
|
||||
|
||||
// GetTenantModuleTypes 获取模块的租户类型列表
|
||||
func GetTenantModuleTypes(module string) []TenantModuleType {
|
||||
func GetTenantModuleTypes(module string) []TenantModuleTypeKV {
|
||||
switch module {
|
||||
case TenantModuleAssets:
|
||||
return TenantModuleTypesAssets
|
||||
@@ -48,7 +57,7 @@ func GetTenantModuleTypes(module string) []TenantModuleType {
|
||||
case TenantModuleAICs:
|
||||
return TenantModuleTypesAICs
|
||||
default:
|
||||
return []TenantModuleType{}
|
||||
return []TenantModuleTypeKV{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,21 +68,14 @@ type ModuleTenantCheckReq struct {
|
||||
|
||||
// ModuleTenantCheckRes 调用admin-go设置模块租户关系的响应
|
||||
type ModuleTenantCheckRes struct {
|
||||
Status string `json:"status"` // 开通状态:activated(已开通)、expired(已到期)、not_activated(未开通)
|
||||
Message string `json:"message"` // 状态描述
|
||||
OpenStatus bool `json:"openStatus"` // 开通状态
|
||||
Status bool `json:"status"`
|
||||
CertificationStatus bool `json:"certificationStatus"`
|
||||
Message string `json:"message"` // 状态描述
|
||||
}
|
||||
|
||||
// ModuleTenant 模块租户关系实体(引用自admin-go)
|
||||
type ModuleTenant struct {
|
||||
Id uint64 `json:"id" description:""`
|
||||
CreateBy uint64 `json:"createBy" description:"创建者"`
|
||||
UpdateBy uint64 `json:"updateBy" description:"更新者"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" description:"更新时间"`
|
||||
ModuleKey string `json:"moduleKey" description:"模块Key"`
|
||||
TenantId uint64 `json:"tenantId" description:"租户ID"`
|
||||
ExpireAt *gtime.Time `json:"expireAt" description:"到期时间"`
|
||||
AssetId string `json:"assetId" description:"资产ID"`
|
||||
AssetSkuId string `json:"assetSkuId" description:"资产SKU ID"`
|
||||
ExpireAt *gtime.Time `json:"expireAt" description:"到期时间"`
|
||||
TenantModuleType TenantModuleType `json:"tenantModuleType" description:"租户模块类型"`
|
||||
CertificationStatus int `json:"certificationStatus" description:"认证状态"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user