|
@@ -30,34 +30,35 @@ import java.util.List;
|
|
|
* @author Alex
|
|
|
* @date 2020-10-09
|
|
|
*/
|
|
|
-@Api(value = "点赞记录",tags = "点赞记录")
|
|
|
+@Api(value = "点赞记录", tags = "点赞记录")
|
|
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
@RestController
|
|
|
-@RequestMapping("/app/thumbs" )
|
|
|
+@RequestMapping("/app/thumbs")
|
|
|
public class PublishThumbsController extends AppBaseController {
|
|
|
|
|
|
private final ITbPublishThumbsService thumbsService;
|
|
|
|
|
|
/**
|
|
|
* 点赞/取消
|
|
|
+ *
|
|
|
* @param appUserId
|
|
|
* @param publishId
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation("点赞/取消")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "appUserId", value = "点赞人id",paramType="Long"),
|
|
|
- @ApiImplicitParam(name = "publishId", value = "发表id",paramType="Long")
|
|
|
+ @ApiImplicitParam(name = "appUserId", value = "点赞人id", paramType = "Long"),
|
|
|
+ @ApiImplicitParam(name = "publishId", value = "发表id", paramType = "Long")
|
|
|
})
|
|
|
@GetMapping("/action")
|
|
|
- public AjaxResult action(Long appUserId, Long publishId){
|
|
|
+ public AjaxResult action(Long appUserId, Long publishId) {
|
|
|
// TODO 在点赞或取消时,APP端的点赞数组异步增加或去掉记录
|
|
|
if (appUserId == null || publishId == null) {
|
|
|
return AjaxResult.error("参数不能为空");
|
|
|
}
|
|
|
TbPublishThumbs thumbs = thumbsService.getOne(new LambdaQueryWrapper<TbPublishThumbs>()
|
|
|
.eq(TbPublishThumbs::getPublishId, publishId)
|
|
|
- .eq(TbPublishThumbs::getAppUserId,appUserId)
|
|
|
+ .eq(TbPublishThumbs::getAppUserId, appUserId)
|
|
|
.last("limit 1")
|
|
|
);
|
|
|
AppMemberVo user = getLoginUser().getUser();
|
|
@@ -74,9 +75,11 @@ public class PublishThumbsController extends AppBaseController {
|
|
|
thumbsService.removeById(thumbs.getId());
|
|
|
}
|
|
|
// 点赞或取消后,返回点赞记录
|
|
|
- List<TbPublishThumbs> list = thumbsService.selectList(new LambdaQueryWrapper<TbPublishThumbs>()
|
|
|
- .eq(TbPublishThumbs::getPublishId,publishId)
|
|
|
+ TbPublishThumbs obj = thumbsService.getOne(new LambdaQueryWrapper<TbPublishThumbs>()
|
|
|
+ .eq(TbPublishThumbs::getPublishId, publishId)
|
|
|
+ .eq(TbPublishThumbs::getAppUserId, appUserId)
|
|
|
+ .last("limit 1")
|
|
|
);
|
|
|
- return AjaxResult.success(list);
|
|
|
+ return AjaxResult.success(obj);
|
|
|
}
|
|
|
}
|