改进剩余流量显示

改为后端运行。
This commit is contained in:
liuyanxi975
2022-05-30 17:21:21 +08:00
parent a070093a5f
commit 6c3dbb6acd
3 changed files with 13 additions and 26 deletions

View File

@@ -148,6 +148,14 @@ var funcMap = template.FuncMap{
"add": func(a, b int) int {
return a + b
},
"Transleft": func(a, b float64) (n float64) {
n, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (100-(a/b)*100)), 64)
return
},
"UintToFloat": func(a uint64) (n float64) {
n, _ = strconv.ParseFloat((strconv.FormatUint(a, 10)), 64)
return
},
"dayBefore": func(i int) string {
year, month, day := time.Now().Date()
today := time.Date(year, month, day, 0, 0, 0, 0, time.Local)