(id, to)
| 451 | } |
| 452 | |
| 453 | sendEmoticon (id, to) { |
| 454 | return Promise.resolve().then(() => { |
| 455 | let params = { |
| 456 | 'fun': 'sys', |
| 457 | 'pass_ticket': this.PROP.passTicket, |
| 458 | 'lang': 'zh_CN' |
| 459 | } |
| 460 | let clientMsgId = getClientMsgId() |
| 461 | let data = { |
| 462 | 'BaseRequest': this.getBaseRequest(), |
| 463 | 'Scene': 0, |
| 464 | 'Msg': { |
| 465 | 'Type': this.CONF.MSGTYPE_EMOTICON, |
| 466 | 'EmojiFlag': 2, |
| 467 | 'FromUserName': this.user['UserName'], |
| 468 | 'ToUserName': to, |
| 469 | 'LocalID': clientMsgId, |
| 470 | 'ClientMsgId': clientMsgId |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | if (id.indexOf('@') === 0) { |
| 475 | data.Msg.MediaId = id |
| 476 | } else { |
| 477 | data.Msg.EMoticonMd5 = id |
| 478 | } |
| 479 | |
| 480 | return this.request({ |
| 481 | method: 'POST', |
| 482 | url: this.CONF.API_webwxsendemoticon, |
| 483 | params: params, |
| 484 | data: data |
| 485 | }).then(res => { |
| 486 | let data = res.data |
| 487 | assert.equal(data.BaseResponse.Ret, 0, res) |
| 488 | return data |
| 489 | }) |
| 490 | }).catch(err => { |
| 491 | debug(err) |
| 492 | err.tips = '发送表情信息失败' |
| 493 | throw err |
| 494 | }) |
| 495 | } |
| 496 | |
| 497 | // file: Stream, Buffer, File, Blob |
| 498 | uploadMedia (file, filename, toUserName) { |
no test coverage detected