|
@@ -2442,47 +2442,3 @@ func customXssPolicy() (p *bluemonday.Policy) {
|
|
|
p.AllowAttrs("allowfullscreen").OnElements("iframe")
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
-// SecondsToHHMMSS 秒转HH:MM:SS
|
|
|
-func SecondsToHHMMSS(seconds int) string {
|
|
|
- duration := time.Duration(seconds) * time.Second
|
|
|
- hours := int(duration.Hours())
|
|
|
- minutes := int(duration.Minutes()) % 60
|
|
|
- seconds = int(duration.Seconds()) % 60
|
|
|
-
|
|
|
- if hours > 0 {
|
|
|
- return fmt.Sprintf("%02d:%02d:%02d", hours, minutes, seconds)
|
|
|
- } else {
|
|
|
- return fmt.Sprintf("%02d:%02d", minutes, seconds)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// MillisecondsToHHMMSS 毫秒转HH:MM:SS
|
|
|
-func MillisecondsToHHMMSS(ms int) string {
|
|
|
- duration := time.Duration(ms) * time.Millisecond
|
|
|
- hours := int(duration / (time.Hour))
|
|
|
- minutes := int((duration % (time.Hour)) / time.Minute)
|
|
|
- seconds := int((duration % time.Hour % time.Minute) / time.Second)
|
|
|
-
|
|
|
- // 将整数小时、分钟和秒数转换为字符串,并添加冒号分隔符
|
|
|
- hourStr := strconv.Itoa(hours)
|
|
|
- minuteStr := strconv.Itoa(minutes)
|
|
|
- secondStr := strconv.Itoa(seconds)
|
|
|
-
|
|
|
- // 根据不足两位数的情况补零
|
|
|
- if len(hourStr) == 1 {
|
|
|
- hourStr = "0" + hourStr
|
|
|
- }
|
|
|
- if len(minuteStr) == 1 {
|
|
|
- minuteStr = "0" + minuteStr
|
|
|
- }
|
|
|
- if len(secondStr) == 1 {
|
|
|
- secondStr = "0" + secondStr
|
|
|
- }
|
|
|
-
|
|
|
- return hourStr + ":" + minuteStr + ":" + secondStr
|
|
|
-}
|
|
|
-
|
|
|
-func ByteToMB(byteCount int) float64 {
|
|
|
- return float64(byteCount) / (1024 * 1024)
|
|
|
-}
|