feat: 长文本语音合成
This commit is contained in:
@@ -91,6 +91,22 @@ func (s *InteractionService) ToggleLike(userId, programId string) (bool, error)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GetLikeList 获取点赞列表
|
||||
func (s *InteractionService) GetLikeList(userId string, req radioReq.GetLikeList) ([]radio.RadioLike, int64, error) {
|
||||
db := global.DB.Model(&radio.RadioLike{}).Where("user_id = ?", userId).Preload("RadioProgram")
|
||||
var list []radio.RadioLike
|
||||
var total int64
|
||||
|
||||
err := db.Count(&total).Error
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
offset := (req.Current - 1) * req.PageSize
|
||||
err = db.Offset(offset).Limit(req.PageSize).Order("created_at DESC").Find(&list).Error
|
||||
return list, total, err
|
||||
}
|
||||
|
||||
// IsLiked 检查是否已点赞
|
||||
func (s *InteractionService) IsLiked(userId, programId string) (bool, error) {
|
||||
var count int64
|
||||
@@ -124,7 +140,7 @@ func (s *InteractionService) RemoveFavorite(userId, programId string) error {
|
||||
|
||||
// GetFavoriteList 获取收藏列表
|
||||
func (s *InteractionService) GetFavoriteList(userId string, info radioReq.GetFavoriteList) ([]radio.RadioFavorite, int64, error) {
|
||||
db := global.DB.Model(&radio.RadioFavorite{}).Where("user_id = ?", userId)
|
||||
db := global.DB.Model(&radio.RadioFavorite{}).Where("user_id = ?", userId).Preload("RadioProgram")
|
||||
var list []radio.RadioFavorite
|
||||
var total int64
|
||||
|
||||
@@ -188,3 +204,7 @@ func (s *InteractionService) DeleteAllHistory(userId string) error {
|
||||
func (s *InteractionService) RemoveAllFavorite(userId string) error {
|
||||
return global.DB.Where("user_id = ?", userId).Delete(&radio.RadioFavorite{}).Error
|
||||
}
|
||||
|
||||
func (s *InteractionService) RemoveAllLike(userId string) error {
|
||||
return global.DB.Where("user_id = ?", userId).Delete(&radio.RadioLike{}).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user