实现 gost 网关
This commit is contained in:
@@ -11,14 +11,14 @@ var Edge = &edgeService{}
|
||||
type edgeService struct{}
|
||||
|
||||
func (s *edgeService) AllEdges(count int, filter EdgeFilter) ([]*m.Edge, error) {
|
||||
do := q.Edge.Where()
|
||||
if filter.Prov != nil {
|
||||
do = do.Where(q.Edge.Prov.Eq(*filter.Prov))
|
||||
do := q.Edge.Where(q.Edge.Type.Eq(int(m.EdgeTypeSelfBuilt)))
|
||||
if prov := u.N(filter.Prov); prov != nil {
|
||||
do = do.Where(q.Edge.Prov.Eq(*prov))
|
||||
}
|
||||
if filter.City != nil {
|
||||
do = do.Where(q.Edge.City.Eq(*filter.City))
|
||||
if city := u.N(filter.City); city != nil {
|
||||
do = do.Where(q.Edge.City.Eq(*city))
|
||||
}
|
||||
if filter.Isp != nil {
|
||||
if isp := u.X(filter.Isp.String()); isp != nil {
|
||||
do = do.Where(q.Edge.ISP.Eq(int(*filter.Isp)))
|
||||
}
|
||||
if count > 0 {
|
||||
@@ -44,9 +44,5 @@ func (f *EdgeFilter) IsEmpty() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if f.Isp.String() == "" || u.Z(f.Prov) != "" || u.Z(f.City) != "" {
|
||||
return false
|
||||
}
|
||||
|
||||
return false
|
||||
return u.X(f.Isp.String()) == nil && u.N(f.Prov) == nil && u.N(f.City) == nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user