Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5382eb

Browse files
committed
七牛
1 parent c601932 commit f5382eb

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

config/env.sample.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ activate_sign_salt = Gj&NaEqio1Tv2&4&3$
4848
access_key = xxxxxx
4949
secret_key = xxxxxxx
5050
bucket_name = xxxx
51+
domain = xxx
5152

5253
; 抓取程序
5354
[crawl]

src/http/controller/image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ func (ImageController) Transfer(ctx echo.Context) error {
7676
return fail(ctx, 2, "文件上传失败!")
7777
}
7878

79-
return success(ctx, map[string]interface{}{"uri": logic.ImageDomain + path})
79+
return success(ctx, map[string]interface{}{"uri": logic.QiniuDomain + path})
8080
}

src/logic/uploader.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ import (
3737
"github.com/qiniu/api.v6/rs"
3838
)
3939

40+
var (
41+
// QiniuDomain = "https://dn-studygolang.qbox.me/"
42+
QiniuDomain = "http://studygolang.qiniudn.com/"
43+
)
44+
4045
const (
41-
// ImageDomain = "http://studygolang.qiniudn.com/"
42-
ImageDomain = "https://dn-studygolang.qbox.me/"
4346
MaxImageSize = 5 << 20 // 5M
4447
)
4548

@@ -58,6 +61,11 @@ func (this *UploaderLogic) InitQiniu() {
5861
conf.ACCESS_KEY = config.ConfigFile.MustValue("qiniu", "access_key")
5962
conf.SECRET_KEY = config.ConfigFile.MustValue("qiniu", "secret_key")
6063
this.bucketName = config.ConfigFile.MustValue("qiniu", "bucket_name")
64+
65+
qiniuDomain := config.ConfigFile.MustValue("qiniu", "domain")
66+
if qiniuDomain != "" {
67+
QiniuDomain = qiniuDomain
68+
}
6169
}
6270

6371
// 生成上传凭证

0 commit comments

Comments
 (0)