feat: 互动处理
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user