|
@@ -10,6 +10,7 @@ import ( |
|
@@ -10,6 +10,7 @@ import ( |
10
|
comm_time "gitlab.fjmaimaimai.com/mmm-go/gocomm/time"
|
10
|
comm_time "gitlab.fjmaimaimai.com/mmm-go/gocomm/time"
|
11
|
"opp/internal/utils"
|
11
|
"opp/internal/utils"
|
12
|
"path"
|
12
|
"path"
|
|
|
13
|
+ "path/filepath"
|
13
|
"time"
|
14
|
"time"
|
14
|
)
|
15
|
)
|
15
|
|
16
|
|
|
@@ -39,10 +40,13 @@ func InitVodClient(accessKeyId string, accessKeySecret string) (client *vod.Clie |
|
@@ -39,10 +40,13 @@ func InitVodClient(accessKeyId string, accessKeySecret string) (client *vod.Clie |
39
|
//获取视频上传地址和凭证,并创建视频信息
|
40
|
//获取视频上传地址和凭证,并创建视频信息
|
40
|
func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (response *CreateUploadVideoResponse, err error) {
|
41
|
func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (response *CreateUploadVideoResponse, err error) {
|
41
|
request := vod.CreateCreateUploadVideoRequest()
|
42
|
request := vod.CreateCreateUploadVideoRequest()
|
42
|
- request.Title = getFileName(FileVideo, "video_file.mp4")
|
|
|
43
|
- request.FileName = getFileName(FileVideo, "video_file.mp4")
|
|
|
44
|
- //request.CoverURL = "http://img.alicdn.com/tps/TB1qnJ1PVXXXXXCXXXXXXXXXXXX-700-700.png"
|
|
|
45
|
- //request.Tags = "tag1,tag2"
|
43
|
+ filePath := getFileName(FileVideo, r.FileName)
|
|
|
44
|
+ if filepath.Ext(r.FileName) == "mp3" {
|
|
|
45
|
+ filePath = getFileName(FileVideo, r.FileName)
|
|
|
46
|
+ }
|
|
|
47
|
+ request.Title = filePath
|
|
|
48
|
+ request.FileName = filePath
|
|
|
49
|
+ //request.StorageLocation = filepath.Base(filePath)
|
46
|
request.AcceptFormat = "JSON"
|
50
|
request.AcceptFormat = "JSON"
|
47
|
rsp, err := client.CreateUploadVideo(request)
|
51
|
rsp, err := client.CreateUploadVideo(request)
|
48
|
if err != nil {
|
52
|
if err != nil {
|
|
@@ -60,9 +64,12 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons |
|
@@ -60,9 +64,12 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons |
60
|
//获取图片上传地址和凭证,并创建视频信息
|
64
|
//获取图片上传地址和凭证,并创建视频信息
|
61
|
func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (response *CreateUploadImageResponse, err error) {
|
65
|
func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (response *CreateUploadImageResponse, err error) {
|
62
|
request := vod.CreateCreateUploadImageRequest()
|
66
|
request := vod.CreateCreateUploadImageRequest()
|
63
|
- request.ImageType = "cover"
|
67
|
+ filePath := getFileName(FileImage, r.FileName)
|
|
|
68
|
+ request.ImageType = "default"
|
|
|
69
|
+ request.Title = filePath
|
|
|
70
|
+ request.ImageExt = filepath.Ext(r.FileName)
|
64
|
request.AcceptFormat = "JSON"
|
71
|
request.AcceptFormat = "JSON"
|
65
|
- request.ImageExt = "jpg"
|
72
|
+ //request.StorageLocation = filepath.Base(request.Title)
|
66
|
rsp, err := client.CreateUploadImage(request)
|
73
|
rsp, err := client.CreateUploadImage(request)
|
67
|
if err != nil {
|
74
|
if err != nil {
|
68
|
return
|
75
|
return
|