实现数据看板--用户

This commit is contained in:
GoEdgeLab
2021-07-11 18:05:57 +08:00
parent 2f647a3478
commit 85f85345aa
48 changed files with 564 additions and 300 deletions

View File

@@ -8,7 +8,6 @@ import (
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
"github.com/TeaOSLab/EdgeAPI/internal/db/models/dns"
"github.com/TeaOSLab/EdgeAPI/internal/db/models/regions"
rpcutils "github.com/TeaOSLab/EdgeAPI/internal/rpc/utils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/maps"
@@ -250,7 +249,7 @@ func (this *ServerService) UpdateServerTLS(ctx context.Context, req *pb.UpdateSe
// UpdateServerUnix 修改Unix服务
func (this *ServerService) UpdateServerUnix(ctx context.Context, req *pb.UpdateServerUnixRequest) (*pb.RPCSuccess, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}
@@ -273,7 +272,7 @@ func (this *ServerService) UpdateServerUnix(ctx context.Context, req *pb.UpdateS
// UpdateServerUDP 修改UDP服务
func (this *ServerService) UpdateServerUDP(ctx context.Context, req *pb.UpdateServerUDPRequest) (*pb.RPCSuccess, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}
@@ -940,7 +939,7 @@ func (this *ServerService) FindAllEnabledServersWithSSLCertId(ctx context.Contex
// CountAllEnabledServersWithNodeClusterId 计算运行在某个集群上的所有服务数量
func (this *ServerService) CountAllEnabledServersWithNodeClusterId(ctx context.Context, req *pb.CountAllEnabledServersWithNodeClusterIdRequest) (*pb.RPCCountResponse, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}
@@ -957,7 +956,7 @@ func (this *ServerService) CountAllEnabledServersWithNodeClusterId(ctx context.C
// CountAllEnabledServersWithServerGroupId 计算使用某个分组的服务数量
func (this *ServerService) CountAllEnabledServersWithServerGroupId(ctx context.Context, req *pb.CountAllEnabledServersWithServerGroupIdRequest) (*pb.RPCCountResponse, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}
@@ -974,7 +973,7 @@ func (this *ServerService) CountAllEnabledServersWithServerGroupId(ctx context.C
// NotifyServersChange 通知更新
func (this *ServerService) NotifyServersChange(ctx context.Context, _ *pb.NotifyServersChangeRequest) (*pb.NotifyServersChangeResponse, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}
@@ -998,7 +997,7 @@ func (this *ServerService) NotifyServersChange(ctx context.Context, _ *pb.Notify
// FindAllEnabledServersDNSWithNodeClusterId 取得某个集群下的所有服务相关的DNS
func (this *ServerService) FindAllEnabledServersDNSWithNodeClusterId(ctx context.Context, req *pb.FindAllEnabledServersDNSWithNodeClusterIdRequest) (*pb.FindAllEnabledServersDNSWithNodeClusterIdResponse, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}