实现数据看板--用户

This commit is contained in:
刘祥超
2021-07-11 18:05:57 +08:00
parent 11c344eef4
commit 45e4eb72ac
48 changed files with 564 additions and 300 deletions

View File

@@ -3,19 +3,18 @@ package services
import (
"context"
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
rpcutils "github.com/TeaOSLab/EdgeAPI/internal/rpc/utils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
// 文件片段相关服务
// FileChunkService 文件片段相关服务
type FileChunkService struct {
BaseService
}
// 创建文件片段
// CreateFileChunk 创建文件片段
func (this *FileChunkService) CreateFileChunk(ctx context.Context, req *pb.CreateFileChunkRequest) (*pb.CreateFileChunkResponse, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}
@@ -29,7 +28,7 @@ func (this *FileChunkService) CreateFileChunk(ctx context.Context, req *pb.Creat
return &pb.CreateFileChunkResponse{FileChunkId: chunkId}, nil
}
// 获取的一个文件的所有片段IDs
// FindAllFileChunkIds 获取的一个文件的所有片段IDs
func (this *FileChunkService) FindAllFileChunkIds(ctx context.Context, req *pb.FindAllFileChunkIdsRequest) (*pb.FindAllFileChunkIdsResponse, error) {
// 校验请求
_, _, err := this.ValidateAdminAndUser(ctx, 0, -1)
@@ -48,7 +47,7 @@ func (this *FileChunkService) FindAllFileChunkIds(ctx context.Context, req *pb.F
return &pb.FindAllFileChunkIdsResponse{FileChunkIds: chunkIds}, nil
}
// 下载文件片段
// DownloadFileChunk 下载文件片段
func (this *FileChunkService) DownloadFileChunk(ctx context.Context, req *pb.DownloadFileChunkRequest) (*pb.DownloadFileChunkResponse, error) {
// 校验请求
_, _, err := this.ValidateAdminAndUser(ctx, 0, -1)