朋友圈 实现点赞 service dubbo服务

800阅读模式
 /*
    *  实现朋友圈   点赞  取消点赞
    * */


    public Long likeComment(String publishId) {
        User user = UserThreadLocal.get();
        //点赞
        Boolean result = this.quanZiApi.likeComment(user.getId(), publishId);
        if(result){
            //查询点赞数
            return this.quanZiApi.queryLikeCount(publishId);
        }
        return null;
    }



    /*
    *  动态取消点赞
    *
    *  */


    public Long disLikeComment(String publishId) {
        User user = UserThreadLocal.get();
        //取消点赞
        Boolean result = this.quanZiApi.disLikeComment(user.getId(),
                publishId);
        if(result){
            //查询点赞数
            return this.quanZiApi.queryLikeCount(publishId);
        }
        return null;
    }



    /**
     * 填充⽤户信息
     *
     */
    private void fillUserInfoToQuanZiVo(UserInfo userInfo, QuanZiVo quanZiVo) {
        BeanUtil.copyProperties(userInfo, quanZiVo, "id");
        quanZiVo.setGender(userInfo.getSex().name().toLowerCase());
        quanZiVo.setTags(StringUtils.split(userInfo.getTags(), ','));
        //当前⽤户
        User user = UserThreadLocal.get();
        quanZiVo.setCommentCount(0); //TODO 评论数
        quanZiVo.setDistance("1.2公⾥"); //TODO 距离
        quanZiVo.setHasLiked(this.quanZiApi.queryUserIsLike(user.getId(),
                quanZiVo.getId()) ? 1 : 0); //是否点赞(1是,0否)

        quanZiVo.setLikeCount(Convert.toInt(this.quanZiApi.queryLikeCount(quanZiVo.getId()))); //点赞数
        quanZiVo.setHasLoved(0); //TODO 是否喜欢(1是,0否)
        quanZiVo.setLoveCount(0); //TODO 喜欢数
    }
}
文章源自懂站帝-http://www.sfdkj.com/14180.html
懂站帝
  • 本文由 发表于 2022年6月12日 23:06:18
  • 版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至395045033@qq.com举报,一经查实,本站将立刻删除。
评论  0  访客  0