diff options
author | Vitaly Takmazov | 2018-04-24 22:35:12 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-24 22:35:12 +0300 |
commit | 003ff7221782c4f0cf4a5660832e40c7ac386618 (patch) | |
tree | 091a77e710501677a175fe3f86c8290b4bd7d50c | |
parent | 473c9dcec4ff03baf9940bc980371692e369ead2 (diff) |
server: count parameter for /react
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/Post.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Post.java b/juick-server/src/main/java/com/juick/server/api/Post.java index 3b022aae..486e9c0f 100644 --- a/juick-server/src/main/java/com/juick/server/api/Post.java +++ b/juick-server/src/main/java/com/juick/server/api/Post.java @@ -263,7 +263,8 @@ public class Post { @PostMapping("/react") @ResponseStatus(value = HttpStatus.OK) - public Status doPostReact(@RequestParam Integer mid,@RequestParam @NotNull int reactionId){ + public Status doPostReact(@RequestParam Integer mid,@RequestParam @NotNull int reactionId, + @RequestParam (required = false, defaultValue = "1") int count) { logger.info("got reaction with type: {}", reactionId); com.juick.User visitor = UserUtils.getCurrentUser(); @@ -277,9 +278,10 @@ public class Post { if (msg.getUser().getUid() == visitor.getUid()) { throw new HttpForbiddenException(); } - - MessagesService.RecommendStatus recommendStatus = messagesService.likeMessage(mid,visitor.getUid(), - reactionId); + MessagesService.RecommendStatus recommendStatus = MessagesService.RecommendStatus.Error; + for (int i = 0; i < count; i++) + recommendStatus = messagesService.likeMessage(mid, visitor.getUid(), + reactionId); return recommendStatus == MessagesService.RecommendStatus.Error ? Status.ERROR :Status.OK; } |