示例#1
0
/**
 * [GetDownloadUrl 取私密下载连接]
 * @param  string      inUrl  [图片链接]
 * @return string, error      [私密链接,错误值]
 */
func (this *QiniuSdk) GetDownloadUrl(inUrl string) (string, error) {
	urlStruct, err := url.Parse(inUrl)
	if err != nil {
		return "", err
	}
	domain := "http://" + urlStruct.Host
	key := urlStruct.Path

	client := this.getClient()

	getPolicy := &kodo.GetPolicy{
		Expires: 3600,
	}
	baseUrl := kodo.MakeBaseUrl(domain, key)
	privateUrl := client.MakePrivateUrl(baseUrl, getPolicy)

	return privateUrl, nil
}
示例#2
0
func GetCloudFileUrl(remoteKey string) (url string) {
	baseUrl := kodo.MakeBaseUrl(DOMAIN, remoteKey) // 得到下载 url
	return baseUrl
}
示例#3
0
/**
 * [MakeBaseUrl 获取基本地址]
 * @param  [type]     domain [域名]
 * @param  string     key    [图片哈希值]
 * @return string            [地址]
 */
func (this *QiniuSdk) MakeBaseUrl(domain, key string) string {
	return kodo.MakeBaseUrl(domain, key)
}
示例#4
0
//获取完整url
func (this *QiniuService) GetUrlOnQiniu(path string) (url string) {
	return kodo.MakeBaseUrl(this.qiniu_BaseUrl, path)
}