mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	用户系统可以切换CDN和智能DNS
This commit is contained in:
		@@ -27,32 +27,34 @@ type User struct {
 | 
			
		||||
	RejectReason    string   `field:"rejectReason"`    // 拒绝理由
 | 
			
		||||
	IsVerified      bool     `field:"isVerified"`      // 是否验证通过
 | 
			
		||||
	RequirePlans    uint8    `field:"requirePlans"`    // 是否需要购买套餐
 | 
			
		||||
	Modules         dbs.JSON `field:"modules"`         // 用户模块
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type UserOperator struct {
 | 
			
		||||
	Id              interface{} // ID
 | 
			
		||||
	IsOn            interface{} // 是否启用
 | 
			
		||||
	Username        interface{} // 用户名
 | 
			
		||||
	Password        interface{} // 密码
 | 
			
		||||
	Fullname        interface{} // 真实姓名
 | 
			
		||||
	Mobile          interface{} // 手机号
 | 
			
		||||
	Tel             interface{} // 联系电话
 | 
			
		||||
	Remark          interface{} // 备注
 | 
			
		||||
	Email           interface{} // 邮箱地址
 | 
			
		||||
	EmailIsVerified interface{} // 邮箱是否已验证
 | 
			
		||||
	AvatarFileId    interface{} // 头像文件ID
 | 
			
		||||
	CreatedAt       interface{} // 创建时间
 | 
			
		||||
	Day             interface{} // YYYYMMDD
 | 
			
		||||
	UpdatedAt       interface{} // 修改时间
 | 
			
		||||
	State           interface{} // 状态
 | 
			
		||||
	Source          interface{} // 来源
 | 
			
		||||
	ClusterId       interface{} // 集群ID
 | 
			
		||||
	Features        interface{} // 允许操作的特征
 | 
			
		||||
	RegisteredIP    interface{} // 注册使用的IP
 | 
			
		||||
	IsRejected      interface{} // 是否已拒绝
 | 
			
		||||
	RejectReason    interface{} // 拒绝理由
 | 
			
		||||
	IsVerified      interface{} // 是否验证通过
 | 
			
		||||
	RequirePlans    interface{} // 是否需要购买套餐
 | 
			
		||||
	Id              any // ID
 | 
			
		||||
	IsOn            any // 是否启用
 | 
			
		||||
	Username        any // 用户名
 | 
			
		||||
	Password        any // 密码
 | 
			
		||||
	Fullname        any // 真实姓名
 | 
			
		||||
	Mobile          any // 手机号
 | 
			
		||||
	Tel             any // 联系电话
 | 
			
		||||
	Remark          any // 备注
 | 
			
		||||
	Email           any // 邮箱地址
 | 
			
		||||
	EmailIsVerified any // 邮箱是否已验证
 | 
			
		||||
	AvatarFileId    any // 头像文件ID
 | 
			
		||||
	CreatedAt       any // 创建时间
 | 
			
		||||
	Day             any // YYYYMMDD
 | 
			
		||||
	UpdatedAt       any // 修改时间
 | 
			
		||||
	State           any // 状态
 | 
			
		||||
	Source          any // 来源
 | 
			
		||||
	ClusterId       any // 集群ID
 | 
			
		||||
	Features        any // 允许操作的特征
 | 
			
		||||
	RegisteredIP    any // 注册使用的IP
 | 
			
		||||
	IsRejected      any // 是否已拒绝
 | 
			
		||||
	RejectReason    any // 拒绝理由
 | 
			
		||||
	IsVerified      any // 是否验证通过
 | 
			
		||||
	RequirePlans    any // 是否需要购买套餐
 | 
			
		||||
	Modules         any // 用户模块
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewUserOperator() *UserOperator {
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +1,21 @@
 | 
			
		||||
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
											
										
									
								
							
		Reference in New Issue
	
	Block a user