...
|
...
|
@@ -6,6 +6,7 @@ import ( |
|
|
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
|
|
|
"github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
|
|
|
"github.com/astaxie/beego"
|
|
|
"github.com/prometheus/common/log"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
|
|
|
comm_time "gitlab.fjmaimaimai.com/mmm-go/gocomm/time"
|
|
|
"opp/internal/utils"
|
...
|
...
|
@@ -42,11 +43,10 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons |
|
|
request := vod.CreateCreateUploadVideoRequest()
|
|
|
filePath := getFileName(FileVideo, r.FileName)
|
|
|
if filepath.Ext(r.FileName) == "mp3" {
|
|
|
filePath = getFileName(FileVideo, r.FileName)
|
|
|
filePath = getFileName(FileVoice, r.FileName)
|
|
|
}
|
|
|
request.Title = filePath
|
|
|
request.FileName = filePath
|
|
|
//request.StorageLocation = filepath.Base(filePath)
|
|
|
request.AcceptFormat = "JSON"
|
|
|
rsp, err := client.CreateUploadVideo(request)
|
|
|
if err != nil {
|
...
|
...
|
@@ -58,6 +58,32 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons |
|
|
UploadAddress: rsp.UploadAddress,
|
|
|
UploadAuth: rsp.UploadAuth,
|
|
|
}
|
|
|
if up, e := ParseUploadAddress(rsp.UploadAddress); e != nil {
|
|
|
log.Error(e)
|
|
|
} else {
|
|
|
response.FileURL = up.GetFileUrl("")
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func RefreshUploadVideo(client *vod.Client, r *RefreshUploadVideoRequest) (response *RefreshUploadVideoResponse, err error) {
|
|
|
request := vod.CreateRefreshUploadVideoRequest()
|
|
|
request.VideoId = r.VideoId
|
|
|
request.AcceptFormat = "JSON"
|
|
|
|
|
|
var rsp *vod.RefreshUploadVideoResponse
|
|
|
rsp, err = client.RefreshUploadVideo(request)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
if err = utils.JsonDeepCopy(&response, &rsp); err != nil {
|
|
|
return
|
|
|
}
|
|
|
if up, e := ParseUploadAddress(rsp.UploadAddress); e != nil {
|
|
|
log.Error(e)
|
|
|
} else {
|
|
|
response.FileURL = up.GetFileUrl("")
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
@@ -67,7 +93,7 @@ func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (respons |
|
|
filePath := getFileName(FileImage, r.FileName)
|
|
|
request.ImageType = "default"
|
|
|
request.Title = filePath
|
|
|
request.ImageExt = filepath.Ext(r.FileName)
|
|
|
request.ImageExt = filepath.Ext(r.FileName)[1:]
|
|
|
request.AcceptFormat = "JSON"
|
|
|
//request.StorageLocation = filepath.Base(request.Title)
|
|
|
rsp, err := client.CreateUploadImage(request)
|
...
|
...
|
@@ -87,11 +113,17 @@ func GetPlayInfo(client *vod.Client, r *GetPlayInfoRequest) (response *vod.GetPl |
|
|
}
|
|
|
|
|
|
//获取播放信息
|
|
|
func GetGetVideoPlayAuth(client *vod.Client, r *GetVideoPlayAuthRequest) (response interface{}, err error) {
|
|
|
func GetGetVideoPlayAuth(client *vod.Client, r *GetVideoPlayAuthRequest) (response GetVideoPlayAuthResponse, err error) {
|
|
|
request := vod.CreateGetVideoPlayAuthRequest()
|
|
|
request.VideoId = r.VideoId
|
|
|
request.AcceptFormat = "JSON"
|
|
|
return client.GetVideoPlayAuth(request)
|
|
|
var rsp *vod.GetVideoPlayAuthResponse
|
|
|
if rsp, err = client.GetVideoPlayAuth(request); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
err = utils.JsonDeepCopy(&response, rsp)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//fileType: video voice image
|
...
|
...
|
|