You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
package newbiedao |
|
|
|
import ( |
|
"context" |
|
"github.com/pkg/errors" |
|
"go-common/app/interface/main/growup/model" |
|
"go-common/library/ecode" |
|
"go-common/library/log" |
|
"go-common/library/net/metadata" |
|
"net/url" |
|
"strconv" |
|
) |
|
|
|
// GetVideoUp get video up |
|
func (d *Dao) GetVideoUp(c context.Context, aid int64) (videoUpArchive *model.VideoUpArchive, err error) { |
|
uv := url.Values{} |
|
uv.Set("aid", strconv.FormatInt(aid, 10)) |
|
videoUpRes := new(model.VideoUpRes) |
|
err = d.httpRead.Get(c, d.c.Host.VideoUpURI, metadata.String(c, metadata.RemoteIP), uv, videoUpRes) |
|
if err != nil { |
|
log.Error("s.dao.GetVideoUp error(%v)", err) |
|
return |
|
} |
|
if videoUpRes.Code != ecode.OK.Code() { |
|
err = errors.Wrap(ecode.Int(videoUpRes.Code), "get video up failed") |
|
log.Error("s.dao.GetVideoUp get video up failed, ecode: %d", videoUpRes.Code) |
|
return |
|
} |
|
if videoUpRes.Data == nil || videoUpRes.Data.Archive == nil { |
|
err = errors.Wrap(ecode.Int(videoUpRes.Code), "get video up nil") |
|
log.Error("s.dao.GetVideoUp get video up is empty") |
|
return |
|
} |
|
|
|
videoUpArchive = videoUpRes.Data.Archive |
|
return |
|
}
|
|
|