调整下图文消息格式

This commit is contained in:
jinyu
2015-07-16 17:31:50 +08:00
parent ba5d2da3a1
commit 624d2fac8f
6 changed files with 68 additions and 67 deletions
@@ -133,12 +133,13 @@ public class MassApi extends MpApi {
if (tuple instanceof MpNews) {
MpNews _news = (MpNews) tuple;
List<MpArticle> _articles = _news.getArticles();
if (StringUtil.isBlank(_news.getMediaId())
&& (_articles == null || _articles.isEmpty())) {
throw new WeixinException(
"mass fail:mediaId or articles is required");
if (StringUtil.isBlank(_news.getMediaId())) {
if (_articles.isEmpty()) {
throw new WeixinException(
"mass fail:mediaId or articles is required");
}
tuple = new MpNews(uploadArticle(_articles));
}
tuple = new MpNews(uploadArticle(_articles));
}
String msgtype = tuple.getMessageType();
JSONObject obj = new JSONObject();
@@ -73,8 +73,8 @@ public class NotifyTest extends TokenTest {
public void news() throws WeixinException {
News news = new News();
NotifyMessage notify = new NotifyMessage("to", news);
news.pushArticle("title1", "desc1", "picUrl1", "url1");
news.pushArticle("title2", "desc2", "picUrl2", "url2");
news.addArticle("title1", "desc1", "picUrl1", "url1");
news.addArticle("title2", "desc2", "picUrl2", "url2");
System.out.println(notifyApi.sendNotify(notify));
}