mirror of
https://github.com/xxjwxc/public.git
synced 2025-09-26 20:01:19 +08:00
20 lines
342 B
Go
20 lines
342 B
Go
package myfile
|
|
|
|
import (
|
|
"fmt"
|
|
"path"
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/xxjwxc/public/tools"
|
|
)
|
|
|
|
// GetExp 获取字符串后缀
|
|
func GetExp(ext string) string {
|
|
return strings.TrimLeft(path.Ext(ext), ".")
|
|
}
|
|
|
|
func getFileName(exp string) string {
|
|
return fmt.Sprintf("%d%s.%s", tools.GetUtcTime(time.Now()), tools.GetRandomString(4), exp)
|
|
}
|