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

getShopList()

getShopList(integer  $pageindex = 1, integer  $pagesize = 2) : array

获取 Wi-Fi 门店列表

Parameters

integer $pageindex

分页下标,默认从1开始

integer $pagesize

每页的个数,默认10个,最大20个

Throws

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

Returns

array

getShopWifi()

getShopWifi(integer  $shop_id) : array

查询门店Wi-Fi信息

Parameters

integer $shop_id

门店ID

Throws

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

Returns

array

upShopWifi()

upShopWifi(integer  $shop_id, string  $old_ssid, string  $ssid, string  $password = null) : array

修改门店网络信息

Parameters

integer $shop_id

门店ID

string $old_ssid

旧的无线网络设备的ssid

string $ssid

新的无线网络设备的ssid

string $password

无线网络设备的密码(可选)

Throws

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

Returns

array

clearShopWifi()

clearShopWifi(integer  $shop_id) : array

清空门店网络及设备

Parameters

integer $shop_id

Throws

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

Returns

array

addShopWifi()

addShopWifi(integer  $shop_id, string  $ssid, null|string  $password = null) : array

添加密码型设备

Parameters

integer $shop_id

门店ID

string $ssid

无线网络设备的ssid

null|string $password

无线网络设备的密码

Throws

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

Returns

array

addShopPortal()

addShopPortal(integer  $shop_id, string  $ssid, boolean  $reset = false) : array

添加portal型设备

Parameters

integer $shop_id

门店ID

string $ssid

无线网络设备的ssid

boolean $reset

重置secretkey,false-不重置,true-重置,默认为false

Throws

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

Returns

array

queryShopWifi()

queryShopWifi(null|integer  $shop_id = null, null|integer  $pageindex = null, null|integer  $pagesize = null) : array

查询设备

Parameters

null|integer $shop_id

根据门店id查询

null|integer $pageindex

分页下标,默认从1开始

null|integer $pagesize

每页的个数,默认10个,最大20个

Throws

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

Returns

array

delShopWifi()

delShopWifi(string  $bssid) : array

删除设备

Parameters

string $bssid

需要删除的无线网络设备无线mac地址,格式冒号分隔,字符长度17个,并且字母小写,例如:00:1f:7a:ad:5c:a8

Throws

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

Returns

array

getQrc()

getQrc(integer  $shop_id, string  $ssid, integer  $img_id = 1) : array

获取物料二维码

Parameters

integer $shop_id

门店ID

string $ssid

已添加到门店下的无线网络名称

integer $img_id

物料样式编号:0-纯二维码,可用于自由设计宣传材料;1-二维码物料,155mm×215mm(宽×高),可直接张贴

Throws

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

Returns

array

setHomePage()

setHomePage(integer  $shop_id, integer  $template_id, null|string  $url = null) : array

设置商家主页

Parameters

integer $shop_id

门店ID

integer $template_id

模板ID,0-默认模板,1-自定义url

null|string $url

自定义链接,当template_id为1时必填

Throws

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

Returns

array

getHomePage()

getHomePage(integer  $shop_id) : array

查询商家主页

Parameters

integer $shop_id

查询的门店id

Throws

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

Returns

array

setBar()

setBar(integer  $shop_id, integer  $bar_type = 1) : array

设置微信首页欢迎语

Parameters

integer $shop_id

门店ID

integer $bar_type

微信首页欢迎语的文本内容:0--欢迎光临+公众号名称;1--欢迎光临+门店名称;2--已连接+公众号名称+WiFi;3--已连接+门店名称+Wi-Fi。

Throws

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

Returns

array

setFinishPage()

setFinishPage(integer  $shop_id, string  $finishpage_url) : array

设置连网完成页

Parameters

integer $shop_id

门店ID

string $finishpage_url

连网完成页URL

Throws

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

Returns

array

staticList()

staticList(string  $begin_date, string  $end_date, integer  $shop_id = -1) : array

Wi-Fi 数据统计

Parameters

string $begin_date

起始日期时间,格式yyyy-mm-dd,最长时间跨度为30天

string $end_date

结束日期时间戳,格式yyyy-mm-dd,最长时间跨度为30天

integer $shop_id

按门店ID搜索,-1为总统计

Throws

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

Returns

array

setCouponput()

setCouponput(integer  $shop_id, integer  $card_id, string  $card_describe, string  $start_time, string  $end_time) : array

设置门店卡券投放信息

Parameters

integer $shop_id

门店ID,可设置为0,表示所有门店

integer $card_id

卡券ID

string $card_describe

卡券描述,不能超过18个字符

string $start_time

卡券投放开始时间(单位是秒)

string $end_time

卡券投放结束时间(单位是秒) 注:不能超过卡券的有效期时间

Throws

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

Returns

array

getCouponput()

getCouponput(integer  $shop_id) : array

查询门店卡券投放信息

Parameters

integer $shop_id

门店ID,可设置为0,表示所有门店

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