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.

35 lines
775 B

3 years ago
  1. package upload
  2. import (
  3. "mime/multipart"
  4. "github.com/flipped-aurora/gin-vue-admin/server/global"
  5. )
  6. // OSS 对象存储接口
  7. // Author [SliverHorn](https://github.com/SliverHorn)
  8. // Author [ccfish86](https://github.com/ccfish86)
  9. type OSS interface {
  10. UploadFile(file *multipart.FileHeader) (string, string, error)
  11. DeleteFile(key string) error
  12. }
  13. // NewOss OSS的实例化方法
  14. // Author [SliverHorn](https://github.com/SliverHorn)
  15. // Author [ccfish86](https://github.com/ccfish86)
  16. func NewOss() OSS {
  17. switch global.GVA_CONFIG.System.OssType {
  18. case "local":
  19. return &Local{}
  20. case "qiniu":
  21. return &Qiniu{}
  22. case "tencent-cos":
  23. return &TencentCOS{}
  24. case "aliyun-oss":
  25. return &AliyunOSS{}
  26. case "huawei-obs":
  27. return HuaWeiObs
  28. default:
  29. return &Local{}
  30. }
  31. }