在线不卡日本ⅴ一区v二区_精品一区二区中文字幕_天堂v在线视频_亚洲五月天婷婷中文网站

  • <menu id="lky3g"></menu>
  • <style id="lky3g"></style>
    <pre id="lky3g"><tt id="lky3g"></tt></pre>

    朋友圈 喜歡功能 接口 邏輯 controller service

    朋友圈 喜歡功能 controller

    /** 朋友圈 喜歡功能* *//** * 喜歡 * */@GetMapping(“/{id}/love”)public ResponseEntity loveComment(@PathVariable(“id”) String publishId) { try { Long loveCount = this.quanZiService.loveComment(publishId); if (null != loveCount) { return ResponseEntity.ok(loveCount); } } catch (Exception e) { e.printStackTrace(); } return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();}/** * 取消喜歡 * */@GetMapping(“/{id}/unlove”)public ResponseEntity disLoveComment(@PathVariable(“id”) String publishId) { try { Long loveCount = this.quanZiService.disLoveComment(publishId); if (null != loveCount) { return ResponseEntity.ok(loveCount); } } catch (Exception e) { e.printStackTrace(); } return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();}

    朋友圈 喜歡功能 service

    /** 朋友圈 喜歡功能* */public Long loveComment(String publishId) { User user = UserThreadLocal.get(); //喜歡 Boolean result = this.quanZiApi.loveComment(user.getId(), publishId); if(result){ //查詢喜歡數(shù) return this.quanZiApi.queryLoveCount(publishId); } return null;}public Long disLoveComment(String publishId) { User user = UserThreadLocal.get(); //取消喜歡 Boolean result = this.quanZiApi.disLoveComment(user.getId(), publishId); if(result){ //查詢喜歡數(shù) return this.quanZiApi.queryLoveCount(publishId); } return null;}/** * 填充 戶信息 * * @param userInfo * @param quanZiVo */private void fillUserInfoToQuanZiVo(UserInfo userInfo, QuanZiVo quanZiVo) { BeanUtil.copyProperties(userInfo, quanZiVo, “id”); quanZiVo.setGender(userInfo.getSex().name().toLowerCase()); quanZiVo.setTags(StringUtils.split(userInfo.getTags(), ‘,’)); //當(dāng)前 戶 User user = UserThreadLocal.get(); quanZiVo.setCommentCount(0); //TODO 評論數(shù) quanZiVo.setDistance(“1.2公 “); //TODO 距離 quanZiVo.setHasLiked(this.quanZiApi.queryUserIsLike(user.getId(), quanZiVo.getId()) ? 1 : 0); //是否點(diǎn)贊(1是,0否) quanZiVo.setLikeCount(Convert.toInt(this.quanZiApi.queryLikeCount(quanZiVo.getId()))); //點(diǎn)贊數(shù) quanZiVo.setHasLoved(this.quanZiApi.queryUserIsLove(user.getId(), quanZiVo.getId()) ? 1 : 0); //是否喜歡(1是,0否) quanZiVo.setLoveCount(Convert.toInt(this.quanZiApi.queryLoveCount(quanZiVo.getId()))); //喜歡數(shù)}

    鄭重聲明:本文內(nèi)容及圖片均整理自互聯(lián)網(wǎng),不代表本站立場,版權(quán)歸原作者所有,如有侵權(quán)請聯(lián)系管理員(admin#wlmqw.com)刪除。
    用戶投稿
    上一篇 2022年6月12日 14:29
    下一篇 2022年6月12日 14:29

    相關(guān)推薦

    聯(lián)系我們

    聯(lián)系郵箱:admin#wlmqw.com
    工作時(shí)間:周一至周五,10:30-18:30,節(jié)假日休息