正在显示
8 个修改的文件
包含
220 行增加
和
12 行删除
| @@ -37,6 +37,27 @@ func (this *VodController) CreateUploadVideo() { | @@ -37,6 +37,27 @@ func (this *VodController) CreateUploadVideo() { | ||
| 37 | msg = protocol.NewReturnResponse(upload.CreateUploadVideo(header, request)) | 37 | msg = protocol.NewReturnResponse(upload.CreateUploadVideo(header, request)) |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | +//刷新视频上传凭证 RefreshUploadVideo | ||
| 41 | +// @router /refreshUploadVideo [post] | ||
| 42 | +func (this *VodController) RefreshUploadVideo() { | ||
| 43 | + var msg *protocol.ResponseMessage | ||
| 44 | + defer func() { | ||
| 45 | + this.Resp(msg) | ||
| 46 | + }() | ||
| 47 | + var request *aliyun.RefreshUploadVideoRequest | ||
| 48 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 49 | + log.Error(err) | ||
| 50 | + msg = protocol.BadRequestParam(1) | ||
| 51 | + return | ||
| 52 | + } | ||
| 53 | + if b, m := this.Valid(request); !b { | ||
| 54 | + msg = m | ||
| 55 | + return | ||
| 56 | + } | ||
| 57 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 58 | + msg = protocol.NewReturnResponse(upload.RefreshUploadVideo(header, request)) | ||
| 59 | +} | ||
| 60 | + | ||
| 40 | //创建图片上传凭证 CreateUploadImage | 61 | //创建图片上传凭证 CreateUploadImage |
| 41 | // @router /createUploadImage [post] | 62 | // @router /createUploadImage [post] |
| 42 | func (this *VodController) CreateUploadImage() { | 63 | func (this *VodController) CreateUploadImage() { |
| @@ -58,6 +79,45 @@ func (this *VodController) CreateUploadImage() { | @@ -58,6 +79,45 @@ func (this *VodController) CreateUploadImage() { | ||
| 58 | msg = protocol.NewReturnResponse(upload.CreateUploadImage(header, request)) | 79 | msg = protocol.NewReturnResponse(upload.CreateUploadImage(header, request)) |
| 59 | } | 80 | } |
| 60 | 81 | ||
| 82 | +//创建图片上传凭证 CreateUploadImages | ||
| 83 | +// @router /createUploadImages [post] | ||
| 84 | +func (this *VodController) CreateUploadImages() { | ||
| 85 | + var msg *protocol.ResponseMessage | ||
| 86 | + defer func() { | ||
| 87 | + this.Resp(msg) | ||
| 88 | + }() | ||
| 89 | + var ( | ||
| 90 | + request *aliyun.CreateUploadImagesRequest | ||
| 91 | + response *aliyun.CreateUploadImagesResponse = &aliyun.CreateUploadImagesResponse{ | ||
| 92 | + List: make([]*aliyun.CreateUploadImageResponse, 0), | ||
| 93 | + } | ||
| 94 | + ) | ||
| 95 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 96 | + log.Error(err) | ||
| 97 | + msg = protocol.BadRequestParam(1) | ||
| 98 | + return | ||
| 99 | + } | ||
| 100 | + if b, m := this.Valid(request); !b { | ||
| 101 | + msg = m | ||
| 102 | + return | ||
| 103 | + } | ||
| 104 | + var err error | ||
| 105 | + if len(request.Items) == 0 { | ||
| 106 | + msg = protocol.BadRequestParam(2) | ||
| 107 | + } | ||
| 108 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 109 | + for i := range request.Items { | ||
| 110 | + r := request.Items[i] | ||
| 111 | + if rsp, e := upload.CreateUploadImage(header, r); e != nil { | ||
| 112 | + err = e | ||
| 113 | + break | ||
| 114 | + } else { | ||
| 115 | + response.List = append(response.List, rsp) | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + msg = protocol.NewReturnResponse(response, err) | ||
| 119 | +} | ||
| 120 | + | ||
| 61 | //获取视频播放地址 GetPlayInfo | 121 | //获取视频播放地址 GetPlayInfo |
| 62 | // @router /getPlayInfo [post] | 122 | // @router /getPlayInfo [post] |
| 63 | func (this *VodController) GetPlayInfo() { | 123 | func (this *VodController) GetPlayInfo() { |
| @@ -3,7 +3,7 @@ package aliyun | @@ -3,7 +3,7 @@ package aliyun | ||
| 3 | //创建视频上传凭证 | 3 | //创建视频上传凭证 |
| 4 | /*CreateUploadVideo */ | 4 | /*CreateUploadVideo */ |
| 5 | type CreateUploadVideoRequest struct { | 5 | type CreateUploadVideoRequest struct { |
| 6 | - FileName string `position:"Query" name:"fileName"` | 6 | + FileName string `json:"fileName"` |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | type CreateUploadVideoResponse struct { | 9 | type CreateUploadVideoResponse struct { |
| @@ -11,6 +11,20 @@ type CreateUploadVideoResponse struct { | @@ -11,6 +11,20 @@ type CreateUploadVideoResponse struct { | ||
| 11 | VideoId string `json:"videoId"` | 11 | VideoId string `json:"videoId"` |
| 12 | UploadAddress string `json:"uploadAddress"` | 12 | UploadAddress string `json:"uploadAddress"` |
| 13 | UploadAuth string `json:"uploadAuth"` | 13 | UploadAuth string `json:"uploadAuth"` |
| 14 | + FileURL string `json:"fileURL"` | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +//刷新视频上传凭证 RefreshUploadVideo | ||
| 18 | +type RefreshUploadVideoRequest struct { | ||
| 19 | + VideoId string `json:"videoId" valid:"Required;"` | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +type RefreshUploadVideoResponse struct { | ||
| 23 | + RequestId string `json:"requestId"` | ||
| 24 | + VideoId string `json:"videoId"` | ||
| 25 | + UploadAddress string `json:"uploadAddress"` | ||
| 26 | + UploadAuth string `json:"uploadAuth"` | ||
| 27 | + FileURL string `json:"fileURL"` | ||
| 14 | } | 28 | } |
| 15 | 29 | ||
| 16 | /*GetPlayInfo 获取播放信息*/ | 30 | /*GetPlayInfo 获取播放信息*/ |
| @@ -75,3 +89,19 @@ type PlayInfo struct { | @@ -75,3 +89,19 @@ type PlayInfo struct { | ||
| 75 | PlayURL string `json:"PlayURL" xml:"PlayURL"` | 89 | PlayURL string `json:"PlayURL" xml:"PlayURL"` |
| 76 | Specification string `json:"Specification" xml:"Specification"` | 90 | Specification string `json:"Specification" xml:"Specification"` |
| 77 | } | 91 | } |
| 92 | + | ||
| 93 | +//GetVideoPlayAuthResponse is the response struct for api GetVideoPlayAuth | ||
| 94 | +type GetVideoPlayAuthResponse struct { | ||
| 95 | + RequestId string `json:"requestId" xml:"RequestId"` | ||
| 96 | + PlayAuth string `json:"playAuth" xml:"PlayAuth"` | ||
| 97 | + VideoMeta VideoMeta `json:"videoMeta" xml:"VideoMeta"` | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +// VideoMeta is a nested struct in vod response | ||
| 101 | +type VideoMeta struct { | ||
| 102 | + CoverURL string `json:"coverURL" xml:"CoverURL"` | ||
| 103 | + Duration float64 `json:"duration" xml:"Duration"` | ||
| 104 | + Status string `json:"-" xml:"Status"` | ||
| 105 | + Title string `json:"title" xml:"Title"` | ||
| 106 | + VideoId string `json:"videoId" xml:"VideoId"` | ||
| 107 | +} |
| @@ -5,10 +5,18 @@ type CreateUploadImageRequest struct { | @@ -5,10 +5,18 @@ type CreateUploadImageRequest struct { | ||
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | type CreateUploadImageResponse struct { | 7 | type CreateUploadImageResponse struct { |
| 8 | - RequestId string `json:"requestId" xml:"RequestId"` | ||
| 9 | - ImageId string `json:"imageId" xml:"ImageId"` | ||
| 10 | - ImageURL string `json:"imageURL" xml:"ImageURL"` | ||
| 11 | - UploadAddress string `json:"uploadAddress" xml:"UploadAddress"` | ||
| 12 | - UploadAuth string `json:"uploadAuth" xml:"UploadAuth"` | ||
| 13 | - FileURL string `json:"fileURL" xml:"FileURL"` | 8 | + RequestId string `json:"requestId"` |
| 9 | + ImageId string `json:"imageId" ` | ||
| 10 | + ImageURL string `json:"imageURL"` | ||
| 11 | + UploadAddress string `json:"uploadAddress"` | ||
| 12 | + UploadAuth string `json:"uploadAuth"` | ||
| 13 | + FileURL string `json:"fileURL"` | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +type CreateUploadImagesRequest struct { | ||
| 17 | + Items []*CreateUploadImageRequest `json:"items"` | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +type CreateUploadImagesResponse struct { | ||
| 21 | + List []*CreateUploadImageResponse `json:"list"` | ||
| 14 | } | 22 | } |
internal/aliyun/utils.go
0 → 100644
| 1 | +package aliyun | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "encoding/base64" | ||
| 5 | + "encoding/json" | ||
| 6 | + "fmt" | ||
| 7 | + "strings" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type UploadAddress struct { | ||
| 11 | + Endpoint string | ||
| 12 | + Bucket string | ||
| 13 | + FileName string | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +//@cname 绑定域名 | ||
| 17 | +func (up UploadAddress) GetFileUrl(cname string) string { | ||
| 18 | + if len(cname) > 0 { | ||
| 19 | + return fmt.Sprintf("%v%v", cname, up.FileName) | ||
| 20 | + } | ||
| 21 | + if strings.Contains(up.Endpoint, "https") { | ||
| 22 | + return fmt.Sprintf("%v%v.%v/%v", up.Endpoint[:8], up.Bucket, up.Endpoint[8:], up.FileName) | ||
| 23 | + } else if strings.Contains(up.Endpoint, "http") { | ||
| 24 | + return fmt.Sprintf("%v%v.%v/%v", up.Endpoint[:7], up.Bucket, up.Endpoint[7:], up.FileName) | ||
| 25 | + } | ||
| 26 | + return "" | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +//解析UploadAddress | ||
| 30 | +func ParseUploadAddress(uploadAddress string) (up UploadAddress, err error) { | ||
| 31 | + var jsData []byte | ||
| 32 | + jsData, err = base64.StdEncoding.DecodeString(uploadAddress) | ||
| 33 | + if err != nil { | ||
| 34 | + return | ||
| 35 | + } | ||
| 36 | + if err = json.Unmarshal(jsData, &up); err != nil { | ||
| 37 | + return | ||
| 38 | + } | ||
| 39 | + return | ||
| 40 | +} |
| @@ -6,6 +6,7 @@ import ( | @@ -6,6 +6,7 @@ import ( | ||
| 6 | "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" | 6 | "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" |
| 7 | "github.com/aliyun/alibaba-cloud-sdk-go/services/vod" | 7 | "github.com/aliyun/alibaba-cloud-sdk-go/services/vod" |
| 8 | "github.com/astaxie/beego" | 8 | "github.com/astaxie/beego" |
| 9 | + "github.com/prometheus/common/log" | ||
| 9 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/common" | 10 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/common" |
| 10 | comm_time "gitlab.fjmaimaimai.com/mmm-go/gocomm/time" | 11 | comm_time "gitlab.fjmaimaimai.com/mmm-go/gocomm/time" |
| 11 | "opp/internal/utils" | 12 | "opp/internal/utils" |
| @@ -42,11 +43,10 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons | @@ -42,11 +43,10 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons | ||
| 42 | request := vod.CreateCreateUploadVideoRequest() | 43 | request := vod.CreateCreateUploadVideoRequest() |
| 43 | filePath := getFileName(FileVideo, r.FileName) | 44 | filePath := getFileName(FileVideo, r.FileName) |
| 44 | if filepath.Ext(r.FileName) == "mp3" { | 45 | if filepath.Ext(r.FileName) == "mp3" { |
| 45 | - filePath = getFileName(FileVideo, r.FileName) | 46 | + filePath = getFileName(FileVoice, r.FileName) |
| 46 | } | 47 | } |
| 47 | request.Title = filePath | 48 | request.Title = filePath |
| 48 | request.FileName = filePath | 49 | request.FileName = filePath |
| 49 | - //request.StorageLocation = filepath.Base(filePath) | ||
| 50 | request.AcceptFormat = "JSON" | 50 | request.AcceptFormat = "JSON" |
| 51 | rsp, err := client.CreateUploadVideo(request) | 51 | rsp, err := client.CreateUploadVideo(request) |
| 52 | if err != nil { | 52 | if err != nil { |
| @@ -58,6 +58,32 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons | @@ -58,6 +58,32 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons | ||
| 58 | UploadAddress: rsp.UploadAddress, | 58 | UploadAddress: rsp.UploadAddress, |
| 59 | UploadAuth: rsp.UploadAuth, | 59 | UploadAuth: rsp.UploadAuth, |
| 60 | } | 60 | } |
| 61 | + if up, e := ParseUploadAddress(rsp.UploadAddress); e != nil { | ||
| 62 | + log.Error(e) | ||
| 63 | + } else { | ||
| 64 | + response.FileURL = up.GetFileUrl("") | ||
| 65 | + } | ||
| 66 | + return | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +func RefreshUploadVideo(client *vod.Client, r *RefreshUploadVideoRequest) (response *RefreshUploadVideoResponse, err error) { | ||
| 70 | + request := vod.CreateRefreshUploadVideoRequest() | ||
| 71 | + request.VideoId = r.VideoId | ||
| 72 | + request.AcceptFormat = "JSON" | ||
| 73 | + | ||
| 74 | + var rsp *vod.RefreshUploadVideoResponse | ||
| 75 | + rsp, err = client.RefreshUploadVideo(request) | ||
| 76 | + if err != nil { | ||
| 77 | + return | ||
| 78 | + } | ||
| 79 | + if err = utils.JsonDeepCopy(&response, &rsp); err != nil { | ||
| 80 | + return | ||
| 81 | + } | ||
| 82 | + if up, e := ParseUploadAddress(rsp.UploadAddress); e != nil { | ||
| 83 | + log.Error(e) | ||
| 84 | + } else { | ||
| 85 | + response.FileURL = up.GetFileUrl("") | ||
| 86 | + } | ||
| 61 | return | 87 | return |
| 62 | } | 88 | } |
| 63 | 89 | ||
| @@ -67,7 +93,7 @@ func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (respons | @@ -67,7 +93,7 @@ func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (respons | ||
| 67 | filePath := getFileName(FileImage, r.FileName) | 93 | filePath := getFileName(FileImage, r.FileName) |
| 68 | request.ImageType = "default" | 94 | request.ImageType = "default" |
| 69 | request.Title = filePath | 95 | request.Title = filePath |
| 70 | - request.ImageExt = filepath.Ext(r.FileName) | 96 | + request.ImageExt = filepath.Ext(r.FileName)[1:] |
| 71 | request.AcceptFormat = "JSON" | 97 | request.AcceptFormat = "JSON" |
| 72 | //request.StorageLocation = filepath.Base(request.Title) | 98 | //request.StorageLocation = filepath.Base(request.Title) |
| 73 | rsp, err := client.CreateUploadImage(request) | 99 | rsp, err := client.CreateUploadImage(request) |
| @@ -87,11 +113,17 @@ func GetPlayInfo(client *vod.Client, r *GetPlayInfoRequest) (response *vod.GetPl | @@ -87,11 +113,17 @@ func GetPlayInfo(client *vod.Client, r *GetPlayInfoRequest) (response *vod.GetPl | ||
| 87 | } | 113 | } |
| 88 | 114 | ||
| 89 | //获取播放信息 | 115 | //获取播放信息 |
| 90 | -func GetGetVideoPlayAuth(client *vod.Client, r *GetVideoPlayAuthRequest) (response interface{}, err error) { | 116 | +func GetGetVideoPlayAuth(client *vod.Client, r *GetVideoPlayAuthRequest) (response GetVideoPlayAuthResponse, err error) { |
| 91 | request := vod.CreateGetVideoPlayAuthRequest() | 117 | request := vod.CreateGetVideoPlayAuthRequest() |
| 92 | request.VideoId = r.VideoId | 118 | request.VideoId = r.VideoId |
| 93 | request.AcceptFormat = "JSON" | 119 | request.AcceptFormat = "JSON" |
| 94 | - return client.GetVideoPlayAuth(request) | 120 | + var rsp *vod.GetVideoPlayAuthResponse |
| 121 | + if rsp, err = client.GetVideoPlayAuth(request); err != nil { | ||
| 122 | + log.Error(err) | ||
| 123 | + return | ||
| 124 | + } | ||
| 125 | + err = utils.JsonDeepCopy(&response, rsp) | ||
| 126 | + return | ||
| 95 | } | 127 | } |
| 96 | 128 | ||
| 97 | //fileType: video voice image | 129 | //fileType: video voice image |
| @@ -492,6 +492,7 @@ func ClearEmptyForm(inputFormList []*Form) (FormList []*Form) { | @@ -492,6 +492,7 @@ func ClearEmptyForm(inputFormList []*Form) (FormList []*Form) { | ||
| 492 | type Speech struct { | 492 | type Speech struct { |
| 493 | Path string `json:"path"` | 493 | Path string `json:"path"` |
| 494 | Duration int `json:"duration"` | 494 | Duration int `json:"duration"` |
| 495 | + VideoId string `json:"videoId"` | ||
| 495 | } | 496 | } |
| 496 | 497 | ||
| 497 | //图片 | 498 | //图片 |
| @@ -499,6 +500,7 @@ type Picture struct { | @@ -499,6 +500,7 @@ type Picture struct { | ||
| 499 | Path string `json:"path"` | 500 | Path string `json:"path"` |
| 500 | W int `json:"w"` | 501 | W int `json:"w"` |
| 501 | H int `json:"h"` | 502 | H int `json:"h"` |
| 503 | + ImageId string `json:"imageId"` | ||
| 502 | } | 504 | } |
| 503 | 505 | ||
| 504 | //视频 | 506 | //视频 |
| @@ -506,6 +508,7 @@ type Video struct { | @@ -506,6 +508,7 @@ type Video struct { | ||
| 506 | Path string `json:"path"` | 508 | Path string `json:"path"` |
| 507 | Cover Cover `json:"cover"` //封面 | 509 | Cover Cover `json:"cover"` //封面 |
| 508 | Duration int `json:"duration"` | 510 | Duration int `json:"duration"` |
| 511 | + VideoId string `json:"videoId"` | ||
| 509 | } | 512 | } |
| 510 | 513 | ||
| 511 | //审批配置 | 514 | //审批配置 |
| @@ -625,6 +625,14 @@ func init() { | @@ -625,6 +625,14 @@ func init() { | ||
| 625 | 625 | ||
| 626 | beego.GlobalControllerRouter["opp/controllers/v1:VodController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:VodController"], | 626 | beego.GlobalControllerRouter["opp/controllers/v1:VodController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:VodController"], |
| 627 | beego.ControllerComments{ | 627 | beego.ControllerComments{ |
| 628 | + Method: "CreateUploadImages", | ||
| 629 | + Router: `/createUploadImages`, | ||
| 630 | + AllowHTTPMethods: []string{"post"}, | ||
| 631 | + MethodParams: param.Make(), | ||
| 632 | + Params: nil}) | ||
| 633 | + | ||
| 634 | + beego.GlobalControllerRouter["opp/controllers/v1:VodController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:VodController"], | ||
| 635 | + beego.ControllerComments{ | ||
| 628 | Method: "CreateUploadVideo", | 636 | Method: "CreateUploadVideo", |
| 629 | Router: `/createUploadVideo`, | 637 | Router: `/createUploadVideo`, |
| 630 | AllowHTTPMethods: []string{"post"}, | 638 | AllowHTTPMethods: []string{"post"}, |
| @@ -647,4 +655,12 @@ func init() { | @@ -647,4 +655,12 @@ func init() { | ||
| 647 | MethodParams: param.Make(), | 655 | MethodParams: param.Make(), |
| 648 | Params: nil}) | 656 | Params: nil}) |
| 649 | 657 | ||
| 658 | + beego.GlobalControllerRouter["opp/controllers/v1:VodController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:VodController"], | ||
| 659 | + beego.ControllerComments{ | ||
| 660 | + Method: "RefreshUploadVideo", | ||
| 661 | + Router: `/refreshUploadVideo`, | ||
| 662 | + AllowHTTPMethods: []string{"post"}, | ||
| 663 | + MethodParams: param.Make(), | ||
| 664 | + Params: nil}) | ||
| 665 | + | ||
| 650 | } | 666 | } |
| @@ -151,6 +151,22 @@ func CreateUploadVideo(header *protocol.RequestHeader, request *aliyun.CreateUpl | @@ -151,6 +151,22 @@ func CreateUploadVideo(header *protocol.RequestHeader, request *aliyun.CreateUpl | ||
| 151 | return | 151 | return |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | +//创建视频上传凭证 | ||
| 155 | +func RefreshUploadVideo(header *protocol.RequestHeader, request *aliyun.RefreshUploadVideoRequest) (rsp *aliyun.RefreshUploadVideoResponse, err error) { | ||
| 156 | + var () | ||
| 157 | + client, e := aliyun.DefaultVodClient() | ||
| 158 | + if e != nil { | ||
| 159 | + log.Error(e) | ||
| 160 | + err = e | ||
| 161 | + return | ||
| 162 | + } | ||
| 163 | + rsp, err = aliyun.RefreshUploadVideo(client, request) | ||
| 164 | + if err != nil { | ||
| 165 | + log.Error(err) | ||
| 166 | + } | ||
| 167 | + return | ||
| 168 | +} | ||
| 169 | + | ||
| 154 | //创建图片上传凭证 | 170 | //创建图片上传凭证 |
| 155 | func CreateUploadImage(header *protocol.RequestHeader, request *aliyun.CreateUploadImageRequest) (rsp *aliyun.CreateUploadImageResponse, err error) { | 171 | func CreateUploadImage(header *protocol.RequestHeader, request *aliyun.CreateUploadImageRequest) (rsp *aliyun.CreateUploadImageResponse, err error) { |
| 156 | var () | 172 | var () |
| @@ -160,6 +176,9 @@ func CreateUploadImage(header *protocol.RequestHeader, request *aliyun.CreateUpl | @@ -160,6 +176,9 @@ func CreateUploadImage(header *protocol.RequestHeader, request *aliyun.CreateUpl | ||
| 160 | err = e | 176 | err = e |
| 161 | return | 177 | return |
| 162 | } | 178 | } |
| 179 | + if len(request.FileName) == 0 { | ||
| 180 | + request.FileName = aliyun.DefaultImageFileName | ||
| 181 | + } | ||
| 163 | rsp, err = aliyun.CreateUploadImage(client, request) | 182 | rsp, err = aliyun.CreateUploadImage(client, request) |
| 164 | if err != nil { | 183 | if err != nil { |
| 165 | log.Error(err) | 184 | log.Error(err) |
-
请 注册 或 登录 后发表评论