优化代码

This commit is contained in:
刘祥超
2022-03-22 21:45:07 +08:00
parent 314362c24d
commit 30bfbdc01e
148 changed files with 340 additions and 315 deletions

View File

@@ -74,7 +74,7 @@ func (this *NSAccessLogService) ListNSAccessLogs(ctx context.Context, req *pb.Li
if route != nil {
a.NsRoutes = append(a.NsRoutes, &pb.NSRoute{
Id: types.Int64(route.Id),
IsOn: route.IsOn == 1,
IsOn: route.IsOn,
Name: route.Name,
Code: routeCode,
NsCluster: nil,

View File

@@ -112,7 +112,7 @@ func (this *NSClusterService) FindEnabledNSCluster(ctx context.Context, req *pb.
}
return &pb.FindEnabledNSClusterResponse{NsCluster: &pb.NSCluster{
Id: int64(cluster.Id),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
Name: cluster.Name,
InstallDir: cluster.InstallDir,
}}, nil
@@ -147,7 +147,7 @@ func (this *NSClusterService) ListEnabledNSClusters(ctx context.Context, req *pb
for _, cluster := range clusters {
pbClusters = append(pbClusters, &pb.NSCluster{
Id: int64(cluster.Id),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
Name: cluster.Name,
InstallDir: cluster.InstallDir,
})
@@ -170,7 +170,7 @@ func (this *NSClusterService) FindAllEnabledNSClusters(ctx context.Context, req
for _, cluster := range clusters {
pbClusters = append(pbClusters, &pb.NSCluster{
Id: int64(cluster.Id),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
Name: cluster.Name,
InstallDir: cluster.InstallDir,
})

View File

@@ -108,12 +108,12 @@ func (this *NSDomainService) FindEnabledNSDomain(ctx context.Context, req *pb.Fi
NsDomain: &pb.NSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
TsigJSON: domain.Tsig,
CreatedAt: int64(domain.CreatedAt),
NsCluster: &pb.NSCluster{
Id: int64(cluster.Id),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
Name: cluster.Name,
},
User: pbUser,
@@ -180,12 +180,12 @@ func (this *NSDomainService) ListEnabledNSDomains(ctx context.Context, req *pb.L
pbDomains = append(pbDomains, &pb.NSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
CreatedAt: int64(domain.CreatedAt),
TsigJSON: domain.Tsig,
NsCluster: &pb.NSCluster{
Id: int64(cluster.Id),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
Name: cluster.Name,
},
User: pbUser,
@@ -217,7 +217,7 @@ func (this *NSDomainService) ListNSDomainsAfterVersion(ctx context.Context, req
pbDomains = append(pbDomains, &pb.NSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
IsDeleted: domain.State == nameservers.NSDomainStateDisabled,
Version: int64(domain.Version),
TsigJSON: domain.Tsig,

View File

@@ -76,7 +76,7 @@ func (this *NSKeyService) FindEnabledNSKey(ctx context.Context, req *pb.FindEnab
return &pb.FindEnabledNSKeyResponse{
NsKey: &pb.NSKey{
Id: int64(key.Id),
IsOn: key.IsOn == 1,
IsOn: key.IsOn,
Name: key.Name,
Algo: key.Algo,
Secret: key.Secret,
@@ -116,7 +116,7 @@ func (this *NSKeyService) ListEnabledNSKeys(ctx context.Context, req *pb.ListEna
for _, key := range keys {
pbKeys = append(pbKeys, &pb.NSKey{
Id: int64(key.Id),
IsOn: key.IsOn == 1,
IsOn: key.IsOn,
Name: key.Name,
Algo: key.Algo,
Secret: key.Secret,
@@ -155,7 +155,7 @@ func (this *NSKeyService) ListNSKeysAfterVersion(ctx context.Context, req *pb.Li
pbKeys = append(pbKeys, &pb.NSKey{
Id: int64(key.Id),
IsOn: key.IsOn == 1,
IsOn: key.IsOn,
Name: "",
Algo: key.Algo,
Secret: key.Secret,

View File

@@ -44,7 +44,7 @@ func (this *NSNodeService) FindAllEnabledNSNodesWithNSClusterId(ctx context.Cont
pbNodes = append(pbNodes, &pb.NSNode{
Id: int64(node.Id),
Name: node.Name,
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
IsInstalled: node.IsInstalled == 1,
@@ -120,7 +120,7 @@ func (this *NSNodeService) ListEnabledNSNodesMatch(ctx context.Context, req *pb.
pbNodes = append(pbNodes, &pb.NSNode{
Id: int64(node.Id),
Name: node.Name,
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
IsActive: node.IsActive == 1,
@@ -276,7 +276,7 @@ func (this *NSNodeService) FindEnabledNSNode(ctx context.Context, req *pb.FindEn
Name: clusterName,
},
InstallStatus: installStatusResult,
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
IsActive: node.IsActive == 1,
NodeLogin: respLogin,
}}, nil

View File

@@ -120,7 +120,7 @@ func (this *NSRecordService) ListEnabledNSRecords(ctx context.Context, req *pb.L
Ttl: types.Int32(record.Ttl),
Weight: types.Int32(record.Weight),
CreatedAt: int64(record.CreatedAt),
IsOn: record.IsOn == 1,
IsOn: record.IsOn,
NsDomain: nil,
NsRoutes: pbRoutes,
})
@@ -155,7 +155,7 @@ func (this *NSRecordService) FindEnabledNSRecord(ctx context.Context, req *pb.Fi
var pbDomain = &pb.NSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
}
// 线路
@@ -186,7 +186,7 @@ func (this *NSRecordService) FindEnabledNSRecord(ctx context.Context, req *pb.Fi
Ttl: types.Int32(record.Ttl),
Weight: types.Int32(record.Weight),
CreatedAt: int64(record.CreatedAt),
IsOn: record.IsOn == 1,
IsOn: record.IsOn,
NsDomain: pbDomain,
NsRoutes: pbRoutes,
}}, nil
@@ -237,7 +237,7 @@ func (this *NSRecordService) ListNSRecordsAfterVersion(ctx context.Context, req
Ttl: types.Int32(record.Ttl),
Weight: types.Int32(record.Weight),
IsDeleted: record.State == nameservers.NSRecordStateDisabled,
IsOn: record.IsOn == 1,
IsOn: record.IsOn,
Version: int64(record.Version),
NsDomain: &pb.NSDomain{Id: int64(record.DomainId)},
NsRoutes: pbRoutes,

View File

@@ -83,7 +83,7 @@ func (this *NSRouteService) FindEnabledNSRoute(ctx context.Context, req *pb.Find
if cluster != nil {
pbCluster = &pb.NSCluster{
Id: int64(cluster.Id),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
Name: cluster.Name,
}
}
@@ -100,14 +100,14 @@ func (this *NSRouteService) FindEnabledNSRoute(ctx context.Context, req *pb.Find
pbDomain = &pb.NSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
}
}
}
return &pb.FindEnabledNSRouteResponse{NsRoute: &pb.NSRoute{
Id: int64(route.Id),
IsOn: route.IsOn == 1,
IsOn: route.IsOn,
Name: route.Name,
RangesJSON: route.Ranges,
NsCluster: pbCluster,
@@ -138,7 +138,7 @@ func (this *NSRouteService) FindAllEnabledNSRoutes(ctx context.Context, req *pb.
if cluster != nil {
pbCluster = &pb.NSCluster{
Id: int64(cluster.Id),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
Name: cluster.Name,
}
}
@@ -155,14 +155,14 @@ func (this *NSRouteService) FindAllEnabledNSRoutes(ctx context.Context, req *pb.
pbDomain = &pb.NSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
}
}
}
pbRoutes = append(pbRoutes, &pb.NSRoute{
Id: int64(route.Id),
IsOn: route.IsOn == 1,
IsOn: route.IsOn,
Name: route.Name,
RangesJSON: route.Ranges,
NsCluster: pbCluster,
@@ -216,7 +216,7 @@ func (this *NSRouteService) ListNSRoutesAfterVersion(ctx context.Context, req *p
pbRoutes = append(pbRoutes, &pb.NSRoute{
Id: int64(route.Id),
IsOn: route.IsOn == 1,
IsOn: route.IsOn,
Name: "",
RangesJSON: route.Ranges,
IsDeleted: route.State == nameservers.NSRouteStateDisabled,

View File

@@ -61,7 +61,7 @@ func (this *ACMEProviderAccountService) FindAllACMEProviderAccountsWithProviderC
Id: int64(account.Id),
Name: account.Name,
ProviderCode: account.ProviderCode,
IsOn: account.IsOn == 1,
IsOn: account.IsOn,
EabKid: account.EabKid,
EabKey: account.EabKey,
Error: account.Error,
@@ -137,7 +137,7 @@ func (this *ACMEProviderAccountService) FindEnabledACMEProviderAccount(ctx conte
Id: int64(account.Id),
Name: account.Name,
ProviderCode: account.ProviderCode,
IsOn: account.IsOn == 1,
IsOn: account.IsOn,
EabKid: account.EabKid,
EabKey: account.EabKey,
Error: account.Error,
@@ -191,7 +191,7 @@ func (this *ACMEProviderAccountService) ListEnabledACMEProviderAccounts(ctx cont
Id: int64(account.Id),
Name: account.Name,
ProviderCode: account.ProviderCode,
IsOn: account.IsOn == 1,
IsOn: account.IsOn,
EabKid: account.EabKid,
EabKey: account.EabKey,
Error: account.Error,

View File

@@ -123,7 +123,7 @@ func (this *ACMETaskService) ListEnabledACMETasks(ctx context.Context, req *pb.L
pbACMEUser.AcmeProviderAccount = &pb.ACMEProviderAccount{
Id: int64(account.Id),
Name: account.Name,
IsOn: account.IsOn == 1,
IsOn: account.IsOn,
ProviderCode: account.ProviderCode,
AcmeProvider: nil,
}
@@ -171,7 +171,7 @@ func (this *ACMETaskService) ListEnabledACMETasks(ctx context.Context, req *pb.L
}
pbCert = &pb.SSLCert{
Id: int64(cert.Id),
IsOn: cert.IsOn == 1,
IsOn: cert.IsOn,
Name: cert.Name,
TimeBeginAt: int64(cert.TimeBeginAt),
TimeEndAt: int64(cert.TimeEndAt),
@@ -195,7 +195,7 @@ func (this *ACMETaskService) ListEnabledACMETasks(ctx context.Context, req *pb.L
result = append(result, &pb.ACMETask{
Id: int64(task.Id),
IsOn: task.IsOn == 1,
IsOn: task.IsOn,
DnsDomain: task.DnsDomain,
Domains: task.DecodeDomains(),
CreatedAt: int64(task.CreatedAt),
@@ -370,7 +370,7 @@ func (this *ACMETaskService) FindEnabledACMETask(ctx context.Context, req *pb.Fi
pbACMEUser.AcmeProviderAccount = &pb.ACMEProviderAccount{
Id: int64(account.Id),
Name: account.Name,
IsOn: account.IsOn == 1,
IsOn: account.IsOn,
ProviderCode: account.ProviderCode,
AcmeProvider: nil,
}
@@ -407,7 +407,7 @@ func (this *ACMETaskService) FindEnabledACMETask(ctx context.Context, req *pb.Fi
return &pb.FindEnabledACMETaskResponse{AcmeTask: &pb.ACMETask{
Id: int64(task.Id),
IsOn: task.IsOn == 1,
IsOn: task.IsOn,
DnsDomain: task.DnsDomain,
Domains: task.DecodeDomains(),
CreatedAt: int64(task.CreatedAt),

View File

@@ -147,7 +147,7 @@ func (this *ACMEUserService) ListACMEUsers(ctx context.Context, req *pb.ListACME
pbUser.AcmeProviderAccount = &pb.ACMEProviderAccount{
Id: int64(account.Id),
Name: account.Name,
IsOn: account.IsOn == 1,
IsOn: account.IsOn,
ProviderCode: account.ProviderCode,
AcmeProvider: nil,
}
@@ -229,7 +229,7 @@ func (this *ACMEUserService) FindEnabledACMEUser(ctx context.Context, req *pb.Fi
pbACMEUser.AcmeProviderAccount = &pb.ACMEProviderAccount{
Id: int64(account.Id),
Name: account.Name,
IsOn: account.IsOn == 1,
IsOn: account.IsOn,
ProviderCode: account.ProviderCode,
AcmeProvider: nil,
}

View File

@@ -174,7 +174,7 @@ func (this *AdminService) FindEnabledAdmin(ctx context.Context, req *pb.FindEnab
Id: int64(adminAuth.Id),
Type: adminAuth.Type,
ParamsJSON: adminAuth.Params,
IsOn: adminAuth.IsOn == 1,
IsOn: adminAuth.IsOn,
}
}
}
@@ -183,7 +183,7 @@ func (this *AdminService) FindEnabledAdmin(ctx context.Context, req *pb.FindEnab
Id: int64(admin.Id),
Fullname: admin.Fullname,
Username: admin.Username,
IsOn: admin.IsOn == 1,
IsOn: admin.IsOn,
IsSuper: admin.IsSuper == 1,
Modules: pbModules,
OtpLogin: pbOtpAuth,
@@ -394,7 +394,7 @@ func (this *AdminService) ListEnabledAdmins(ctx context.Context, req *pb.ListEna
Id: int64(adminAuth.Id),
Type: adminAuth.Type,
ParamsJSON: adminAuth.Params,
IsOn: adminAuth.IsOn == 1,
IsOn: adminAuth.IsOn,
}
}
}
@@ -403,7 +403,7 @@ func (this *AdminService) ListEnabledAdmins(ctx context.Context, req *pb.ListEna
Id: int64(admin.Id),
Fullname: admin.Fullname,
Username: admin.Username,
IsOn: admin.IsOn == 1,
IsOn: admin.IsOn,
IsSuper: admin.IsSuper == 1,
CreatedAt: int64(admin.CreatedAt),
OtpLogin: pbOtpAuth,

View File

@@ -87,7 +87,7 @@ func (this *APINodeService) FindAllEnabledAPINodes(ctx context.Context, req *pb.
result = append(result, &pb.APINode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
NodeClusterId: int64(node.ClusterId),
UniqueId: node.UniqueId,
Secret: node.Secret,
@@ -160,7 +160,7 @@ func (this *APINodeService) ListEnabledAPINodes(ctx context.Context, req *pb.Lis
result = append(result, &pb.APINode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
NodeClusterId: int64(node.ClusterId),
UniqueId: node.UniqueId,
Secret: node.Secret,
@@ -205,7 +205,7 @@ func (this *APINodeService) FindEnabledAPINode(ctx context.Context, req *pb.Find
result := &pb.APINode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
NodeClusterId: int64(node.ClusterId),
UniqueId: node.UniqueId,
Secret: node.Secret,
@@ -256,7 +256,7 @@ func (this *APINodeService) FindCurrentAPINode(ctx context.Context, req *pb.Find
return &pb.FindCurrentAPINodeResponse{ApiNode: &pb.APINode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
NodeClusterId: 0,
UniqueId: "",
Secret: "",

View File

@@ -82,7 +82,7 @@ func (this *AuthorityNodeService) FindAllEnabledAuthorityNodes(ctx context.Conte
for _, node := range nodes {
result = append(result, &pb.AuthorityNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -128,7 +128,7 @@ func (this *AuthorityNodeService) ListEnabledAuthorityNodes(ctx context.Context,
for _, node := range nodes {
result = append(result, &pb.AuthorityNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -160,7 +160,7 @@ func (this *AuthorityNodeService) FindEnabledAuthorityNode(ctx context.Context,
result := &pb.AuthorityNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -198,7 +198,7 @@ func (this *AuthorityNodeService) FindCurrentAuthorityNode(ctx context.Context,
result := &pb.AuthorityNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,

View File

@@ -104,7 +104,7 @@ func (this *DBNodeService) ListEnabledDBNodes(ctx context.Context, req *pb.ListE
status := &pb.DBNodeStatus{}
// 是否能够连接
if node.IsOn == 1 {
if node.IsOn {
db, err := dbs.NewInstanceFromConfig(node.DBConfig())
if err != nil {
status.Error = err.Error()
@@ -132,7 +132,7 @@ func (this *DBNodeService) ListEnabledDBNodes(ctx context.Context, req *pb.ListE
Id: int64(node.Id),
Name: node.Name,
Description: node.Description,
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
Host: node.Host,
Port: types.Int32(node.Port),
Database: node.Database,
@@ -166,7 +166,7 @@ func (this *DBNodeService) FindEnabledDBNode(ctx context.Context, req *pb.FindEn
Id: int64(node.Id),
Name: node.Name,
Description: node.Description,
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
Host: node.Host,
Port: types.Int32(node.Port),
Database: node.Database,
@@ -318,7 +318,7 @@ func (this *DBNodeService) CheckDBNodeStatus(ctx context.Context, req *pb.CheckD
status := &pb.DBNodeStatus{}
// 是否能够连接
if node.IsOn == 1 {
if node.IsOn {
db, err := dbs.NewInstanceFromConfig(node.DBConfig())
if err != nil {
status.Error = err.Error()

View File

@@ -190,7 +190,7 @@ func (this *DNSDomainService) FindEnabledBasicDNSDomain(ctx context.Context, req
return &pb.FindEnabledBasicDNSDomainResponse{DnsDomain: &pb.DNSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
ProviderId: int64(domain.ProviderId),
}}, nil
}
@@ -259,7 +259,7 @@ func (this *DNSDomainService) FindAllEnabledBasicDNSDomainsWithDNSProviderId(ctx
result = append(result, &pb.DNSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
IsUp: domain.IsUp == 1,
IsDeleted: domain.IsDeleted == 1,
})
@@ -389,7 +389,7 @@ func (this *DNSDomainService) convertDomainToPB(tx *dbs.Tx, domain *dns.DNSDomai
Id: int64(domain.Id),
ProviderId: int64(domain.ProviderId),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
IsUp: domain.IsUp == 1,
IsDeleted: domain.IsDeleted == 1,
DataUpdatedAt: int64(domain.DataUpdatedAt),

View File

@@ -43,7 +43,7 @@ func (this *HTTPAccessLogPolicyService) ListEnabledHTTPAccessLogPolicies(ctx con
pbPolicies = append(pbPolicies, &pb.HTTPAccessLogPolicy{
Id: int64(policy.Id),
Name: policy.Name,
IsOn: policy.IsOn == 1,
IsOn: policy.IsOn,
Type: policy.Type,
OptionsJSON: policy.Options,
CondsJSON: policy.Conds,
@@ -121,7 +121,7 @@ func (this *HTTPAccessLogPolicyService) FindEnabledHTTPAccessLogPolicy(ctx conte
return &pb.FindEnabledHTTPAccessLogPolicyResponse{HttpAccessLogPolicy: &pb.HTTPAccessLogPolicy{
Id: int64(policy.Id),
Name: policy.Name,
IsOn: policy.IsOn == 1,
IsOn: policy.IsOn,
Type: policy.Type,
OptionsJSON: policy.Options,
CondsJSON: policy.Conds,

View File

@@ -61,7 +61,7 @@ func (this *HTTPAuthPolicyService) FindEnabledHTTPAuthPolicy(ctx context.Context
return &pb.FindEnabledHTTPAuthPolicyResponse{HttpAuthPolicy: &pb.HTTPAuthPolicy{
Id: int64(policy.Id),
IsOn: policy.IsOn == 1,
IsOn: policy.IsOn,
Name: policy.Name,
Type: policy.Type,
ParamsJSON: policy.Params,

View File

@@ -30,7 +30,7 @@ func (this *HTTPCachePolicyService) FindAllEnabledHTTPCachePolicies(ctx context.
result = append(result, &pb.HTTPCachePolicy{
Id: int64(p.Id),
Name: p.Name,
IsOn: p.IsOn == 1,
IsOn: p.IsOn,
})
}
return &pb.FindAllEnabledHTTPCachePoliciesResponse{CachePolicies: result}, nil
@@ -164,7 +164,7 @@ func (this *HTTPCachePolicyService) FindEnabledHTTPCachePolicy(ctx context.Conte
return &pb.FindEnabledHTTPCachePolicyResponse{HttpCachePolicy: &pb.HTTPCachePolicy{
Id: int64(policy.Id),
Name: policy.Name,
IsOn: policy.IsOn == 1,
IsOn: policy.IsOn,
}}, nil
}

View File

@@ -75,7 +75,7 @@ func (this *HTTPFastcgiService) FindEnabledHTTPFastcgi(ctx context.Context, req
}
return &pb.FindEnabledHTTPFastcgiResponse{HttpFastcgi: &pb.HTTPFastcgi{
Id: int64(fastcgi.Id),
IsOn: fastcgi.IsOn == 1,
IsOn: fastcgi.IsOn,
Address: fastcgi.Address,
ParamsJSON: fastcgi.Params,
ReadTimeoutJSON: fastcgi.ReadTimeout,

View File

@@ -40,7 +40,7 @@ func (this *HTTPFirewallPolicyService) FindAllEnabledHTTPFirewallPolicies(ctx co
Id: int64(p.Id),
Name: p.Name,
Description: p.Description,
IsOn: p.IsOn == 1,
IsOn: p.IsOn,
InboundJSON: p.Inbound,
OutboundJSON: p.Outbound,
Mode: p.Mode,
@@ -389,7 +389,7 @@ func (this *HTTPFirewallPolicyService) ListEnabledHTTPFirewallPolicies(ctx conte
Id: int64(p.Id),
Name: p.Name,
Description: p.Description,
IsOn: p.IsOn == 1,
IsOn: p.IsOn,
InboundJSON: p.Inbound,
OutboundJSON: p.Outbound,
Mode: p.Mode,
@@ -481,7 +481,7 @@ func (this *HTTPFirewallPolicyService) FindEnabledHTTPFirewallPolicy(ctx context
ServerId: int64(policy.ServerId),
Name: policy.Name,
Description: policy.Description,
IsOn: policy.IsOn == 1,
IsOn: policy.IsOn,
InboundJSON: policy.Inbound,
OutboundJSON: policy.Outbound,
Mode: policy.Mode,

View File

@@ -147,7 +147,7 @@ func (this *HTTPFirewallRuleGroupService) FindEnabledHTTPFirewallRuleGroup(ctx c
FirewallRuleGroup: &pb.HTTPFirewallRuleGroup{
Id: int64(group.Id),
Name: group.Name,
IsOn: group.IsOn == 1,
IsOn: group.IsOn,
Description: group.Description,
Code: group.Code,
},

View File

@@ -131,7 +131,7 @@ func (this *HTTPFirewallRuleSetService) FindEnabledHTTPFirewallRuleSet(ctx conte
FirewallRuleSet: &pb.HTTPFirewallRuleSet{
Id: int64(set.Id),
Name: set.Name,
IsOn: set.IsOn == 1,
IsOn: set.IsOn,
Description: set.Description,
Code: set.Code,
},

View File

@@ -61,7 +61,7 @@ func (this *HTTPWebService) FindEnabledHTTPWeb(ctx context.Context, req *pb.Find
result := &pb.HTTPWeb{}
result.Id = int64(web.Id)
result.IsOn = web.IsOn == 1
result.IsOn = web.IsOn
return &pb.FindEnabledHTTPWebResponse{HttpWeb: result}, nil
}

View File

@@ -66,7 +66,7 @@ func (this *IPListService) FindEnabledIPList(ctx context.Context, req *pb.FindEn
}
return &pb.FindEnabledIPListResponse{IpList: &pb.IPList{
Id: int64(list.Id),
IsOn: list.IsOn == 1,
IsOn: list.IsOn,
Type: list.Type,
Name: list.Name,
Code: list.Code,
@@ -107,7 +107,7 @@ func (this *IPListService) ListEnabledIPLists(ctx context.Context, req *pb.ListE
for _, list := range ipLists {
pbLists = append(pbLists, &pb.IPList{
Id: int64(list.Id),
IsOn: list.IsOn == 1,
IsOn: list.IsOn,
Type: list.Type,
Name: list.Name,
Code: list.Code,
@@ -190,7 +190,7 @@ func (this *IPListService) FindEnabledIPListContainsIP(ctx context.Context, req
}
pbLists = append(pbLists, &pb.IPList{
Id: int64(list.Id),
IsOn: list.IsOn == 1,
IsOn: list.IsOn,
Type: list.Type,
Name: list.Name,
Code: list.Code,

View File

@@ -34,7 +34,7 @@ func (this *LoginService) FindEnabledLogin(ctx context.Context, req *pb.FindEnab
Id: int64(login.Id),
Type: login.Type,
ParamsJSON: login.Params,
IsOn: login.IsOn == 1,
IsOn: login.IsOn,
AdminId: int64(login.AdminId),
UserId: int64(login.UserId),
}}, nil

View File

@@ -31,7 +31,7 @@ func (this *MessageMediaService) FindAllMessageMedias(ctx context.Context, req *
Name: media.Name,
Description: media.Description,
UserDescription: media.UserDescription,
IsOn: media.IsOn == 1,
IsOn: media.IsOn,
})
}
return &pb.FindAllMessageMediasResponse{MessageMedias: pbMedias}, nil

View File

@@ -123,13 +123,13 @@ func (this *MessageMediaInstanceService) ListEnabledMessageMediaInstances(ctx co
Name: media.Name,
Description: media.Description,
UserDescription: media.UserDescription,
IsOn: media.IsOn == 1,
IsOn: media.IsOn,
}
pbInstances = append(pbInstances, &pb.MessageMediaInstance{
Id: int64(instance.Id),
Name: instance.Name,
IsOn: instance.IsOn == 1,
IsOn: instance.IsOn,
MessageMedia: pbMedia,
ParamsJSON: instance.Params,
Description: instance.Description,
@@ -171,13 +171,13 @@ func (this *MessageMediaInstanceService) FindEnabledMessageMediaInstance(ctx con
Name: media.Name,
Description: media.Description,
UserDescription: media.UserDescription,
IsOn: media.IsOn == 1,
IsOn: media.IsOn,
}
return &pb.FindEnabledMessageMediaInstanceResponse{MessageMediaInstance: &pb.MessageMediaInstance{
Id: int64(instance.Id),
Name: instance.Name,
IsOn: instance.IsOn == 1,
IsOn: instance.IsOn,
MessageMedia: pbMedia,
ParamsJSON: instance.Params,
Description: instance.Description,

View File

@@ -113,14 +113,14 @@ func (this *MessageReceiverService) FindAllEnabledMessageReceivers(ctx context.C
Id: int64(admin.Id),
Fullname: admin.Fullname,
Username: admin.Username,
IsOn: admin.IsOn == 1,
IsOn: admin.IsOn,
},
MessageMediaInstance: &pb.MessageMediaInstance{
Id: int64(instance.Id),
Name: instance.Name,
IsOn: instance.IsOn == 1,
IsOn: instance.IsOn,
},
IsOn: recipient.IsOn == 1,
IsOn: recipient.IsOn,
MessageRecipientGroups: nil,
Description: "",
User: "",
@@ -140,7 +140,7 @@ func (this *MessageReceiverService) FindAllEnabledMessageReceivers(ctx context.C
pbRecipientGroup = &pb.MessageRecipientGroup{
Id: int64(group.Id),
Name: group.Name,
IsOn: group.IsOn == 1,
IsOn: group.IsOn,
}
}

View File

@@ -102,7 +102,7 @@ func (this *MessageRecipientService) ListEnabledMessageRecipients(ctx context.Co
Id: int64(admin.Id),
Fullname: admin.Fullname,
Username: admin.Username,
IsOn: admin.IsOn == 1,
IsOn: admin.IsOn,
}
// 媒介实例
@@ -115,7 +115,7 @@ func (this *MessageRecipientService) ListEnabledMessageRecipients(ctx context.Co
}
pbInstance := &pb.MessageMediaInstance{
Id: int64(instance.Id),
IsOn: instance.IsOn == 1,
IsOn: instance.IsOn,
Name: instance.Name,
Description: instance.Description,
}
@@ -133,7 +133,7 @@ func (this *MessageRecipientService) ListEnabledMessageRecipients(ctx context.Co
pbGroups = append(pbGroups, &pb.MessageRecipientGroup{
Id: int64(group.Id),
Name: group.Name,
IsOn: group.IsOn == 1,
IsOn: group.IsOn,
})
}
}
@@ -144,7 +144,7 @@ func (this *MessageRecipientService) ListEnabledMessageRecipients(ctx context.Co
Admin: pbAdmin,
User: recipient.User,
MessageMediaInstance: pbInstance,
IsOn: recipient.IsOn == 1,
IsOn: recipient.IsOn,
MessageRecipientGroups: pbGroups,
Description: recipient.Description,
TimeFrom: recipient.TimeFrom,
@@ -184,7 +184,7 @@ func (this *MessageRecipientService) FindEnabledMessageRecipient(ctx context.Con
Id: int64(admin.Id),
Fullname: admin.Fullname,
Username: admin.Username,
IsOn: admin.IsOn == 1,
IsOn: admin.IsOn,
}
// 媒介实例
@@ -197,7 +197,7 @@ func (this *MessageRecipientService) FindEnabledMessageRecipient(ctx context.Con
}
pbInstance := &pb.MessageMediaInstance{
Id: int64(instance.Id),
IsOn: instance.IsOn == 1,
IsOn: instance.IsOn,
Name: instance.Name,
Description: instance.Description,
}
@@ -215,7 +215,7 @@ func (this *MessageRecipientService) FindEnabledMessageRecipient(ctx context.Con
pbGroups = append(pbGroups, &pb.MessageRecipientGroup{
Id: int64(group.Id),
Name: group.Name,
IsOn: group.IsOn == 1,
IsOn: group.IsOn,
})
}
}
@@ -226,7 +226,7 @@ func (this *MessageRecipientService) FindEnabledMessageRecipient(ctx context.Con
User: recipient.User,
Admin: pbAdmin,
MessageMediaInstance: pbInstance,
IsOn: recipient.IsOn == 1,
IsOn: recipient.IsOn,
MessageRecipientGroups: pbGroups,
Description: recipient.Description,
TimeFrom: recipient.TimeFrom,

View File

@@ -60,7 +60,7 @@ func (this *MessageRecipientGroupService) FindAllEnabledMessageRecipientGroups(c
pbGroups = append(pbGroups, &pb.MessageRecipientGroup{
Id: int64(group.Id),
Name: group.Name,
IsOn: group.IsOn == 1,
IsOn: group.IsOn,
})
}
@@ -99,7 +99,7 @@ func (this *MessageRecipientGroupService) FindEnabledMessageRecipientGroup(ctx c
}
pbGroup := &pb.MessageRecipientGroup{
Id: int64(group.Id),
IsOn: group.IsOn == 1,
IsOn: group.IsOn,
Name: group.Name,
}
return &pb.FindEnabledMessageRecipientGroupResponse{MessageRecipientGroup: pbGroup}, nil

View File

@@ -51,7 +51,7 @@ func (this *MessageTaskService) FindSendingMessageTasks(ctx context.Context, req
if err != nil {
return nil, err
}
if recipient == nil || recipient.IsOn == 0 {
if recipient == nil || !recipient.IsOn {
// 如果发送人已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {
@@ -65,7 +65,7 @@ func (this *MessageTaskService) FindSendingMessageTasks(ctx context.Context, req
if err != nil {
return nil, err
}
if instance == nil || instance.IsOn == 0 {
if instance == nil || !instance.IsOn {
// 如果媒介实例已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {
@@ -92,7 +92,7 @@ func (this *MessageTaskService) FindSendingMessageTasks(ctx context.Context, req
if err != nil {
return nil, err
}
if instance == nil || instance.IsOn == 0 {
if instance == nil || !instance.IsOn {
// 如果媒介实例已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {
@@ -202,7 +202,7 @@ func (this *MessageTaskService) FindEnabledMessageTask(ctx context.Context, req
if err != nil {
return nil, err
}
if recipient == nil || recipient.IsOn == 0 {
if recipient == nil || !recipient.IsOn {
// 如果发送人已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {
@@ -216,7 +216,7 @@ func (this *MessageTaskService) FindEnabledMessageTask(ctx context.Context, req
if err != nil {
return nil, err
}
if instance == nil || instance.IsOn == 0 {
if instance == nil || !instance.IsOn {
// 如果媒介实例已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {
@@ -241,7 +241,7 @@ func (this *MessageTaskService) FindEnabledMessageTask(ctx context.Context, req
if err != nil {
return nil, err
}
if instance == nil || instance.IsOn == 0 {
if instance == nil || !instance.IsOn {
// 如果媒介实例已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {
@@ -320,7 +320,7 @@ func (this *MessageTaskService) ListMessageTasksWithStatus(ctx context.Context,
if err != nil {
return nil, err
}
if recipient == nil || recipient.IsOn == 0 {
if recipient == nil || !recipient.IsOn {
// 如果发送人已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {
@@ -334,7 +334,7 @@ func (this *MessageTaskService) ListMessageTasksWithStatus(ctx context.Context,
if err != nil {
return nil, err
}
if instance == nil || instance.IsOn == 0 {
if instance == nil || !instance.IsOn {
// 如果媒介实例已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {
@@ -362,7 +362,7 @@ func (this *MessageTaskService) ListMessageTasksWithStatus(ctx context.Context,
if err != nil {
return nil, err
}
if instance == nil || instance.IsOn == 0 {
if instance == nil || !instance.IsOn {
// 如果媒介实例已经删除或者禁用,则删除此消息
err = models.SharedMessageTaskDAO.DisableMessageTask(tx, int64(task.Id))
if err != nil {

View File

@@ -85,7 +85,7 @@ func (this *MetricChartService) FindEnabledMetricChart(ctx context.Context, req
ParamsJSON: chart.Params,
IgnoreEmptyKeys: chart.IgnoreEmptyKeys == 1,
IgnoredKeys: chart.DecodeIgnoredKeys(),
IsOn: chart.IsOn == 1,
IsOn: chart.IsOn,
MetricItem: &pb.MetricItem{Id: int64(chart.ItemId)},
},
}, nil
@@ -129,7 +129,7 @@ func (this *MetricChartService) ListEnabledMetricCharts(ctx context.Context, req
ParamsJSON: chart.Params,
IgnoreEmptyKeys: chart.IgnoreEmptyKeys == 1,
IgnoredKeys: chart.DecodeIgnoredKeys(),
IsOn: chart.IsOn == 1,
IsOn: chart.IsOn,
})
}
return &pb.ListEnabledMetricChartsResponse{MetricCharts: pbCharts}, nil

View File

@@ -61,7 +61,7 @@ func (this *MetricItemService) FindEnabledMetricItem(ctx context.Context, req *p
}
return &pb.FindEnabledMetricItemResponse{MetricItem: &pb.MetricItem{
Id: int64(item.Id),
IsOn: item.IsOn == 1,
IsOn: item.IsOn,
Code: item.Code,
Category: item.Category,
Name: item.Name,
@@ -104,7 +104,7 @@ func (this *MetricItemService) ListEnabledMetricItems(ctx context.Context, req *
for _, item := range items {
pbItems = append(pbItems, &pb.MetricItem{
Id: int64(item.Id),
IsOn: item.IsOn == 1,
IsOn: item.IsOn,
Code: item.Code,
Category: item.Category,
Name: item.Name,

View File

@@ -82,7 +82,7 @@ func (this *MonitorNodeService) FindAllEnabledMonitorNodes(ctx context.Context,
for _, node := range nodes {
result = append(result, &pb.MonitorNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -128,7 +128,7 @@ func (this *MonitorNodeService) ListEnabledMonitorNodes(ctx context.Context, req
for _, node := range nodes {
result = append(result, &pb.MonitorNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -160,7 +160,7 @@ func (this *MonitorNodeService) FindEnabledMonitorNode(ctx context.Context, req
result := &pb.MonitorNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -198,7 +198,7 @@ func (this *MonitorNodeService) FindCurrentMonitorNode(ctx context.Context, req
result := &pb.MonitorNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,

View File

@@ -238,7 +238,7 @@ func (this *NodeService) ListEnabledNodesMatch(ctx context.Context, req *pb.List
for _, secondaryCluster := range secondaryClusters {
pbSecondaryClusters = append(pbSecondaryClusters, &pb.NodeCluster{
Id: int64(secondaryCluster.Id),
IsOn: secondaryCluster.IsOn == 1,
IsOn: secondaryCluster.IsOn,
Name: secondaryCluster.Name,
})
}
@@ -303,7 +303,7 @@ func (this *NodeService) ListEnabledNodesMatch(ctx context.Context, req *pb.List
if region != nil {
pbRegion = &pb.NodeRegion{
Id: int64(region.Id),
IsOn: region.IsOn == 1,
IsOn: region.IsOn,
Name: region.Name,
}
}
@@ -322,7 +322,7 @@ func (this *NodeService) ListEnabledNodesMatch(ctx context.Context, req *pb.List
SecondaryNodeClusters: pbSecondaryClusters,
InstallStatus: installStatusResult,
MaxCPU: types.Int32(node.MaxCPU),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
IsUp: node.IsUp == 1,
NodeGroup: pbGroup,
NodeRegion: pbRegion,
@@ -369,7 +369,7 @@ func (this *NodeService) FindAllEnabledNodesWithNodeClusterId(ctx context.Contex
Secret: node.Secret,
ConnectedAPINodeIds: apiNodeIds,
MaxCPU: types.Int32(node.MaxCPU),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
})
}
return &pb.FindAllEnabledNodesWithNodeClusterIdResponse{Nodes: result}, nil
@@ -466,7 +466,7 @@ func (this *NodeService) FindEnabledNode(ctx context.Context, req *pb.FindEnable
}
secondaryPBClusters = append(secondaryPBClusters, &pb.NodeCluster{
Id: int64(cluster.Id),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
Name: cluster.Name,
})
}
@@ -528,7 +528,7 @@ func (this *NodeService) FindEnabledNode(ctx context.Context, req *pb.FindEnable
if region != nil {
pbRegion = &pb.NodeRegion{
Id: int64(region.Id),
IsOn: region.IsOn == 1,
IsOn: region.IsOn,
Name: region.Name,
}
}
@@ -572,7 +572,7 @@ func (this *NodeService) FindEnabledNode(ctx context.Context, req *pb.FindEnable
NodeLogin: respLogin,
InstallStatus: installStatusResult,
MaxCPU: types.Int32(node.MaxCPU),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
IsUp: node.IsUp == 1,
NodeGroup: pbGroup,
NodeRegion: pbRegion,
@@ -606,7 +606,7 @@ func (this *NodeService) FindEnabledBasicNode(ctx context.Context, req *pb.FindE
return &pb.FindEnabledBasicNodeResponse{Node: &pb.BasicNode{
Id: int64(node.Id),
Name: node.Name,
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
IsUp: node.IsUp == 1,
NodeCluster: &pb.NodeCluster{
Id: int64(node.ClusterId),
@@ -881,7 +881,7 @@ func (this *NodeService) FindAllEnabledNodesWithNodeGrantId(ctx context.Context,
Id: int64(node.ClusterId),
Name: clusterName,
},
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
})
}
@@ -975,7 +975,7 @@ func (this *NodeService) FindAllNotInstalledNodesWithNodeClusterId(ctx context.C
Version: int64(node.Version),
IsInstalled: node.IsInstalled == 1,
StatusJSON: node.Status,
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
NodeLogin: pbLogin,
IpAddresses: pbAddresses,
InstallStatus: pbInstallStatus,
@@ -1093,7 +1093,7 @@ func (this *NodeService) FindAllUpgradeNodesWithNodeClusterId(ctx context.Contex
Version: int64(node.Version),
IsInstalled: node.IsInstalled == 1,
StatusJSON: node.Status,
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
IpAddresses: pbAddresses,
NodeLogin: pbLogin,
InstallStatus: pbInstallStatus,
@@ -1451,7 +1451,7 @@ func (this *NodeService) FindEnabledNodesWithIds(ctx context.Context, req *pb.Fi
}
pbNodes = append(pbNodes, &pb.Node{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
IsActive: node.IsActive == 1,
ConnectedAPINodeIds: connectedAPINodeIds,
})

View File

@@ -159,7 +159,7 @@ func (this *NodeClusterService) FindEnabledNodeCluster(ctx context.Context, req
HttpFirewallPolicyId: int64(cluster.HttpFirewallPolicyId),
DnsName: cluster.DnsName,
DnsDomainId: int64(cluster.DnsDomainId),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
TimeZone: cluster.TimeZone,
NodeMaxThreads: int32(cluster.NodeMaxThreads),
NodeTCPMaxConnections: int32(cluster.NodeTCPMaxConnections),
@@ -207,7 +207,7 @@ func (this *NodeClusterService) FindAPINodesWithNodeCluster(ctx context.Context,
}
apiNodes = append(apiNodes, &pb.APINode{
Id: int64(apiNode.Id),
IsOn: apiNode.IsOn == 1,
IsOn: apiNode.IsOn,
NodeClusterId: int64(apiNode.ClusterId),
Name: apiNode.Name,
Description: apiNode.Description,
@@ -244,7 +244,7 @@ func (this *NodeClusterService) FindAllEnabledNodeClusters(ctx context.Context,
CreatedAt: int64(cluster.CreatedAt),
UniqueId: cluster.UniqueId,
Secret: cluster.Secret,
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
})
}
@@ -296,7 +296,7 @@ func (this *NodeClusterService) ListEnabledNodeClusters(ctx context.Context, req
Secret: cluster.Secret,
DnsName: cluster.DnsName,
DnsDomainId: int64(cluster.DnsDomainId),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
TimeZone: cluster.TimeZone,
IsPinned: cluster.IsPinned == 1,
})
@@ -412,7 +412,7 @@ func (this *NodeClusterService) FindAllEnabledNodeClustersWithNodeGrantId(ctx co
CreatedAt: int64(cluster.CreatedAt),
UniqueId: cluster.UniqueId,
Secret: cluster.Secret,
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
})
}
return &pb.FindAllEnabledNodeClustersWithNodeGrantIdResponse{NodeClusters: result}, nil
@@ -471,7 +471,7 @@ func (this *NodeClusterService) FindEnabledNodeClusterDNS(ctx context.Context, r
pbDomain := &pb.DNSDomain{
Id: int64(domain.Id),
Name: domain.Name,
IsOn: domain.IsOn == 1,
IsOn: domain.IsOn,
}
provider, err := dns.SharedDNSProviderDAO.FindEnabledDNSProvider(tx, int64(domain.ProviderId))
@@ -572,7 +572,7 @@ func (this *NodeClusterService) FindAllEnabledNodeClustersWithDNSDomainId(ctx co
Name: cluster.Name,
DnsName: cluster.DnsName,
DnsDomainId: int64(cluster.DnsDomainId),
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
})
}
return &pb.FindAllEnabledNodeClustersWithDNSDomainIdResponse{NodeClusters: result}, nil
@@ -733,7 +733,7 @@ func (this *NodeClusterService) FindAllEnabledNodeClustersWithHTTPCachePolicyId(
result = append(result, &pb.NodeCluster{
Id: int64(cluster.Id),
Name: cluster.Name,
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
})
}
return &pb.FindAllEnabledNodeClustersWithHTTPCachePolicyIdResponse{
@@ -775,7 +775,7 @@ func (this *NodeClusterService) FindAllEnabledNodeClustersWithHTTPFirewallPolicy
result = append(result, &pb.NodeCluster{
Id: int64(cluster.Id),
Name: cluster.Name,
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
})
}
return &pb.FindAllEnabledNodeClustersWithHTTPFirewallPolicyIdResponse{
@@ -953,7 +953,7 @@ func (this *NodeClusterService) FindLatestNodeClusters(ctx context.Context, req
pbClusters = append(pbClusters, &pb.NodeCluster{
Id: int64(cluster.Id),
Name: cluster.Name,
IsOn: cluster.IsOn == 1,
IsOn: cluster.IsOn,
})
}
return &pb.FindLatestNodeClustersResponse{NodeClusters: pbClusters}, nil

View File

@@ -71,7 +71,7 @@ func (this *NodeClusterMetricItemService) FindAllNodeClusterMetricItems(ctx cont
if item != nil {
pbItems = append(pbItems, &pb.MetricItem{
Id: int64(item.Id),
IsOn: item.IsOn == 1,
IsOn: item.IsOn,
Code: item.Code,
Category: item.Category,
Name: item.Name,

View File

@@ -156,7 +156,7 @@ func (this *NodeIPAddressService) FindEnabledNodeIPAddress(ctx context.Context,
State: int64(address.State),
Order: int64(address.Order),
CanAccess: address.CanAccess == 1,
IsOn: address.IsOn == 1,
IsOn: address.IsOn,
IsUp: address.IsUp == 1,
BackupIP: address.DecodeBackupIP(),
}
@@ -192,7 +192,7 @@ func (this *NodeIPAddressService) FindAllEnabledNodeIPAddressesWithNodeId(ctx co
State: int64(address.State),
Order: int64(address.Order),
CanAccess: address.CanAccess == 1,
IsOn: address.IsOn == 1,
IsOn: address.IsOn,
IsUp: address.IsUp == 1,
BackupIP: address.DecodeBackupIP(),
})
@@ -242,7 +242,7 @@ func (this *NodeIPAddressService) ListEnabledNodeIPAddresses(ctx context.Context
Ip: addr.Ip,
Description: addr.Description,
CanAccess: addr.CanAccess == 1,
IsOn: addr.IsOn == 1,
IsOn: addr.IsOn,
IsUp: addr.IsUp == 1,
BackupIP: addr.DecodeBackupIP(),
})

View File

@@ -78,7 +78,7 @@ func (this *NodeIPAddressLogService) ListNodeIPAddressLogs(ctx context.Context,
Id: int64(log.Id),
Description: log.Description,
CreatedAt: int64(log.CreatedAt),
IsOn: log.IsOn == 1,
IsOn: log.IsOn,
IsUp: log.IsUp == 1,
CanAccess: log.CanAccess == 1,
BackupIP: log.BackupIP,

View File

@@ -76,7 +76,7 @@ func (this *NodePriceItemService) FindAllEnabledNodePriceItems(ctx context.Conte
for _, price := range prices {
result = append(result, &pb.NodePriceItem{
Id: int64(price.Id),
IsOn: price.IsOn == 1,
IsOn: price.IsOn,
Name: price.Name,
Type: price.Type,
BitsFrom: int64(price.BitsFrom),
@@ -87,7 +87,7 @@ func (this *NodePriceItemService) FindAllEnabledNodePriceItems(ctx context.Conte
return &pb.FindAllEnabledNodePriceItemsResponse{NodePriceItems: result}, nil
}
// 查找所有启用的区域价格
// FindAllEnabledAndOnNodePriceItems 查找所有启用的区域价格
func (this *NodePriceItemService) FindAllEnabledAndOnNodePriceItems(ctx context.Context, req *pb.FindAllEnabledAndOnNodePriceItemsRequest) (*pb.FindAllEnabledAndOnNodePriceItemsResponse, error) {
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
@@ -104,7 +104,7 @@ func (this *NodePriceItemService) FindAllEnabledAndOnNodePriceItems(ctx context.
for _, price := range prices {
result = append(result, &pb.NodePriceItem{
Id: int64(price.Id),
IsOn: price.IsOn == 1,
IsOn: price.IsOn,
Name: price.Name,
Type: price.Type,
BitsFrom: int64(price.BitsFrom),
@@ -133,7 +133,7 @@ func (this *NodePriceItemService) FindEnabledNodePriceItem(ctx context.Context,
}
return &pb.FindEnabledNodePriceItemResponse{NodePriceItem: &pb.NodePriceItem{
Id: int64(price.Id),
IsOn: price.IsOn == 1,
IsOn: price.IsOn,
Name: price.Name,
Type: price.Type,
BitsFrom: int64(price.BitsFrom),

View File

@@ -76,7 +76,7 @@ func (this *NodeRegionService) FindAllEnabledNodeRegions(ctx context.Context, re
for _, region := range regions {
result = append(result, &pb.NodeRegion{
Id: int64(region.Id),
IsOn: region.IsOn == 1,
IsOn: region.IsOn,
Name: region.Name,
Description: region.Description,
PricesJSON: region.Prices,
@@ -102,7 +102,7 @@ func (this *NodeRegionService) FindAllEnabledAndOnNodeRegions(ctx context.Contex
for _, region := range regions {
result = append(result, &pb.NodeRegion{
Id: int64(region.Id),
IsOn: region.IsOn == 1,
IsOn: region.IsOn,
Name: region.Name,
Description: region.Description,
PricesJSON: region.Prices,
@@ -145,7 +145,7 @@ func (this *NodeRegionService) FindEnabledNodeRegion(ctx context.Context, req *p
}
return &pb.FindEnabledNodeRegionResponse{NodeRegion: &pb.NodeRegion{
Id: int64(region.Id),
IsOn: region.IsOn == 1,
IsOn: region.IsOn,
Name: region.Name,
Description: region.Description,
PricesJSON: region.Prices,

View File

@@ -100,7 +100,7 @@ func (this *NodeThresholdService) FindAllEnabledNodeThresholds(ctx context.Conte
DurationUnit: threshold.DurationUnit,
SumMethod: threshold.SumMethod,
NotifyDuration: int32(threshold.NotifyDuration),
IsOn: threshold.IsOn == 1,
IsOn: threshold.IsOn,
})
}
return &pb.FindAllEnabledNodeThresholdsResponse{NodeThresholds: pbThresholds}, nil
@@ -166,6 +166,6 @@ func (this *NodeThresholdService) FindEnabledNodeThreshold(ctx context.Context,
DurationUnit: threshold.DurationUnit,
SumMethod: threshold.SumMethod,
NotifyDuration: int32(threshold.NotifyDuration),
IsOn: threshold.IsOn == 1,
IsOn: threshold.IsOn,
}}, nil
}

View File

@@ -176,7 +176,7 @@ func (this *OriginService) FindEnabledOrigin(ctx context.Context, req *pb.FindEn
result := &pb.Origin{
Id: int64(origin.Id),
IsOn: origin.IsOn == 1,
IsOn: origin.IsOn,
Name: origin.Name,
Addr: &pb.NetworkAddress{
Protocol: addr.Protocol.String(),

View File

@@ -686,7 +686,7 @@ func (this *ServerService) ListEnabledServersMatch(ctx context.Context, req *pb.
result = append(result, &pb.Server{
Id: int64(server.Id),
IsOn: server.IsOn == 1,
IsOn: server.IsOn,
Type: server.Type,
Config: configJSON,
Name: server.Name,
@@ -829,7 +829,7 @@ func (this *ServerService) FindEnabledServer(ctx context.Context, req *pb.FindEn
return &pb.FindEnabledServerResponse{Server: &pb.Server{
Id: int64(server.Id),
IsOn: server.IsOn == 1,
IsOn: server.IsOn,
Type: server.Type,
Name: server.Name,
Description: server.Description,
@@ -1074,7 +1074,7 @@ func (this *ServerService) FindAllEnabledServersWithSSLCertId(ctx context.Contex
result = append(result, &pb.Server{
Id: int64(server.Id),
Name: server.Name,
IsOn: server.IsOn == 1,
IsOn: server.IsOn,
Type: server.Type,
})
}
@@ -1311,7 +1311,7 @@ func (this *ServerService) FindEnabledUserServerBasic(ctx context.Context, req *
Id: int64(server.Id),
Name: server.Name,
Description: server.Description,
IsOn: server.IsOn == 1,
IsOn: server.IsOn,
Type: server.Type,
NodeCluster: &pb.NodeCluster{
Id: int64(server.ClusterId),
@@ -1610,7 +1610,7 @@ func (this *ServerService) FindNearbyServers(ctx context.Context, req *pb.FindNe
pbGroup.Servers = append(pbGroup.Servers, &pb.Server{
Id: int64(server.Id),
Name: server.Name,
IsOn: server.IsOn == 1,
IsOn: server.IsOn,
})
}
pbGroups = append(pbGroups, pbGroup)
@@ -1651,7 +1651,7 @@ func (this *ServerService) FindNearbyServers(ctx context.Context, req *pb.FindNe
pbGroup.Servers = append(pbGroup.Servers, &pb.Server{
Id: int64(server.Id),
Name: server.Name,
IsOn: server.IsOn == 1,
IsOn: server.IsOn,
})
}
@@ -1913,7 +1913,7 @@ func (this *ServerService) FindServerUserPlan(ctx context.Context, req *pb.FindS
UserId: int64(userPlan.UserId),
PlanId: int64(userPlan.PlanId),
Name: userPlan.Name,
IsOn: userPlan.IsOn == 1,
IsOn: userPlan.IsOn,
DayTo: userPlan.DayTo,
User: nil,
Plan: &pb.Plan{

View File

@@ -41,7 +41,7 @@ func (this *ServerStatBoardService) FindAllEnabledServerStatBoards(ctx context.C
pbBoards = append(pbBoards, &pb.ServerStatBoard{
Id: int64(board.Id),
Name: board.Name,
IsOn: board.IsOn == 1,
IsOn: board.IsOn,
})
}

View File

@@ -86,11 +86,11 @@ func (this *ServerStatBoardChartService) FindAllEnabledServerStatBoardCharts(ctx
Type: metricChart.Type,
WidthDiv: types.Int32(metricChart.WidthDiv),
ParamsJSON: nil,
IsOn: metricChart.IsOn == 1,
IsOn: metricChart.IsOn,
MaxItems: types.Int32(metricChart.MaxItems),
MetricItem: &pb.MetricItem{
Id: int64(metricItem.Id),
IsOn: metricItem.IsOn == 1,
IsOn: metricItem.IsOn,
Code: metricItem.Code,
Category: metricItem.Category,
Name: metricItem.Name,

View File

@@ -214,7 +214,7 @@ func (this *SSLCertService) ListSSLCertsWithOCSPError(ctx context.Context, req *
for _, cert := range certs {
pbCerts = append(pbCerts, &pb.SSLCert{
Id: int64(cert.Id),
IsOn: cert.IsOn == 1,
IsOn: cert.IsOn,
Name: cert.Name,
TimeBeginAt: types.Int64(cert.TimeBeginAt),
TimeEndAt: types.Int64(cert.TimeEndAt),

View File

@@ -219,7 +219,7 @@ func (this *UserService) ListEnabledUsers(ctx context.Context, req *pb.ListEnabl
Tel: user.Tel,
Email: user.Email,
Remark: user.Remark,
IsOn: user.IsOn == 1,
IsOn: user.IsOn,
RegisteredIP: user.RegisteredIP,
IsVerified: user.IsVerified == 1,
IsRejected: user.IsRejected == 1,
@@ -269,7 +269,7 @@ func (this *UserService) FindEnabledUser(ctx context.Context, req *pb.FindEnable
Tel: user.Tel,
Email: user.Email,
Remark: user.Remark,
IsOn: user.IsOn == 1,
IsOn: user.IsOn,
CreatedAt: int64(user.CreatedAt),
RegisteredIP: user.RegisteredIP,
IsVerified: user.IsVerified == 1,

View File

@@ -47,7 +47,7 @@ func (this *UserAccessKeyService) FindAllEnabledUserAccessKeys(ctx context.Conte
Id: int64(accessKey.Id),
UserId: int64(accessKey.UserId),
SubUserId: int64(accessKey.SubUserId),
IsOn: accessKey.IsOn == 1,
IsOn: accessKey.IsOn,
UniqueId: accessKey.UniqueId,
Secret: accessKey.Secret,
Description: accessKey.Description,

View File

@@ -87,7 +87,7 @@ func (this *UserNodeService) FindAllEnabledUserNodes(ctx context.Context, req *p
result = append(result, &pb.UserNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -142,7 +142,7 @@ func (this *UserNodeService) ListEnabledUserNodes(ctx context.Context, req *pb.L
result = append(result, &pb.UserNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -183,7 +183,7 @@ func (this *UserNodeService) FindEnabledUserNode(ctx context.Context, req *pb.Fi
result := &pb.UserNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,
@@ -230,7 +230,7 @@ func (this *UserNodeService) FindCurrentUserNode(ctx context.Context, req *pb.Fi
result := &pb.UserNode{
Id: int64(node.Id),
IsOn: node.IsOn == 1,
IsOn: node.IsOn,
UniqueId: node.UniqueId,
Secret: node.Secret,
Name: node.Name,

View File

@@ -230,7 +230,7 @@ func (this *CacheTaskManager) findAllMetricDataCharts(tx *dbs.Tx) (result []*pb.
}
for _, chart := range charts {
if chart.IsOn == 0 {
if !chart.IsOn {
continue
}
@@ -240,7 +240,7 @@ func (this *CacheTaskManager) findAllMetricDataCharts(tx *dbs.Tx) (result []*pb.
Type: chart.Type,
WidthDiv: chart.WidthDiv,
ParamsJSON: nil,
IsOn: chart.IsOn == 1,
IsOn: chart.IsOn,
MaxItems: types.Int32(chart.MaxItems),
MetricItem: &pb.MetricItem{
Id: itemId,
@@ -251,7 +251,7 @@ func (this *CacheTaskManager) findAllMetricDataCharts(tx *dbs.Tx) (result []*pb.
Category: item.Category,
Keys: item.DecodeKeys(),
Code: item.Code,
IsOn: item.IsOn == 1,
IsOn: item.IsOn,
},
}
var pbStats = []*pb.MetricStat{}
@@ -333,7 +333,7 @@ func (this *CacheTaskManager) findNodeClusterMetricDataCharts(tx *dbs.Tx, cluste
var metricItemIds = []int64{}
var items = []*models.MetricItem{}
for _, clusterMetricItem := range clusterMetricItems {
if clusterMetricItem.IsOn != 1 {
if !clusterMetricItem.IsOn {
continue
}
var itemId = int64(clusterMetricItem.ItemId)
@@ -341,7 +341,7 @@ func (this *CacheTaskManager) findNodeClusterMetricDataCharts(tx *dbs.Tx, cluste
if err != nil {
return nil, err
}
if item == nil || item.IsOn == 0 {
if item == nil || !item.IsOn {
continue
}
items = append(items, item)
@@ -353,7 +353,7 @@ func (this *CacheTaskManager) findNodeClusterMetricDataCharts(tx *dbs.Tx, cluste
return nil, err
}
for _, item := range publicMetricItems {
if item.IsOn != 1 {
if !item.IsOn {
continue
}
if lists.ContainsInt64(metricItemIds, int64(item.Id)) {
@@ -370,7 +370,7 @@ func (this *CacheTaskManager) findNodeClusterMetricDataCharts(tx *dbs.Tx, cluste
}
for _, chart := range charts {
if chart.IsOn == 0 {
if !chart.IsOn {
continue
}
@@ -380,7 +380,7 @@ func (this *CacheTaskManager) findNodeClusterMetricDataCharts(tx *dbs.Tx, cluste
Type: chart.Type,
WidthDiv: chart.WidthDiv,
ParamsJSON: nil,
IsOn: chart.IsOn == 1,
IsOn: chart.IsOn,
MaxItems: types.Int32(chart.MaxItems),
MetricItem: &pb.MetricItem{
Id: itemId,
@@ -391,7 +391,7 @@ func (this *CacheTaskManager) findNodeClusterMetricDataCharts(tx *dbs.Tx, cluste
Category: item.Category,
Keys: item.DecodeKeys(),
Code: item.Code,
IsOn: item.IsOn == 1,
IsOn: item.IsOn,
},
}
var pbStats = []*pb.MetricStat{}