feat: update issues
This commit is contained in:
@@ -2,6 +2,7 @@ package http
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"quyun/app/models"
|
||||
@@ -156,9 +157,12 @@ type PlayUrl struct {
|
||||
// @Bind id path
|
||||
// @Bind user local
|
||||
func (ctl *posts) Play(ctx fiber.Ctx, id int64, user *model.Users) (*PlayUrl, error) {
|
||||
log := log.WithField("PlayPostID", strconv.FormatInt(id, 10))
|
||||
|
||||
log.Infof("Fetching play URL for post ID: %d", id)
|
||||
post, err := models.Posts.GetByID(ctx.Context(), id)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("GetByID err: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -172,10 +176,12 @@ func (ctl *posts) Play(ctx fiber.Ctx, id int64, user *model.Users) (*PlayUrl, er
|
||||
if asset.Type == "video/mp4" && asset.Metas != nil && asset.Metas.Short == preview {
|
||||
media, err := models.Medias.GetByID(ctx.Context(), asset.Media)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("medias GetByID err: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
url, err := ctl.oss.GetSignedUrl(ctx.Context(), media.Path)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("media GetSignedUrl err: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
return &PlayUrl{Url: url}, nil
|
||||
|
||||
Reference in New Issue
Block a user