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;
@@ -11,7 +23,8 @@ use Wechat\Lib\Tools;
* @author Anyon <zoujingli@qq.com>
* @date 2016-08-22 10:32
*/
class WechatExtends extends Common {
class WechatExtends extends Common
{
const QR_LIMIT_SCENE = 1;
@@ -56,7 +69,8 @@ class WechatExtends extends Common {
* @param string $ticket 传入由getQRCode方法生成的ticket参数
* @return string url 返回http地址
*/
public function getQRUrl($ticket) {
public function getQRUrl($ticket)
{
return self::QRCODE_IMG_URL . urlencode($ticket);
}
@@ -65,14 +79,12 @@ class WechatExtends extends Common {
* @param string $long_url 传入要转换的长url
* @return bool|string url 成功则返回转换后的短url
*/
public function getShortUrl($long_url) {
public function getShortUrl($long_url)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
$data = array(
'action' => 'long2short',
'long_url' => $long_url
);
$data = array('action' => 'long2short', 'long_url' => $long_url);
$result = Tools::httpPost(self::API_URL_PREFIX . self::SHORT_URL . "access_token={$this->access_token}", Tools::json_encode($data));
if ($result) {
$json = json_decode($result, true);
@@ -93,7 +105,8 @@ class WechatExtends extends Common {
* @param int $expire 临时二维码有效期最大为2592000秒(30天)
* @return bool|array ('ticket'=>'qrcode字串','expire_seconds'=>2592000,'url'=>'二维码图片解析后的地址')
*/
public function getQRCode($scene_id, $type = 0, $expire = 2592000) {
public function getQRCode($scene_id, $type = 0, $expire = 2592000)
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -130,7 +143,8 @@ class WechatExtends extends Common {
* @param string $region 区域名称,在城市存在的情况下可省略;与经纬度二选一传入
* @return bool|array
*/
public function querySemantic($uid, $query, $category, $latitude = 0.00, $longitude = 0.00, $city = "", $region = "") {
public function querySemantic($uid, $query, $category, $latitude = 0.00, $longitude = 0.00, $city = "", $region = "")
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
@@ -170,17 +184,15 @@ class WechatExtends extends Common {
* @param string $end_date 结束时间
* @return bool|array 成功返回查询结果数组,其定义请看官方文档
*/
public function getDatacube($type, $subtype, $begin_date, $end_date = '') {
public function getDatacube($type, $subtype, $begin_date, $end_date = '')
{
if (!$this->access_token && !$this->getAccessToken()) {
return false;
}
if (!isset(self::$DATACUBE_URL_ARR[$type]) || !isset(self::$DATACUBE_URL_ARR[$type][$subtype])) {
return false;
}
$data = array(
'begin_date' => $begin_date,
'end_date' => $end_date ? $end_date : $begin_date
);
$data = array('begin_date' => $begin_date, 'end_date' => $end_date ? $end_date : $begin_date);
$result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::$DATACUBE_URL_ARR[$type][$subtype] . "access_token={$this->access_token}", Tools::json_encode($data));
if ($result) {
$json = json_decode($result, true);