优化表结构,重构模型,重新实现基于白银网关的提取节点流程
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
edge2 "platform/web/domains/edge"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
)
|
||||
@@ -12,14 +11,14 @@ type edgeService struct{}
|
||||
|
||||
func (s *edgeService) AllEdges(count int, filter EdgeFilter) ([]*m.Edge, error) {
|
||||
do := q.Edge.Where()
|
||||
if filter.Prov != "" {
|
||||
do = do.Where(q.Edge.Prov.Eq(filter.Prov))
|
||||
if filter.Prov != nil {
|
||||
do = do.Where(q.Edge.Prov.Eq(*filter.Prov))
|
||||
}
|
||||
if filter.City != "" {
|
||||
do = do.Where(q.Edge.City.Eq(filter.City))
|
||||
if filter.City != nil {
|
||||
do = do.Where(q.Edge.City.Eq(*filter.City))
|
||||
}
|
||||
if filter.Isp != "" {
|
||||
do = do.Where(q.Edge.Isp.Eq(int32(edge2.ISPFromStr(filter.Isp))))
|
||||
if filter.Isp != nil {
|
||||
do = do.Where(q.Edge.ISP.Eq(int(*filter.Isp)))
|
||||
}
|
||||
if count > 0 {
|
||||
do = do.Limit(count)
|
||||
@@ -33,11 +32,8 @@ func (s *edgeService) AllEdges(count int, filter EdgeFilter) ([]*m.Edge, error)
|
||||
return edges, nil
|
||||
}
|
||||
|
||||
type EdgeInfo struct {
|
||||
}
|
||||
|
||||
type EdgeFilter struct {
|
||||
Isp string `json:"isp"`
|
||||
Prov string `json:"prov"`
|
||||
City string `json:"city"`
|
||||
Isp *m.EdgeISP `json:"isp"`
|
||||
Prov *string `json:"prov"`
|
||||
City *string `json:"city"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user