调整下图文消息格式
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user