sun-pc-linux 1 ماه پیش
والد
کامیت
fa36c3acf1
1فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  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},
 	}