\app\wechat\controller\apiPush

微信接口控制器 Class Api

Summary

Methods
Properties
Constants
index()
notify()
No public properties found
No constants found
call()
text()
event()
keys()
sendMessage()
updateSpread()
updateFansinfo()
$appid
$openid
$receive
N/A
No private methods found
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

call()

call(string  $appid, string  $openid, array  $revice) : string

初始化接口

Parameters

string $appid

公众号APPID

string $openid

公众号OPENID

array $revice

消息对象

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  $key) : boolean

更新推荐二维码关系

Parameters

string $key

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