1、已知bug修复

2、微信接口更新
This commit is contained in:
2017-08-26 17:57:10 +08:00
parent cfcd6250ff
commit 356cccd1d4
25 changed files with 1353 additions and 695 deletions

View File

@@ -1,5 +1,17 @@
<?php
// +----------------------------------------------------------------------
// | wechat-php-sdk
// +----------------------------------------------------------------------
// | 版权所有 2014~2017 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方文档: https://www.kancloud.cn/zoujingli/wechat-php-sdk
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/wechat-php-sdk
// +----------------------------------------------------------------------
namespace Wechat;
use Wechat\Lib\Common;
@@ -10,7 +22,8 @@ use Wechat\Lib\Tools;
* @author Anyon <zoujingli@qq.com>
* @date 2016-08-22 10:35
*/
class WechatDevice extends Common {
class WechatDevice extends Common
{
const SHAKEAROUND_DEVICE_APPLYID = '/shakearound/device/applyid?'; //申请设备ID
const SHAKEAROUND_DEVICE_APPLYSTATUS = '/shakearound/device/applystatus?'; //查询设备ID申请审核状态
@@ -33,7 +46,8 @@ class WechatDevice extends Common {
* @param array $data
* @return bool|array
*/
public function applyShakeAroundDevice($data) {
public function applyShakeAroundDevice($data)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -55,7 +69,8 @@ class WechatDevice extends Common {
* @param int $apply_id
* @return bool|array
*/
public function applyStatusShakeAroundDevice($apply_id) {
public function applyStatusShakeAroundDevice($apply_id)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -78,7 +93,8 @@ class WechatDevice extends Common {
* @param array $data
* @return bool
*/
public function updateShakeAroundDevice($data) {
public function updateShakeAroundDevice($data)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -101,7 +117,8 @@ class WechatDevice extends Common {
* @param $data
* @return bool|array
*/
public function searchShakeAroundDevice($data) {
public function searchShakeAroundDevice($data)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -127,7 +144,8 @@ class WechatDevice extends Common {
* @param int $minor
* @return bool|array
*/
public function bindLocationShakeAroundDevice($device_id, $poi_id, $uuid = '', $major = 0, $minor = 0) {
public function bindLocationShakeAroundDevice($device_id, $poi_id, $uuid = '', $major = 0, $minor = 0)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -137,9 +155,7 @@ class WechatDevice extends Common {
}
$device_identifier = array('uuid' => $uuid, 'major' => $major, 'minor' => $minor);
} else {
$device_identifier = array(
'device_id' => $device_id
);
$device_identifier = array('device_id' => $device_id);
}
$data = array('device_identifier' => $device_identifier, 'poi_id' => $poi_id);
$result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::SHAKEAROUND_DEVICE_BINDLOCATION . "access_token={$this->access_token}", Tools::json_encode($data));
@@ -162,7 +178,8 @@ class WechatDevice extends Common {
* @param type $poi_appid 目标微信appid
* @return boolean
*/
public function bindLocationOtherShakeAroundDevice($device_identifier, $poi_id, $poi_appid) {
public function bindLocationOtherShakeAroundDevice($device_identifier, $poi_id, $poi_appid)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -175,7 +192,7 @@ class WechatDevice extends Common {
$this->errMsg = $json['errmsg'];
return $this->checkRetry(__FUNCTION__, func_get_args());
}
return $json; //这个可以更改为返回true
return $json;
}
return false;
}
@@ -191,7 +208,8 @@ class WechatDevice extends Common {
* @param int $minor
* @return bool|array
*/
public function bindPageShakeAroundDevice($device_id, $page_ids = array(), $bind = 1, $append = 1, $uuid = '', $major = 0, $minor = 0) {
public function bindPageShakeAroundDevice($device_id, $page_ids = array(), $bind = 1, $append = 1, $uuid = '', $major = 0, $minor = 0)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -223,11 +241,12 @@ class WechatDevice extends Common {
* @param array $data {"media":'@Path\filename.jpg'}
* @return bool|array
*/
public function uploadShakeAroundMedia($data) {
public function uploadShakeAroundMedia($data)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
$result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::SHAKEAROUND_MATERIAL_ADD . "access_token={$this->access_token}", $data, true);
$result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::SHAKEAROUND_MATERIAL_ADD . "access_token={$this->access_token}", $data);
if ($result) {
$json = json_decode($result, true);
if (!$json || !empty($json['errcode'])) {
@@ -250,7 +269,8 @@ class WechatDevice extends Common {
* @param string $comment 页面的备注信息不超过15 个字,可不填
* @return bool|array
*/
public function addShakeAroundPage($title, $description, $icon_url, $page_url, $comment = '') {
public function addShakeAroundPage($title, $description, $icon_url, $page_url, $comment = '')
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -279,7 +299,8 @@ class WechatDevice extends Common {
* @param string $comment 页面的备注信息不超过15 个字,可不填
* @return bool|array
*/
public function updateShakeAroundPage($page_id, $title, $description, $icon_url, $page_url, $comment = '') {
public function updateShakeAroundPage($page_id, $title, $description, $icon_url, $page_url, $comment = '')
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -305,7 +326,8 @@ class WechatDevice extends Common {
* @param int $count
* @return bool|mixed
*/
public function searchShakeAroundPage($page_ids = array(), $begin = 0, $count = 1) {
public function searchShakeAroundPage($page_ids = array(), $begin = 0, $count = 1)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -333,7 +355,8 @@ class WechatDevice extends Common {
* @param array $page_ids
* @return bool|array
*/
public function deleteShakeAroundPage($page_ids = array()) {
public function deleteShakeAroundPage($page_ids = array())
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -357,7 +380,8 @@ class WechatDevice extends Common {
* @param string $ticket 摇周边业务的ticket(可在摇到的URL中得到ticket生效时间为30 分钟)
* @return bool|array
*/
public function getShakeInfoShakeAroundUser($ticket) {
public function getShakeInfoShakeAroundUser($ticket)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -386,7 +410,8 @@ class WechatDevice extends Common {
* @param int $minor
* @return bool|array
*/
public function deviceShakeAroundStatistics($device_id, $begin_date, $end_date, $uuid = '', $major = 0, $minor = 0) {
public function deviceShakeAroundStatistics($device_id, $begin_date, $end_date, $uuid = '', $major = 0, $minor = 0)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -420,7 +445,8 @@ class WechatDevice extends Common {
* @param int $end_date 结束日期时间戳最长时间跨度为30 天
* @return bool|array
*/
public function pageShakeAroundStatistics($page_id, $begin_date, $end_date) {
public function pageShakeAroundStatistics($page_id, $begin_date, $end_date)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}