|
@@ -10,7 +10,7 @@ import (
|
|
|
|
|
|
type CcService interface {
|
|
|
GetCcList(ctx context.Context, req v1.CCListRequest) ([]v1.CCListResponse, error)
|
|
|
- EditCcState(ctx context.Context, req []v1.CCStateRequest) error
|
|
|
+ EditCcState(ctx context.Context, req v1.CCStateRequest) error
|
|
|
}
|
|
|
func NewCcService(
|
|
|
service *Service,
|
|
@@ -57,16 +57,16 @@ func (s *ccService) GetCcList(ctx context.Context, req v1.CCListRequest) ([]v1.C
|
|
|
return res, nil
|
|
|
}
|
|
|
|
|
|
-func (s *ccService) EditCcState(ctx context.Context, req []v1.CCStateRequest) error {
|
|
|
- for _, v := range req {
|
|
|
- webData, err := s.webForwardingRep.GetWebForwarding(ctx, v.WebId)
|
|
|
+func (s *ccService) EditCcState(ctx context.Context, req v1.CCStateRequest) error {
|
|
|
+ for _, v := range req.Ips {
|
|
|
+ webData, err := s.webForwardingRep.GetWebForwarding(ctx, req.WebId)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
if webData.CdnWebId == 0 {
|
|
|
return fmt.Errorf("网站不存在")
|
|
|
}
|
|
|
- err = s.ccRepository.EditCcState(ctx, int64(webData.CdnWebId), v.Ip)
|
|
|
+ err = s.ccRepository.EditCcState(ctx, int64(webData.CdnWebId), v)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|