...
|
...
|
@@ -36,8 +36,9 @@ func IsFile(path string) bool { |
|
|
return !IsDir(path)
|
|
|
}
|
|
|
|
|
|
//fileType: video voice image
|
|
|
func GetFileName(projectName, fileType string, filename string) string {
|
|
|
// fileType: video voice image
|
|
|
func GetFileName(projectName, fileType string, filename string, args ...interface{}) string {
|
|
|
var oldFileName = filename
|
|
|
date := comm_time.GetTimeByYyyymmdd()
|
|
|
subfix := path.Ext(filename)
|
|
|
if len(projectName) == 0 {
|
...
|
...
|
@@ -45,6 +46,9 @@ func GetFileName(projectName, fileType string, filename string) string { |
|
|
}
|
|
|
prefix := fmt.Sprintf("%v_%v", time.Now().Unix(), common.RandomString(32))
|
|
|
filename = fmt.Sprintf("%v%v", prefix, subfix)
|
|
|
if len(args) > 0 && args[0].(bool) {
|
|
|
filename = oldFileName
|
|
|
}
|
|
|
sourcePath := fmt.Sprintf("%v/%v/%v/%v/%v", projectName, beego.BConfig.RunMode, date, fileType, filename)
|
|
|
return sourcePath
|
|
|
} |
...
|
...
|
|