mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-22 22:40:29 +08:00
实现数据看板--用户
This commit is contained in:
@@ -9,15 +9,15 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
// IP库服务
|
||||
// IPLibraryService IP库服务
|
||||
type IPLibraryService struct {
|
||||
BaseService
|
||||
}
|
||||
|
||||
// 创建IP库
|
||||
// CreateIPLibrary 创建IP库
|
||||
func (this *IPLibraryService) CreateIPLibrary(ctx context.Context, req *pb.CreateIPLibraryRequest) (*pb.CreateIPLibraryResponse, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
_, _, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -34,10 +34,10 @@ func (this *IPLibraryService) CreateIPLibrary(ctx context.Context, req *pb.Creat
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 查找单个IP库
|
||||
// FindEnabledIPLibrary 查找单个IP库
|
||||
func (this *IPLibraryService) FindEnabledIPLibrary(ctx context.Context, req *pb.FindEnabledIPLibraryRequest) (*pb.FindEnabledIPLibraryResponse, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
_, _, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -76,10 +76,10 @@ func (this *IPLibraryService) FindEnabledIPLibrary(ctx context.Context, req *pb.
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 查找最新的IP库
|
||||
// FindLatestIPLibraryWithType 查找最新的IP库
|
||||
func (this *IPLibraryService) FindLatestIPLibraryWithType(ctx context.Context, req *pb.FindLatestIPLibraryWithTypeRequest) (*pb.FindLatestIPLibraryWithTypeResponse, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeNode)
|
||||
_, _, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeNode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -118,10 +118,10 @@ func (this *IPLibraryService) FindLatestIPLibraryWithType(ctx context.Context, r
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 列出某个类型的所有IP库
|
||||
// FindAllEnabledIPLibrariesWithType 列出某个类型的所有IP库
|
||||
func (this *IPLibraryService) FindAllEnabledIPLibrariesWithType(ctx context.Context, req *pb.FindAllEnabledIPLibrariesWithTypeRequest) (*pb.FindAllEnabledIPLibrariesWithTypeResponse, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
_, _, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -158,10 +158,10 @@ func (this *IPLibraryService) FindAllEnabledIPLibrariesWithType(ctx context.Cont
|
||||
return &pb.FindAllEnabledIPLibrariesWithTypeResponse{IpLibraries: result}, nil
|
||||
}
|
||||
|
||||
// 删除IP库
|
||||
// DeleteIPLibrary 删除IP库
|
||||
func (this *IPLibraryService) DeleteIPLibrary(ctx context.Context, req *pb.DeleteIPLibraryRequest) (*pb.RPCSuccess, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
_, err := this.ValidateAdmin(ctx, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -175,7 +175,7 @@ func (this *IPLibraryService) DeleteIPLibrary(ctx context.Context, req *pb.Delet
|
||||
return this.Success()
|
||||
}
|
||||
|
||||
// 查询某个IP信息
|
||||
// LookupIPRegion 查询某个IP信息
|
||||
func (this *IPLibraryService) LookupIPRegion(ctx context.Context, req *pb.LookupIPRegionRequest) (*pb.LookupIPRegionResponse, error) {
|
||||
// 校验请求
|
||||
_, _, err := this.ValidateAdminAndUser(ctx, 0, 0)
|
||||
@@ -215,7 +215,7 @@ func (this *IPLibraryService) LookupIPRegion(ctx context.Context, req *pb.Lookup
|
||||
}}, nil
|
||||
}
|
||||
|
||||
// 查询一组IP信息
|
||||
// LookupIPRegions 查询一组IP信息
|
||||
func (this *IPLibraryService) LookupIPRegions(ctx context.Context, req *pb.LookupIPRegionsRequest) (*pb.LookupIPRegionsResponse, error) {
|
||||
// 校验请求
|
||||
_, _, err := this.ValidateAdminAndUser(ctx, 0, 0)
|
||||
|
||||
Reference in New Issue
Block a user