Browse Source

Merge branch 'feature/eta2.6.5_kpler' into debug

xyxie 1 tuần trước cách đây
mục cha
commit
5be7f1db11
1 tập tin đã thay đổi với 12 bổ sung0 xóa
  1. 12 0
      controllers/base_from_kpler.go

+ 12 - 0
controllers/base_from_kpler.go

@@ -7,6 +7,7 @@ import (
 	"eta/eta_index_lib/services"
 	"eta/eta_index_lib/utils"
 	"fmt"
+	"sort"
 	"strconv"
 	"strings"
 	"time"
@@ -64,6 +65,17 @@ func (this *KplerController) GetData() {
 		return
 	}
 
+	for _, index := range indexes {
+		//根据日期的值倒序
+		sort.Slice(index.IndexData, func(i, j int) bool {
+			return index.IndexData[i].DataTime > index.IndexData[j].DataTime
+		})
+		//只显示10条数据
+		if len(index.IndexData) > 10 {
+			index.IndexData = index.IndexData[:10]
+		}
+	}
+
 	br.Data = indexes
 	br.Ret = 200
 	br.Success = true