|
@@ -2,11 +2,12 @@ package flexCdn
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ v1 "github.com/go-nunu/nunu-layout-advanced/api/v1"
|
|
|
"github.com/go-nunu/nunu-layout-advanced/internal/repository"
|
|
|
)
|
|
|
|
|
|
type CcIpListRepository interface {
|
|
|
- GetCcIpList(ctx context.Context, serverId int64) ([]string, error)
|
|
|
+ GetCcIpList(ctx context.Context, serverId int64) ([]v1.CcIpListResponse, error)
|
|
|
GetHttpWebId(ctx context.Context, serverId int64) (int64, error)
|
|
|
GetIpListId(ctx context.Context, serverId int64,ipListType string) (int64,error)
|
|
|
GetIpId(ctx context.Context, ipListId int64,ip string,sourceCategory string) (int64,error)
|
|
@@ -26,13 +27,13 @@ type ccIpListRepository struct {
|
|
|
*repository.Repository
|
|
|
}
|
|
|
|
|
|
-func (r *ccIpListRepository) GetCcIpList(ctx context.Context, serverId int64) ([]string, error) {
|
|
|
+func (r *ccIpListRepository) GetCcIpList(ctx context.Context, serverId int64) ([]v1.CcIpListResponse, error) {
|
|
|
+ var req []v1.CcIpListResponse
|
|
|
ipListId, err := r.GetIpListId(ctx, serverId,"white")
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
- var ips []string
|
|
|
- return ips, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND sourceCategory = ?", ipListId, "cc").Select("value").Scan(&ips).Error
|
|
|
+ return req, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND sourceCategory = ?", ipListId, "cc").Select("value,type, reason").Scan(&req).Error
|
|
|
}
|
|
|
|
|
|
func (r *ccIpListRepository) GetHttpWebId(ctx context.Context, serverId int64) (int64, error) {
|