Methods summary
public
|
|
public static
WxRobot_SDK
|
|
public
string
|
#
toMsgText( $Msg, $mode = 1 )
返回文本信信息
Parameters
- $Msg
- 信息
- $mode
- 是否开启截取模式(0:不开启,1:开启.默认开启)
Returns
string xml
exp:
echo $this->toMsgText($contentStr);//文本地址
|
public
|
#
toMsgTextAlink( array $alink, string $suffix = '' )
在手机客服端显示的一种(仅在客服端,有效果)
Parameters
- $alink
- $suffix
- (一般为"\r\n", 默认为空)
Exp:
$alink[0]['link'] = 'midoks.cachecha.com';
$alink[0]['title'] = '你好';
Info
由(http://weibo.com/clothand)提供, 当然我做了优化
|
public
string
|
#
toMsgPic( $MediaId )
返回图片信息(测试未成功)
Parameters
Returns
string xml
exp:
echo $this->toMsgPic($MediaId);图
|
public
string
|
#
toMsgVoice( MediaId $MediaId )
返回voice xml
Parameters
Returns
string xml
exp:
echo $this->toMsgVoice($MediaId);
|
public
xml
|
#
toMsgMusic( string $title, string $desc, string $MusicUrl, string $HQMusicUrl, $ThumbMediaId = '' )
返回music xml
Parameters
- $title
- 标题
- $desc
- 描述
- $MusicUrl
- 地址
- $HQMusicUrl
- 高清播放(会首先选择)
- $ThumbMediaId
Returns
xml exp:
echo $this->toMsgVoice('声音','当男人好难!', $MusicUrl, $MusicUrl);//voice
|
public
xml
|
#
toMsgVideo( $media_id, $thumb_media_id )
返回video xml
Parameters
- $media_id
- $thumb_media_id
Returns
xml
|
public
string
|
#
toMsgTextPic( array $picTextInfo, array $array,… )
返回图文
Parameters
- $picTextInfo
- $info
- $array,…
Returns
string xml
exp
$textPic = array(
array(
'title'=> '标题',
'desc'=> '描述',
'pic'=> $this->bigPic(),//图片地址
'link'=>$pic,//图片链接地址
),//第一个图片为大图
array(
'title'=> '标题',
'desc'=> '描述',
'pic'=> $this->smallPic(),//图片地址
'link'=> '',//图片链接地址
),//此自以后皆为小图
array(
'title'=> '标题',
'desc' => '描述',
'pic' => $this->smallPic(),//图片地址
'link' => '',//图片链接地址
),
array(
'title'=> '标题',
'desc' => '描述',
'pic' => $this->smallPic(),//图片地址
'link' => '',//图片链接地址
),
array(
'title'=> '标题',
'desc' => '描述',
'pic' => $this->smallPic(),//图片地址
'link' => '',//图片链接地址
),
array(
'title'=> '标题',
'desc' => '描述',
'pic' => $this->smallPic(),//图片地址
'link' => '',//图片链接地址
),
);
echo $this->toMsgTextPic($textPic);//图文
|
public
|
#
toMsgTextPicList( $list )
在客服端列表的展示形式
$list[0]['title'] = '0';
$list[0]['desc'] = '0';
$list[0]['link'] = "http://midok.cachecha.com/";
|
public
string
|
|
public
string
|
|
public
string
|
#
getCustomServiceLog( $open_id, $starttime, $endtime, $pagesize = 20, $pageindex = 1 )
获取客服聊天记录
Parameters
- $open_id
- 普通用户的标识,对当前公众号唯一
- $starttime
- 查询开始时间,UNIX时间戳
- $endtime
- 查询结束时间,UNIX时间戳,每次查询不能跨日查询
- $pagesize
- 每页大小,每页最多拉取1000条
- $pageindex
- 查询第几页,从1开始
Returns
string json
|
public
json
|
#
getSemantic( string $query, string $appid, string $uid, string $city = '北京', string $category = 'flight,hotel', string $region = '', string $lat = '', string $long = '' )
智能语意分析
Parameters
- $query
- 查询的句子
- $appid
- 公众号唯一标示
- $uid
- 用户唯一ID
- $city
- 城市名称 默认 北京
- $category
- 需要使用的服务类型 默认flight,hotel
- $region
- 区域名称 默认为空
- $lat
- 纬度坐标 默认为空
- $long
- 经度坐标 默认为空
Returns
json
|
public
json
|
#
pushMsgText( string $open_id, string $msg )
推送文本类型的消息
Parameters
Returns
json
|
public
json
|
#
pushMsgImage( string $open_id, string $media_id )
推送图片消息
Parameters
Returns
json
|
public
json
|
#
pushMsgImageAdv( string $open_id, string $file )
推送高清图片消息
Parameters
- $open_id
- 用户open_id
- $file
- 文件绝对地址
Returns
json
|
public
json
|
#
pushMsgVoice( string $open_id, string $media_id )
推送音频消息
Parameters
- $open_id
- 用户open_id
- $media_id
- 资源ID
Returns
json
|
public
json
|
#
pushMsgVoiceAdv( string $open_id, string $file )
推送高清音频消息
Parameters
- $open_id
- 用户open_id
- $file
- $media_id 资源ID
Returns
json
|
public
json
|
#
pushMsgVideo( string $open_id, string $media_id, string $title, string $desc )
推送视频消息
Parameters
- $open_id
- 用户open_id
- $media_id
- 资源ID
- $title
- 标题
- $desc
- 描述信息
Returns
json
|
public
json
|
#
pushMsgVideoAdv( string $open_id, string $file, string $title, string $desc )
推送高清视频消息
Parameters
- $open_id
- 用户open_id
- $file
- 绝对地址
- $title
- 标题
- $desc
- 描述信息
Returns
json
|
public
json
|
#
pushMsgMusic( string $open_id, string $file, string $title, string $desc, string $musicurl, string $hqmusicurl )
推送音乐消息
Parameters
- $open_id
- 用户open_id
- $file
- 文件绝对地址
- $title
- 标题
- $desc
- 描述信息
- $musicurl
- 音乐url地址
- $hqmusicurl
- 高质量url地址
Returns
json
|
public
json
|
#
pushMsgMusicAdv( string $open_id, string $file, string $title, string $desc, string $musicurl, string $hqmusicurl )
推送高清音乐消息
Parameters
- $open_id
- 用户open_id
- $file
- 文件绝对地址
- $title
- 标题
- $desc
- 描述信息
- $musicurl
- 音乐url地址
- $hqmusicurl
- 高质量url地址
Returns
json
|
public
json
|
#
pushMsgNew( string $open_id, array $info )
推送图文信息
Parameters
- $open_id
- 用户open_id
- $info
- 图文信息
Returns
json
Exp:
$info should be:
$info[]["title"] = "Happy Day";
$info[]["description"]="Is Really A Happy Day";
$info[]["url"] = "URL";
$info[]["picurl"] = "PIC_URL";
|
public
json
|
#
download( string $media_id )
下载媒体文件
Parameters
Returns
json
|
public
json
|
#
upload( string $type, string $file )
上传媒体文件
Parameters
- $type
- 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
- $file
- 文件地址
Returns
json
|
public
json
|
#
getUserInfo( string $open_id, string $lang = 'zh_CN' )
获取用户信息
Parameters
- $open_id
- 普通用户的标识,对当前公众号唯一
- $lang
- 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
Returns
json
|
public
json
|
#
getUserList( string $next_openid = '' )
获取用户列表
Parameters
Returns
json
|
public
json
|
|
public
json
|
|
public
json
|
|
public
json
|
|
public
json
|
|
public
url
|
#
get_ticket_url( string $scene_id = 'midoks', time $time = '3000', string $type = 'temp' )
获取二维码的图片的图片路径
Parameters
- $scene_id
- 识别标示,默认midoks
- $time
- 过期时间 当$type为temp类型时有效, 默认5分钟
- $type
- 二维码的类型, 默认temp, 还有 permanent 类型
Returns
url
|
public
json
|
#
temp_ticket( json $json )
创建二维码ticket
Parameters
Returns
json
|
public
json
|
|
public
|
|
public
json
|
#
long2short( string $url )
把长连接转换为短链接
Parameters
Returns
json
|
public
json
|
#
sendGroupInfo( array $json )
分组群发接口
Parameters
Returns
json exp:
$msg[] = array(
'image' => WEIXIN_PLUGINS."/demo.jpg", //仅支持jpg(必须是本地的图片)
'author' => "xxx", //作者
'title' => "Happy Day", //标题
'content_source_url' => "www.qq.com",//内容地址
'content' => "content", //内容
'digest' => "digest", //图文消息的描述
'show_cover_pic' => "1" //是否显示封面,0,为不显示,1,为显示
),
|
public
json
|
#
uploadMsgImageText( array $msg )
上传图文消息素材优化版
Parameters
Returns
json exp:
$msg[] = array(
'thumb_media_id' => "qI6_Ze_6PtV7svjolgs",
'author' => "xxx",
'title' => "Happy Day",
'content_source_url' => "www.qq.com",
'content' => "content",
'digest' => "digest",
'show_cover_pic' => "1"
),
|
public
json
|
#
sendAllByGroup( string $group_id, string $media_id, string $msgtype = 'mpnews' )
通过分组进行群发
Parameters
- $group_id
- 分组ID
- $media_id
- 资源ID
- $msgtype
- 资源类型
Returns
json
|
public
json
|
#
sendAll( array $user, string $media_id, $msgtype = 'mpnews' )
根据OpenID列表群发
Parameters
- $user
- 发送用户列表
- $media_id
- 资源ID
- $msgtype
Returns
json
|
public
json
|
#
deleteSend( integer $id )
删除群发信息
Parameters
Returns
json
|
public
json
|
#
sendTemplateInfo( array $json )
模版接口发送消息
Parameters
Returns
json exp: $array = array(
"touser"=>"OPENID",
"template_id"=>"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY",
"url"=>"http://weixin.qq.com/download",
"topcolor"=>"#FF0000",
"data"=> array(
"first"=>array(
"value"=>"您好,您已成功消费。",
"color"=>"#0A0A0A"
),
"keynote1"=>array(
"value"=>"巧克力",
"color"=>"#CCCCCC"
),
"keynote2"=>array(
"value"=>"39.8元",
"color"=>"#CCCCCC"
),
"keynote3"=>array(
"value"=>"2014年9月16日",
"color"=>"#CCCCCC"
),
"remark"=>array(
"value"=>"欢迎再次购买。",
"color"=>"#173177"
)
)
);
|
public
json
|
|
public
string
|
#
byte_substr( string $str, integer $len = 2048 )
返回定长字节(仅utf-8)
Parameters
- $str
- 截取字符传
- $len
- 字节长度(默认:2048字节)
Returns
string
|
public
json
|
#
to_json( array $arr )
转化为微信可识别的json
Parameters
Returns
json
|