mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	优化代码
This commit is contained in:
		@@ -453,7 +453,7 @@ func (this *ACMETaskDAO) runTaskWithoutLog(tx *dbs.Tx, taskId int64) (isOk bool,
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		err = models.SharedSSLCertDAO.UpdateCert(tx, resultCertId, cert.IsOn, cert.Name, cert.Description, cert.ServerName, cert.IsCA == 1, certData, keyData, sslConfig.TimeBeginAt, sslConfig.TimeEndAt, sslConfig.DNSNames, sslConfig.CommonNames)
 | 
			
		||||
		err = models.SharedSSLCertDAO.UpdateCert(tx, resultCertId, cert.IsOn, cert.Name, cert.Description, cert.ServerName, cert.IsCA, certData, keyData, sslConfig.TimeBeginAt, sslConfig.TimeEndAt, sslConfig.DNSNames, sslConfig.CommonNames)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			errMsg = "证书生成成功,但是修改数据库中的证书信息时出错:" + err.Error()
 | 
			
		||||
			return
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
package acme
 | 
			
		||||
 | 
			
		||||
// ACME任务运行日志
 | 
			
		||||
// ACMETaskLog ACME任务运行日志
 | 
			
		||||
type ACMETaskLog struct {
 | 
			
		||||
	Id        uint64 `field:"id"`        // ID
 | 
			
		||||
	TaskId    uint64 `field:"taskId"`    // 任务ID
 | 
			
		||||
	IsOk      uint8  `field:"isOk"`      // 是否成功
 | 
			
		||||
	IsOk      bool   `field:"isOk"`      // 是否成功
 | 
			
		||||
	Error     string `field:"error"`     // 错误信息
 | 
			
		||||
	CreatedAt uint64 `field:"createdAt"` // 运行时间
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ type Admin struct {
 | 
			
		||||
	Username  string   `field:"username"`  // 用户名
 | 
			
		||||
	Password  string   `field:"password"`  // 密码
 | 
			
		||||
	Fullname  string   `field:"fullname"`  // 全名
 | 
			
		||||
	IsSuper   uint8    `field:"isSuper"`   // 是否为超级管理员
 | 
			
		||||
	IsSuper   bool     `field:"isSuper"`   // 是否为超级管理员
 | 
			
		||||
	CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
			
		||||
	UpdatedAt uint64   `field:"updatedAt"` // 修改时间
 | 
			
		||||
	State     uint8    `field:"state"`     // 状态
 | 
			
		||||
 
 | 
			
		||||
@@ -16,9 +16,9 @@ type DNSDomain struct {
 | 
			
		||||
	Data          string   `field:"data"`          // 原始数据信息
 | 
			
		||||
	Records       dbs.JSON `field:"records"`       // 所有解析记录
 | 
			
		||||
	Routes        dbs.JSON `field:"routes"`        // 线路数据
 | 
			
		||||
	IsUp          uint8    `field:"isUp"`          // 是否在线
 | 
			
		||||
	IsUp          bool     `field:"isUp"`          // 是否在线
 | 
			
		||||
	State         uint8    `field:"state"`         // 状态
 | 
			
		||||
	IsDeleted     uint8    `field:"isDeleted"`     // 是否已删除
 | 
			
		||||
	IsDeleted     bool     `field:"isDeleted"`     // 是否已删除
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type DNSDomainOperator struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,8 +9,8 @@ type DNSTask struct {
 | 
			
		||||
	DomainId  uint32 `field:"domainId"`  // 域名ID
 | 
			
		||||
	Type      string `field:"type"`      // 任务类型
 | 
			
		||||
	UpdatedAt uint64 `field:"updatedAt"` // 更新时间
 | 
			
		||||
	IsDone    uint8  `field:"isDone"`    // 是否已完成
 | 
			
		||||
	IsOk      uint8  `field:"isOk"`      // 是否成功
 | 
			
		||||
	IsDone    bool   `field:"isDone"`    // 是否已完成
 | 
			
		||||
	IsOk      bool   `field:"isOk"`      // 是否成功
 | 
			
		||||
	Error     string `field:"error"`     // 错误信息
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,8 @@ type File struct {
 | 
			
		||||
	Order       uint32 `field:"order"`       // 排序
 | 
			
		||||
	Type        string `field:"type"`        // 类型
 | 
			
		||||
	State       uint8  `field:"state"`       // 状态
 | 
			
		||||
	IsFinished  uint8  `field:"isFinished"`  // 是否已完成上传
 | 
			
		||||
	IsPublic    uint8  `field:"isPublic"`    // 是否可以公开访问
 | 
			
		||||
	IsFinished  bool   `field:"isFinished"`  // 是否已完成上传
 | 
			
		||||
	IsPublic    bool   `field:"isPublic"`    // 是否可以公开访问
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type FileOperator struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ type HTTPAccessLogPolicy struct {
 | 
			
		||||
	Type       string   `field:"type"`       // 存储类型
 | 
			
		||||
	Options    dbs.JSON `field:"options"`    // 存储选项
 | 
			
		||||
	Conds      dbs.JSON `field:"conds"`      // 请求条件
 | 
			
		||||
	IsPublic   uint8    `field:"isPublic"`   // 是否为公用
 | 
			
		||||
	IsPublic   bool     `field:"isPublic"`   // 是否为公用
 | 
			
		||||
	Version    uint32   `field:"version"`    // 版本号
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,7 @@ func (this *HTTPFirewallRuleDAO) ComposeFirewallRule(tx *dbs.Tx, ruleId int64) (
 | 
			
		||||
 | 
			
		||||
	config.Operator = rule.Operator
 | 
			
		||||
	config.Value = rule.Value
 | 
			
		||||
	config.IsCaseInsensitive = rule.IsCaseInsensitive == 1
 | 
			
		||||
	config.IsCaseInsensitive = rule.IsCaseInsensitive
 | 
			
		||||
 | 
			
		||||
	if IsNotNull(rule.CheckpointOptions) {
 | 
			
		||||
		checkpointOptions := map[string]interface{}{}
 | 
			
		||||
 
 | 
			
		||||
@@ -95,7 +95,7 @@ func (this *HTTPFirewallRuleGroupDAO) ComposeFirewallRuleGroup(tx *dbs.Tx, group
 | 
			
		||||
	config.Name = group.Name
 | 
			
		||||
	config.Description = group.Description
 | 
			
		||||
	config.Code = group.Code
 | 
			
		||||
	config.IsTemplate = group.IsTemplate == 1
 | 
			
		||||
	config.IsTemplate = group.IsTemplate
 | 
			
		||||
 | 
			
		||||
	if IsNotNull(group.Sets) {
 | 
			
		||||
		setRefs := []*firewallconfigs.HTTPFirewallRuleSetRef{}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ type HTTPFirewallRuleGroup struct {
 | 
			
		||||
	Name        string   `field:"name"`        // 名称
 | 
			
		||||
	Description string   `field:"description"` // 描述
 | 
			
		||||
	Code        string   `field:"code"`        // 代号
 | 
			
		||||
	IsTemplate  uint8    `field:"isTemplate"`  // 是否为预置模板
 | 
			
		||||
	IsTemplate  bool     `field:"isTemplate"`  // 是否为预置模板
 | 
			
		||||
	AdminId     uint32   `field:"adminId"`     // 管理员ID
 | 
			
		||||
	UserId      uint32   `field:"userId"`      // 用户ID
 | 
			
		||||
	State       uint8    `field:"state"`       // 状态
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ type HTTPFirewallRule struct {
 | 
			
		||||
	ParamFilters      dbs.JSON `field:"paramFilters"`      // 处理器
 | 
			
		||||
	Operator          string   `field:"operator"`          // 操作符
 | 
			
		||||
	Value             string   `field:"value"`             // 对比值
 | 
			
		||||
	IsCaseInsensitive uint8    `field:"isCaseInsensitive"` // 是否大小写不敏感
 | 
			
		||||
	IsCaseInsensitive bool     `field:"isCaseInsensitive"` // 是否大小写不敏感
 | 
			
		||||
	CheckpointOptions dbs.JSON `field:"checkpointOptions"` // 检查点参数
 | 
			
		||||
	State             uint8    `field:"state"`             // 状态
 | 
			
		||||
	CreatedAt         uint64   `field:"createdAt"`         // 创建时间
 | 
			
		||||
 
 | 
			
		||||
@@ -175,7 +175,7 @@ func (this *HTTPLocationDAO) ComposeLocationConfig(tx *dbs.Tx, locationId int64,
 | 
			
		||||
	config.Name = location.Name
 | 
			
		||||
	config.Pattern = location.Pattern
 | 
			
		||||
	config.URLPrefix = location.UrlPrefix
 | 
			
		||||
	config.IsBreak = location.IsBreak == 1
 | 
			
		||||
	config.IsBreak = location.IsBreak
 | 
			
		||||
 | 
			
		||||
	// web
 | 
			
		||||
	if location.WebId > 0 {
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ type HTTPLocation struct {
 | 
			
		||||
	WebId        uint32   `field:"webId"`        // Web配置ID
 | 
			
		||||
	ReverseProxy dbs.JSON `field:"reverseProxy"` // 反向代理
 | 
			
		||||
	UrlPrefix    string   `field:"urlPrefix"`    // URL前缀
 | 
			
		||||
	IsBreak      uint8    `field:"isBreak"`      // 是否终止匹配
 | 
			
		||||
	IsBreak      bool     `field:"isBreak"`      // 是否终止匹配
 | 
			
		||||
	Conds        dbs.JSON `field:"conds"`        // 匹配条件
 | 
			
		||||
	Domains      dbs.JSON `field:"domains"`      // 专属域名
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -103,7 +103,7 @@ func (this *HTTPRewriteRuleDAO) ComposeRewriteRule(tx *dbs.Tx, rewriteRuleId int
 | 
			
		||||
	config.Mode = rule.Mode
 | 
			
		||||
	config.RedirectStatus = types.Int(rule.RedirectStatus)
 | 
			
		||||
	config.ProxyHost = rule.ProxyHost
 | 
			
		||||
	config.IsBreak = rule.IsBreak == 1
 | 
			
		||||
	config.IsBreak = rule.IsBreak
 | 
			
		||||
	config.WithQuery = rule.WithQuery == 1
 | 
			
		||||
 | 
			
		||||
	// conds
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ type HTTPRewriteRule struct {
 | 
			
		||||
	Mode           string   `field:"mode"`           // 替换模式
 | 
			
		||||
	RedirectStatus uint32   `field:"redirectStatus"` // 跳转的状态码
 | 
			
		||||
	ProxyHost      string   `field:"proxyHost"`      // 代理的主机名
 | 
			
		||||
	IsBreak        uint8    `field:"isBreak"`        // 是否终止解析
 | 
			
		||||
	IsBreak        bool     `field:"isBreak"`        // 是否终止解析
 | 
			
		||||
	WithQuery      uint8    `field:"withQuery"`      // 是否保留URI参数
 | 
			
		||||
	Conds          dbs.JSON `field:"conds"`          // 匹配条件
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ type IPItem struct {
 | 
			
		||||
	SourceHTTPFirewallPolicyId    uint32 `field:"sourceHTTPFirewallPolicyId"`    // 来源策略ID
 | 
			
		||||
	SourceHTTPFirewallRuleGroupId uint32 `field:"sourceHTTPFirewallRuleGroupId"` // 来源规则集分组ID
 | 
			
		||||
	SourceHTTPFirewallRuleSetId   uint32 `field:"sourceHTTPFirewallRuleSetId"`   // 来源规则集ID
 | 
			
		||||
	IsRead                        uint8  `field:"isRead"`                        // 是否已读
 | 
			
		||||
	IsRead                        bool   `field:"isRead"`                        // 是否已读
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type IPItemOperator struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,8 @@ var listTypeCacheMap = map[int64]*IPList{} // listId => *IPList
 | 
			
		||||
var DefaultGlobalIPList = &IPList{
 | 
			
		||||
	Id:       uint32(firewallconfigs.GlobalListId),
 | 
			
		||||
	Name:     "全局封锁名单",
 | 
			
		||||
	IsPublic: 1,
 | 
			
		||||
	IsGlobal: 1,
 | 
			
		||||
	IsPublic: true,
 | 
			
		||||
	IsGlobal: true,
 | 
			
		||||
	Type:     "black",
 | 
			
		||||
	State:    IPListStateEnabled,
 | 
			
		||||
	IsOn:     true,
 | 
			
		||||
 
 | 
			
		||||
@@ -16,8 +16,8 @@ type IPList struct {
 | 
			
		||||
	Timeout     dbs.JSON `field:"timeout"`     // 默认超时时间
 | 
			
		||||
	Actions     dbs.JSON `field:"actions"`     // IP触发的动作
 | 
			
		||||
	Description string   `field:"description"` // 描述
 | 
			
		||||
	IsPublic    uint8    `field:"isPublic"`    // 是否公用
 | 
			
		||||
	IsGlobal    uint8    `field:"isGlobal"`    // 是否全局
 | 
			
		||||
	IsPublic    bool     `field:"isPublic"`    // 是否公用
 | 
			
		||||
	IsGlobal    bool     `field:"isGlobal"`    // 是否全局
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type IPListOperator struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ type Message struct {
 | 
			
		||||
	Body      string   `field:"body"`      // 内容
 | 
			
		||||
	Type      string   `field:"type"`      // 消息类型
 | 
			
		||||
	Params    dbs.JSON `field:"params"`    // 额外的参数
 | 
			
		||||
	IsRead    uint8    `field:"isRead"`    // 是否已读
 | 
			
		||||
	IsRead    bool     `field:"isRead"`    // 是否已读
 | 
			
		||||
	State     uint8    `field:"state"`     // 状态
 | 
			
		||||
	CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
			
		||||
	Day       string   `field:"day"`       // 日期YYYYMMDD
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ type MessageTaskLog struct {
 | 
			
		||||
	Id        uint64 `field:"id"`        // ID
 | 
			
		||||
	TaskId    uint64 `field:"taskId"`    // 任务ID
 | 
			
		||||
	CreatedAt uint64 `field:"createdAt"` // 创建时间
 | 
			
		||||
	IsOk      uint8  `field:"isOk"`      // 是否成功
 | 
			
		||||
	IsOk      bool   `field:"isOk"`      // 是否成功
 | 
			
		||||
	Error     string `field:"error"`     // 错误信息
 | 
			
		||||
	Response  string `field:"response"`  // 响应信息
 | 
			
		||||
	Day       string `field:"day"`       // YYYYMMDD
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ type MessageTask struct {
 | 
			
		||||
	State       uint8    `field:"state"`       // 状态
 | 
			
		||||
	Result      dbs.JSON `field:"result"`      // 结果
 | 
			
		||||
	Day         string   `field:"day"`         // YYYYMMDD
 | 
			
		||||
	IsPrimary   uint8    `field:"isPrimary"`   // 是否优先
 | 
			
		||||
	IsPrimary   bool     `field:"isPrimary"`   // 是否优先
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type MessageTaskOperator struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -161,7 +161,7 @@ func (this *MetricItemDAO) UpdateItem(tx *dbs.Tx, itemId int64, name string, key
 | 
			
		||||
	if oldItem == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	oldIsPublic := oldItem.IsPublic == 1
 | 
			
		||||
	oldIsPublic := oldItem.IsPublic
 | 
			
		||||
	var versionChanged = false
 | 
			
		||||
	if strings.Join(oldItem.DecodeKeys(), "&") != strings.Join(keys, "&") || types.Int32(oldItem.Period) != period || oldItem.PeriodUnit != periodUnit || oldItem.Value != value {
 | 
			
		||||
		versionChanged = true
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ type MetricItem struct {
 | 
			
		||||
	Value      string   `field:"value"`      // 值运算
 | 
			
		||||
	State      uint8    `field:"state"`      // 状态
 | 
			
		||||
	Version    uint32   `field:"version"`    // 版本号
 | 
			
		||||
	IsPublic   uint8    `field:"isPublic"`   // 是否为公用
 | 
			
		||||
	IsPublic   bool     `field:"isPublic"`   // 是否为公用
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type MetricItemOperator struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ type NodeCluster struct {
 | 
			
		||||
	NodeMaxThreads        uint32   `field:"nodeMaxThreads"`        // 节点最大线程数
 | 
			
		||||
	NodeTCPMaxConnections uint32   `field:"nodeTCPMaxConnections"` // TCP最大连接数
 | 
			
		||||
	AutoOpenPorts         uint8    `field:"autoOpenPorts"`         // 是否自动尝试开放端口
 | 
			
		||||
	IsPinned              uint8    `field:"isPinned"`              // 是否置顶
 | 
			
		||||
	IsPinned              bool     `field:"isPinned"`              // 是否置顶
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type NodeClusterOperator struct {
 | 
			
		||||
 
 | 
			
		||||
@@ -679,7 +679,7 @@ func (this *NodeDAO) FindNodeInstallStatus(tx *dbs.Tx, nodeId int64) (*NodeInsta
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	installStatus := node.(*Node).InstallStatus
 | 
			
		||||
	isInstalled := node.(*Node).IsInstalled == 1
 | 
			
		||||
	isInstalled := node.(*Node).IsInstalled
 | 
			
		||||
	if len(installStatus) == 0 {
 | 
			
		||||
		return NewNodeInstallStatus(), nil
 | 
			
		||||
	}
 | 
			
		||||
@@ -1266,7 +1266,7 @@ func (this *NodeDAO) UpdateNodeUpCount(tx *dbs.Tx, nodeId int64, isUp bool, maxU
 | 
			
		||||
	if one == nil {
 | 
			
		||||
		return false, nil
 | 
			
		||||
	}
 | 
			
		||||
	oldIsUp := one.(*Node).IsUp == 1
 | 
			
		||||
	oldIsUp := one.(*Node).IsUp
 | 
			
		||||
 | 
			
		||||
	// 如果新老状态一致,则不做任何事情
 | 
			
		||||
	if oldIsUp == isUp {
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ func (this *NodeIPAddressDAO) FindAddressIsHealthy(tx *dbs.Tx, addressId int64)
 | 
			
		||||
		return false, err
 | 
			
		||||
	}
 | 
			
		||||
	var addr = one.(*NodeIPAddress)
 | 
			
		||||
	return addr.IsHealthy == 1, nil
 | 
			
		||||
	return addr.IsHealthy, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateAddress 创建IP地址
 | 
			
		||||
@@ -469,7 +469,7 @@ func (this *NodeIPAddressDAO) UpdateAddressHealthCount(tx *dbs.Tx, addrId int64,
 | 
			
		||||
	if one == nil {
 | 
			
		||||
		return false, nil
 | 
			
		||||
	}
 | 
			
		||||
	oldIsHealthy := one.(*NodeIPAddress).IsHealthy == 1
 | 
			
		||||
	oldIsHealthy := one.(*NodeIPAddress).IsHealthy
 | 
			
		||||
 | 
			
		||||
	// 如果新老状态一致,则不做任何事情
 | 
			
		||||
	if oldIsHealthy == isUp {
 | 
			
		||||
 
 | 
			
		||||
@@ -7,9 +7,9 @@ type NodeIPAddressLog struct {
 | 
			
		||||
	AdminId     uint32 `field:"adminId"`     // 管理员ID
 | 
			
		||||
	Description string `field:"description"` // 描述
 | 
			
		||||
	CreatedAt   uint64 `field:"createdAt"`   // 操作时间
 | 
			
		||||
	IsUp        uint8  `field:"isUp"`        // 是否在线
 | 
			
		||||
	IsUp        bool   `field:"isUp"`        // 是否在线
 | 
			
		||||
	IsOn        bool   `field:"isOn"`        // 是否启用
 | 
			
		||||
	CanAccess   uint8  `field:"canAccess"`   // 是否可访问
 | 
			
		||||
	CanAccess   bool   `field:"canAccess"`   // 是否可访问
 | 
			
		||||
	Day         string `field:"day"`         // YYYYMMDD,用来清理
 | 
			
		||||
	BackupIP    string `field:"backupIP"`    // 备用IP
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -13,10 +13,10 @@ type NodeIPAddress struct {
 | 
			
		||||
	Description       string   `field:"description"`       // 描述
 | 
			
		||||
	State             uint8    `field:"state"`             // 状态
 | 
			
		||||
	Order             uint32   `field:"order"`             // 排序
 | 
			
		||||
	CanAccess         uint8    `field:"canAccess"`         // 是否可以访问
 | 
			
		||||
	CanAccess         bool     `field:"canAccess"`         // 是否可以访问
 | 
			
		||||
	IsOn              bool     `field:"isOn"`              // 是否启用
 | 
			
		||||
	IsUp              uint8    `field:"isUp"`              // 是否上线
 | 
			
		||||
	IsHealthy         uint8    `field:"isHealthy"`         // 是否健康
 | 
			
		||||
	IsUp              bool     `field:"isUp"`              // 是否上线
 | 
			
		||||
	IsHealthy         bool     `field:"isHealthy"`         // 是否健康
 | 
			
		||||
	Thresholds        dbs.JSON `field:"thresholds"`        // 上线阈值
 | 
			
		||||
	Connectivity      dbs.JSON `field:"connectivity"`      // 连通性状态
 | 
			
		||||
	BackupIP          string   `field:"backupIP"`          // 备用IP
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ type NodeIPAddressThreshold struct {
 | 
			
		||||
	Items      dbs.JSON `field:"items"`      // 阈值条目
 | 
			
		||||
	Actions    dbs.JSON `field:"actions"`    // 动作
 | 
			
		||||
	NotifiedAt uint64   `field:"notifiedAt"` // 上次通知时间
 | 
			
		||||
	IsMatched  uint8    `field:"isMatched"`  // 上次是否匹配
 | 
			
		||||
	IsMatched  bool     `field:"isMatched"`  // 上次是否匹配
 | 
			
		||||
	State      uint8    `field:"state"`      // 状态
 | 
			
		||||
	Order      uint32   `field:"order"`      // 排序
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,8 +17,8 @@ type NodeLog struct {
 | 
			
		||||
	OriginId    uint32   `field:"originId"`    // 源站ID
 | 
			
		||||
	Hash        string   `field:"hash"`        // 信息内容Hash
 | 
			
		||||
	Count       uint32   `field:"count"`       // 重复次数
 | 
			
		||||
	IsFixed     uint8    `field:"isFixed"`     // 是否已处理
 | 
			
		||||
	IsRead      uint8    `field:"isRead"`      // 是否已读
 | 
			
		||||
	IsFixed     bool     `field:"isFixed"`     // 是否已处理
 | 
			
		||||
	IsRead      bool     `field:"isRead"`      // 是否已读
 | 
			
		||||
	Params      dbs.JSON `field:"params"`      // 参数
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,10 +8,10 @@ type Node struct {
 | 
			
		||||
	AdminId                uint32   `field:"adminId"`                // 管理员ID
 | 
			
		||||
	UserId                 uint32   `field:"userId"`                 // 用户ID
 | 
			
		||||
	IsOn                   bool     `field:"isOn"`                   // 是否启用
 | 
			
		||||
	IsUp                   uint8    `field:"isUp"`                   // 是否在线
 | 
			
		||||
	IsUp                   bool     `field:"isUp"`                   // 是否在线
 | 
			
		||||
	CountUp                uint32   `field:"countUp"`                // 连续在线次数
 | 
			
		||||
	CountDown              uint32   `field:"countDown"`              // 连续下线次数
 | 
			
		||||
	IsActive               uint8    `field:"isActive"`               // 是否活跃
 | 
			
		||||
	IsActive               bool     `field:"isActive"`               // 是否活跃
 | 
			
		||||
	UniqueId               string   `field:"uniqueId"`               // 节点ID
 | 
			
		||||
	Secret                 string   `field:"secret"`                 // 密钥
 | 
			
		||||
	Name                   string   `field:"name"`                   // 节点名
 | 
			
		||||
@@ -25,7 +25,7 @@ type Node struct {
 | 
			
		||||
	Version                uint32   `field:"version"`                // 当前版本号
 | 
			
		||||
	LatestVersion          uint32   `field:"latestVersion"`          // 最后版本号
 | 
			
		||||
	InstallDir             string   `field:"installDir"`             // 安装目录
 | 
			
		||||
	IsInstalled            uint8    `field:"isInstalled"`            // 是否已安装
 | 
			
		||||
	IsInstalled            bool     `field:"isInstalled"`            // 是否已安装
 | 
			
		||||
	InstallStatus          dbs.JSON `field:"installStatus"`          // 安装状态
 | 
			
		||||
	State                  uint8    `field:"state"`                  // 状态
 | 
			
		||||
	ConnectedAPINodes      dbs.JSON `field:"connectedAPINodes"`      // 当前连接的API节点
 | 
			
		||||
 
 | 
			
		||||
@@ -10,10 +10,10 @@ type NodeTask struct {
 | 
			
		||||
	Type       string `field:"type"`       // 任务类型
 | 
			
		||||
	UniqueId   string `field:"uniqueId"`   // 唯一ID:nodeId@type
 | 
			
		||||
	UpdatedAt  uint64 `field:"updatedAt"`  // 修改时间
 | 
			
		||||
	IsDone     uint8  `field:"isDone"`     // 是否已完成
 | 
			
		||||
	IsOk       uint8  `field:"isOk"`       // 是否已完成
 | 
			
		||||
	IsDone     bool   `field:"isDone"`     // 是否已完成
 | 
			
		||||
	IsOk       bool   `field:"isOk"`       // 是否已完成
 | 
			
		||||
	Error      string `field:"error"`      // 错误信息
 | 
			
		||||
	IsNotified uint8  `field:"isNotified"` // 是否已通知更新
 | 
			
		||||
	IsNotified bool   `field:"isNotified"` // 是否已通知更新
 | 
			
		||||
	Version    uint64 `field:"version"`    // 版本
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -293,7 +293,7 @@ func (this *NSNodeDAO) FindNodeInstallStatus(tx *dbs.Tx, nodeId int64) (*NodeIns
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	installStatus := node.(*NSNode).InstallStatus
 | 
			
		||||
	isInstalled := node.(*NSNode).IsInstalled == 1
 | 
			
		||||
	isInstalled := node.(*NSNode).IsInstalled
 | 
			
		||||
	if len(installStatus) == 0 {
 | 
			
		||||
		return NewNodeInstallStatus(), nil
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,12 +12,12 @@ type NSNode struct {
 | 
			
		||||
	Status            dbs.JSON `field:"status"`            // 运行状态
 | 
			
		||||
	UniqueId          string   `field:"uniqueId"`          // 节点ID
 | 
			
		||||
	Secret            string   `field:"secret"`            // 密钥
 | 
			
		||||
	IsUp              uint8    `field:"isUp"`              // 是否运行
 | 
			
		||||
	IsInstalled       uint8    `field:"isInstalled"`       // 是否已安装
 | 
			
		||||
	IsUp              bool     `field:"isUp"`              // 是否运行
 | 
			
		||||
	IsInstalled       bool     `field:"isInstalled"`       // 是否已安装
 | 
			
		||||
	InstallStatus     dbs.JSON `field:"installStatus"`     // 安装状态
 | 
			
		||||
	InstallDir        string   `field:"installDir"`        // 安装目录
 | 
			
		||||
	State             uint8    `field:"state"`             // 状态
 | 
			
		||||
	IsActive          uint8    `field:"isActive"`          // 是否活跃
 | 
			
		||||
	IsActive          bool     `field:"isActive"`          // 是否活跃
 | 
			
		||||
	StatusIsNotified  uint8    `field:"statusIsNotified"`  // 活跃状态已经通知
 | 
			
		||||
	ConnectedAPINodes dbs.JSON `field:"connectedAPINodes"` // 当前连接的API节点
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ type ReportNode struct {
 | 
			
		||||
	Location  string   `field:"location"`  // 所在区域
 | 
			
		||||
	Isp       string   `field:"isp"`       // 网络服务商
 | 
			
		||||
	AllowIPs  dbs.JSON `field:"allowIPs"`  // 允许的IP
 | 
			
		||||
	IsActive  uint8    `field:"isActive"`  // 是否活跃
 | 
			
		||||
	IsActive  bool     `field:"isActive"`  // 是否活跃
 | 
			
		||||
	Status    dbs.JSON `field:"status"`    // 状态
 | 
			
		||||
	State     uint8    `field:"state"`     // 状态
 | 
			
		||||
	CreatedAt uint64   `field:"createdAt"` // 创建时间
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ type ReportResult struct {
 | 
			
		||||
	TargetDesc   string  `field:"targetDesc"`   // 对象描述
 | 
			
		||||
	UpdatedAt    uint64  `field:"updatedAt"`    // 更新时间
 | 
			
		||||
	ReportNodeId uint32  `field:"reportNodeId"` // 监控节点ID
 | 
			
		||||
	IsOk         uint8   `field:"isOk"`         // 是否可连接
 | 
			
		||||
	IsOk         bool    `field:"isOk"`         // 是否可连接
 | 
			
		||||
	Level        string  `field:"level"`        // 级别
 | 
			
		||||
	CostMs       float64 `field:"costMs"`       // 单次连接花费的时间
 | 
			
		||||
	Error        string  `field:"error"`        // 产生的错误信息
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ type ServerDailyStat struct {
 | 
			
		||||
	Hour                string  `field:"hour"`                // YYYYMMDDHH
 | 
			
		||||
	TimeFrom            string  `field:"timeFrom"`            // 开始时间HHMMSS
 | 
			
		||||
	TimeTo              string  `field:"timeTo"`              // 结束时间
 | 
			
		||||
	IsCharged           uint8   `field:"isCharged"`           // 是否已计算费用
 | 
			
		||||
	IsCharged           bool    `field:"isCharged"`           // 是否已计算费用
 | 
			
		||||
	PlanId              uint64  `field:"planId"`              // 套餐ID
 | 
			
		||||
	Fee                 float64 `field:"fee"`                 // 费用
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -550,7 +550,7 @@ func (this *ServerDAO) FindServerServerNames(tx *dbs.Tx, serverId int64) (server
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	server := one.(*Server)
 | 
			
		||||
	return server.ServerNames, server.IsAuditing == 1, int64(server.AuditingAt), server.AuditingServerNames, server.AuditingResult, nil
 | 
			
		||||
	return server.ServerNames, server.IsAuditing, int64(server.AuditingAt), server.AuditingServerNames, server.AuditingResult, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateServerNames 修改ServerNames配置
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ type Server struct {
 | 
			
		||||
	ServerNames         dbs.JSON `field:"serverNames"`         // 域名列表
 | 
			
		||||
	AuditingAt          uint64   `field:"auditingAt"`          // 审核提交时间
 | 
			
		||||
	AuditingServerNames dbs.JSON `field:"auditingServerNames"` // 审核中的域名
 | 
			
		||||
	IsAuditing          uint8    `field:"isAuditing"`          // 是否正在审核
 | 
			
		||||
	IsAuditing          bool     `field:"isAuditing"`          // 是否正在审核
 | 
			
		||||
	AuditingResult      dbs.JSON `field:"auditingResult"`      // 审核结果
 | 
			
		||||
	Http                dbs.JSON `field:"http"`                // HTTP配置
 | 
			
		||||
	Https               dbs.JSON `field:"https"`               // HTTPS配置
 | 
			
		||||
 
 | 
			
		||||
@@ -220,8 +220,8 @@ func (this *SSLCertDAO) ComposeCertConfig(tx *dbs.Tx, certId int64, cacheMap *ut
 | 
			
		||||
	config := &sslconfigs.SSLCertConfig{}
 | 
			
		||||
	config.Id = int64(cert.Id)
 | 
			
		||||
	config.IsOn = cert.IsOn
 | 
			
		||||
	config.IsCA = cert.IsCA == 1
 | 
			
		||||
	config.IsACME = cert.IsACME == 1
 | 
			
		||||
	config.IsCA = cert.IsCA
 | 
			
		||||
	config.IsACME = cert.IsACME
 | 
			
		||||
	config.Name = cert.Name
 | 
			
		||||
	config.Description = cert.Description
 | 
			
		||||
	config.CertData = cert.CertData
 | 
			
		||||
 
 | 
			
		||||
@@ -16,13 +16,13 @@ type SSLCert struct {
 | 
			
		||||
	CertData           []byte   `field:"certData"`           // 证书内容
 | 
			
		||||
	KeyData            []byte   `field:"keyData"`            // 密钥内容
 | 
			
		||||
	ServerName         string   `field:"serverName"`         // 证书使用的主机名
 | 
			
		||||
	IsCA               uint8    `field:"isCA"`               // 是否为CA证书
 | 
			
		||||
	IsCA               bool     `field:"isCA"`               // 是否为CA证书
 | 
			
		||||
	GroupIds           dbs.JSON `field:"groupIds"`           // 证书分组
 | 
			
		||||
	TimeBeginAt        uint64   `field:"timeBeginAt"`        // 开始时间
 | 
			
		||||
	TimeEndAt          uint64   `field:"timeEndAt"`          // 结束时间
 | 
			
		||||
	DnsNames           dbs.JSON `field:"dnsNames"`           // DNS名称列表
 | 
			
		||||
	CommonNames        dbs.JSON `field:"commonNames"`        // 发行单位列表
 | 
			
		||||
	IsACME             uint8    `field:"isACME"`             // 是否为ACME自动生成的
 | 
			
		||||
	IsACME             bool     `field:"isACME"`             // 是否为ACME自动生成的
 | 
			
		||||
	AcmeTaskId         uint64   `field:"acmeTaskId"`         // ACME任务ID
 | 
			
		||||
	NotifiedAt         uint64   `field:"notifiedAt"`         // 最后通知时间
 | 
			
		||||
	Ocsp               []byte   `field:"ocsp"`               // OCSP缓存
 | 
			
		||||
 
 | 
			
		||||
@@ -10,8 +10,8 @@ type UserBill struct {
 | 
			
		||||
	DayFrom     string  `field:"dayFrom"`     // YYYYMMDD
 | 
			
		||||
	DayTo       string  `field:"dayTo"`       // YYYYMMDD
 | 
			
		||||
	Month       string  `field:"month"`       // 帐期YYYYMM
 | 
			
		||||
	CanPay      uint8   `field:"canPay"`      // 是否可以支付
 | 
			
		||||
	IsPaid      uint8   `field:"isPaid"`      // 是否已支付
 | 
			
		||||
	CanPay      bool    `field:"canPay"`      // 是否可以支付
 | 
			
		||||
	IsPaid      bool    `field:"isPaid"`      // 是否已支付
 | 
			
		||||
	PaidAt      uint64  `field:"paidAt"`      // 支付时间
 | 
			
		||||
	Code        string  `field:"code"`        // 账单编号
 | 
			
		||||
	CreatedAt   uint64  `field:"createdAt"`   // 创建时间
 | 
			
		||||
 
 | 
			
		||||
@@ -23,9 +23,9 @@ type User struct {
 | 
			
		||||
	ClusterId       uint32   `field:"clusterId"`       // 集群ID
 | 
			
		||||
	Features        dbs.JSON `field:"features"`        // 允许操作的特征
 | 
			
		||||
	RegisteredIP    string   `field:"registeredIP"`    // 注册使用的IP
 | 
			
		||||
	IsRejected      uint8    `field:"isRejected"`      // 是否已拒绝
 | 
			
		||||
	IsRejected      bool     `field:"isRejected"`      // 是否已拒绝
 | 
			
		||||
	RejectReason    string   `field:"rejectReason"`    // 拒绝理由
 | 
			
		||||
	IsVerified      uint8    `field:"isVerified"`      // 是否验证通过
 | 
			
		||||
	IsVerified      bool     `field:"isVerified"`      // 是否验证通过
 | 
			
		||||
	RequirePlans    uint8    `field:"requirePlans"`    // 是否需要购买套餐
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -47,9 +47,9 @@ func (this *NSNodeService) FindAllEnabledNSNodesWithNSClusterId(ctx context.Cont
 | 
			
		||||
			IsOn:        node.IsOn,
 | 
			
		||||
			UniqueId:    node.UniqueId,
 | 
			
		||||
			Secret:      node.Secret,
 | 
			
		||||
			IsInstalled: node.IsInstalled == 1,
 | 
			
		||||
			IsInstalled: node.IsInstalled,
 | 
			
		||||
			InstallDir:  node.InstallDir,
 | 
			
		||||
			IsUp:        node.IsUp == 1,
 | 
			
		||||
			IsUp:        node.IsUp,
 | 
			
		||||
			NsCluster:   nil,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
@@ -123,10 +123,10 @@ func (this *NSNodeService) ListEnabledNSNodesMatch(ctx context.Context, req *pb.
 | 
			
		||||
			IsOn:          node.IsOn,
 | 
			
		||||
			UniqueId:      node.UniqueId,
 | 
			
		||||
			Secret:        node.Secret,
 | 
			
		||||
			IsActive:      node.IsActive == 1,
 | 
			
		||||
			IsInstalled:   node.IsInstalled == 1,
 | 
			
		||||
			IsActive:      node.IsActive,
 | 
			
		||||
			IsInstalled:   node.IsInstalled,
 | 
			
		||||
			InstallDir:    node.InstallDir,
 | 
			
		||||
			IsUp:          node.IsUp == 1,
 | 
			
		||||
			IsUp:          node.IsUp,
 | 
			
		||||
			StatusJSON:    node.Status,
 | 
			
		||||
			InstallStatus: installStatusResult,
 | 
			
		||||
			NsCluster:     nil,
 | 
			
		||||
@@ -269,7 +269,7 @@ func (this *NSNodeService) FindEnabledNSNode(ctx context.Context, req *pb.FindEn
 | 
			
		||||
		StatusJSON:  node.Status,
 | 
			
		||||
		UniqueId:    node.UniqueId,
 | 
			
		||||
		Secret:      node.Secret,
 | 
			
		||||
		IsInstalled: node.IsInstalled == 1,
 | 
			
		||||
		IsInstalled: node.IsInstalled,
 | 
			
		||||
		InstallDir:  node.InstallDir,
 | 
			
		||||
		NsCluster: &pb.NSCluster{
 | 
			
		||||
			Id:   int64(node.ClusterId),
 | 
			
		||||
@@ -277,7 +277,7 @@ func (this *NSNodeService) FindEnabledNSNode(ctx context.Context, req *pb.FindEn
 | 
			
		||||
		},
 | 
			
		||||
		InstallStatus: installStatusResult,
 | 
			
		||||
		IsOn:          node.IsOn,
 | 
			
		||||
		IsActive:      node.IsActive == 1,
 | 
			
		||||
		IsActive:      node.IsActive,
 | 
			
		||||
		NodeLogin:     respLogin,
 | 
			
		||||
	}}, nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -187,7 +187,7 @@ func (this *ACMETaskService) ListEnabledACMETasks(ctx context.Context, req *pb.L
 | 
			
		||||
		if taskLog != nil {
 | 
			
		||||
			pbTaskLog = &pb.ACMETaskLog{
 | 
			
		||||
				Id:        int64(taskLog.Id),
 | 
			
		||||
				IsOk:      taskLog.IsOk == 1,
 | 
			
		||||
				IsOk:      taskLog.IsOk,
 | 
			
		||||
				Error:     taskLog.Error,
 | 
			
		||||
				CreatedAt: int64(taskLog.CreatedAt),
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -184,7 +184,7 @@ func (this *AdminService) FindEnabledAdmin(ctx context.Context, req *pb.FindEnab
 | 
			
		||||
		Fullname: admin.Fullname,
 | 
			
		||||
		Username: admin.Username,
 | 
			
		||||
		IsOn:     admin.IsOn,
 | 
			
		||||
		IsSuper:  admin.IsSuper == 1,
 | 
			
		||||
		IsSuper:  admin.IsSuper,
 | 
			
		||||
		Modules:  pbModules,
 | 
			
		||||
		OtpLogin: pbOtpAuth,
 | 
			
		||||
		CanLogin: admin.CanLogin == 1,
 | 
			
		||||
@@ -298,7 +298,7 @@ func (this *AdminService) FindAllAdminModules(ctx context.Context, req *pb.FindA
 | 
			
		||||
 | 
			
		||||
		list := &pb.AdminModuleList{
 | 
			
		||||
			AdminId:  int64(admin.Id),
 | 
			
		||||
			IsSuper:  admin.IsSuper == 1,
 | 
			
		||||
			IsSuper:  admin.IsSuper,
 | 
			
		||||
			Fullname: admin.Fullname,
 | 
			
		||||
			Theme:    admin.Theme,
 | 
			
		||||
			Modules:  pbModules,
 | 
			
		||||
@@ -404,7 +404,7 @@ func (this *AdminService) ListEnabledAdmins(ctx context.Context, req *pb.ListEna
 | 
			
		||||
			Fullname:  admin.Fullname,
 | 
			
		||||
			Username:  admin.Username,
 | 
			
		||||
			IsOn:      admin.IsOn,
 | 
			
		||||
			IsSuper:   admin.IsSuper == 1,
 | 
			
		||||
			IsSuper:   admin.IsSuper,
 | 
			
		||||
			CreatedAt: int64(admin.CreatedAt),
 | 
			
		||||
			OtpLogin:  pbOtpAuth,
 | 
			
		||||
			CanLogin:  admin.CanLogin == 1,
 | 
			
		||||
 
 | 
			
		||||
@@ -260,8 +260,8 @@ func (this *DNSDomainService) FindAllEnabledBasicDNSDomainsWithDNSProviderId(ctx
 | 
			
		||||
			Id:        int64(domain.Id),
 | 
			
		||||
			Name:      domain.Name,
 | 
			
		||||
			IsOn:      domain.IsOn,
 | 
			
		||||
			IsUp:      domain.IsUp == 1,
 | 
			
		||||
			IsDeleted: domain.IsDeleted == 1,
 | 
			
		||||
			IsUp:      domain.IsUp,
 | 
			
		||||
			IsDeleted: domain.IsDeleted,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -390,8 +390,8 @@ func (this *DNSDomainService) convertDomainToPB(tx *dbs.Tx, domain *dns.DNSDomai
 | 
			
		||||
		ProviderId:         int64(domain.ProviderId),
 | 
			
		||||
		Name:               domain.Name,
 | 
			
		||||
		IsOn:               domain.IsOn,
 | 
			
		||||
		IsUp:               domain.IsUp == 1,
 | 
			
		||||
		IsDeleted:          domain.IsDeleted == 1,
 | 
			
		||||
		IsUp:               domain.IsUp,
 | 
			
		||||
		IsDeleted:          domain.IsDeleted,
 | 
			
		||||
		DataUpdatedAt:      int64(domain.DataUpdatedAt),
 | 
			
		||||
		CountNodeRecords:   int64(countNodeRecords),
 | 
			
		||||
		NodesChanged:       nodesChanged,
 | 
			
		||||
@@ -834,7 +834,7 @@ func (this *DNSDomainService) SyncDNSDomainsFromProvider(ctx context.Context, re
 | 
			
		||||
				return nil, err
 | 
			
		||||
			}
 | 
			
		||||
			hasChanges = true
 | 
			
		||||
		} else if domain.IsUp == 0 {
 | 
			
		||||
		} else if !domain.IsUp {
 | 
			
		||||
			err = dns.SharedDNSDomainDAO.UpdateDomainIsUp(tx, int64(domain.Id), true)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
@@ -846,7 +846,7 @@ func (this *DNSDomainService) SyncDNSDomainsFromProvider(ctx context.Context, re
 | 
			
		||||
	// 将老的域名置为下线
 | 
			
		||||
	for _, oldDomain := range oldDomains {
 | 
			
		||||
		var domainName = oldDomain.Name
 | 
			
		||||
		if oldDomain.IsUp == 1 && !lists.ContainsString(domainNames, domainName) {
 | 
			
		||||
		if oldDomain.IsUp && !lists.ContainsString(domainNames, domainName) {
 | 
			
		||||
			err = dns.SharedDNSDomainDAO.UpdateDomainIsUp(tx, int64(oldDomain.Id), false)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
 
 | 
			
		||||
@@ -55,8 +55,8 @@ func (this *DNSTaskService) FindAllDoingDNSTasks(ctx context.Context, req *pb.Fi
 | 
			
		||||
		pbTask := &pb.DNSTask{
 | 
			
		||||
			Id:        int64(task.Id),
 | 
			
		||||
			Type:      task.Type,
 | 
			
		||||
			IsDone:    task.IsDone == 1,
 | 
			
		||||
			IsOk:      task.IsOk == 1,
 | 
			
		||||
			IsDone:    task.IsDone,
 | 
			
		||||
			IsOk:      task.IsOk,
 | 
			
		||||
			Error:     task.Error,
 | 
			
		||||
			UpdatedAt: int64(task.UpdatedAt),
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ func (this *FileService) FindEnabledFile(ctx context.Context, req *pb.FindEnable
 | 
			
		||||
		return &pb.FindEnabledFileResponse{File: nil}, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if file.IsPublic != 1 {
 | 
			
		||||
	if !file.IsPublic {
 | 
			
		||||
		// 校验权限
 | 
			
		||||
		if userId > 0 && int64(file.UserId) != userId {
 | 
			
		||||
			return nil, this.PermissionError()
 | 
			
		||||
@@ -40,7 +40,7 @@ func (this *FileService) FindEnabledFile(ctx context.Context, req *pb.FindEnable
 | 
			
		||||
			Filename:  file.Filename,
 | 
			
		||||
			Size:      int64(file.Size),
 | 
			
		||||
			CreatedAt: int64(file.CreatedAt),
 | 
			
		||||
			IsPublic:  file.IsPublic == 1,
 | 
			
		||||
			IsPublic:  file.IsPublic,
 | 
			
		||||
		},
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,7 @@ func (this *HTTPAccessLogPolicyService) ListEnabledHTTPAccessLogPolicies(ctx con
 | 
			
		||||
			Type:        policy.Type,
 | 
			
		||||
			OptionsJSON: policy.Options,
 | 
			
		||||
			CondsJSON:   policy.Conds,
 | 
			
		||||
			IsPublic:    policy.IsPublic == 1,
 | 
			
		||||
			IsPublic:    policy.IsPublic,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	return &pb.ListEnabledHTTPAccessLogPoliciesResponse{HttpAccessLogPolicies: pbPolicies}, nil
 | 
			
		||||
@@ -125,7 +125,7 @@ func (this *HTTPAccessLogPolicyService) FindEnabledHTTPAccessLogPolicy(ctx conte
 | 
			
		||||
		Type:        policy.Type,
 | 
			
		||||
		OptionsJSON: policy.Options,
 | 
			
		||||
		CondsJSON:   policy.Conds,
 | 
			
		||||
		IsPublic:    policy.IsPublic == 1,
 | 
			
		||||
		IsPublic:    policy.IsPublic,
 | 
			
		||||
	}}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -280,7 +280,7 @@ func (this *IPItemService) ListIPItemsWithListId(ctx context.Context, req *pb.Li
 | 
			
		||||
			SourceHTTPFirewallPolicy:      pbSourcePolicy,
 | 
			
		||||
			SourceHTTPFirewallRuleGroup:   pbSourceGroup,
 | 
			
		||||
			SourceHTTPFirewallRuleSet:     pbSourceSet,
 | 
			
		||||
			IsRead:                        item.IsRead == 1,
 | 
			
		||||
			IsRead:                        item.IsRead,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -383,7 +383,7 @@ func (this *IPItemService) ListIPItemsAfterVersion(ctx context.Context, req *pb.
 | 
			
		||||
			Type:       item.Type,
 | 
			
		||||
			EventLevel: item.EventLevel,
 | 
			
		||||
			ListType:   list.Type,
 | 
			
		||||
			IsGlobal:   list.IsPublic == 1 && list.IsGlobal == 1,
 | 
			
		||||
			IsGlobal:   list.IsPublic && list.IsGlobal,
 | 
			
		||||
			NodeId:     int64(item.NodeId),
 | 
			
		||||
			ServerId:   int64(item.ServerId),
 | 
			
		||||
		})
 | 
			
		||||
@@ -604,7 +604,7 @@ func (this *IPItemService) ListAllEnabledIPItems(ctx context.Context, req *pb.Li
 | 
			
		||||
			SourceHTTPFirewallRuleGroup:   pbSourceGroup,
 | 
			
		||||
			SourceHTTPFirewallRuleSet:     pbSourceSet,
 | 
			
		||||
			SourceNode:                    pbSourceNode,
 | 
			
		||||
			IsRead:                        item.IsRead == 1,
 | 
			
		||||
			IsRead:                        item.IsRead,
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// 所属名单
 | 
			
		||||
@@ -623,8 +623,8 @@ func (this *IPItemService) ListAllEnabledIPItems(ctx context.Context, req *pb.Li
 | 
			
		||||
			Id:       int64(list.Id),
 | 
			
		||||
			Name:     list.Name,
 | 
			
		||||
			Type:     list.Type,
 | 
			
		||||
			IsPublic: list.IsPublic == 1,
 | 
			
		||||
			IsGlobal: list.IsGlobal == 1,
 | 
			
		||||
			IsPublic: list.IsPublic,
 | 
			
		||||
			IsGlobal: list.IsGlobal,
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// 所属服务(注意同SourceServer不同)
 | 
			
		||||
@@ -632,7 +632,7 @@ func (this *IPItemService) ListAllEnabledIPItems(ctx context.Context, req *pb.Li
 | 
			
		||||
 | 
			
		||||
		// 所属策略(注意同SourceHTTPFirewallPolicy不同)
 | 
			
		||||
		var pbFirewallPolicy *pb.HTTPFirewallPolicy
 | 
			
		||||
		if list.IsPublic == 0 {
 | 
			
		||||
		if !list.IsPublic {
 | 
			
		||||
			policy, err := models.SharedHTTPFirewallPolicyDAO.FindEnabledFirewallPolicyWithIPListId(tx, int64(list.Id))
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ func (this *IPListService) FindEnabledIPList(ctx context.Context, req *pb.FindEn
 | 
			
		||||
		Code:        list.Code,
 | 
			
		||||
		TimeoutJSON: list.Timeout,
 | 
			
		||||
		Description: list.Description,
 | 
			
		||||
		IsGlobal:    list.IsGlobal == 1,
 | 
			
		||||
		IsGlobal:    list.IsGlobal,
 | 
			
		||||
	}}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -112,9 +112,9 @@ func (this *IPListService) ListEnabledIPLists(ctx context.Context, req *pb.ListE
 | 
			
		||||
			Name:        list.Name,
 | 
			
		||||
			Code:        list.Code,
 | 
			
		||||
			TimeoutJSON: list.Timeout,
 | 
			
		||||
			IsPublic:    list.IsPublic == 1,
 | 
			
		||||
			IsPublic:    list.IsPublic,
 | 
			
		||||
			Description: list.Description,
 | 
			
		||||
			IsGlobal:    list.IsGlobal == 1,
 | 
			
		||||
			IsGlobal:    list.IsGlobal,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	return &pb.ListEnabledIPListsResponse{IpLists: pbLists}, nil
 | 
			
		||||
@@ -185,7 +185,7 @@ func (this *IPListService) FindEnabledIPListContainsIP(ctx context.Context, req
 | 
			
		||||
		if list == nil {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		if list.IsPublic != 1 {
 | 
			
		||||
		if !list.IsPublic {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		pbLists = append(pbLists, &pb.IPList{
 | 
			
		||||
@@ -194,8 +194,8 @@ func (this *IPListService) FindEnabledIPListContainsIP(ctx context.Context, req
 | 
			
		||||
			Type:        list.Type,
 | 
			
		||||
			Name:        list.Name,
 | 
			
		||||
			Code:        list.Code,
 | 
			
		||||
			IsPublic:    list.IsPublic == 1,
 | 
			
		||||
			IsGlobal:    list.IsGlobal == 1,
 | 
			
		||||
			IsPublic:    list.IsPublic,
 | 
			
		||||
			IsGlobal:    list.IsGlobal,
 | 
			
		||||
			Description: "",
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -109,7 +109,7 @@ func (this *MessageService) ListUnreadMessages(ctx context.Context, req *pb.List
 | 
			
		||||
			Body:        message.Body,
 | 
			
		||||
			Level:       message.Level,
 | 
			
		||||
			ParamsJSON:  message.Params,
 | 
			
		||||
			IsRead:      message.IsRead == 1,
 | 
			
		||||
			IsRead:      message.IsRead,
 | 
			
		||||
			CreatedAt:   int64(message.CreatedAt),
 | 
			
		||||
			NodeCluster: pbCluster,
 | 
			
		||||
			Node:        pbNode,
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ func (this *MessageTaskLogService) ListMessageTaskLogs(ctx context.Context, req
 | 
			
		||||
		pbLogs = append(pbLogs, &pb.MessageTaskLog{
 | 
			
		||||
			Id:        int64(log.Id),
 | 
			
		||||
			CreatedAt: int64(log.CreatedAt),
 | 
			
		||||
			IsOk:      log.IsOk == 1,
 | 
			
		||||
			IsOk:      log.IsOk,
 | 
			
		||||
			Error:     log.Error,
 | 
			
		||||
			Response:  log.Response,
 | 
			
		||||
			MessageTask: &pb.MessageTask{
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ func (this *MetricItemService) FindEnabledMetricItem(ctx context.Context, req *p
 | 
			
		||||
		Period:     types.Int32(item.Period),
 | 
			
		||||
		PeriodUnit: item.PeriodUnit,
 | 
			
		||||
		Value:      item.Value,
 | 
			
		||||
		IsPublic:   item.IsPublic == 1,
 | 
			
		||||
		IsPublic:   item.IsPublic,
 | 
			
		||||
	}}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -112,7 +112,7 @@ func (this *MetricItemService) ListEnabledMetricItems(ctx context.Context, req *
 | 
			
		||||
			Period:     types.Int32(item.Period),
 | 
			
		||||
			PeriodUnit: item.PeriodUnit,
 | 
			
		||||
			Value:      item.Value,
 | 
			
		||||
			IsPublic:   item.IsPublic == 1,
 | 
			
		||||
			IsPublic:   item.IsPublic,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -313,7 +313,7 @@ func (this *NodeService) ListEnabledNodesMatch(ctx context.Context, req *pb.List
 | 
			
		||||
			Id:          int64(node.Id),
 | 
			
		||||
			Name:        node.Name,
 | 
			
		||||
			Version:     int64(node.Version),
 | 
			
		||||
			IsInstalled: node.IsInstalled == 1,
 | 
			
		||||
			IsInstalled: node.IsInstalled,
 | 
			
		||||
			StatusJSON:  node.Status,
 | 
			
		||||
			NodeCluster: &pb.NodeCluster{
 | 
			
		||||
				Id:   int64(node.ClusterId),
 | 
			
		||||
@@ -323,7 +323,7 @@ func (this *NodeService) ListEnabledNodesMatch(ctx context.Context, req *pb.List
 | 
			
		||||
			InstallStatus:         installStatusResult,
 | 
			
		||||
			MaxCPU:                types.Int32(node.MaxCPU),
 | 
			
		||||
			IsOn:                  node.IsOn,
 | 
			
		||||
			IsUp:                  node.IsUp == 1,
 | 
			
		||||
			IsUp:                  node.IsUp,
 | 
			
		||||
			NodeGroup:             pbGroup,
 | 
			
		||||
			NodeRegion:            pbRegion,
 | 
			
		||||
			DnsRoutes:             pbRoutes,
 | 
			
		||||
@@ -563,7 +563,7 @@ func (this *NodeService) FindEnabledNode(ctx context.Context, req *pb.FindEnable
 | 
			
		||||
		LatestVersion: int64(node.LatestVersion),
 | 
			
		||||
		Secret:        node.Secret,
 | 
			
		||||
		InstallDir:    node.InstallDir,
 | 
			
		||||
		IsInstalled:   node.IsInstalled == 1,
 | 
			
		||||
		IsInstalled:   node.IsInstalled,
 | 
			
		||||
		NodeCluster: &pb.NodeCluster{
 | 
			
		||||
			Id:   int64(node.ClusterId),
 | 
			
		||||
			Name: clusterName,
 | 
			
		||||
@@ -573,7 +573,7 @@ func (this *NodeService) FindEnabledNode(ctx context.Context, req *pb.FindEnable
 | 
			
		||||
		InstallStatus:          installStatusResult,
 | 
			
		||||
		MaxCPU:                 types.Int32(node.MaxCPU),
 | 
			
		||||
		IsOn:                   node.IsOn,
 | 
			
		||||
		IsUp:                   node.IsUp == 1,
 | 
			
		||||
		IsUp:                   node.IsUp,
 | 
			
		||||
		NodeGroup:              pbGroup,
 | 
			
		||||
		NodeRegion:             pbRegion,
 | 
			
		||||
		MaxCacheDiskCapacity:   pbMaxCacheDiskCapacity,
 | 
			
		||||
@@ -607,7 +607,7 @@ func (this *NodeService) FindEnabledBasicNode(ctx context.Context, req *pb.FindE
 | 
			
		||||
		Id:   int64(node.Id),
 | 
			
		||||
		Name: node.Name,
 | 
			
		||||
		IsOn: node.IsOn,
 | 
			
		||||
		IsUp: node.IsUp == 1,
 | 
			
		||||
		IsUp: node.IsUp,
 | 
			
		||||
		NodeCluster: &pb.NodeCluster{
 | 
			
		||||
			Id:   int64(node.ClusterId),
 | 
			
		||||
			Name: clusterName,
 | 
			
		||||
@@ -875,7 +875,7 @@ func (this *NodeService) FindAllEnabledNodesWithNodeGrantId(ctx context.Context,
 | 
			
		||||
			Id:          int64(node.Id),
 | 
			
		||||
			Name:        node.Name,
 | 
			
		||||
			Version:     int64(node.Version),
 | 
			
		||||
			IsInstalled: node.IsInstalled == 1,
 | 
			
		||||
			IsInstalled: node.IsInstalled,
 | 
			
		||||
			StatusJSON:  node.Status,
 | 
			
		||||
			NodeCluster: &pb.NodeCluster{
 | 
			
		||||
				Id:   int64(node.ClusterId),
 | 
			
		||||
@@ -948,7 +948,7 @@ func (this *NodeService) FindAllNotInstalledNodesWithNodeClusterId(ctx context.C
 | 
			
		||||
				Description: address.Description,
 | 
			
		||||
				State:       int64(address.State),
 | 
			
		||||
				Order:       int64(address.Order),
 | 
			
		||||
				CanAccess:   address.CanAccess == 1,
 | 
			
		||||
				CanAccess:   address.CanAccess,
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -973,7 +973,7 @@ func (this *NodeService) FindAllNotInstalledNodesWithNodeClusterId(ctx context.C
 | 
			
		||||
			Id:            int64(node.Id),
 | 
			
		||||
			Name:          node.Name,
 | 
			
		||||
			Version:       int64(node.Version),
 | 
			
		||||
			IsInstalled:   node.IsInstalled == 1,
 | 
			
		||||
			IsInstalled:   node.IsInstalled,
 | 
			
		||||
			StatusJSON:    node.Status,
 | 
			
		||||
			IsOn:          node.IsOn,
 | 
			
		||||
			NodeLogin:     pbLogin,
 | 
			
		||||
@@ -1057,7 +1057,7 @@ func (this *NodeService) FindAllUpgradeNodesWithNodeClusterId(ctx context.Contex
 | 
			
		||||
					Description: address.Description,
 | 
			
		||||
					State:       int64(address.State),
 | 
			
		||||
					Order:       int64(address.Order),
 | 
			
		||||
					CanAccess:   address.CanAccess == 1,
 | 
			
		||||
					CanAccess:   address.CanAccess,
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -1091,7 +1091,7 @@ func (this *NodeService) FindAllUpgradeNodesWithNodeClusterId(ctx context.Contex
 | 
			
		||||
				Id:            int64(node.Id),
 | 
			
		||||
				Name:          node.Name,
 | 
			
		||||
				Version:       int64(node.Version),
 | 
			
		||||
				IsInstalled:   node.IsInstalled == 1,
 | 
			
		||||
				IsInstalled:   node.IsInstalled,
 | 
			
		||||
				StatusJSON:    node.Status,
 | 
			
		||||
				IsOn:          node.IsOn,
 | 
			
		||||
				IpAddresses:   pbAddresses,
 | 
			
		||||
@@ -1452,7 +1452,7 @@ func (this *NodeService) FindEnabledNodesWithIds(ctx context.Context, req *pb.Fi
 | 
			
		||||
		pbNodes = append(pbNodes, &pb.Node{
 | 
			
		||||
			Id:                  int64(node.Id),
 | 
			
		||||
			IsOn:                node.IsOn,
 | 
			
		||||
			IsActive:            node.IsActive == 1,
 | 
			
		||||
			IsActive:            node.IsActive,
 | 
			
		||||
			ConnectedAPINodeIds: connectedAPINodeIds,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -298,7 +298,7 @@ func (this *NodeClusterService) ListEnabledNodeClusters(ctx context.Context, req
 | 
			
		||||
			DnsDomainId: int64(cluster.DnsDomainId),
 | 
			
		||||
			IsOn:        cluster.IsOn,
 | 
			
		||||
			TimeZone:    cluster.TimeZone,
 | 
			
		||||
			IsPinned:    cluster.IsPinned == 1,
 | 
			
		||||
			IsPinned:    cluster.IsPinned,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -79,7 +79,7 @@ func (this *NodeClusterMetricItemService) FindAllNodeClusterMetricItems(ctx cont
 | 
			
		||||
				Period:     types.Int32(item.Period),
 | 
			
		||||
				PeriodUnit: item.PeriodUnit,
 | 
			
		||||
				Value:      item.Value,
 | 
			
		||||
				IsPublic:   item.IsPublic == 1,
 | 
			
		||||
				IsPublic:   item.IsPublic,
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -155,9 +155,9 @@ func (this *NodeIPAddressService) FindEnabledNodeIPAddress(ctx context.Context,
 | 
			
		||||
			Description: address.Description,
 | 
			
		||||
			State:       int64(address.State),
 | 
			
		||||
			Order:       int64(address.Order),
 | 
			
		||||
			CanAccess:   address.CanAccess == 1,
 | 
			
		||||
			CanAccess:   address.CanAccess,
 | 
			
		||||
			IsOn:        address.IsOn,
 | 
			
		||||
			IsUp:        address.IsUp == 1,
 | 
			
		||||
			IsUp:        address.IsUp,
 | 
			
		||||
			BackupIP:    address.DecodeBackupIP(),
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -191,9 +191,9 @@ func (this *NodeIPAddressService) FindAllEnabledNodeIPAddressesWithNodeId(ctx co
 | 
			
		||||
			Description: address.Description,
 | 
			
		||||
			State:       int64(address.State),
 | 
			
		||||
			Order:       int64(address.Order),
 | 
			
		||||
			CanAccess:   address.CanAccess == 1,
 | 
			
		||||
			CanAccess:   address.CanAccess,
 | 
			
		||||
			IsOn:        address.IsOn,
 | 
			
		||||
			IsUp:        address.IsUp == 1,
 | 
			
		||||
			IsUp:        address.IsUp,
 | 
			
		||||
			BackupIP:    address.DecodeBackupIP(),
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
@@ -241,9 +241,9 @@ func (this *NodeIPAddressService) ListEnabledNodeIPAddresses(ctx context.Context
 | 
			
		||||
			Name:        addr.Name,
 | 
			
		||||
			Ip:          addr.Ip,
 | 
			
		||||
			Description: addr.Description,
 | 
			
		||||
			CanAccess:   addr.CanAccess == 1,
 | 
			
		||||
			CanAccess:   addr.CanAccess,
 | 
			
		||||
			IsOn:        addr.IsOn,
 | 
			
		||||
			IsUp:        addr.IsUp == 1,
 | 
			
		||||
			IsUp:        addr.IsUp,
 | 
			
		||||
			BackupIP:    addr.DecodeBackupIP(),
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -79,8 +79,8 @@ func (this *NodeIPAddressLogService) ListNodeIPAddressLogs(ctx context.Context,
 | 
			
		||||
			Description:   log.Description,
 | 
			
		||||
			CreatedAt:     int64(log.CreatedAt),
 | 
			
		||||
			IsOn:          log.IsOn,
 | 
			
		||||
			IsUp:          log.IsUp == 1,
 | 
			
		||||
			CanAccess:     log.CanAccess == 1,
 | 
			
		||||
			IsUp:          log.IsUp,
 | 
			
		||||
			CanAccess:     log.CanAccess,
 | 
			
		||||
			BackupIP:      log.BackupIP,
 | 
			
		||||
			NodeIPAddress: pbAddr,
 | 
			
		||||
			Admin:         pbAdmin,
 | 
			
		||||
 
 | 
			
		||||
@@ -84,8 +84,8 @@ func (this *NodeLogService) ListNodeLogs(ctx context.Context, req *pb.ListNodeLo
 | 
			
		||||
			ServerId:    int64(log.ServerId),
 | 
			
		||||
			CreatedAt:   int64(log.CreatedAt),
 | 
			
		||||
			Count:       types.Int32(log.Count),
 | 
			
		||||
			IsFixed:     log.IsFixed == 1,
 | 
			
		||||
			IsRead:      log.IsRead == 1,
 | 
			
		||||
			IsFixed:     log.IsFixed,
 | 
			
		||||
			IsRead:      log.IsRead,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	return &pb.ListNodeLogsResponse{NodeLogs: result}, nil
 | 
			
		||||
 
 | 
			
		||||
@@ -126,16 +126,16 @@ func (this *NodeTaskService) FindNodeClusterTasks(ctx context.Context, req *pb.F
 | 
			
		||||
 | 
			
		||||
			// 是否超时(N秒内没有更新)
 | 
			
		||||
			if int64(task.UpdatedAt) < time.Now().Unix()-120 {
 | 
			
		||||
				task.IsDone = 1
 | 
			
		||||
				task.IsOk = 0
 | 
			
		||||
				task.IsDone = true
 | 
			
		||||
				task.IsOk = false
 | 
			
		||||
				task.Error = "节点响应超时"
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			pbNodeTasks = append(pbNodeTasks, &pb.NodeTask{
 | 
			
		||||
				Id:        int64(task.Id),
 | 
			
		||||
				Type:      task.Type,
 | 
			
		||||
				IsDone:    task.IsDone == 1,
 | 
			
		||||
				IsOk:      task.IsOk == 1,
 | 
			
		||||
				IsDone:    task.IsDone,
 | 
			
		||||
				IsOk:      task.IsOk,
 | 
			
		||||
				Error:     task.Error,
 | 
			
		||||
				UpdatedAt: int64(task.UpdatedAt),
 | 
			
		||||
				ServerId:  int64(task.ServerId),
 | 
			
		||||
@@ -258,8 +258,8 @@ func (this *NodeTaskService) FindNotifyingNodeTasks(ctx context.Context, req *pb
 | 
			
		||||
		pbTasks = append(pbTasks, &pb.NodeTask{
 | 
			
		||||
			Id:        int64(task.Id),
 | 
			
		||||
			Type:      task.Type,
 | 
			
		||||
			IsDone:    task.IsDone == 1,
 | 
			
		||||
			IsOk:      task.IsOk == 1,
 | 
			
		||||
			IsDone:    task.IsDone,
 | 
			
		||||
			IsOk:      task.IsOk,
 | 
			
		||||
			Error:     task.Error,
 | 
			
		||||
			UpdatedAt: int64(task.UpdatedAt),
 | 
			
		||||
			Node:      &pb.Node{Id: int64(task.NodeId)},
 | 
			
		||||
 
 | 
			
		||||
@@ -700,7 +700,7 @@ func (this *ServerService) ListEnabledServersMatch(ctx context.Context, req *pb.
 | 
			
		||||
			IncludeNodes:            server.IncludeNodes,
 | 
			
		||||
			ExcludeNodes:            server.ExcludeNodes,
 | 
			
		||||
			ServerNamesJSON:         server.ServerNames,
 | 
			
		||||
			IsAuditing:              server.IsAuditing == 1,
 | 
			
		||||
			IsAuditing:              server.IsAuditing,
 | 
			
		||||
			AuditingAt:              int64(server.AuditingAt),
 | 
			
		||||
			AuditingServerNamesJSON: server.AuditingServerNames,
 | 
			
		||||
			AuditingResult:          auditingResult,
 | 
			
		||||
 
 | 
			
		||||
@@ -220,13 +220,13 @@ func (this *SSLCertService) ListSSLCertsWithOCSPError(ctx context.Context, req *
 | 
			
		||||
			TimeEndAt:     types.Int64(cert.TimeEndAt),
 | 
			
		||||
			DnsNames:      cert.DecodeDNSNames(),
 | 
			
		||||
			CommonNames:   cert.DecodeCommonNames(),
 | 
			
		||||
			IsACME:        cert.IsACME == 1,
 | 
			
		||||
			IsACME:        cert.IsACME,
 | 
			
		||||
			AcmeTaskId:    int64(cert.AcmeTaskId),
 | 
			
		||||
			Ocsp:          cert.Ocsp,
 | 
			
		||||
			OcspIsUpdated: cert.OcspIsUpdated == 1,
 | 
			
		||||
			OcspError:     cert.OcspError,
 | 
			
		||||
			Description:   cert.Description,
 | 
			
		||||
			IsCA:          cert.IsCA == 1,
 | 
			
		||||
			IsCA:          cert.IsCA,
 | 
			
		||||
			ServerName:    cert.ServerName,
 | 
			
		||||
			CreatedAt:     int64(cert.CreatedAt),
 | 
			
		||||
			UpdatedAt:     int64(cert.UpdatedAt),
 | 
			
		||||
 
 | 
			
		||||
@@ -221,8 +221,8 @@ func (this *UserService) ListEnabledUsers(ctx context.Context, req *pb.ListEnabl
 | 
			
		||||
			Remark:       user.Remark,
 | 
			
		||||
			IsOn:         user.IsOn,
 | 
			
		||||
			RegisteredIP: user.RegisteredIP,
 | 
			
		||||
			IsVerified:   user.IsVerified == 1,
 | 
			
		||||
			IsRejected:   user.IsRejected == 1,
 | 
			
		||||
			IsVerified:   user.IsVerified,
 | 
			
		||||
			IsRejected:   user.IsRejected,
 | 
			
		||||
			CreatedAt:    int64(user.CreatedAt),
 | 
			
		||||
			NodeCluster:  pbCluster,
 | 
			
		||||
		})
 | 
			
		||||
@@ -272,8 +272,8 @@ func (this *UserService) FindEnabledUser(ctx context.Context, req *pb.FindEnable
 | 
			
		||||
		IsOn:         user.IsOn,
 | 
			
		||||
		CreatedAt:    int64(user.CreatedAt),
 | 
			
		||||
		RegisteredIP: user.RegisteredIP,
 | 
			
		||||
		IsVerified:   user.IsVerified == 1,
 | 
			
		||||
		IsRejected:   user.IsRejected == 1,
 | 
			
		||||
		IsVerified:   user.IsVerified,
 | 
			
		||||
		IsRejected:   user.IsRejected,
 | 
			
		||||
		RejectReason: user.RejectReason,
 | 
			
		||||
		NodeCluster:  pbCluster,
 | 
			
		||||
	}}, nil
 | 
			
		||||
 
 | 
			
		||||
@@ -95,8 +95,8 @@ func (this *UserBillService) ListUserBills(ctx context.Context, req *pb.ListUser
 | 
			
		||||
			Description: bill.Description,
 | 
			
		||||
			Amount:      float32(bill.Amount),
 | 
			
		||||
			Month:       bill.Month,
 | 
			
		||||
			CanPay:      bill.CanPay == 1,
 | 
			
		||||
			IsPaid:      bill.IsPaid == 1,
 | 
			
		||||
			CanPay:      bill.CanPay,
 | 
			
		||||
			IsPaid:      bill.IsPaid,
 | 
			
		||||
			PaidAt:      int64(bill.PaidAt),
 | 
			
		||||
			Code:        bill.Code,
 | 
			
		||||
		})
 | 
			
		||||
@@ -153,8 +153,8 @@ func (this *UserBillService) FindUserBill(ctx context.Context, req *pb.FindUserB
 | 
			
		||||
			Description: bill.Description,
 | 
			
		||||
			Amount:      float32(bill.Amount),
 | 
			
		||||
			Month:       bill.Month,
 | 
			
		||||
			CanPay:      bill.CanPay == 1,
 | 
			
		||||
			IsPaid:      bill.IsPaid == 1,
 | 
			
		||||
			CanPay:      bill.CanPay,
 | 
			
		||||
			IsPaid:      bill.IsPaid,
 | 
			
		||||
			PaidAt:      int64(bill.PaidAt),
 | 
			
		||||
			Code:        bill.Code,
 | 
			
		||||
		},
 | 
			
		||||
@@ -188,7 +188,7 @@ func (this *UserBillService) PayUserBill(ctx context.Context, req *pb.PayUserBil
 | 
			
		||||
		userId = int64(bill.UserId)
 | 
			
		||||
 | 
			
		||||
		// 是否已支付
 | 
			
		||||
		if bill.IsPaid == 1 {
 | 
			
		||||
		if bill.IsPaid {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -197,7 +197,7 @@ func (this *UserBillService) PayUserBill(ctx context.Context, req *pb.PayUserBil
 | 
			
		||||
			return models.SharedUserBillDAO.UpdateUserBillIsPaid(tx, req.UserBillId, true)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if bill.CanPay == 0 {
 | 
			
		||||
		if !bill.CanPay {
 | 
			
		||||
			return errors.New("can not pay now")
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -333,7 +333,7 @@ func (this *DNSTaskExecutor) doCluster(taskId int64, clusterId int64) error {
 | 
			
		||||
		}
 | 
			
		||||
		for _, ipAddress := range ipAddresses {
 | 
			
		||||
			ip := ipAddress.DNSIP()
 | 
			
		||||
			if len(ip) == 0 || ipAddress.CanAccess == 0 || ipAddress.IsUp == 0 || !ipAddress.IsOn {
 | 
			
		||||
			if len(ip) == 0 || !ipAddress.CanAccess || !ipAddress.IsUp || !ipAddress.IsOn {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			if net.ParseIP(ip) == nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -102,7 +102,7 @@ func (this *SSLCertUpdateOCSPTask) Loop(checkLock bool) error {
 | 
			
		||||
 | 
			
		||||
// UpdateCertOCSP 更新单个证书OCSP
 | 
			
		||||
func (this *SSLCertUpdateOCSPTask) UpdateCertOCSP(certOne *models.SSLCert) (ocspData []byte, expiresAt int64, err error) {
 | 
			
		||||
	if certOne.IsCA == 1 || len(certOne.CertData) == 0 || len(certOne.KeyData) == 0 {
 | 
			
		||||
	if certOne.IsCA || len(certOne.CertData) == 0 || len(certOne.KeyData) == 0 {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user