feat: 互动处理
This commit is contained in:
@@ -37,9 +37,20 @@ func (s *ProgramService) GetProgramList(info radioReq.GetProgramList) ([]radio.R
|
||||
}
|
||||
|
||||
// GetProgramById 获取节目详情
|
||||
func (s *ProgramService) GetProgramById(id string) (*radio.RadioProgram, error) {
|
||||
func (s *ProgramService) GetProgramById(id, userId string) (*radio.RadioProgram, error) {
|
||||
var program radio.RadioProgram
|
||||
err := global.DB.Where("id = ?", id).Preload("Audio").First(&program).Error
|
||||
program.HasLiked = 0
|
||||
program.HasFavorite = 0
|
||||
liked, err := InteractionServiceApp.IsLiked(userId, id)
|
||||
if liked {
|
||||
program.HasLiked = 1
|
||||
}
|
||||
favorite, err := InteractionServiceApp.IsFavorited(userId, id)
|
||||
if favorite {
|
||||
program.HasFavorite = 1
|
||||
}
|
||||
|
||||
return &program, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user