sun-pc-linux 1 month ago
parent
commit
fa36c3acf1
1 changed files with 12 additions and 0 deletions
  1. 12 0
      boxcost/api/stages.go

+ 12 - 0
boxcost/api/stages.go

@@ -90,6 +90,18 @@ func AddStage(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 			"updateTime": time.Now(),
 		},
 	}
+
+	if req.Stages == nil {
+		update = bson.M{
+			"$push": bson.M{
+				"pack.components.$[components].stages": bson.M{
+					"$each": []string{},
+				},
+			},
+		}
+
+	}
+
 	arrayFilters := []interface{}{
 		bson.M{"components.id": req.CompId},
 	}