'commit'
continuous-integration/drone/push Build is passing Details

master
黄海 4 years ago
parent 760951ce00
commit b0779754b7

@ -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 ""
}

Binary file not shown.

Binary file not shown.

@ -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)
}

Loading…
Cancel
Save