11package cn .jpush .api .report ;
22
3+ import java .net .URLEncoder ;
34import java .util .regex .Pattern ;
45
56import cn .jpush .api .common .NativeHttpClient ;
910import cn .jpush .api .utils .StringUtils ;
1011
1112public class ReportClient {
12- private static final String REPORT_HOST_NAME = "http://183.232.25.237:9900" ; //" https://report.jpush.cn";
13- private static final String REPORT_RECEIVE_PATH = "/v2 /received" ;
14- private static final String REPORT_USER_PATH = "/v3/user " ;
15- private static final String REPORT_MESSAGE_PATH = "/v3/message " ;
13+ private static final String REPORT_HOST_NAME = "https://report.jpush.cn" ;
14+ private static final String REPORT_RECEIVE_PATH = "/v3 /received" ;
15+ private static final String REPORT_USER_PATH = "/v3/users " ;
16+ private static final String REPORT_MESSAGE_PATH = "/v3/messages " ;
1617
1718 private NativeHttpClient _httpClient = new NativeHttpClient ();;
1819
@@ -40,7 +41,7 @@ public ReceivedsResult getReceiveds(String msgIds) {
4041 return ReceivedsResult .fromResponse (response );
4142 }
4243
43- public MessagesResult getMessagesCount (String msgIds ) {
44+ public MessagesResult getMessages (String msgIds ) {
4445 checkMsgids (msgIds );
4546 String authCode = ServiceHelper .getAuthorizationBase64 (_appKey , _masterSecret );
4647
@@ -50,12 +51,18 @@ public MessagesResult getMessagesCount(String msgIds) {
5051 return MessagesResult .fromResponse (response );
5152 }
5253
53- public UsersResult getUsersCount (TimeUnit timeUnit , String start , int step ) {
54+ public UsersResult getUsers (TimeUnit timeUnit , String start , int duration ) {
5455 String authCode = ServiceHelper .getAuthorizationBase64 (_appKey , _masterSecret );
5556
57+ String startEncoded = null ;
58+ try {
59+ startEncoded = URLEncoder .encode (start , "utf-8" );
60+ } catch (Exception e ) {
61+ }
62+
5663 String url = REPORT_HOST_NAME + REPORT_USER_PATH
5764 + "?time_unit=" + timeUnit .toString ()
58- + "&start=" + start + "&step =" + step ;
65+ + "&start=" + startEncoded + "&duration =" + duration ;
5966 ResponseWrapper response = _httpClient .sendGet (url , null , authCode );
6067
6168 return UsersResult .fromResponse (response );
0 commit comments