\app\wechat\controller\apiPush

微信接口控制器 Class Api

Summary

Methods
Properties
Constants
index()
notify()
No public properties found
No constants found
text()
event()
keys()
sendMessage()
updateSpread()
updateFansinfo()
$appid
$openid
$receive
N/A
init()
No private properties found
N/A

Properties

$appid

$appid : string

当前公众号APPID

Type

string

$openid

$openid : string

当前微信用户openid

Type

string

$receive

$receive : array

当前微信消息对象

Type

array

Methods

index()

index() : string

微信消息接口(来自ThinkService授权的消息推送)

Throws

\think\Exception
\think\exception\PDOException

Returns

string

notify()

notify() : string

微信消息接口(来自在公众号官方的消息推送)

Throws

\think\Exception
\think\exception\PDOException

Returns

string

text()

text() : boolean

文件消息处理

Throws

\WeChat\Exceptions\InvalidDecryptException
\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException
\think\Exception
\think\db\exception\DataNotFoundException
\think\db\exception\ModelNotFoundException
\think\exception\DbException
\think\exception\PDOException

Returns

boolean

event()

event() : boolean|string

事件消息处理

Throws

\WeChat\Exceptions\InvalidDecryptException
\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException
\think\Exception
\think\db\exception\DataNotFoundException
\think\db\exception\ModelNotFoundException
\think\exception\DbException
\think\exception\PDOException

Returns

boolean|string

keys()

keys(string  $rule, boolean  $isLastReply = false) : boolean|string

关键字处理

Parameters

string $rule

关键字规则

boolean $isLastReply

强制结束

Throws

\WeChat\Exceptions\InvalidDecryptException
\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException
\think\Exception
\think\db\exception\DataNotFoundException
\think\db\exception\ModelNotFoundException
\think\exception\DbException
\think\exception\PDOException

Returns

boolean|string

sendMessage()

sendMessage(string  $type, array  $data) : array|boolean

发送消息到公众号

Parameters

string $type

消息类型(text|image|voice|video|music|news|mpnews|wxcard)

array $data

消息内容

Throws

\WeChat\Exceptions\InvalidDecryptException
\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException
\think\Exception
\think\exception\PDOException

Returns

array|boolean

updateSpread()

updateSpread(string  $openid) : boolean

更新推荐二维码关系

Parameters

string $openid

Throws

\think\Exception
\think\db\exception\DataNotFoundException
\think\db\exception\ModelNotFoundException
\think\exception\DbException
\think\exception\PDOException

Returns

boolean

updateFansinfo()

updateFansinfo(boolean  $subscribe = true) : string

同步粉丝状态

Parameters

boolean $subscribe

关注状态

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException
\think\Exception
\think\exception\PDOException

Returns

string

init()

init() : string

初始化接口

Throws

\think\Exception
\think\exception\PDOException

Returns

string