Skip to content

Commit

Permalink
小冰公众号原本的account: xiaoice-ms 已经失效了,现在只能使用名称来找到
Browse files Browse the repository at this point in the history
修复了因此造成的 XiaoiceReplay 插件 以及 /openwx/consult 接口存在的问题
  • Loading branch information
hexsum committed Apr 23, 2018
1 parent 65acadf commit 2c7a061
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -861,13 +861,13 @@ Content-Type: application/json
|--------|:------------------------------------------|
|uri |/openwx/consult|
|请求方法|GET\|POST|
|请求参数|**id**: 好友的id<br>**account**: 好友的帐号<br>**displayname**: 好友显示名称<br>**markname**: 好友备注名称<br>**timeout**:等待回复的时间,默认30秒<br>**media_path**:媒体路径(可以是文件路径或url,需要做urlencode)|
|请求参数|**id**: 好友的id<br>**displayname**: 好友显示名称<br>**markname**: 好友备注名称<br>**timeout**:等待回复的时间,默认30秒<br>**media_path**:媒体路径(可以是文件路径或url,需要做urlencode)|
|数据格式|application/x-www-form-urlencoded|
|调用示例|http://127.0.0.1:3000/openwx/consult?account=ms-xiaoice&content=haha<br>http://127.0.0.1:3000/openwx/consult?account=ms-xiaoice&media_path=%2ftmp%2fhello.jpg|
|调用示例|http://127.0.0.1:3000/openwx/consult?displayname=小冰&content=haha<br>http://127.0.0.1:3000/openwx/consult?displayname=%e5%b0%8f%e5%86%b0&media_path=%2ftmp%2fhello.jpg|

主要应用场景是把小冰(微信帐号ms-xiaoice)的智能回复封装成接口,给小冰发好友消息前,你需要先关注小冰的公众号
主要应用场景是把小冰(中文名称做urlencode: %e5%b0%8f%e5%86%b0)的智能回复封装成接口,给小冰发好友消息前,你需要先关注小冰的公众号
```
GET /openwx/consult?account=ms-xiaoice&content=haha HTTP/1.1
GET /openwx/consult?displayname=%e5%b0%8f%e5%86%b0&content=haha HTTP/1.1
User-Agent: curl/7.29.0
Host: 127.0.0.1:3000
Accept: */*
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Weixin/Plugin/XiaoiceReply.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sub call{

$client->on(ready=>sub{
#支持绑定的两个对象之间互相转发消息
my $xiaoice = $client->search_friend(account=>'xiaoice-ms');
my $xiaoice = $client->search_friend(name=>"小冰",category=>"公众号");
if(not defined $xiaoice){
$client->error("未能在通讯录中搜索到 微软小冰 帐号信息,请确认是否已经关注 微软小冰 公众号");
return;
Expand All @@ -31,7 +31,7 @@ sub call{
return if $msg->format !~ /^text|media$/;
return if not $msg->allow_plugin;
return if not $onoff_flag;
my $xiaoice = $client->search_friend(account=>'xiaoice-ms');
my $xiaoice = $client->search_friend(name=>"小冰",category=>"公众号");
if(not defined $xiaoice){
$client->error("未能在通讯录中搜索到 微软小冰 帐号信息,请确认是否已经关注 微软小冰 公众号");
return;
Expand Down

0 comments on commit 2c7a061

Please sign in to comment.