|
|
|
@@ -460,6 +460,9 @@ func getPageDateCloudbrainInfo(dateCloudbrainInfo []DateCloudbrainInfo, page int |
|
|
|
} |
|
|
|
|
|
|
|
func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { |
|
|
|
queryType := ctx.QueryTrim("type") |
|
|
|
beginTimeStr := ctx.QueryTrim("beginTime") |
|
|
|
endTimeStr := ctx.QueryTrim("endTime") |
|
|
|
recordCloudbrain, err := models.GetRecordBeginTime() |
|
|
|
if err != nil { |
|
|
|
log.Error("Can not get record begin time", err) |
|
|
|
@@ -474,8 +477,6 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { |
|
|
|
ctx.Error(http.StatusBadRequest, ctx.Tr("repo.parameter_is_wrong")) |
|
|
|
return |
|
|
|
} |
|
|
|
log.Info("ssssdistrubuydst:", beginTime) |
|
|
|
log.Info("endTime:", endTime) |
|
|
|
|
|
|
|
cloudbrains, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ |
|
|
|
Type: models.TypeCloudBrainAll, |
|
|
|
@@ -489,8 +490,12 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) { |
|
|
|
intelligentNetJobTypeRes := make(map[string]int) |
|
|
|
cloudBrainPeriodNum := make(map[int]int) |
|
|
|
cloudBrainComputeResource := make(map[string]int) |
|
|
|
beginTimeTemp := beginTime.Unix() |
|
|
|
if queryType == "all" || (queryType == "" && (beginTimeStr == "" || endTimeStr == "")) { |
|
|
|
beginTimeTemp = int64(recordCloudbrain[0].Cloudbrain.CreatedUnix) |
|
|
|
} |
|
|
|
for _, cloudbrain := range cloudbrains { |
|
|
|
if int64(cloudbrain.Cloudbrain.CreatedUnix) >= beginTime.Unix() && int64(cloudbrain.Cloudbrain.CreatedUnix) < endTime.Unix() { |
|
|
|
if int64(cloudbrain.Cloudbrain.CreatedUnix) >= beginTimeTemp && int64(cloudbrain.Cloudbrain.CreatedUnix) <= endTime.Unix() { |
|
|
|
if cloudbrain.Cloudbrain.Type == models.TypeCloudBrainOne { |
|
|
|
if _, ok := cloudOneJobTypeRes[cloudbrain.JobType]; !ok { |
|
|
|
cloudOneJobTypeRes[cloudbrain.JobType] = 1 |
|
|
|
@@ -1248,10 +1253,10 @@ func getBrainDeleteTime(rs *models.CloudbrainInfo) string { |
|
|
|
} |
|
|
|
func getCloudbrainTimePeroid(ctx *context.Context, recordBeginTime time.Time) (time.Time, time.Time, error) { |
|
|
|
queryType := ctx.QueryTrim("type") |
|
|
|
now := time.Now() |
|
|
|
|
|
|
|
beginTimeStr := ctx.QueryTrim("beginTime") |
|
|
|
endTimeStr := ctx.QueryTrim("endTime") |
|
|
|
now := time.Now() |
|
|
|
|
|
|
|
var beginTime time.Time |
|
|
|
var endTime time.Time |
|
|
|
var err error |
|
|
|
@@ -1315,9 +1320,6 @@ func getCloudbrainTimePeroid(ctx *context.Context, recordBeginTime time.Time) (t |
|
|
|
if err != nil { |
|
|
|
return now, now, err |
|
|
|
} |
|
|
|
|
|
|
|
// beginTime = beginTime.AddDate(0, 0, 1) |
|
|
|
// endTime = endTime.AddDate(0, 0, 1) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|