增加服务之间拷贝配置的API(开源版本只有定义,没有完全实现)

This commit is contained in:
刘祥超
2023-04-09 16:01:23 +08:00
parent 73164de93e
commit 5a93ec0e32
16 changed files with 434 additions and 238 deletions

View File

@@ -85,21 +85,26 @@ func (this *ServerGroupService) DeleteServerGroup(ctx context.Context, req *pb.D
// FindAllEnabledServerGroups 查询所有分组
func (this *ServerGroupService) FindAllEnabledServerGroups(ctx context.Context, req *pb.FindAllEnabledServerGroupsRequest) (*pb.FindAllEnabledServerGroupsResponse, error) {
// 校验请求
_, userId, err := this.ValidateAdminAndUser(ctx, true)
adminId, userId, err := this.ValidateAdminAndUser(ctx, true)
if err != nil {
return nil, err
}
if adminId > 0 {
userId = req.UserId
}
var tx = this.NullTx()
groups, err := models.SharedServerGroupDAO.FindAllEnabledGroups(tx, userId)
if err != nil {
return nil, err
}
result := []*pb.ServerGroup{}
var result = []*pb.ServerGroup{}
for _, group := range groups {
result = append(result, &pb.ServerGroup{
Id: int64(group.Id),
IsOn: group.IsOn,
Name: group.Name,
})
}
@@ -153,6 +158,7 @@ func (this *ServerGroupService) FindEnabledServerGroup(ctx context.Context, req
return &pb.FindEnabledServerGroupResponse{
ServerGroup: &pb.ServerGroup{
Id: int64(group.Id),
IsOn: group.IsOn,
Name: group.Name,
},
}, nil