From af820fe08c8895db70792aa0044c977e9687f722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=89=E6=98=A5?= Date: Thu, 30 Mar 2023 12:44:38 +0800 Subject: [PATCH] - update storage --- library.go | 2 +- utils/gostorage/aliyun.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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 }