用户系统可以切换CDN和智能DNS

This commit is contained in:
刘祥超
2022-09-13 19:04:31 +08:00
parent d1f8e7e757
commit c78c4d58ff
3 changed files with 46 additions and 24 deletions

View File

@@ -27,32 +27,34 @@ type User struct {
RejectReason string `field:"rejectReason"` // 拒绝理由 RejectReason string `field:"rejectReason"` // 拒绝理由
IsVerified bool `field:"isVerified"` // 是否验证通过 IsVerified bool `field:"isVerified"` // 是否验证通过
RequirePlans uint8 `field:"requirePlans"` // 是否需要购买套餐 RequirePlans uint8 `field:"requirePlans"` // 是否需要购买套餐
Modules dbs.JSON `field:"modules"` // 用户模块
} }
type UserOperator struct { type UserOperator struct {
Id interface{} // ID Id any // ID
IsOn interface{} // 是否启用 IsOn any // 是否启用
Username interface{} // 用户名 Username any // 用户名
Password interface{} // 密码 Password any // 密码
Fullname interface{} // 真实姓名 Fullname any // 真实姓名
Mobile interface{} // 手机号 Mobile any // 手机号
Tel interface{} // 联系电话 Tel any // 联系电话
Remark interface{} // 备注 Remark any // 备注
Email interface{} // 邮箱地址 Email any // 邮箱地址
EmailIsVerified interface{} // 邮箱是否已验证 EmailIsVerified any // 邮箱是否已验证
AvatarFileId interface{} // 头像文件ID AvatarFileId any // 头像文件ID
CreatedAt interface{} // 创建时间 CreatedAt any // 创建时间
Day interface{} // YYYYMMDD Day any // YYYYMMDD
UpdatedAt interface{} // 修改时间 UpdatedAt any // 修改时间
State interface{} // 状态 State any // 状态
Source interface{} // 来源 Source any // 来源
ClusterId interface{} // 集群ID ClusterId any // 集群ID
Features interface{} // 允许操作的特征 Features any // 允许操作的特征
RegisteredIP interface{} // 注册使用的IP RegisteredIP any // 注册使用的IP
IsRejected interface{} // 是否已拒绝 IsRejected any // 是否已拒绝
RejectReason interface{} // 拒绝理由 RejectReason any // 拒绝理由
IsVerified interface{} // 是否验证通过 IsVerified any // 是否验证通过
RequirePlans interface{} // 是否需要购买套餐 RequirePlans any // 是否需要购买套餐
Modules any // 用户模块
} }
func NewUserOperator() *UserOperator { func NewUserOperator() *UserOperator {

View File

@@ -1 +1,21 @@
package models package models
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
)
// DecodeModules 解析模块
func (this *User) DecodeModules() []string {
if len(this.Modules) == 0 {
return nil
}
var result = []string{}
err := json.Unmarshal(this.Modules, &result)
if err != nil {
remotelogs.Error("User.DecodeModules", err.Error())
}
return result
}

File diff suppressed because one or more lines are too long