mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-01-06 07:25:48 +08:00
字段中的blob和JSON类型映射为[]byte和dbs.JSON
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
package dns
|
||||
|
||||
import "github.com/iwind/TeaGo/dbs"
|
||||
|
||||
// DNSDomain 管理的域名
|
||||
type DNSDomain struct {
|
||||
Id uint32 `field:"id"` // ID
|
||||
AdminId uint32 `field:"adminId"` // 管理员ID
|
||||
UserId uint32 `field:"userId"` // 用户ID
|
||||
ProviderId uint32 `field:"providerId"` // 服务商ID
|
||||
IsOn uint8 `field:"isOn"` // 是否可用
|
||||
Name string `field:"name"` // 域名
|
||||
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
||||
DataUpdatedAt uint64 `field:"dataUpdatedAt"` // 数据更新时间
|
||||
DataError string `field:"dataError"` // 数据更新错误
|
||||
Data string `field:"data"` // 原始数据信息
|
||||
Records string `field:"records"` // 所有解析记录
|
||||
Routes string `field:"routes"` // 线路数据
|
||||
IsUp uint8 `field:"isUp"` // 是否在线
|
||||
State uint8 `field:"state"` // 状态
|
||||
IsDeleted uint8 `field:"isDeleted"` // 是否已删除
|
||||
Id uint32 `field:"id"` // ID
|
||||
AdminId uint32 `field:"adminId"` // 管理员ID
|
||||
UserId uint32 `field:"userId"` // 用户ID
|
||||
ProviderId uint32 `field:"providerId"` // 服务商ID
|
||||
IsOn uint8 `field:"isOn"` // 是否可用
|
||||
Name string `field:"name"` // 域名
|
||||
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
||||
DataUpdatedAt uint64 `field:"dataUpdatedAt"` // 数据更新时间
|
||||
DataError string `field:"dataError"` // 数据更新错误
|
||||
Data string `field:"data"` // 原始数据信息
|
||||
Records dbs.JSON `field:"records"` // 所有解析记录
|
||||
Routes dbs.JSON `field:"routes"` // 线路数据
|
||||
IsUp uint8 `field:"isUp"` // 是否在线
|
||||
State uint8 `field:"state"` // 状态
|
||||
IsDeleted uint8 `field:"isDeleted"` // 是否已删除
|
||||
}
|
||||
|
||||
type DNSDomainOperator struct {
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
|
||||
// DecodeRoutes 获取所有的线路
|
||||
func (this *DNSDomain) DecodeRoutes() ([]*dnstypes.Route, error) {
|
||||
if len(this.Routes) == 0 || this.Routes == "null" {
|
||||
if len(this.Routes) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
result := []*dnstypes.Route{}
|
||||
err := json.Unmarshal([]byte(this.Routes), &result)
|
||||
err := json.Unmarshal(this.Routes, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -35,7 +35,7 @@ func (this *DNSDomain) ContainsRouteCode(route string) (bool, error) {
|
||||
// DecodeRecords 获取所有的记录
|
||||
func (this *DNSDomain) DecodeRecords() ([]*dnstypes.Record, error) {
|
||||
records := this.Records
|
||||
if len(records) == 0 || records == "null" {
|
||||
if len(records) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
result := []*dnstypes.Record{}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package dns
|
||||
|
||||
// DNS服务商
|
||||
import "github.com/iwind/TeaGo/dbs"
|
||||
|
||||
// DNSProvider DNS服务商
|
||||
type DNSProvider struct {
|
||||
Id uint32 `field:"id"` // ID
|
||||
Name string `field:"name"` // 名称
|
||||
AdminId uint32 `field:"adminId"` // 管理员ID
|
||||
UserId uint32 `field:"userId"` // 用户ID
|
||||
Type string `field:"type"` // 供应商类型
|
||||
ApiParams string `field:"apiParams"` // API参数
|
||||
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
||||
State uint8 `field:"state"` // 状态
|
||||
DataUpdatedAt uint64 `field:"dataUpdatedAt"` // 数据同步时间
|
||||
Id uint32 `field:"id"` // ID
|
||||
Name string `field:"name"` // 名称
|
||||
AdminId uint32 `field:"adminId"` // 管理员ID
|
||||
UserId uint32 `field:"userId"` // 用户ID
|
||||
Type string `field:"type"` // 供应商类型
|
||||
ApiParams dbs.JSON `field:"apiParams"` // API参数
|
||||
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
||||
State uint8 `field:"state"` // 状态
|
||||
DataUpdatedAt uint64 `field:"dataUpdatedAt"` // 数据同步时间
|
||||
}
|
||||
|
||||
type DNSProviderOperator struct {
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
// 获取API参数
|
||||
// DecodeAPIParams 获取API参数
|
||||
func (this *DNSProvider) DecodeAPIParams() (maps.Map, error) {
|
||||
if len(this.ApiParams) == 0 || this.ApiParams == "null" {
|
||||
if len(this.ApiParams) == 0 {
|
||||
return maps.Map{}, nil
|
||||
}
|
||||
result := maps.Map{}
|
||||
|
||||
Reference in New Issue
Block a user