mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-28 02:40:25 +08:00
IP名单增加是否全局
This commit is contained in:
@@ -332,10 +332,18 @@ func (this *IPItemService) ListIPItemsAfterVersion(ctx context.Context, req *pb.
|
||||
}
|
||||
|
||||
// List类型
|
||||
listType, err := models.SharedIPListDAO.FindIPListTypeCacheable(tx, int64(item.ListId))
|
||||
list, err := models.SharedIPListDAO.FindIPListCacheable(tx, int64(item.ListId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// 如果已经删除
|
||||
if list.State != models.IPListStateEnabled {
|
||||
item.State = models.IPItemStateDisabled
|
||||
}
|
||||
|
||||
result = append(result, &pb.IPItem{
|
||||
Id: int64(item.Id),
|
||||
@@ -349,7 +357,8 @@ func (this *IPItemService) ListIPItemsAfterVersion(ctx context.Context, req *pb.
|
||||
IsDeleted: item.State == 0,
|
||||
Type: item.Type,
|
||||
EventLevel: item.EventLevel,
|
||||
ListType: listType,
|
||||
ListType: list.Type,
|
||||
IsGlobal: list.IsPublic == 1 && list.IsGlobal == 1,
|
||||
NodeId: int64(item.NodeId),
|
||||
ServerId: int64(item.ServerId),
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ func (this *IPListService) CreateIPList(ctx context.Context, req *pb.CreateIPLis
|
||||
|
||||
tx := this.NullTx()
|
||||
|
||||
listId, err := models.SharedIPListDAO.CreateIPList(tx, userId, req.Type, req.Name, req.Code, req.TimeoutJSON, req.Description, req.IsPublic)
|
||||
listId, err := models.SharedIPListDAO.CreateIPList(tx, userId, req.Type, req.Name, req.Code, req.TimeoutJSON, req.Description, req.IsPublic, req.IsGlobal)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -71,6 +71,7 @@ func (this *IPListService) FindEnabledIPList(ctx context.Context, req *pb.FindEn
|
||||
Code: list.Code,
|
||||
TimeoutJSON: []byte(list.Timeout),
|
||||
Description: list.Description,
|
||||
IsGlobal: list.IsGlobal == 1,
|
||||
}}, nil
|
||||
}
|
||||
|
||||
@@ -112,6 +113,7 @@ func (this *IPListService) ListEnabledIPLists(ctx context.Context, req *pb.ListE
|
||||
TimeoutJSON: []byte(list.Timeout),
|
||||
IsPublic: list.IsPublic == 1,
|
||||
Description: list.Description,
|
||||
IsGlobal: list.IsGlobal == 1,
|
||||
})
|
||||
}
|
||||
return &pb.ListEnabledIPListsResponse{IpLists: pbLists}, nil
|
||||
@@ -191,6 +193,7 @@ func (this *IPListService) FindEnabledIPListContainsIP(ctx context.Context, req
|
||||
Name: list.Name,
|
||||
Code: list.Code,
|
||||
IsPublic: list.IsPublic == 1,
|
||||
IsGlobal: list.IsGlobal == 1,
|
||||
Description: "",
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user