浏览代码

fix: 高频数据显示精度

hsun 9 月之前
父节点
当前提交
1174f2c529
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      controllers/data_manage/base_from_ths_hf.go

+ 3 - 1
controllers/data_manage/base_from_ths_hf.go

@@ -9,6 +9,7 @@ import (
 	"eta/eta_api/utils"
 	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"github.com/shopspring/decimal"
 	"sort"
 	"strconv"
 	"strings"
@@ -177,9 +178,10 @@ func (this *BaseFromThsHfController) Search() {
 				break
 			}
 			limit += 1
+			strVal := decimal.NewFromFloat(d.Value).Round(4).String()
 			item.IndexData = append(item.IndexData, data_manage.ThsHfSearchEdbData{
 				DataTime: d.DataTime.Format(utils.FormatDateTime),
-				Value:    fmt.Sprintf("%.f", d.Value),
+				Value:    strVal,
 			})
 		}
 		resp = append(resp, item)