diff options
Diffstat (limited to 'juick-notifications')
-rw-r--r-- | juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java b/juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java index 88ffad1a..ce07b7fe 100644 --- a/juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java +++ b/juick-notifications/src/main/java/com/juick/components/service/ApiMessagesService.java @@ -7,11 +7,9 @@ import com.juick.server.helpers.ResponseReply; import com.juick.service.BaseRestService; import com.juick.service.MessagesService; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; +import org.springframework.http.*; import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; import java.time.LocalDateTime; import java.util.Collection; @@ -184,7 +182,13 @@ public class ApiMessagesService extends BaseRestService implements MessagesServi @Override public boolean setMessagePopular(int mid, int popular) { - return false; + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON_UTF8); + return getRest().exchange(UriComponentsBuilder.fromHttpUrl("https://api.juick.com/messages/set_popular") + .queryParam("mid", mid) + .queryParam("popular", popular) + .build().toUriString(), HttpMethod.GET, new HttpEntity<>(headers), new ParameterizedTypeReference<Void>() { + }).getStatusCode().equals(HttpStatus.OK); } @Override |