fix: issues
Some checks failed
build quyun / Build (push) Failing after 1m21s

This commit is contained in:
2025-12-22 12:04:38 +08:00
parent ed48ec46a8
commit 4704cf6949
2 changed files with 16 additions and 9 deletions

View File

@@ -186,15 +186,20 @@ func (ctl *posts) Play(ctx fiber.Ctx, post *models.Post, user *models.User) (*Pl
// return &PlayUrl{
// Url: "https://github.com/mediaelement/mediaelement-files/raw/refs/heads/master/big_buck_bunny.mp4",
// }, nil
preview := true
bought, err := services.Users.HasBought(ctx, user.ID, post.ID)
if err != nil {
preview = false
if post.Status != fields.PostStatusPublished {
return nil, fiber.ErrNotFound
}
if bought {
preview = false
preview := true
if user != nil {
bought, err := services.Users.HasBought(ctx, user.ID, post.ID)
if err != nil {
preview = false
}
if bought {
preview = false
}
}
log.Infof("Fetching play URL for post ID: %d", post.ID)