Skip to content

Commit

Permalink
Merge pull request #72 from loulin/master
Browse files Browse the repository at this point in the history
fix更新永久图文素材 #55
  • Loading branch information
JacksonTian committed Sep 29, 2015
2 parents 51dd41e + 49ac9eb commit ec44809
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions lib/api_material.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,29 +172,26 @@ exports._uploadNewsMaterial = function (news, callback) {

/**
* 更新永久图文素材
*
* 详情请见:<http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html>
* News:
* ```
* {
* "media_id":MEDIA_ID,
* "index":INDEX,
* "articles": [
* {
* "title": TITLE,
* "thumb_media_id": THUMB_MEDIA_ID,
* "author": AUTHOR,
* "digest": DIGEST,
* "show_cover_pic": SHOW_COVER_PIC(0 / 1),
* "content": CONTENT,
* "content_source_url": CONTENT_SOURCE_URL
* },
* //若新增的是多图文素材,则此处应还有几段articles结构
* ]
* "articles": {
* "title": TITLE,
* "thumb_media_id": THUMB_MEDIA_ID,
* "author": AUTHOR,
* "digest": DIGEST,
* "show_cover_pic": SHOW_COVER_PIC(0 / 1),
* "content": CONTENT,
* "content_source_url": CONTENT_SOURCE_URL
* }
* }
* ```
* Examples:
* ```
* api.uploadNewsMaterial(news, callback);
* api.updateNewsMaterial(news, callback);
* ```
* Callback:
*
Expand All @@ -209,14 +206,14 @@ exports._uploadNewsMaterial = function (news, callback) {
* @param {Function} callback 回调函数
*/
exports.updateNewsMaterial = function (news, callback) {
this.preRequest(this._uploadNewsMaterial, arguments);
this.preRequest(this._updateNewsMaterial, arguments);
};

/*!
* 新增永久图文素材的未封装版本
* 更新永久图文素材的未封装版本
*/
exports._updateNewsMaterial = function (news, callback) {
var url = this.prefix + 'material/add_news?access_token=' + this.token.accessToken;
var url = this.prefix + 'material/update_news?access_token=' + this.token.accessToken;
this.request(url, postJSON(news), wrapper(callback));
};

Expand Down

0 comments on commit ec44809

Please sign in to comment.