|
|
@@ -116,17 +116,20 @@ public class FsUserVideoFavoriteServiceImpl implements IFsUserVideoFavoriteServi
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
@Synchronized
|
|
|
public void favoriteVideo(Long videoId, long userId) {
|
|
|
String unlikeKey = NO_FAVORITE_KEY_PREFIX + videoId + ":user:" + userId;
|
|
|
redisTemplate.delete(unlikeKey);
|
|
|
String key = FAVORITE_KEY_PREFIX + videoId + ":user:" + userId;
|
|
|
redisTemplate.opsForValue().set(key, true, 1, TimeUnit.DAYS);
|
|
|
+ FsUserVideoFavorite map = new FsUserVideoFavorite();
|
|
|
+ map.setVideoId(videoId);
|
|
|
+ map.setUserId(userId);
|
|
|
+ map.setCreateTime(DateUtils.getNowDate());
|
|
|
+ fsUserVideoFavoriteMapper.insertFsUserVideoFavorite(map);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
@Synchronized
|
|
|
public void deleteFavorite(Long videoId, long userId) {
|
|
|
String key = FAVORITE_KEY_PREFIX + videoId + ":user:" + userId;
|
|
|
@@ -135,5 +138,6 @@ public class FsUserVideoFavoriteServiceImpl implements IFsUserVideoFavoriteServi
|
|
|
// 将取消点赞记录写入Redis
|
|
|
String unlikeKey = NO_FAVORITE_KEY_PREFIX + videoId + ":user:" + userId;
|
|
|
redisTemplate.opsForValue().set(unlikeKey, true, 1, TimeUnit.DAYS);
|
|
|
+ fsUserVideoFavoriteMapper.deleteFavorite(videoId, userId);
|
|
|
}
|
|
|
}
|