Skip to content

Commit

Permalink
add updateRemarkName (#121)
Browse files Browse the repository at this point in the history
* add updateRemarkName

* update README.md for updateRemarkName
  • Loading branch information
originrobot authored and spacelan committed Dec 29, 2016
1 parent 0162e17 commit 7cd6cd9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ OP == 0 取消置顶

OP == 1 置顶

##### bot.updateRemarkName(UserName, RemarkName)

设置联系人备注或标签

## 实例事件

##### uuid
Expand Down
27 changes: 27 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,33 @@ export default class WechatCore {
})
}

updateRemarkName (UserName, RemarkName) {
return Promise.resolve().then(() => {
let params = {
pass_ticket: this.PROP.passTicket,
'lang': 'zh_CN'
}
let data = {
BaseRequest: this.getBaseRequest(),
CmdId: 2,
RemarkName: RemarkName,
UserName: UserName
}
return this.request({
method: 'POST',
url: this.CONF.API_webwxoplog,
params: params,
data: data
}).then(res => {
let data = res.data
assert.equal(data.BaseResponse.Ret, 0, res)
})
}).catch(err => {
debug(err)
throw new Error('设置用户标签失败')
})
}

getBaseRequest () {
return {
Uin: parseInt(this.PROP.uin),
Expand Down

0 comments on commit 7cd6cd9

Please sign in to comment.