Răsfoiți Sursa

Merge branch 'fix/python_email'

Roc 2 ani în urmă
părinte
comite
e87e81a51c
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      services/base_from_python.go

+ 2 - 1
services/base_from_python.go

@@ -4,6 +4,7 @@ import (
 	"bytes"
 	"encoding/json"
 	"fmt"
+	"github.com/shopspring/decimal"
 	"hongze/hongze_edb_lib/utils"
 	"os"
 	"os/exec"
@@ -140,7 +141,7 @@ func ExecPythonCode(edbCode, reqCode string) (dataMap EdbDataFromPython, err err
 		if reflect.TypeOf(tmpValue) != nil {
 			if reflect.TypeOf(tmpValue).Kind() == reflect.Float64 {
 				dataMap.Date[i] = date
-				dataMap.Value[i] = reflect.ValueOf(tmpValue).Float()
+				dataMap.Value[i], _ = decimal.NewFromFloat(reflect.ValueOf(tmpValue).Float()).Truncate(4).Float64() //保留4位小数
 				i++
 			}
 		}