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.

39 lines
832 B

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