Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add updateRemarkName #121

Merged
merged 2 commits into from
Dec 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ bot.getMsgImg(msg.MsgId).then(res => {
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