1
0
mirror of synced 2025-12-22 18:08:12 +08:00

issue #100 用户分析数据接口

This commit is contained in:
Daniel Qian
2015-02-25 15:17:52 +08:00
parent fb10acf6fd
commit 978c51b90d
8 changed files with 280 additions and 2 deletions

View File

@@ -4,12 +4,15 @@ import com.google.inject.Inject;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.session.WxSession;
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage;
import me.chanjar.weixin.mp.bean.WxMpMassNews;
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
import me.chanjar.weixin.mp.bean.WxMpMassVideo;
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
import me.chanjar.weixin.mp.bean.result.WxMpUserCumulate;
import me.chanjar.weixin.mp.bean.result.WxMpUserSummary;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice;
@@ -17,7 +20,11 @@ import org.testng.annotations.Test;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
*
@@ -32,11 +39,31 @@ public class WxMpMiscAPITest {
protected WxMpServiceImpl wxService;
@Test
public void getCallbackIP() throws WxErrorException {
public void testGetCallbackIP() throws WxErrorException {
String[] ipArray = wxService.getCallbackIP();
System.out.println(Arrays.toString(ipArray));
Assert.assertNotNull(ipArray);
Assert.assertNotEquals(ipArray.length, 0);
}
@Test
public void testGetUserSummary() throws WxErrorException, ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date beginDate = simpleDateFormat.parse("2015-01-01");
Date endDate = simpleDateFormat.parse("2015-01-02");
List<WxMpUserSummary> summaries = wxService.getUserSummary(beginDate, endDate);
System.out.println(summaries);
Assert.assertNotNull(summaries);
}
@Test
public void testGetUserCumulate() throws WxErrorException, ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date beginDate = simpleDateFormat.parse("2015-01-01");
Date endDate = simpleDateFormat.parse("2015-01-02");
List<WxMpUserCumulate> cumulates = wxService.getUserCumulate(beginDate, endDate);
System.out.println(cumulates);
Assert.assertNotNull(cumulates);
}
}