55import cn .jpush .api .common .NativeHttpClient ;
66import cn .jpush .api .common .ResponseWrapper ;
77import cn .jpush .api .common .ServiceHelper ;
8+ import cn .jpush .api .common .TimeUnit ;
89import cn .jpush .api .utils .StringUtils ;
910
1011public class ReportClient {
11- private static final String REPORT_HOST_NAME = "https://report.jpush.cn" ;
12+ private static final String REPORT_HOST_NAME = "http://183.232.25.237:9900" ; //" https://report.jpush.cn";
1213 private static final String REPORT_RECEIVE_PATH = "/v2/received" ;
14+ private static final String REPORT_USER_PATH = "/v3/user" ;
1315
1416 private NativeHttpClient _httpClient = new NativeHttpClient ();;
1517
@@ -28,19 +30,26 @@ public ReceivedsResult getReceiveds(String[] msgIdArray) {
2830 }
2931
3032 public ReceivedsResult getReceiveds (String msgIds ) {
31- String authCode = ServiceHelper .getAuthorizationBase64 (_appKey , _masterSecret );
32- return getResportReceived (msgIds , authCode );
33- }
34-
35- public ReceivedsResult getResportReceived (String msgIds , String authCode ) {
3633 checkMsgids (msgIds );
34+ String authCode = ServiceHelper .getAuthorizationBase64 (_appKey , _masterSecret );
3735
3836 String url = REPORT_HOST_NAME + REPORT_RECEIVE_PATH + "?msg_ids=" + msgIds ;
3937 ResponseWrapper response = _httpClient .sendGet (url , null , authCode );
4038
4139 return ReceivedsResult .fromResponse (response );
40+ }
41+
42+ public UsersResult getUsersCount (TimeUnit timeUnit , String start , int step ) {
43+ String authCode = ServiceHelper .getAuthorizationBase64 (_appKey , _masterSecret );
44+
45+ String url = REPORT_HOST_NAME + REPORT_USER_PATH
46+ + "?time_unit=" + timeUnit .toString ()
47+ + "&start=" + start + "&step=" + step ;
48+ ResponseWrapper response = _httpClient .sendGet (url , null , authCode );
49+
50+ return UsersResult .fromResponse (response );
4251 }
43-
52+
4453
4554 private final static Pattern MSGID_PATTERNS = Pattern .compile ("[^0-9, ]" );
4655
0 commit comments