This commit is contained in:
jinyu 2016-03-31 16:25:43 +08:00
parent 5b31f1c8f0
commit c27cd13852
3 changed files with 10 additions and 12 deletions

View File

@ -336,9 +336,9 @@ public class WeixinProxy {
* "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732&token=&lang=zh_CN"> * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732&token=&lang=zh_CN">
* 更新永久图文素材</a> * 更新永久图文素材</a>
*/ */
public JsonResult updateMaterialArticle(String mediaId, int index, List<MpArticle> articles) public JsonResult updateMaterialArticle(String mediaId, int index, MpArticle article)
throws WeixinException { throws WeixinException {
return mediaApi.updateMaterialArticle(mediaId, index, articles); return mediaApi.updateMaterialArticle(mediaId, index, article);
} }
/** /**

View File

@ -355,11 +355,11 @@ public class MediaApi extends MpApi {
* href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732&token=&lang=zh_CN">更新永久图文素材</a> * href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732&token=&lang=zh_CN">更新永久图文素材</a>
*/ */
public JsonResult updateMaterialArticle(String mediaId, int index, public JsonResult updateMaterialArticle(String mediaId, int index,
List<MpArticle> articles) throws WeixinException { MpArticle article) throws WeixinException {
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
String material_article_update_uri = getRequestUri("material_article_update_uri"); String material_article_update_uri = getRequestUri("material_article_update_uri");
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("articles", articles); obj.put("articles", article);
obj.put("media_id", mediaId); obj.put("media_id", mediaId);
obj.put("index", index); obj.put("index", index);
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(

View File

@ -107,15 +107,13 @@ public class MediaTest extends TokenTest {
@Test @Test
public void updateMaterialArticle() throws WeixinException { public void updateMaterialArticle() throws WeixinException {
MpArticle mpArticle = new MpArticle("8790403529", "title", "content"); MpArticle article = new MpArticle("8790403529", "title", "content");
mpArticle.setAuthor("author_update"); article.setAuthor("author_update");
mpArticle.setDigest("digest_update"); article.setDigest("digest_update");
mpArticle.setShowCoverPic(false); article.setShowCoverPic(false);
mpArticle.setSourceUrl("http://www.baidu.com"); article.setSourceUrl("http://www.baidu.com");
List<MpArticle> articles = new ArrayList<MpArticle>();
articles.add(mpArticle);
JsonResult result = mediaApi.updateMaterialArticle("17385064953", 0, JsonResult result = mediaApi.updateMaterialArticle("17385064953", 0,
articles); article);
System.err.println(result); System.err.println(result);
// 17385065153 // 17385065153
} }