:art:客户端列表新增客户端数据流量情况

This commit is contained in:
coward
2024-07-10 10:51:20 +08:00
parent 697341f823
commit 4b864f76bb
5 changed files with 73 additions and 11 deletions

22
utils/flow_calculation.go Normal file
View File

@@ -0,0 +1,22 @@
package utils
import (
"github.com/dustin/go-humanize"
"math/big"
)
type flowCalculation struct{}
func FlowCalculation() flowCalculation {
return flowCalculation{}
}
// Parse
// @description: 解析流量,序列化为字符串
// @receiver flowCalculation
// @param b
// @return string
func (flowCalculation) Parse(b int64) string {
b2 := big.Int{}
return humanize.BigBytes(b2.SetInt64(b))
}