feat: 互动处理

This commit is contained in:
Blizzard
2026-03-05 10:30:29 +08:00
parent 172e5f791f
commit 74b252550b
11 changed files with 846 additions and 790 deletions
+14
View File
@@ -11,6 +11,8 @@ import (
type InteractionService struct{}
var InteractionServiceApp = new(InteractionService)
// AddHistory 添加收听历史
func (s *InteractionService) AddHistory(userId string, req radioReq.AddHistory) error {
// 先查找是否已存在记录
@@ -174,3 +176,15 @@ func (s *InteractionService) GetCommentList(programId string, info radioReq.GetC
err = db.Offset(offset).Limit(info.PageSize).Order("created_at DESC").Find(&list).Error
return list, total, err
}
func (s *InteractionService) DeleteHistory(userId, programId string) error {
return global.DB.Where("user_id = ? AND program_id = ?", userId, programId).Delete(&radio.RadioHistory{}).Error
}
func (s *InteractionService) DeleteAllHistory(userId string) error {
return global.DB.Where("user_id = ?", userId).Delete(&radio.RadioHistory{}).Error
}
func (s *InteractionService) RemoveAllFavorite(userId string) error {
return global.DB.Where("user_id = ?", userId).Delete(&radio.RadioFavorite{}).Error
}