Receive
extends BasicPushEvent
in
公众号推送管理 Class Receive
Table of Contents
$appid | 公众号APPID | string |
---|---|---|
$postxml | 公众号推送XML内容 | string |
$encryptType | 公众号推送加密类型 | string |
$input | 公众号的推送请求参数 | DataArray |
$config | 当前公众号配置对象 | DataArray |
$receive | 公众号推送内容对象 | DataArray |
$message | 准备回复的消息内容 | array |
transferCustomerService() | 转发多客服消息 | $this |
text() | 设置文本消息 | $this |
news() | 设置回复图文 | $this |
image() | 设置图片消息 | $this |
voice() | 设置语音回复消息 | $this |
video() | 设置视频回复消息 | $this |
music() | 设置音乐回复消息 | $this |
__construct() | BasicPushEvent constructor. | mixed |
isEncrypt() | 消息是否需要加密 | bool |
reply() | 回复消息 | string |
checkSignature() | 验证来自微信服务器 | bool |
getReceive() | 获取公众号推送对象 | array |
getOpenid() | 获取当前微信OPENID | string |
getMsgType() | 获取当前推送消息类型 | string |
getMsgId() | 获取当前推送消息ID | string |
getMsgTime() | 获取当前推送时间 | int |
getToOpenid() | 获取当前推送公众号 | string |
Properties
$appid
公众号APPID
protected
string
$appid
$postxml
公众号推送XML内容
protected
string
$postxml
$encryptType
公众号推送加密类型
protected
string
$encryptType
$input
公众号的推送请求参数
protected
DataArray
$input
$config
当前公众号配置对象
protected
DataArray
$config
$receive
公众号推送内容对象
protected
DataArray
$receive
$message
准备回复的消息内容
protected
array
$message
Methods
transferCustomerService()
转发多客服消息
public
transferCustomerService(
[ $account :
string
= '' ]
)
: $this
Parameters
- $account : string = ''
Return values
$thistext()
设置文本消息
public
text(
[ $content :
string
= '' ]
)
: $this
Parameters
- $content : string = ''
文本内容
Return values
$thisnews()
设置回复图文
public
news(
[ $newsData :
array
= [] ]
)
: $this
Parameters
- $newsData : array = []
Return values
$thisimage()
设置图片消息
public
image(
[ $mediaId :
string
= '' ]
)
: $this
Parameters
- $mediaId : string = ''
图片媒体ID
Return values
$thisvoice()
设置语音回复消息
public
voice(
[ $mediaid :
string
= '' ]
)
: $this
Parameters
- $mediaid : string = ''
语音媒体ID
Return values
$thisvideo()
设置视频回复消息
public
video(
[ $mediaid :
string
= '' ]
[, $title :
string
= '' ]
[, $description :
string
= '' ]
)
: $this
Parameters
- $mediaid : string = ''
视频媒体ID
- $title : string = ''
视频标题
- $description : string = ''
视频描述
Return values
$thismusic()
设置音乐回复消息
public
music(
$title :
string
, $desc :
string
, $musicurl :
string
[, $hgmusicurl :
string
= '' ]
[, $thumbmediaid :
string
= '' ]
)
: $this
Parameters
- $title : string
音乐标题
- $desc : string
音乐描述
- $musicurl : string
音乐地址
- $hgmusicurl : string = ''
高清音乐地址
- $thumbmediaid : string = ''
音乐图片缩略图的媒体id(可选)
Return values
$this__construct()
BasicPushEvent constructor.
public
__construct(
$options :
array
)
: mixed
Parameters
- $options : array
Tags
Return values
mixedisEncrypt()
消息是否需要加密
public
isEncrypt(
)
: bool
Return values
boolreply()
回复消息
public
reply(
[ $data :
array
= [] ]
[, $return :
bool
= false ]
[, $isEncrypt :
bool
= false ]
)
: string
Parameters
- $data : array = []
消息内容
- $return : bool = false
是否返回XML内容
- $isEncrypt : bool = false
是否加密内容
Tags
Return values
stringcheckSignature()
验证来自微信服务器
private
checkSignature(
[ $str :
string
= '' ]
)
: bool
Parameters
- $str : string = ''
Return values
boolgetReceive()
获取公众号推送对象
public
getReceive(
[ $field :
null|string
= null ]
)
: array
Parameters
- $field : null|string = null
指定获取字段
Return values
arraygetOpenid()
获取当前微信OPENID
public
getOpenid(
)
: string
Return values
stringgetMsgType()
获取当前推送消息类型
public
getMsgType(
)
: string
Return values
stringgetMsgId()
获取当前推送消息ID
public
getMsgId(
)
: string
Return values
stringgetMsgTime()
获取当前推送时间
public
getMsgTime(
)
: int
Return values
intgetToOpenid()
获取当前推送公众号
public
getToOpenid(
)
: string