Constants

API_SEND_NOTICE

API_SEND_NOTICE = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send'

Send notice message.

API_SET_INDUSTRY

API_SET_INDUSTRY = 'https://api.weixin.qq.com/cgi-bin/template/api_set_industry'

API_ADD_TEMPLATE

API_ADD_TEMPLATE = 'https://api.weixin.qq.com/cgi-bin/template/api_add_template'

API_GET_INDUSTRY

API_GET_INDUSTRY = 'https://api.weixin.qq.com/cgi-bin/template/get_industry'

API_GET_ALL_PRIVATE_TEMPLATE

API_GET_ALL_PRIVATE_TEMPLATE = 'https://api.weixin.qq.com/cgi-bin/template/get_all_private_template'

API_DEL_PRIVATE_TEMPLATE

API_DEL_PRIVATE_TEMPLATE = 'https://api.weixin.qq.com/cgi-bin/template/del_private_template'

GET

GET = 'get'

POST

POST = 'post'

JSON

JSON = 'json'

Properties

$defaultColor

$defaultColor : string

Default color.

Type

string

$message

$message : array

{@inheritdoc}.

Type

array

$required

$required : array

{@inheritdoc}.

Type

array

$messageBackup

$messageBackup : array

Message backup.

Type

array

$maxRetries

$maxRetries : integer

Type

integer

$defaults

$defaults : 

{@inheritdoc}.

Type

Methods

defaultColor()

defaultColor(string  $color) : $this

Set default color.

Parameters

string $color

example: #0f0f0f

Returns

$this

setIndustry()

setIndustry(integer  $industryOne, integer  $industryTwo) : \EasyWeChat\Support\Collection

Set industry.

Parameters

integer $industryOne
integer $industryTwo

Returns

\EasyWeChat\Support\Collection

addTemplate()

addTemplate(string  $shortId) : \EasyWeChat\Support\Collection

Add a template and get template ID.

Parameters

string $shortId

Returns

\EasyWeChat\Support\Collection

deletePrivateTemplate()

deletePrivateTemplate(string  $templateId) : \EasyWeChat\Support\Collection

Delete private template.

Parameters

string $templateId

Returns

\EasyWeChat\Support\Collection

send()

send(  $data = array()) : \EasyWeChat\Support\Collection

Send a notice message.

Parameters

$data

Throws

\EasyWeChat\Core\Exceptions\InvalidArgumentException

Returns

\EasyWeChat\Support\Collection

__call()

__call(string  $method, array  $args) : \EasyWeChat\Notice\Notice

Magic access.

.

Parameters

string $method
array $args

Returns

\EasyWeChat\Notice\Notice

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

Throws

\EasyWeChat\Core\Exceptions\HttpException

Returns

\EasyWeChat\Support\Collection

| null

formatData()

formatData(array  $data) : array

Format template data.

Parameters

array $data

Returns

array

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