This commit is contained in:
wangchuxiao
2022-05-10 10:44:43 +08:00
parent 97e5d9f610
commit 00265a7e8e
27 changed files with 369 additions and 187 deletions
+31
View File
@@ -2,6 +2,7 @@ package utils
import (
"Open_IM/pkg/common/constant"
"errors"
"fmt"
"math/rand"
"os"
@@ -37,3 +38,33 @@ func GetNewFileNameAndContentType(fileName string, fileType int) (string, string
}
return newName, contentType
}
func GetUploadAppNewName(appType int, version string) (string, string, error) {
var newFileName, newYamlName = version + "_app_", version + "_yaml_"
switch appType {
case constant.IOSPlatformID:
newFileName += constant.IOSPlatformStr
newYamlName += constant.IOSPlatformStr
case constant.AndroidPlatformID:
newFileName += constant.AndroidPlatformStr
newYamlName += constant.AndroidPlatformStr
case constant.WindowsPlatformID:
newFileName += constant.WindowsPlatformStr
newYamlName += constant.WindowsPlatformStr
case constant.OSXPlatformID:
newFileName += constant.OSXPlatformStr
newYamlName += constant.OSXPlatformStr
case constant.WebPlatformID:
newFileName += constant.WebPlatformStr
newYamlName += constant.WebPlatformStr
case constant.MiniWebPlatformID:
newFileName += constant.MiniWebPlatformStr
newYamlName += constant.MiniWebPlatformStr
case constant.LinuxPlatformID:
newFileName += constant.LinuxPlatformStr
newYamlName += constant.LinuxPlatformStr
default:
return "", "", errors.New("invalid app type")
}
return newFileName, newYamlName, nil
}