feat: phone validate
This commit is contained in:
@@ -69,7 +69,7 @@ func (ctl *posts) List(
|
||||
}
|
||||
|
||||
postIds := lo.Map(pager.Items.([]*models.Post), func(item *models.Post, _ int) int64 { return item.ID })
|
||||
if len(postIds) > 0 {
|
||||
if len(postIds) > 0 && user != nil {
|
||||
userBoughtIds, err := services.Users.BatchCheckHasBought(ctx, user.ID, postIds)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("BatchCheckHasBought err: %v", err)
|
||||
@@ -146,9 +146,13 @@ func (ctl *posts) Show(ctx fiber.Ctx, post *models.Post, user *models.User) (*Po
|
||||
return nil, fiber.ErrNotFound
|
||||
}
|
||||
|
||||
bought, err := services.Users.HasBought(ctx, user.ID, post.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var err error
|
||||
bought := false
|
||||
if user != nil {
|
||||
bought, err = services.Users.HasBought(ctx, user.ID, post.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
medias, err := services.Posts.GetMediasByIds(ctx, post.HeadImages.Data())
|
||||
@@ -200,10 +204,14 @@ func (ctl *posts) Play(ctx fiber.Ctx, post *models.Post, user *models.User) (*Pl
|
||||
// Url: "https://github.com/mediaelement/mediaelement-files/raw/refs/heads/master/big_buck_bunny.mp4",
|
||||
// }, nil
|
||||
|
||||
preview := false
|
||||
preview := true
|
||||
bought, err := services.Users.HasBought(ctx, user.ID, post.ID)
|
||||
if !bought || err != nil {
|
||||
preview = true
|
||||
if err != nil {
|
||||
preview = false
|
||||
}
|
||||
|
||||
if bought {
|
||||
preview = false
|
||||
}
|
||||
|
||||
log.Infof("Fetching play URL for post ID: %d", post.ID)
|
||||
|
||||
Reference in New Issue
Block a user