Browse Source

update

tags/v1.22.10.1^2
liuzx 3 years ago
parent
commit
3d5bb467ad
1 changed files with 28 additions and 6 deletions
  1. +28
    -6
      routers/api/v1/repo/cloudbrain_dashboard.go

+ 28
- 6
routers/api/v1/repo/cloudbrain_dashboard.go View File

@@ -186,10 +186,18 @@ func GetOverviewDuration(ctx *context.Context) {
worker_server_num := 1
cardNum := 1
durationSum := int64(0)
durationSumAll := int64(0)
cardDuSum := int64(0)

cloudBrainOneSum := int64(0)
cloudBrainTwoSum := int64(0)
c2NetSum := int64(0)
cDCenterSum := int64(0)

cloudBrainOneDuration := int64(0)
cloudBrainTwoDuration := int64(0)
c2NetDuration := int64(0)
cDCenterDuration := int64(0)

for count == pagesize && count != 0 {
cloudbrains, _, err := models.CloudbrainAllStatic(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{
@@ -220,23 +228,37 @@ func GetOverviewDuration(ctx *context.Context) {
duration := cloudbrain.Duration
durationSum = duration * int64(worker_server_num) * int64(cardNum)
if cloudbrain.Cloudbrain.Type == models.TypeCloudBrainOne {
cloudBrainOneDuration += duration
cloudBrainOneSum += durationSum
} else if cloudbrain.Cloudbrain.Type == models.TypeCloudBrainTwo {
cloudBrainTwoDuration += duration
cloudBrainTwoSum += durationSum
} else if cloudbrain.Cloudbrain.Type == models.TypeC2Net {
c2NetDuration += duration
c2NetSum += durationSum
} else if cloudbrain.Cloudbrain.Type == models.TypeCDCenter {
cDCenterDuration += duration
cDCenterSum += durationSum
}

durationSumAll += durationSum
durationSum += duration
cardDuSum += durationSum
count = len(cloudbrains)
page += 1
}
}
ctx.JSON(http.StatusOK, map[string]interface{}{
"cloudBrainOneSum": cloudBrainOneSum,
"cloudBrainTwoSum": cloudBrainTwoSum,
"c2NetSum": c2NetSum,
"durationSumAll": durationSumAll,
"cloudBrainOneCardDuSum": cloudBrainOneSum,
"cloudBrainTwoCardDuSum": cloudBrainTwoSum,
"c2NetCardDuSum": c2NetSum,
"cDNetCardDuSum": cDCenterSum,
"cardDuSum": cardDuSum,

"cloudBrainOneDuration": cloudBrainOneDuration,
"cloudBrainTwoDuration": cloudBrainTwoDuration,
"c2NetDuration": c2NetDuration,
"cDCenterDuration": cDCenterDuration,
"durationSum": durationSum,
})
}



Loading…
Cancel
Save