亚洲精品中文免费|亚洲日韩中文字幕制服|久久精品亚洲免费|一本之道久久免费

      
      

            <dl id="hur0q"><div id="hur0q"></div></dl>

                朋友圈 喜歡功能 接口 邏輯 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){ //查詢喜歡數 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){ //查詢喜歡數 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(), ‘,’)); //當前 戶 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(this.quanZiApi.queryUserIsLove(user.getId(), quanZiVo.getId()) ? 1 : 0); //是否喜歡(1是,0否) quanZiVo.setLoveCount(Convert.toInt(this.quanZiApi.queryLoveCount(quanZiVo.getId()))); //喜歡數}

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

                相關推薦

                聯(lián)系我們

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