38 lines
702 B
Go
38 lines
702 B
Go
package controller
|
|
|
|
import (
|
|
"SciencesServer/app/service"
|
|
"SciencesServer/config"
|
|
"SciencesServer/serve/cache"
|
|
"SciencesServer/utils"
|
|
)
|
|
|
|
// Platform
|
|
type Platform struct{ *service.Session }
|
|
|
|
func (c *Platform) Format() string {
|
|
return ""
|
|
}
|
|
|
|
// ReturnPages 分页数据
|
|
type ReturnPages struct {
|
|
Data interface{} `json:"data"`
|
|
Count int64 `json:"count"`
|
|
}
|
|
|
|
type Key struct{}
|
|
|
|
// Generate 生成秘钥
|
|
func (*Key) Generate(len int) string {
|
|
key := utils.GetRandomString(len)
|
|
for {
|
|
isExist, _ := cache.Cache.SIsMember(config.RedisKeyForTenantKeys, key)
|
|
|
|
if !isExist {
|
|
_ = cache.Cache.SAdd(config.RedisKeyForTenantKeys, key)
|
|
return key
|
|
}
|
|
key = utils.GetRandomString(len)
|
|
}
|
|
}
|