diff --git a/dsSzxy/Utils/CommonUtil/CommonUtil.go b/dsSzxy/Utils/CommonUtil/CommonUtil.go index 311ad576..a6d5017d 100644 --- a/dsSzxy/Utils/CommonUtil/CommonUtil.go +++ b/dsSzxy/Utils/CommonUtil/CommonUtil.go @@ -291,3 +291,15 @@ func GetUUID() string { u2 := strings.ToUpper(uuid.NewV4().String()) return u2 } + +/** +功能: 获取扩展名 + */ +func Ext(path string) string { + for i := len(path) - 1; i >= 0 && path[i] != '/'; i-- { + if path[i] == '.' { + return path[i:] + } + } + return "" +} \ No newline at end of file diff --git a/dsSzxy/WinBuild/Distribute.exe b/dsSzxy/WinBuild/Distribute.exe index c2afe9ee..92378f72 100644 Binary files a/dsSzxy/WinBuild/Distribute.exe and b/dsSzxy/WinBuild/Distribute.exe differ diff --git a/dsSzxy/build/dsSzxy b/dsSzxy/build/dsSzxy index 91d6ff3c..909117ba 100644 Binary files a/dsSzxy/build/dsSzxy and b/dsSzxy/build/dsSzxy differ diff --git a/dsSzxy/main.go b/dsSzxy/main.go index b5701fc5..76ae2fed 100644 --- a/dsSzxy/main.go +++ b/dsSzxy/main.go @@ -17,25 +17,6 @@ import ( "strings" ) -func Ext(path string) string { - for i := len(path) - 1; i >= 0 && path[i] != '/'; i-- { - if path[i] == '.' { - return path[i:] - } - } - return "" -} -func PathExists(path string) (bool, error) { - _, err := os.Stat(path) - if err == nil { - return true, nil - } - if os.IsNotExist(err) { - return false, nil - } - return false, err -} - // @title 东师理想智慧校园支撑系统 // @version 2.0 // @description @@ -68,13 +49,13 @@ func main() { return } //扩展名 - ext := Ext(file.Filename) + ext := CommonUtil.Ext(file.Filename) ext = strings.ToLower(ext) //真实文件名 uuid := CommonUtil.GetUUID() //子目录 p := ConfigUtil.SavePath + uuid[0:2] - exist, _ := PathExists(p) + exist := CommonUtil.Exists(p) if !exist { os.Mkdir(p, os.ModePerm) }