Skip to content

Commit

Permalink
Merge pull request #1488 from holden-cpu/shd-dev
Browse files Browse the repository at this point in the history
[fix] Fixed the issue of forcible batch deletion
  • Loading branch information
humingcheng authored Sep 2, 2024
2 parents dc6d3d1 + 3e77a20 commit e7b3288
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions server/resource/disco/service_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ import (
"net/http"
"strings"

pb "github.com/go-chassis/cari/discovery"

"github.com/apache/servicecomb-service-center/datasource"
"github.com/apache/servicecomb-service-center/pkg/log"
"github.com/apache/servicecomb-service-center/pkg/rest"
"github.com/apache/servicecomb-service-center/pkg/util"
discosvc "github.com/apache/servicecomb-service-center/server/service/disco"
pb "github.com/go-chassis/cari/discovery"
)

var trueOrFalse = map[string]bool{"true": true, "false": false, "1": true, "0": false}
Expand Down Expand Up @@ -211,8 +212,16 @@ func (s *ServiceResource) UnregisterManyService(w http.ResponseWriter, r *http.R
rest.WriteError(w, pb.ErrInvalidParams, err.Error())
return
}

request := &pb.DelServicesRequest{}
query := r.URL.Query()
force := query.Get("force")
b, ok := trueOrFalse[force]
if force != "" && !ok {
rest.WriteError(w, pb.ErrInvalidParams, "parameter force must be false or true")
return
}
request := &pb.DelServicesRequest{
Force: b,
}

err = json.Unmarshal(message, request)
if err != nil {
Expand Down

0 comments on commit e7b3288

Please sign in to comment.