82 lines
2.7 KiB
Go
82 lines
2.7 KiB
Go
|
|
package beans
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// ModuleAssetId 模块资产ID映射(key-value结构)
|
|||
|
|
// Key: 服务名,Value: 资产ID
|
|||
|
|
var ModuleAssetId = map[string]string{
|
|||
|
|
"assets": "696b4acd1be1c8b76c4b4c15", // 资产模块
|
|||
|
|
"cid": "696f423705e496ba4ccbe665", // 广告模块
|
|||
|
|
"customerService": "696f421205e496ba4ccbe662", // AI客服模块
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 模块类型(值从ModuleAssetId map获取)
|
|||
|
|
var (
|
|||
|
|
TenantModuleAssets = ModuleAssetId["assets"] // 资产模块
|
|||
|
|
TenantModuleAd = ModuleAssetId["cid"] // 广告模块
|
|||
|
|
TenantModuleAICs = ModuleAssetId["customerService"] // AI客服模块
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
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 = []TenantModuleTypeKV{
|
|||
|
|
{Key: string(TenantModuleTypePrivate), Value: "私域租户"},
|
|||
|
|
{Key: string(TenantModuleTypeSupplier), Value: "供应商"},
|
|||
|
|
{Key: string(TenantModuleTypeSmallShop), Value: "电商小店"},
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// TenantModuleTypesAd 广告模块租户类型(待定)
|
|||
|
|
var TenantModuleTypesAd []TenantModuleTypeKV
|
|||
|
|
|
|||
|
|
// TenantModuleTypesAICs AI客服模块租户类型(待定)
|
|||
|
|
var TenantModuleTypesAICs []TenantModuleTypeKV
|
|||
|
|
|
|||
|
|
// GetTenantModuleTypes 获取模块的租户类型列表
|
|||
|
|
func GetTenantModuleTypes(module string) []TenantModuleTypeKV {
|
|||
|
|
switch module {
|
|||
|
|
case TenantModuleAssets:
|
|||
|
|
return TenantModuleTypesAssets
|
|||
|
|
case TenantModuleAd:
|
|||
|
|
return TenantModuleTypesAd
|
|||
|
|
case TenantModuleAICs:
|
|||
|
|
return TenantModuleTypesAICs
|
|||
|
|
default:
|
|||
|
|
return []TenantModuleTypeKV{}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ModuleTenantCheckReq struct {
|
|||
|
|
ModuleKey string `p:"moduleKey" v:"required#模块Key不能为空"`
|
|||
|
|
TenantId uint64 `p:"tenantId" v:"required#租户ID不能为空"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ModuleTenantCheckRes 调用admin-go设置模块租户关系的响应
|
|||
|
|
type ModuleTenantCheckRes struct {
|
|||
|
|
Status bool `json:"status"`
|
|||
|
|
CertificationStatus bool `json:"certificationStatus"`
|
|||
|
|
Message string `json:"message"` // 状态描述
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ModuleTenant 模块租户关系实体(引用自admin-go)
|
|||
|
|
type ModuleTenant struct {
|
|||
|
|
ExpireAt *gtime.Time `json:"expireAt" description:"到期时间"`
|
|||
|
|
TenantModuleType TenantModuleType `json:"tenantModuleType" description:"租户模块类型"`
|
|||
|
|
CertificationStatus int `json:"certificationStatus" description:"认证状态"`
|
|||
|
|
}
|