Browse Source
Merge pull request #625 from flipped-aurora/gva_gormv2_dev
fmt project
main
奇淼(piexlmax
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
2 additions and
2 deletions
-
server/config/oss.go
-
server/utils/upload/qiniu.go
|
|
@ -20,7 +20,7 @@ type AliyunOSS struct { |
|
|
|
AccessKeySecret string `mapstructure:"access-key-secret" json:"accessKeySecret" yaml:"access-key-secret"` |
|
|
|
BucketName string `mapstructure:"bucket-name" json:"bucketName" yaml:"bucket-name"` |
|
|
|
BucketUrl string `mapstructure:"bucket-url" json:"bucketUrl" yaml:"bucket-url"` |
|
|
|
BasePath string `mapstructure:"base-path" json:"basePath" yaml:"base-path"` |
|
|
|
BasePath string `mapstructure:"base-path" json:"basePath" yaml:"base-path"` |
|
|
|
} |
|
|
|
type TencentCOS struct { |
|
|
|
Bucket string `mapstructure:"bucket" json:"bucket" yaml:"bucket"` |
|
|
|
|
|
@ -38,7 +38,7 @@ func (*Qiniu) UploadFile(file *multipart.FileHeader) (string, string, error) { |
|
|
|
|
|
|
|
return "", "", errors.New("function file.Open() Filed, err:" + openError.Error()) |
|
|
|
} |
|
|
|
defer f.Close() // 创建文件 defer 关闭
|
|
|
|
defer f.Close() // 创建文件 defer 关闭
|
|
|
|
fileKey := fmt.Sprintf("%d%s", time.Now().Unix(), file.Filename) // 文件名格式 自己可以改 建议保证唯一性
|
|
|
|
putErr := formUploader.Put(context.Background(), &ret, upToken, fileKey, f, file.Size, &putExtra) |
|
|
|
if putErr != nil { |
|
|
|