优化代码

This commit is contained in:
2021-06-06 02:27:22 +08:00
parent 79453d4d2a
commit 4038598470
3 changed files with 7 additions and 9 deletions
+3 -5
View File
@@ -1,7 +1,6 @@
package common
import (
"bytes"
"encoding/json"
"errors"
"math"
@@ -258,11 +257,10 @@ func ObjToStr(obj interface{}) string {
case float64:
str = strconv.FormatFloat(obj.(float64), 'f', -1, 64)
default:
strbte, err := json.Marshal(obj)
var configByte bytes.Buffer
err = json.Indent(&configByte, strbte, "", "\t")
strbte, err := json.MarshalIndent(obj, "", "\t")
if err == nil {
str = configByte.String()
str = string(strbte)
}
}