Properties

$access_token

$access_token : string

访问AccessToken

Type

string

$currentMethod

$currentMethod : array

当前请求方法参数

Type

array

$isTry

$isTry : boolean

当前模式

Type

boolean

$GetAccessTokenCallback

$GetAccessTokenCallback : string

注册代替函数

Type

string

Methods

__construct()

__construct(array  $options) 

BasicWeChat constructor.

Parameters

array $options

getAccessToken()

getAccessToken() : string

获取访问accessToken

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

string

delAccessToken()

delAccessToken() : boolean

清理删除accessToken

Returns

boolean

callPostApi()

callPostApi(string  $url, array  $data, boolean  $isBuildJson = true) : array

接口通用POST请求方法

Parameters

string $url

接口URL

array $data

POST提交接口参数

boolean $isBuildJson

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

callGetApi()

callGetApi(string  $url) : array

接口通用GET请求方法

Parameters

string $url

接口URL

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

register()

register(array  $data) : array

申请开通功能

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

auditStatus()

auditStatus() : array

查询审核状态

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

createApply()

createApply(string  $quantity, string  $apply_reason, null|string  $comment = null, null|string  $poi_id = null) : array

申请设备ID

Parameters

string $quantity

申请的设备ID的数量,单次新增设备超过500个,需走人工审核流程

string $apply_reason

申请理由,不超过100个汉字或200个英文字母

null|string $comment

备注,不超过15个汉字或30个英文字母

null|string $poi_id

设备关联的门店ID,关联门店后,在门店1KM的范围内有优先摇出信息的机会。

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

getApplyStatus()

getApplyStatus(integer  $applyId) : array

查询设备ID申请审核状态

Parameters

integer $applyId

批次ID,申请设备ID时所返回的批次ID

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

updateApply()

updateApply(array  $data) : array

编辑设备信息

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

bindLocation()

bindLocation(array  $data) : array

配置设备与门店的关联关系

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

search()

search(array  $data) : array

查询设备列表

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

createPage()

createPage(array  $data) : array

页面管理

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

updatePage()

updatePage(array  $data) : array

编辑页面信息

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

searchPage()

searchPage(array  $data) : array

查询页面列表

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

deletePage()

deletePage(  $page_id) : array

删除页面

Parameters

$page_id

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

upload()

upload(string  $filename, string  $type = 'icon') : array

上传图片素材

Parameters

string $filename

图片名字

string $type

Icon:摇一摇页面展示的icon图;License:申请开通摇一摇周边功能时需上传的资质文件;若不传type,则默认type=icon

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

bindPage()

bindPage(array  $data) : array

配置设备与页面的关联关系

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

queryPage()

queryPage(array  $data) : array

查询设备与页面的关联关系

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

totalDevice()

totalDevice(array  $data) : array

以设备为维度的数据统计接口

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

totalDeviceList()

totalDeviceList(integer  $date, integer  $page_index = 1) : array

批量查询设备统计数据接口

Parameters

integer $date

指定查询日期时间戳,单位为秒

integer $page_index

指定查询的结果页序号;返回结果按摇周边人数降序排序,每50条记录为一页

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

totalPage()

totalPage(integer  $page_id, integer  $begin_date, integer  $end_date) : array

以页面为维度的数据统计接口

Parameters

integer $page_id

指定页面的设备ID

integer $begin_date

起始日期时间戳,最长时间跨度为30天,单位为秒

integer $end_date

结束日期时间戳,最长时间跨度为30天,单位为秒

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

updateGroup()

updateGroup(integer  $group_id, string  $group_name) : array

编辑分组信息

Parameters

integer $group_id

分组唯一标识,全局唯一

string $group_name

分组名称,不超过100汉字或200个英文字母

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

deleteGroup()

deleteGroup(integer  $group_id) : array

删除分组

Parameters

integer $group_id

分组唯一标识,全局唯一

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

getGroupList()

getGroupList(integer  $begin, integer  $count = 10) : array

查询分组列表

Parameters

integer $begin

分组列表的起始索引值

integer $count

待查询的分组数量,不能超过1000个

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

getGroupDetail()

getGroupDetail(integer  $group_id, integer  $begin, integer  $count = 100) : array

查询分组详情

Parameters

integer $group_id

分组唯一标识,全局唯一

integer $begin

分组里设备的起始索引值

integer $count

待查询的分组里设备的数量,不能超过1000个

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

addDeviceGroup()

addDeviceGroup(array  $data) : array

添加设备到分组

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

deleteDeviceGroup()

deleteDeviceGroup(array  $data) : array

从分组中移除设备

Parameters

array $data

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

httpGetForJson()

httpGetForJson(string  $url) : array

以GET获取接口数据并转为数组

Parameters

string $url

接口地址

Throws

\WeChat\Exceptions\InvalidResponseException

Returns

array

httpPostForJson()

httpPostForJson(string  $url, array  $data, boolean  $buildToJson = true) : array

以POST获取接口数据并转为数组

Parameters

string $url

接口地址

array $data

请求数据

boolean $buildToJson

Throws

\WeChat\Exceptions\InvalidResponseException

Returns

array

registerApi()

registerApi(string  $url, string  $method, array  $arguments = array()) : mixed

注册当前请求接口

Parameters

string $url

接口地址

string $method

当前接口方法

array $arguments

请求参数

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

mixed