Skip to content

Commit

Permalink
feat: batch add dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
DokiDoki1103 committed Dec 25, 2023
1 parent f344491 commit b411bc8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/controller/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ func (t *TenantStruct) AddDependency(w http.ResponseWriter, r *http.Request) {
// "$ref": "#/responses/commandResponse"
// description: 统一返回格式

// AddDependencys -
func (t *TenantStruct) AddDependencys(w http.ResponseWriter, r *http.Request) {
rules := validator.MapData{
"dep_service_ids": []string{"required"},
Expand All @@ -1135,11 +1136,11 @@ func (t *TenantStruct) AddDependencys(w http.ResponseWriter, r *http.Request) {
return
}
depServiceIds := data["dep_service_id"].(string)
for _, depServiceId := range strings.Split(",", depServiceIds) {
for _, depServiceID := range strings.Split(",", depServiceIds) {
ds := &api_model.DependService{
TenantID: r.Context().Value(ctxutil.ContextKey("tenant_id")).(string),
ServiceID: r.Context().Value(ctxutil.ContextKey("service_id")).(string),
DepServiceID: depServiceId,
DepServiceID: depServiceID,
DepServiceType: data["dep_service_type"].(string),
}
if err := handler.GetServiceManager().ServiceDepend("add", ds); err != nil {
Expand Down

0 comments on commit b411bc8

Please sign in to comment.