Skip to content

Commit 7cd6cd9

Browse files
originrobotspacelan
authored andcommitted
add updateRemarkName (#121)
* add updateRemarkName * update README.md for updateRemarkName
1 parent 0162e17 commit 7cd6cd9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ OP == 0 取消置顶
215215

216216
OP == 1 置顶
217217

218+
##### bot.updateRemarkName(UserName, RemarkName)
219+
220+
设置联系人备注或标签
221+
218222
## 实例事件
219223

220224
##### uuid

src/core.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,33 @@ export default class WechatCore {
885885
})
886886
}
887887

888+
updateRemarkName (UserName, RemarkName) {
889+
return Promise.resolve().then(() => {
890+
let params = {
891+
pass_ticket: this.PROP.passTicket,
892+
'lang': 'zh_CN'
893+
}
894+
let data = {
895+
BaseRequest: this.getBaseRequest(),
896+
CmdId: 2,
897+
RemarkName: RemarkName,
898+
UserName: UserName
899+
}
900+
return this.request({
901+
method: 'POST',
902+
url: this.CONF.API_webwxoplog,
903+
params: params,
904+
data: data
905+
}).then(res => {
906+
let data = res.data
907+
assert.equal(data.BaseResponse.Ret, 0, res)
908+
})
909+
}).catch(err => {
910+
debug(err)
911+
throw new Error('设置用户标签失败')
912+
})
913+
}
914+
888915
getBaseRequest () {
889916
return {
890917
Uin: parseInt(this.PROP.uin),

0 commit comments

Comments
 (0)