diff --git a/library.go b/library.go index 3b5a705a..d6e8dc5f 100644 --- a/library.go +++ b/library.go @@ -1,5 +1,5 @@ package go_library func Version() string { - return "1.0.117" + return "1.0.118" } diff --git a/utils/gostorage/aliyun.go b/utils/gostorage/aliyun.go index 34e7c4e9..554b51f5 100644 --- a/utils/gostorage/aliyun.go +++ b/utils/gostorage/aliyun.go @@ -35,10 +35,22 @@ func NewAliYun(config *AliYunConfig) (*AliYun, error) { app.endpoint = config.Endpoint app.bucketName = config.BucketName + // 创建链接 app.client, app.error = oss.New(app.endpoint, app.accessKeyId, app.accessKeySecret) if app.error != nil { return nil, app.error } + // 填写存储空间名称 + app.bucket, app.error = app.client.Bucket(app.bucketName) + if app.error != nil { + return nil, app.error + } + + // 判断存储空间是否存在 + _, app.error = app.client.IsBucketExist(app.bucketName) + if app.error != nil { + return nil, app.error + } return app, nil }