using System.Collections.Generic; using System.Threading.Tasks; namespace LiveForum.IService.Posts { /// /// 点赞服务接口 /// public interface ILikeService { /// /// 查询是否已点赞(优先Redis,再查数据库) /// /// 用户ID /// 目标类型:1-帖子,2-评论 /// 目标ID /// 是否已点赞 Task IsLikedAsync(long userId, int targetType, long targetId); /// /// 获取点赞数(优先Redis,再查数据库) /// /// 目标类型:1-帖子,2-评论 /// 目标ID /// 点赞数 Task GetLikeCountAsync(int targetType, long targetId); /// /// 批量查询点赞状态 /// /// 用户ID /// 目标类型:1-帖子,2-评论 /// 目标ID列表 /// 目标ID到是否点赞的映射 Task> BatchIsLikedAsync(long userId, int targetType, List targetIds); /// /// 批量查询点赞数 /// /// 目标类型:1-帖子,2-评论 /// 目标ID列表 /// 目标ID到点赞数的映射 Task> BatchGetLikeCountAsync(int targetType, List targetIds); /// /// 执行点赞操作(Redis+队列) /// /// 用户ID /// 目标类型:1-帖子,2-评论 /// 目标ID /// 接收者ID(用于消息通知) /// 是否操作成功 Task LikeAsync(long userId, int targetType, long targetId, long receiverId); /// /// 执行取消点赞操作(Redis+队列) /// /// 用户ID /// 目标类型:1-帖子,2-评论 /// 目标ID /// 是否操作成功 Task UnlikeAsync(long userId, int targetType, long targetId); } }