下载链接有效期延长到四小时

This commit is contained in:
122cygf
2021-02-26 12:37:44 +08:00
parent e146054679
commit 46f09836f3
3 changed files with 32 additions and 4 deletions

View File

@@ -28,6 +28,21 @@ func GetFile(fileId string) (*File, error) {
return &resp,nil
}
// get download_url
func GetDownLoadUrl(fileId string) (*File, error) {
url:=conf.Conf.AliDrive.ApiUrl+"/file/get_download_url"
req:=DownloadReq{
DriveId: User.DefaultDriveId,
FileId: fileId,
ExpireSec: 14400,
}
var resp File
if err := BodyToJson(url, req, &resp, true); err!=nil {
return nil,err
}
return &resp,nil
}
// search by keyword
func Search(key string,limit int, marker string) (*Files, error) {
url:=conf.Conf.AliDrive.ApiUrl+"/file/search"
@@ -186,4 +201,4 @@ func GetPaths(fileId string) (*[]Path,error) {
FileId: "root",
})
return &paths,nil
}
}