mongo
This commit is contained in:
@@ -6,8 +6,20 @@ type MinioStorageCredentialReq struct {
|
||||
|
||||
type MiniostorageCredentialResp struct {
|
||||
SecretAccessKey string `json:"secretAccessKey"`
|
||||
AccessKeyID string `json:"accessKeyID"`
|
||||
SessionToken string `json:"sessionToken"`
|
||||
BucketName string `json:"bucketName"`
|
||||
StsEndpointURL string `json:"stsEndpointURL"`
|
||||
AccessKeyID string `json:"accessKeyID"`
|
||||
SessionToken string `json:"sessionToken"`
|
||||
BucketName string `json:"bucketName"`
|
||||
StsEndpointURL string `json:"stsEndpointURL"`
|
||||
}
|
||||
|
||||
type MinioUploadFileReq struct {
|
||||
OperationID string `json:"operationID"`
|
||||
FileType int `json:"fileType"`
|
||||
}
|
||||
|
||||
type MinioUploadFileResp struct {
|
||||
URL string `json:"URL"`
|
||||
NewName string `json:"newName"`
|
||||
SnapshotURL string `json:"snapshotURL" binding:"omitempty"`
|
||||
SnapshotNewName string `json:"snapshotName" binding:"omitempty"`
|
||||
}
|
||||
|
||||
@@ -159,6 +159,10 @@ const (
|
||||
//callback callbackHandleCode
|
||||
CallbackHandleSuccess = 0
|
||||
CallbackHandleFailed = 1
|
||||
|
||||
// minioUpload
|
||||
OtherType = 1
|
||||
VideoType = 2
|
||||
)
|
||||
|
||||
var ContentType2PushContent = map[int64]string{
|
||||
|
||||
+15
-1
@@ -1,6 +1,11 @@
|
||||
package utils
|
||||
|
||||
import "os"
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Determine whether the given path is a folder
|
||||
func IsDir(path string) bool {
|
||||
@@ -20,3 +25,12 @@ func IsFile(path string) bool {
|
||||
func MkDir(path string) error {
|
||||
return os.MkdirAll(path, os.ModePerm)
|
||||
}
|
||||
|
||||
func GetNewFileNameAndContentType(fileType string) (string, string) {
|
||||
newName := fmt.Sprintf("%d-%d%s", time.Now().UnixNano(), rand.Int(), fileType)
|
||||
contentType := ""
|
||||
if fileType == "img" {
|
||||
contentType = "image/" + fileType[1:]
|
||||
}
|
||||
return newName, contentType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user