Compare commits
2 Commits
2ba0097a06
...
55275db618
Author | SHA1 | Date | |
---|---|---|---|
55275db618 | |||
a72c860511 |
@ -56,13 +56,12 @@ type PutRet struct {
|
|||||||
User string `json:"user"`
|
User string `json:"user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(accessKey, secretKey, bucket, domain, securityKey string) QiNiu {
|
func New(accessKey, secretKey, bucket, domain, securityKey string, region *storage.Region) QiNiu {
|
||||||
region, _ := storage.GetRegion(accessKey, bucket)
|
|
||||||
mac := qbox.NewMac(accessKey, secretKey)
|
mac := qbox.NewMac(accessKey, secretKey)
|
||||||
conf := &storage.Config{
|
conf := &storage.Config{
|
||||||
Region: region, //空间所在的存储区域
|
Region: region, //空间所在的存储区域
|
||||||
UseHTTPS: true, //是否使用https域名
|
UseHTTPS: true, //是否使用https域名
|
||||||
UseCdnDomains: true, //上传是否使用CDN上传加速
|
UseCdnDomains: false, //上传是否使用CDN上传加速
|
||||||
}
|
}
|
||||||
return &qiNiu{
|
return &qiNiu{
|
||||||
mac: mac,
|
mac: mac,
|
||||||
@ -216,7 +215,7 @@ func (q *qiNiu) GetFileHash(path, qhash string) (hash string, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sign := q.TimestampSecuritySign(path, time.Second*5)
|
sign := q.TimestampSecuritySign(path, time.Second*5)
|
||||||
addr := fmt.Sprintf("https://cdn.mogume.com/%s?%s&qhash/%s", path, sign, qhash)
|
addr := fmt.Sprintf("%s/%s?%s&qhash/%s", strings.TrimRight(q.domain, "/"), path, sign, qhash)
|
||||||
|
|
||||||
resp, err := http.Get(addr)
|
resp, err := http.Get(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user