You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
809 B
37 lines
809 B
package upload
|
|
|
|
import (
|
|
"mime/multipart"
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
)
|
|
|
|
// OSS 对象存储接口
|
|
// Author [SliverHorn](https://github.com/SliverHorn)
|
|
// Author [ccfish86](https://github.com/ccfish86)
|
|
type OSS interface {
|
|
UploadFile(file *multipart.FileHeader) (string, string, error)
|
|
DeleteFile(key string) error
|
|
}
|
|
|
|
// NewOss OSS的实例化方法
|
|
// Author [SliverHorn](https://github.com/SliverHorn)
|
|
// Author [ccfish86](https://github.com/ccfish86)
|
|
func NewOss() OSS {
|
|
switch global.GVA_CONFIG.System.OssType {
|
|
case "local":
|
|
return &Local{}
|
|
case "qiniu":
|
|
return &Qiniu{}
|
|
case "tencent-cos":
|
|
return &TencentCOS{}
|
|
case "aliyun-oss":
|
|
return &AliyunOSS{}
|
|
case "huawei-obs":
|
|
return HuaWeiObs
|
|
case "aws-s3":
|
|
return &AwsS3{}
|
|
default:
|
|
return &Local{}
|
|
}
|
|
}
|