Constants

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

API_TRANS_MSG

API_TRANS_MSG = 'https://api.weixin.qq.com/device/transmsg'

API_CREATE

API_CREATE = 'https://api.weixin.qq.com/device/create_qrcode'

API_DEV_STAT

API_DEV_STAT = 'https://api.weixin.qq.com/device/get_stat'

API_DEV_AUTH

API_DEV_AUTH = 'https://api.weixin.qq.com/device/authorize_device'

API_DEV_GET_QRCODE

API_DEV_GET_QRCODE = 'https://api.weixin.qq.com/device/getqrcode'

API_DEV_VERIFY_QRCODE

API_DEV_VERIFY_QRCODE = 'https://api.weixin.qq.com/device/verify_qrcode'

API_DEV_BIND

API_DEV_BIND = 'https://api.weixin.qq.com/device/bind'

API_DEV_UNBIND

API_DEV_UNBIND = 'https://api.weixin.qq.com/device/unbind'

API_DEV_COMPEL_BIND

API_DEV_COMPEL_BIND = 'https://api.weixin.qq.com/device/compel_bind'

API_DEV_COMPEL_UNBIND

API_DEV_COMPEL_UNBIND = 'https://api.weixin.qq.com/device/compel_unbind'

API_DEV_GET_OPENID

API_DEV_GET_OPENID = 'https://api.weixin.qq.com/device/get_openid'

API_USER_DEV_BIND

API_USER_DEV_BIND = 'https://api.weixin.qq.com/device/get_bind_device'

Properties

$maxRetries

$maxRetries : integer

Type

integer

$deviceType

$deviceType : 

Type

$productId

$productId : 

Type

$config

$config : 

Type

Methods

__construct()

__construct(\EasyWeChat\Core\AccessToken  $accessToken,   $config) 

Constructor.

Parameters

\EasyWeChat\Core\AccessToken $accessToken
$config

setHttp()

setHttp(\EasyWeChat\Core\Http  $http) : $this

Set the http instance.

Parameters

\EasyWeChat\Core\Http $http

Returns

$this

setAccessToken()

setAccessToken(\EasyWeChat\Core\AccessToken  $accessToken) : $this

Set the request token.

Parameters

\EasyWeChat\Core\AccessToken $accessToken

Returns

$this

maxRetries()

maxRetries(integer  $retries) 

Parameters

integer $retries

parseJSON()

parseJSON(string  $method, array  $args) : \EasyWeChat\Support\Collection

Parse JSON from response and check error.

Parameters

string $method
array $args

Returns

\EasyWeChat\Support\Collection

setProductId()

setProductId(  $productId) 

Parameters

$productId

sendToDevice()

sendToDevice(  $deviceId,   $openId,   $content) : \EasyWeChat\Support\Collection

Send message to device.

Parameters

$deviceId
$openId
$content

Returns

\EasyWeChat\Support\Collection

getDeviceQrcode()

getDeviceQrcode(array  $deviceIds) 

Parameters

array $deviceIds

authorizeDevice()

authorizeDevice(array  $deviceInfos,   $opType) 

Parameters

array $deviceInfos
$opType

createDeviceId()

createDeviceId() 

bind()

bind(  $openId,   $deviceId,   $ticket) 

Parameters

$openId
$deviceId
$ticket

unbind()

unbind(  $openId,   $deviceId,   $ticket) 

Parameters

$openId
$deviceId
$ticket

compelBind()

compelBind(  $openId,   $deviceId) 

Parameters

$openId
$deviceId

compelUnbind()

compelUnbind(  $openId,   $deviceId) 

Parameters

$openId
$deviceId

getDeviceStatus()

getDeviceStatus(  $deviceId) 

Parameters

$deviceId

verifyQrcode()

verifyQrcode(  $ticket) 

Parameters

$ticket

getOpenid()

getOpenid(  $deviceId) 

Parameters

$deviceId

getDeviceidByOpenid()

getDeviceidByOpenid(  $openid) 

Parameters

$openid

registerHttpMiddlewares()

registerHttpMiddlewares() 

Register Guzzle middlewares.

accessTokenMiddleware()

accessTokenMiddleware() : \Closure

Attache access token to request query.

Returns

\Closure

logMiddleware()

logMiddleware() : \Closure

Log the request.

Returns

\Closure

retryMiddleware()

retryMiddleware() : \Closure

Return retry middleware.

Returns

\Closure

checkAndThrow()

checkAndThrow(array  $contents) 

Check the array data errors, and Throw exception when the contents contains error.

Parameters

array $contents

Throws

\EasyWeChat\Core\Exceptions\HttpException

getDeviceList()

getDeviceList(  $deviceInfos) 

Parameters

$deviceInfos