优化用户模型和模块租户检查逻辑,新增NATS消息配置和MongoDB缓存控制
This commit is contained in:
@@ -37,6 +37,7 @@ type MongoBaseDO struct {
|
||||
}
|
||||
|
||||
type User struct {
|
||||
UserName interface{} `bson:"userName" json:"userName"` // MongoDB 默认 ID
|
||||
UserId interface{} `bson:"userId" json:"userId"` // 用户ID
|
||||
UserName interface{} `bson:"userName" json:"userName"` // 用户名
|
||||
TenantId interface{} `bson:"tenantId" json:"tenantId"` // 租户ID
|
||||
}
|
||||
|
||||
@@ -4,6 +4,54 @@ 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客服模块
|
||||
)
|
||||
|
||||
// TenantModuleType 租户类型
|
||||
type TenantModuleType struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
// TenantModuleTypesAssets 资产模块租户类型
|
||||
var TenantModuleTypesAssets = []TenantModuleType{
|
||||
{Key: "private_cloud", Value: "私有云租户"},
|
||||
{Key: "supplier", Value: "供应商"},
|
||||
{Key: "small_shop", Value: "电商小店"},
|
||||
}
|
||||
|
||||
// TenantModuleTypesAd 广告模块租户类型(待定)
|
||||
var TenantModuleTypesAd []TenantModuleType
|
||||
|
||||
// TenantModuleTypesAICs AI客服模块租户类型(待定)
|
||||
var TenantModuleTypesAICs []TenantModuleType
|
||||
|
||||
// GetTenantModuleTypes 获取模块的租户类型列表
|
||||
func GetTenantModuleTypes(module string) []TenantModuleType {
|
||||
switch module {
|
||||
case TenantModuleAssets:
|
||||
return TenantModuleTypesAssets
|
||||
case TenantModuleAd:
|
||||
return TenantModuleTypesAd
|
||||
case TenantModuleAICs:
|
||||
return TenantModuleTypesAICs
|
||||
default:
|
||||
return []TenantModuleType{}
|
||||
}
|
||||
}
|
||||
|
||||
type ModuleTenantCheckReq struct {
|
||||
ModuleKey string `p:"moduleKey" v:"required#模块Key不能为空"`
|
||||
TenantId uint64 `p:"tenantId" v:"required#租户ID不能为空"`
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package beans
|
||||
|
||||
type IsSuperAdminRes struct {
|
||||
IsSuperAdmin bool `p:"isSuperAdmin"`
|
||||
}
|
||||
Reference in New Issue
Block a user