ComposerUpdate

This commit is contained in:
Anyon 2020-03-31 14:25:55 +08:00
parent 5f5a2666e3
commit efcef2ff74
18 changed files with 1001 additions and 45 deletions

View File

@ -10,6 +10,7 @@ return array(
'AliPay\\Bill' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Bill.php', 'AliPay\\Bill' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Bill.php',
'AliPay\\Pos' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Pos.php', 'AliPay\\Pos' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Pos.php',
'AliPay\\Scan' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Scan.php', 'AliPay\\Scan' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Scan.php',
'AliPay\\Trade' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Trade.php',
'AliPay\\Transfer' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Transfer.php', 'AliPay\\Transfer' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Transfer.php',
'AliPay\\Wap' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Wap.php', 'AliPay\\Wap' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Wap.php',
'AliPay\\Web' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Web.php', 'AliPay\\Web' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Web.php',
@ -163,14 +164,18 @@ return array(
'WeMini\\Crypt' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Crypt.php', 'WeMini\\Crypt' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Crypt.php',
'WeMini\\Delivery' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Delivery.php', 'WeMini\\Delivery' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Delivery.php',
'WeMini\\Domain' => $vendorDir . '/zoujingli/weopen-developer/WeMini/Domain.php', 'WeMini\\Domain' => $vendorDir . '/zoujingli/weopen-developer/WeMini/Domain.php',
'WeMini\\Guide' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Guide.php',
'WeMini\\Image' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Image.php', 'WeMini\\Image' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Image.php',
'WeMini\\Live' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Live.php',
'WeMini\\Logistics' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Logistics.php', 'WeMini\\Logistics' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Logistics.php',
'WeMini\\Message' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Message.php', 'WeMini\\Message' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Message.php',
'WeMini\\Newtmpl' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Newtmpl.php', 'WeMini\\Newtmpl' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Newtmpl.php',
'WeMini\\Ocr' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Ocr.php', 'WeMini\\Ocr' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Ocr.php',
'WeMini\\Operation' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Operation.php',
'WeMini\\Plugs' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Plugs.php', 'WeMini\\Plugs' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Plugs.php',
'WeMini\\Poi' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Poi.php', 'WeMini\\Poi' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Poi.php',
'WeMini\\Qrcode' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Qrcode.php', 'WeMini\\Qrcode' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Qrcode.php',
'WeMini\\Search' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Search.php',
'WeMini\\Security' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Security.php', 'WeMini\\Security' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Security.php',
'WeMini\\Soter' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Soter.php', 'WeMini\\Soter' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Soter.php',
'WeMini\\Template' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Template.php', 'WeMini\\Template' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Template.php',

View File

@ -103,6 +103,7 @@ class ComposerStaticInit0ac7cd5b2cda0031cee9c92b2dc93c50
'AliPay\\Bill' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Bill.php', 'AliPay\\Bill' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Bill.php',
'AliPay\\Pos' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Pos.php', 'AliPay\\Pos' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Pos.php',
'AliPay\\Scan' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Scan.php', 'AliPay\\Scan' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Scan.php',
'AliPay\\Trade' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Trade.php',
'AliPay\\Transfer' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Transfer.php', 'AliPay\\Transfer' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Transfer.php',
'AliPay\\Wap' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Wap.php', 'AliPay\\Wap' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Wap.php',
'AliPay\\Web' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Web.php', 'AliPay\\Web' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Web.php',
@ -256,14 +257,18 @@ class ComposerStaticInit0ac7cd5b2cda0031cee9c92b2dc93c50
'WeMini\\Crypt' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Crypt.php', 'WeMini\\Crypt' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Crypt.php',
'WeMini\\Delivery' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Delivery.php', 'WeMini\\Delivery' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Delivery.php',
'WeMini\\Domain' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini/Domain.php', 'WeMini\\Domain' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini/Domain.php',
'WeMini\\Guide' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Guide.php',
'WeMini\\Image' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Image.php', 'WeMini\\Image' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Image.php',
'WeMini\\Live' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Live.php',
'WeMini\\Logistics' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Logistics.php', 'WeMini\\Logistics' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Logistics.php',
'WeMini\\Message' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Message.php', 'WeMini\\Message' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Message.php',
'WeMini\\Newtmpl' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Newtmpl.php', 'WeMini\\Newtmpl' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Newtmpl.php',
'WeMini\\Ocr' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Ocr.php', 'WeMini\\Ocr' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Ocr.php',
'WeMini\\Operation' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Operation.php',
'WeMini\\Plugs' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Plugs.php', 'WeMini\\Plugs' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Plugs.php',
'WeMini\\Poi' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Poi.php', 'WeMini\\Poi' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Poi.php',
'WeMini\\Qrcode' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Qrcode.php', 'WeMini\\Qrcode' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Qrcode.php',
'WeMini\\Search' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Search.php',
'WeMini\\Security' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Security.php', 'WeMini\\Security' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Security.php',
'WeMini\\Soter' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Soter.php', 'WeMini\\Soter' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Soter.php',
'WeMini\\Template' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Template.php', 'WeMini\\Template' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Template.php',

View File

@ -177,8 +177,8 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v3.4.38", "version": "v3.4.39",
"version_normalized": "3.4.38.0", "version_normalized": "3.4.39.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
@ -401,12 +401,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "997cf0eb09f433a42ab3fe7f61fb4448603557c2" "reference": "c9c2f06884ce0b5085bedde8c41620d75b126079"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/997cf0eb09f433a42ab3fe7f61fb4448603557c2", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/c9c2f06884ce0b5085bedde8c41620d75b126079",
"reference": "997cf0eb09f433a42ab3fe7f61fb4448603557c2", "reference": "c9c2f06884ce0b5085bedde8c41620d75b126079",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -426,7 +426,7 @@
"qiniu/php-sdk": "^7.2", "qiniu/php-sdk": "^7.2",
"topthink/framework": "5.1.*" "topthink/framework": "5.1.*"
}, },
"time": "2020-03-03T03:03:27+00:00", "time": "2020-03-12T10:21:24+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -446,17 +446,17 @@
}, },
{ {
"name": "zoujingli/wechat-developer", "name": "zoujingli/wechat-developer",
"version": "v1.2.17", "version": "v1.2.20",
"version_normalized": "1.2.17.0", "version_normalized": "1.2.20.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/WeChatDeveloper.git", "url": "https://github.com/zoujingli/WeChatDeveloper.git",
"reference": "98f6e82311a364220a677cdfd56dc9f97851ab24" "reference": "9afb0a29c658d52dc7b9d46d2f848602124936b7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/WeChatDeveloper/zipball/98f6e82311a364220a677cdfd56dc9f97851ab24", "url": "https://api.github.com/repos/zoujingli/WeChatDeveloper/zipball/9afb0a29c658d52dc7b9d46d2f848602124936b7",
"reference": "98f6e82311a364220a677cdfd56dc9f97851ab24", "reference": "9afb0a29c658d52dc7b9d46d2f848602124936b7",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -466,6 +466,7 @@
] ]
}, },
"require": { "require": {
"ext-bcmath": "*",
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*", "ext-json": "*",
"ext-libxml": "*", "ext-libxml": "*",
@ -474,7 +475,7 @@
"ext-simplexml": "*", "ext-simplexml": "*",
"php": ">=5.4" "php": ">=5.4"
}, },
"time": "2020-03-03T01:38:07+00:00", "time": "2020-03-14T06:58:18+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -483,8 +484,8 @@
], ],
"psr-4": { "psr-4": {
"WePay\\": "WePay", "WePay\\": "WePay",
"WeMini\\": "WeMini",
"WeChat\\": "WeChat", "WeChat\\": "WeChat",
"WeMini\\": "WeMini",
"AliPay\\": "AliPay" "AliPay\\": "AliPay"
} }
}, },
@ -496,7 +497,7 @@
{ {
"name": "Anyon", "name": "Anyon",
"email": "zoujingli@qq.com", "email": "zoujingli@qq.com",
"homepage": "http://ctolog.com" "homepage": "https://thinkadmin.top"
} }
], ],
"description": "WeChat platform and WeChat payment development tools", "description": "WeChat platform and WeChat payment development tools",

View File

@ -30,21 +30,88 @@ class Express
*/ */
public static function query($code, $number) public static function query($code, $number)
{ {
if (in_array($code, ['debangkuaidi'])) $code = 'debangwuliu'; list($list, $cache) = [[], app()->cache->get($ckey = md5($code . $number))];
list($microtime, $clientIp, $list) = [time(), request()->ip(), []]; if (!empty($cache)) return ['message' => 'ok', 'com' => $code, 'nu' => $number, 'data' => $cache];
$options = ['header' => ['Host' => 'www.kuaidi100.com', 'CLIENT-IP' => $clientIp, 'X-FORWARDED-FOR' => $clientIp], 'cookie_file' => env('runtime_path') . 'temp/cookie']; for ($i = 0; $i < 6; $i++) if (is_array($result = self::doExpress($code, $number))) {
$location = "https://sp0.baidu.com/9_Q4sjW91Qh3otqbppnN2DJv/pae/channel/data/asyncqury?cb=callback&appid=4001&com={$code}&nu={$number}&vcode=&token=&_={$microtime}"; if (!empty($result['data']['info']['context'])) {
$result = json_decode(str_replace('/**/callback(', '', trim(http_get($location, [], $options), ')')), true); foreach ($result['data']['info']['context'] as $vo) $list[] = [
if (empty($result['data']['info']['context'])) { // 第一次可能失败,这里尝试第二次查询 'time' => date('Y-m-d H:i:s', $vo['time']), 'context' => $vo['desc'],
$result = json_decode(str_replace('/**/callback(', '', trim(http_get($location, [], $options), ')')), true); ];
if (empty($result['data']['info']['context'])) { app()->cache->set($ckey, $list, 10);
return ['message' => 'ok', 'com' => $code, 'nu' => $number, 'data' => $list]; return ['message' => 'ok', 'com' => $code, 'nu' => $number, 'data' => $list];
} }
} }
foreach ($result['data']['info']['context'] as $vo) $list[] = [
'time' => date('Y-m-d H:i:s', $vo['time']), 'ftime' => date('Y-m-d H:i:s', $vo['time']), 'context' => $vo['desc'],
];
return ['message' => 'ok', 'com' => $code, 'nu' => $number, 'data' => $list]; return ['message' => 'ok', 'com' => $code, 'nu' => $number, 'data' => $list];
} }
/**
* 获取快递公司列表
* @return array
*/
public static function getExpressList()
{
$data = [];
if (preg_match('/"currentData":.*?\[(.*?)\],/', self::getWapBaiduHtml(), $matches)) {
foreach (json_decode("[{$matches['1']}]") as $item) $data[$item->value] = $item->text;
unset($data['_auto']);
return $data;
} else {
app()->cache->delete('express_kuaidi_html');
return self::getExpressList();
}
}
/**
* 执行百度快递100应用查询请求
* @param string $code 快递公司编号
* @param string $number 快递单单号
* @return mixed
*/
private static function doExpress($code, $number)
{
list($uniqid, $token) = [strtr(uniqid(), '.', ''), self::getExpressToken()];
$url = "https://express.baidu.com/express/api/express?tokenV2={$token}&appid=4001&nu={$number}&com={$code}&qid={$uniqid}&new_need_di=1&source_xcx=0&vcode=&token=&sourceId=4155&cb=callback";
return json_decode(str_replace('/**/callback(', '', trim(Http::get($url, [], self::getOption()), ')')), true);
}
/**
* 获取接口请求令牌
* @return string
*/
private static function getExpressToken()
{
if (preg_match('/express\?tokenV2=(.*?)",/', self::getWapBaiduHtml(), $matches)) {
return $matches[1];
} else {
app()->cache->delete('express_kuaidi_html');
return self::getExpressToken();
}
}
/**
* 获取百度WAP快递HTML
* @return string
*/
private static function getWapBaiduHtml()
{
$content = app()->cache->get('express_kuaidi_html');
while (empty($content) || stristr($content, '百度安全验证') > -1 || stripos($content, 'tokenV2') === -1) {
$content = Http::get('https://m.baidu.com/s?word=快递查询&rnd=' . uniqid(), [], self::getOption());
}
app()->cache->set('express_kuaidi_html', $content, 30);
return $content;
}
/**
* 获取HTTP请求配置
* @return array
*/
private static function getOption()
{
return [
'cookie_file' => app()->getRuntimePath() . '_express_cookie.txt',
'headers' => ['Host' => 'express.baidu.com', 'X-FORWARDED-FOR' => request()->ip()],
];
}
} }

View File

@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace AliPay;
use WeChat\Contracts\BasicAliPay;
/**
* 支付宝标准接口
* Class Trade
* @package AliPay
*/
class Trade extends BasicAliPay
{
/**
* 设置交易接口地址
* @param string $method
* @return $this
*/
public function setMethod($method)
{
$this->options->set('method', $method);
return $this;
}
/**
* 获取交易接口地址
* @return string
*/
public function getMethod()
{
return $this->options->get('method');
}
/**
* 设置接口公共参数
* @param array $option
* @return Trade
*/
public function setOption($option = [])
{
foreach ($option as $key => $vo) {
$this->options->set($key, $vo);
}
return $this;
}
/**
* 获取接口公共参数
* @return array|string|null
*/
public function getOption()
{
return $this->options->get();
}
/**
* 执行通过接口
* @param array $options
* @return array|boolean|mixed
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function apply($options)
{
return $this->getResult($options);
}
}

View File

@ -15,6 +15,7 @@
namespace AliPay; namespace AliPay;
use WeChat\Contracts\BasicAliPay; use WeChat\Contracts\BasicAliPay;
use WeChat\Exceptions\InvalidArgumentException;
/** /**
* 支付宝转账到账户 * 支付宝转账到账户
@ -46,6 +47,7 @@ class Transfer extends BasicAliPay
*/ */
public function create($options = []) public function create($options = [])
{ {
$this->setAppCertSnAndRootCertSn();
$this->options->set('method', 'alipay.fund.trans.uni.transfer'); $this->options->set('method', 'alipay.fund.trans.uni.transfer');
return $this->getResult($options); return $this->getResult($options);
} }
@ -59,6 +61,7 @@ class Transfer extends BasicAliPay
*/ */
public function queryResult($options = []) public function queryResult($options = [])
{ {
$this->setAppCertSnAndRootCertSn();
$this->options->set('method', 'alipay.fund.trans.common.query'); $this->options->set('method', 'alipay.fund.trans.common.query');
return $this->getResult($options); return $this->getResult($options);
@ -73,7 +76,29 @@ class Transfer extends BasicAliPay
*/ */
public function queryAccount($options = []) public function queryAccount($options = [])
{ {
$this->setAppCertSnAndRootCertSn();
$this->options->set('method', 'alipay.fund.account.query'); $this->options->set('method', 'alipay.fund.account.query');
return $this->getResult($options); return $this->getResult($options);
} }
/**
* 新版 设置网关应用公钥证书SN、支付宝根证书SN
*/
protected function setAppCertSnAndRootCertSn()
{
if (!$this->config->get('app_cert')) {
throw new InvalidArgumentException("Missing Config -- [app_cert]");
}
if (!$this->config->get('root_cert')) {
throw new InvalidArgumentException("Missing Config -- [root_cert]");
}
$this->options->set('app_cert_sn', $this->getCertSN($this->config->get('app_cert')));
$this->options->set('alipay_root_cert_sn', $this->getRootCertSN($this->config->get('root_cert')));
if (!$this->options->get('app_cert_sn')) {
throw new InvalidArgumentException("Missing options -- [app_cert_sn]");
}
if (!$this->options->get('alipay_root_cert_sn')) {
throw new InvalidArgumentException("Missing options -- [alipay_root_cert_sn]");
}
}
} }

View File

@ -40,7 +40,7 @@ WeChatDeveloper 为开源项目,允许把它用于任何地方,不受任何
* Gitee 托管地址https://gitee.com/zoujingli/WeChatDeveloper * Gitee 托管地址https://gitee.com/zoujingli/WeChatDeveloper
* GitHub 托管地址https://github.com/zoujingli/WeChatDeveloper * GitHub 托管地址https://github.com/zoujingli/WeChatDeveloper
文件说明 文件说明(后缀会根据官方文档增加文件)
---- ----
|文件名|类名|描述|类型|加载 ①| |文件名|类名|描述|类型|加载 ①|

View File

@ -23,6 +23,15 @@ use WeChat\Exceptions\InvalidInstanceException;
* @author Anyon<zoujingli@qq.com> * @author Anyon<zoujingli@qq.com>
* @date 2018/05/24 13:23 * @date 2018/05/24 13:23
* *
* ----- AliPay ----
* @method \AliPay\App AliPayApp($options) static 支付宝App支付网关
* @method \AliPay\Bill AliPayBill($options) static 支付宝电子面单下载
* @method \AliPay\Pos AliPayPos($options) static 支付宝刷卡支付
* @method \AliPay\Scan AliPayScan($options) static 支付宝扫码支付
* @method \AliPay\Transfer AliPayTransfer($options) static 支付宝转账到账户
* @method \AliPay\Wap AliPayWap($options) static 支付宝手机网站支付
* @method \AliPay\Web AliPayWeb($options) static 支付宝网站支付
*
* ----- WeChat ----- * ----- WeChat -----
* @method \WeChat\Card WeChatCard($options = []) static 微信卡券管理 * @method \WeChat\Card WeChatCard($options = []) static 微信卡券管理
* @method \WeChat\Custom WeChatCustom($options = []) static 微信客服消息 * @method \WeChat\Custom WeChatCustom($options = []) static 微信客服消息
@ -45,13 +54,17 @@ use WeChat\Exceptions\InvalidInstanceException;
* ----- WeMini ----- * ----- WeMini -----
* @method \WeMini\Crypt WeMiniCrypt($options = []) static 小程序数据加密处理 * @method \WeMini\Crypt WeMiniCrypt($options = []) static 小程序数据加密处理
* @method \WeMini\Delivery WeMiniDelivery($options = []) static 小程序即时配送 * @method \WeMini\Delivery WeMiniDelivery($options = []) static 小程序即时配送
* @method \WeMini\Guide WeMiniGuide($options = []) static 小程序导购助手
* @method \WeMini\Image WeMiniImage($options = []) static 小程序图像处理 * @method \WeMini\Image WeMiniImage($options = []) static 小程序图像处理
* @method \WeMini\Logistics WeMiniLogistics($options = []) static 小程序物流助手 * @method \WeMini\Logistics WeMiniLogistics($options = []) static 小程序物流助手
* @method \WeMini\Message WeMiniMessage($options = []) static 小程序动态消息 * @method \WeMini\Message WeMiniMessage($options = []) static 小程序动态消息
* @method \WeMini\Newtmpl WeMiniNewtmpl($options = []) static 小程序订阅消息
* @method \WeMini\Ocr WeMiniOcr($options = []) static 小程序ORC服务 * @method \WeMini\Ocr WeMiniOcr($options = []) static 小程序ORC服务
* @method \WeMini\Operation WeMiniOperation($options = []) static 小程序运维中心
* @method \WeMini\Plugs WeMiniPlugs($options = []) static 小程序插件管理 * @method \WeMini\Plugs WeMiniPlugs($options = []) static 小程序插件管理
* @method \WeMini\Poi WeMiniPoi($options = []) static 小程序地址管理 * @method \WeMini\Poi WeMiniPoi($options = []) static 小程序地址管理
* @method \WeMini\Qrcode WeMiniQrcode($options = []) static 小程序二维码管理 * @method \WeMini\Qrcode WeMiniQrcode($options = []) static 小程序二维码管理
* @method \WeMini\Search WeMiniSearch($options = []) static 小程序搜索
* @method \WeMini\Security WeMiniSecurity($options = []) static 小程序内容安全 * @method \WeMini\Security WeMiniSecurity($options = []) static 小程序内容安全
* @method \WeMini\Soter WeMiniSoter($options = []) static 小程序生物认证 * @method \WeMini\Soter WeMiniSoter($options = []) static 小程序生物认证
* @method \WeMini\Template WeMiniTemplate($options = []) static 小程序模板消息支持 * @method \WeMini\Template WeMiniTemplate($options = []) static 小程序模板消息支持
@ -59,21 +72,12 @@ use WeChat\Exceptions\InvalidInstanceException;
* *
* ----- WePay ----- * ----- WePay -----
* @method \WePay\Bill WePayBill($options = []) static 微信商户账单及评论 * @method \WePay\Bill WePayBill($options = []) static 微信商户账单及评论
* @method \WePay\Coupon WePayCoupon($options = []) static 微信商户代金券
* @method \WePay\Order WePayOrder($options = []) static 微信商户订单 * @method \WePay\Order WePayOrder($options = []) static 微信商户订单
* @method \WePay\Refund WePayRefund($options = []) static 微信商户退款 * @method \WePay\Refund WePayRefund($options = []) static 微信商户退款
* @method \WePay\Coupon WePayCoupon($options = []) static 微信商户代金券
* @method \WePay\Redpack WePayRedpack($options = []) static 微信红包支持 * @method \WePay\Redpack WePayRedpack($options = []) static 微信红包支持
* @method \WePay\Transfers WePayTransfers($options = []) static 微信商户打款到零钱 * @method \WePay\Transfers WePayTransfers($options = []) static 微信商户打款到零钱
* @method \WePay\TransfersBank WePayTransfersBank($options = []) static 微信商户打款到银行卡 * @method \WePay\TransfersBank WePayTransfersBank($options = []) static 微信商户打款到银行卡
*
* ----- AliPay ----
* @method \AliPay\App AliPayApp($options) static 支付宝App支付网关
* @method \AliPay\Bill AliPayBill($options) static 支付宝电子面单下载
* @method \AliPay\Pos AliPayPos($options) static 支付宝刷卡支付
* @method \AliPay\Scan AliPayScan($options) static 支付宝扫码支付
* @method \AliPay\Transfer AliPayTransfer($options) static 支付宝转账到账户
* @method \AliPay\Wap AliPayWap($options) static 支付宝手机网站支付
* @method \AliPay\Web AliPayWeb($options) static 支付宝网站支付
*/ */
class We class We
{ {
@ -81,7 +85,7 @@ class We
* 定义当前版本 * 定义当前版本
* @var string * @var string
*/ */
const VERSION = '1.2.17'; const VERSION = '1.2.20';
/** /**
* 静态配置 * 静态配置

View File

@ -198,7 +198,7 @@ abstract class BasicAliPay
*/ */
protected function getSign() protected function getSign()
{ {
$content = wordwrap($this->config->get('private_key'), 64, "\n", true); $content = wordwrap($this->trimCert($this->config->get('private_key')), 64, "\n", true);
$string = "-----BEGIN RSA PRIVATE KEY-----\n{$content}\n-----END RSA PRIVATE KEY-----"; $string = "-----BEGIN RSA PRIVATE KEY-----\n{$content}\n-----END RSA PRIVATE KEY-----";
if ($this->options->get('sign_type') === 'RSA2') { if ($this->options->get('sign_type') === 'RSA2') {
openssl_sign($this->getSignContent($this->options->get(), true), $sign, $string, OPENSSL_ALGO_SHA256); openssl_sign($this->getSignContent($this->options->get(), true), $sign, $string, OPENSSL_ALGO_SHA256);
@ -208,6 +208,17 @@ abstract class BasicAliPay
return base64_encode($sign); return base64_encode($sign);
} }
/**
* 去除证书前后内容及空白
* @param string $sign
* @return string
*/
protected function trimCert($sign)
{
// if (file_exists($sign)) $sign = file_get_contents($sign);
return preg_replace(['/\s+/', '/\-{5}.*?\-{5}/'], '', $sign);
}
/** /**
* 数据签名处理 * 数据签名处理
* @param array $data 需要进行签名数据 * @param array $data 需要进行签名数据
@ -276,6 +287,75 @@ abstract class BasicAliPay
return "{$html}<script>document.forms['alipaysubmit'].submit();</script>"; return "{$html}<script>document.forms['alipaysubmit'].submit();</script>";
} }
/**
* 新版 从证书中提取序列号
* @param string $sign
* @return string
*/
public function getCertSN($sign)
{
// if (file_exists($sign)) $sign = file_get_contents($sign);
$ssl = openssl_x509_parse($sign);
return md5($this->_arr2str(array_reverse($ssl['issuer'])) . $ssl['serialNumber']);
}
/**
* 新版 提取根证书序列号
* @param string $sign
* @return string|null
*/
public function getRootCertSN($sign)
{
$sn = null;
// if (file_exists($sign)) $sign = file_get_contents($sign);
$array = explode("-----END CERTIFICATE-----", $sign);
for ($i = 0; $i < count($array) - 1; $i++) {
$ssl[$i] = openssl_x509_parse($array[$i] . "-----END CERTIFICATE-----");
if (strpos($ssl[$i]['serialNumber'], '0x') === 0) {
$ssl[$i]['serialNumber'] = $this->_hex2dec($ssl[$i]['serialNumber']);
}
if ($ssl[$i]['signatureTypeLN'] == "sha1WithRSAEncryption" || $ssl[$i]['signatureTypeLN'] == "sha256WithRSAEncryption") {
if ($sn == null) {
$sn = md5($this->_arr2str(array_reverse($ssl[$i]['issuer'])) . $ssl[$i]['serialNumber']);
} else {
$sn = $sn . "_" . md5($this->_arr2str(array_reverse($ssl[$i]['issuer'])) . $ssl[$i]['serialNumber']);
}
}
}
return $sn;
}
/**
* 新版 数组转字符串
* @param array $array
* @return string
*/
private function _arr2str($array)
{
$string = [];
if ($array && is_array($array)) {
foreach ($array as $key => $value) {
$string[] = $key . '=' . $value;
}
}
return implode(',', $string);
}
/**
* 新版 0x转高精度数字
* @param string $hex
* @return int|string
*/
private function _hex2dec($hex)
{
list($dec, $len) = [0, strlen($hex)];
for ($i = 1; $i <= $len; $i++) {
$dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i))));
}
return $dec;
}
/** /**
* 应用数据操作 * 应用数据操作
* @param array $options * @param array $options

View File

@ -0,0 +1,547 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 小程序导购助手
* Class Guide
* @package WeMini
*/
class Guide extends BasicWeChat
{
/**
* 服务号添加导购
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function addGuideAcct($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 服务号删除导购
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function delGuideAcct($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/delguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 服务号获取导购信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideAcct($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 获取服务号的敏感词信息与自动回复信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideAcctConfig()
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacctconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, [], true);
}
/**
* 服务号拉取导购列表
* @param integer $page
* @param integer $num
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideAcctList($page = 0, $num = 10)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacctconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['page' => $page, 'num' => $num], true);
}
/**
* 获取导购聊天记录
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideBuyerChatRecord($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 获取导购快捷回复信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideConfig($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 生成导购二维码
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function guideCreateQrCode($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/guidecreateqrcode?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function pushShowWxaPathMenu($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/pushshowwxapathmenu?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 为服务号设置敏感词与自动回复
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function setGuideAcctConfig($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideacctconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 设置导购快捷回复信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function setGuideConfig($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 更新导购昵称或者头像
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function updateGuideAcct($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideconfig?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 添加展示标签信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function addGuideBuyerDisplayTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidebuyerdisplaytag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 为粉丝添加可查询标签
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function addGuideBuyerTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidebuyertag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 添加标签可选值
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function addGuideTagOption($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidetagoption?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 删除粉丝标签
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function delGuideBuyerTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidebuyertag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 查询展示标签信息
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideBuyerDisplayTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerdisplaytag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 查询粉丝标签
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideBuyerTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyertag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 查询标签可选值信息
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideTagOption()
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidetagoption?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, [], true);
}
/**
* 新建可查询标签类型,支持新建4类可查询标签
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function newGuideTagOption($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/newguidetagoption?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 根据标签值筛选粉丝
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function queryGuideBuyerByTag($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/queryguidebuyerbytag?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 为服务号导购添加粉丝
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function addGuideBuyerRelation($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/addguidebuyerrelation?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 删除导购的粉丝
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function delGuideBuyerRelation($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidebuyerrelation?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 查询某一个粉丝与导购的绑定关系
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideBuyerRelation($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelation?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 通过粉丝信息查询该粉丝与导购的绑定关系
* @param string $openid
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideBuyerRelationByBuyer($openid)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelation?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['openid' => $openid], true);
}
/**
* 拉取导购的粉丝列表
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideBuyerRelationList($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelationlist?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 将粉丝从一个导购迁移到另外一个导购下
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function rebindGuideAcctForBuyer($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/rebindguideacctforbuyer?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 更新粉丝昵称
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function updateGuideBuyerRelation($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/updateguidebuyerrelation?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 删除小程序卡片素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function delGuideCardMaterial($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidecardmaterial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 删除图片素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function delGuideImageMaterial($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/delguideimagematerial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 删除文字素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function delGuideWordMaterial($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/delguidewordmaterial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 获取小程序卡片素材信息
* @param integer $type
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideCardMaterial($type = 0)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidecardmaterial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['type' => $type], true);
}
/**
* 获取图片素材信息
* @param integer $type 操作类型
* @param integer $start 分页查询,起始位置
* @param integer $num 分页查询,查询个数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideImageMaterial($type = 0, $start = 0, $num = 10)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideimagematerial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['type' => $type, 'start' => $start, 'num' => $num], true);
}
/**
* 获取文字素材信息
* @param integer $type 操作类型
* @param integer $start 分页查询,起始位置
* @param integer $num 分页查询,查询个数
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getGuideWordMaterial($type = 0, $start = 0, $num = 10)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguidewordmaterial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['type' => $type, 'start' => $start, 'num' => $num], true);
}
/**
* 添加小程序卡片素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function setGuideCardMaterial($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguidecardmaterial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 添加图片素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function setGuideImageMaterial($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguideimagematerial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
/**
* 为服务号添加文字素材
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function setGuideWordMaterial($data)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/setguidewordmaterial?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -0,0 +1,56 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 小程序直播接口
* Class Live
* @package WeMini
*/
class Live extends BasicWeChat
{
/**
* 获取直播房间列表
* @param integer $start 起始拉取房间
* @param integer $limit 每次拉取的个数上限
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getLiveList($start = 0, $limit = 10)
{
$url = 'http://api.weixin.qq.com/wxa/business/getliveinfo?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['start' => $start, 'limit' => $limit], true);
}
/**
* 获取回放源视频
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function getLiveInfo($data = [])
{
$url = 'http://api.weixin.qq.com/wxa/business/getliveinfo?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -74,7 +74,7 @@ class Newtmpl extends BasicWeChat
{ {
$url = 'https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=ACCESS_TOKEN'; $url = 'https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args()); $this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['ids'=>$ids,'start' => '0', 'limit' => '30'], true); return $this->callPostApi($url, ['ids' => $ids, 'start' => '0', 'limit' => '30'], true);
} }
/** /**

View File

@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 小程序运维中心
* Class Operation
* @package WeMini
*/
class Operation extends BasicWeChat
{
/**
* 实时日志查询
* @param array $data
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function realtimelogSearch($data)
{
$url = 'https://api.weixin.qq.com/wxaapi/userlog/userlog_search?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, $data, true);
}
}

View File

@ -0,0 +1,40 @@
<?php
// +----------------------------------------------------------------------
// | WeChatDeveloper
// +----------------------------------------------------------------------
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://think.ctolog.com
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/WeChatDeveloper
// +----------------------------------------------------------------------
namespace WeMini;
use WeChat\Contracts\BasicWeChat;
/**
* 小程序搜索
* Class Search
* @package WeMini
*/
class Search extends BasicWeChat
{
/**
* 提交小程序页面url及参数信息
* @param array $pages
* @return array
* @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException
*/
public function submitPages($pages)
{
$url = 'https://api.weixin.qq.com/cgi-bin/guide/getguideacct?access_token=ACCESS_TOKEN';
$this->registerApi($url, __FUNCTION__, func_get_args());
return $this->callPostApi($url, ['pages' => $pages], true);
}
}

View File

@ -31,7 +31,7 @@ try {
// 参考链接https://docs.open.alipay.com/api_1/alipay.trade.refund // 参考链接https://docs.open.alipay.com/api_1/alipay.trade.refund
$result = $pay->refund($out_trade_no, $refund_fee); $result = $pay->refund($out_trade_no, $refund_fee);
echo '<pre>'; echo '<pre>';
var_export($result); var_export($result);
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -19,10 +19,14 @@ return [
'sign_type' => "RSA2", 'sign_type' => "RSA2",
// 应用ID // 应用ID
'appid' => '2016090900468879', 'appid' => '2016090900468879',
// 支付宝公钥(1行填写特别注意这里是支付宝公钥不是应用公钥最好从开发者中心的网页上去复制) // 支付宝公钥 (1行填写特别注意这里是支付宝公钥不是应用公钥最好从开发者中心的网页上去复制)
'public_key' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtU71NY53UDGY7JNvLYAhsNa+taTF6KthIHJmGgdio9bkqeJGhHk6ttkTKkLqFgwIfgAkHpdKiOv1uZw6gVGZ7TCu5LfHTqKrCd6Uz+N7hxhY+4IwicLgprcV1flXQLmbkJYzFMZqkXGkSgOsR2yXh4LyQZczgk9N456uuzGtRy7MoB4zQy34PLUkkxR6W1B2ftNbLRGXv6tc7p/cmDcrY6K1bSxnGmfRxFSb8lRfhe0V0UM6pKq2SGGSeovrKHN0OLp+Nn5wcULVnFgATXGCENshRlp96piPEBFwneXs19n+sX1jx60FTR7/rME3sW3AHug0fhZ9mSqW4x401WjdnwIDAQAB', 'public_key' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtU71NY53UDGY7JNvLYAhsNa+taTF6KthIHJmGgdio9bkqeJGhHk6ttkTKkLqFgwIfgAkHpdKiOv1uZw6gVGZ7TCu5LfHTqKrCd6Uz+N7hxhY+4IwicLgprcV1flXQLmbkJYzFMZqkXGkSgOsR2yXh4LyQZczgk9N456uuzGtRy7MoB4zQy34PLUkkxR6W1B2ftNbLRGXv6tc7p/cmDcrY6K1bSxnGmfRxFSb8lRfhe0V0UM6pKq2SGGSeovrKHN0OLp+Nn5wcULVnFgATXGCENshRlp96piPEBFwneXs19n+sX1jx60FTR7/rME3sW3AHug0fhZ9mSqW4x401WjdnwIDAQAB',
// 支付宝私钥(1行填写) // 支付宝私钥 (1行填写)
'private_key' => 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC3pbN7esinxgjE8uxXAsccgGNKIq+PR1LteNTFOy0fsete43ObQCrzd9DO0zaUeBUzpIOnxrKxez7QoZROZMYrinttFZ/V5rbObEM9E5AR5Tv/Fr4IBywoS8ZtN16Xb+fZmibfU91yq9O2RYSvscncU2qEYmmaTenM0QlUO80ZKqPsM5JkgCNdcYZTUeHclWeyER3dSImNtlSKiSBSSTHthb11fkudjzdiUXua0NKVWyYuAOoDMcpXbD6NJmYqEA/iZ/AxtQt08pv0Mow581GPB0Uop5+qA2hCV85DpagE94a067sKcRui0rtkJzHem9k7xVL+2RoFm1fv3RnUkMwhAgMBAAECggEAAetkddzxrfc+7jgPylUIGb8pyoOUTC4Vqs/BgZI9xYAJksNT2QKRsFvHPfItNt4Ocqy8h4tnIL3GCU43C564B4p6AcjhE85GiN/O0BudPOKlfuQQ9mqExqMMHuYeQfz0cmzPDTSGMwWiv9v4KBH2pyvkCCAzNF6uG+rvawb4/NNVuiI7C8Ku/wYsamtbgjMZVOFFdScYgIw1BgA99RUU/fWBLMnTQkoyowSRb9eSmEUHjt/WQt+/QgKAT2WmuX4RhaGy0qcQLbNaJNKXdJ+PVhQrSiasINNtqYMa8GsQuuKsk3X8TCg9K6/lowivt5ruhyWcP2sx93zY/LGzIHgHcQKBgQDoZlcs9RWxTdGDdtH8kk0J/r+QtMijNzWI0a+t+ZsWOyd3rw+uM/8O4JTNP4Y98TvvxhJXewITbfiuOIbW1mxh8bnO/fcz7+RXZKgPDeoTeNo717tZFZGBEyUdH9M9Inqvht7+hjVDIMCYBDomYebdk3Xqo4mDBjLRdVNGrhGmVQKBgQDKS/MgTMK8Ktfnu1KzwCbn/FfHTOrp1a1t1wWPv9AW0rJPYeaP6lOkgIoO/1odG9qDDhdB6njqM+mKY5Yr3N94PHamHbwJUCmbkqEunCWpGzgcQZ1Q254xk9D7UKq/XUqW2WDqDq80GQeNial+fBc46yelQzokwdA+JdIFKoyinQKBgQCBems9V/rTAtkk1nFdt6EGXZEbLS3PiXXhGXo4gqV+OEzf6H/i/YMwJb2hsK+5GQrcps0XQihA7PctEb9GOMa/tu5fva0ZmaDtc94SLR1p5d4okyQFGPgtIp594HpPSEN0Qb9BrUJFeRz0VP6U3dzDPGHo7V4yyqRLgIN6EIcy1QKBgAqdh6mHPaTAHspDMyjJiYEc5cJIj/8rPkmIQft0FkhMUB0IRyAALNlyAUyeK61hW8sKvz+vPR8VEEk5xpSQp41YpuU6pDZc5YILZLfca8F+8yfQbZ/jll6Foi694efezl4yE/rUQG9cbOAJfEJt4o4TEOaEK5XoMbRBKc8pl22lAoGARTq0qOr9SStihRAy9a+8wi2WEwL4QHcmOjH7iAuJxy5b5TRDSjlk6h+0dnTItiFlTXdfpO8KhWA8EoSJVBZ1kcACQDFgMIA+VM+yXydtzMotOn21W4stfZ4I6dHFiujMsnKpNYVpQh3oCrJf4SeXiQDdiSCodqb1HlKkEc6naHQ=', 'private_key' => 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC3pbN7esinxgjE8uxXAsccgGNKIq+PR1LteNTFOy0fsete43ObQCrzd9DO0zaUeBUzpIOnxrKxez7QoZROZMYrinttFZ/V5rbObEM9E5AR5Tv/Fr4IBywoS8ZtN16Xb+fZmibfU91yq9O2RYSvscncU2qEYmmaTenM0QlUO80ZKqPsM5JkgCNdcYZTUeHclWeyER3dSImNtlSKiSBSSTHthb11fkudjzdiUXua0NKVWyYuAOoDMcpXbD6NJmYqEA/iZ/AxtQt08pv0Mow581GPB0Uop5+qA2hCV85DpagE94a067sKcRui0rtkJzHem9k7xVL+2RoFm1fv3RnUkMwhAgMBAAECggEAAetkddzxrfc+7jgPylUIGb8pyoOUTC4Vqs/BgZI9xYAJksNT2QKRsFvHPfItNt4Ocqy8h4tnIL3GCU43C564B4p6AcjhE85GiN/O0BudPOKlfuQQ9mqExqMMHuYeQfz0cmzPDTSGMwWiv9v4KBH2pyvkCCAzNF6uG+rvawb4/NNVuiI7C8Ku/wYsamtbgjMZVOFFdScYgIw1BgA99RUU/fWBLMnTQkoyowSRb9eSmEUHjt/WQt+/QgKAT2WmuX4RhaGy0qcQLbNaJNKXdJ+PVhQrSiasINNtqYMa8GsQuuKsk3X8TCg9K6/lowivt5ruhyWcP2sx93zY/LGzIHgHcQKBgQDoZlcs9RWxTdGDdtH8kk0J/r+QtMijNzWI0a+t+ZsWOyd3rw+uM/8O4JTNP4Y98TvvxhJXewITbfiuOIbW1mxh8bnO/fcz7+RXZKgPDeoTeNo717tZFZGBEyUdH9M9Inqvht7+hjVDIMCYBDomYebdk3Xqo4mDBjLRdVNGrhGmVQKBgQDKS/MgTMK8Ktfnu1KzwCbn/FfHTOrp1a1t1wWPv9AW0rJPYeaP6lOkgIoO/1odG9qDDhdB6njqM+mKY5Yr3N94PHamHbwJUCmbkqEunCWpGzgcQZ1Q254xk9D7UKq/XUqW2WDqDq80GQeNial+fBc46yelQzokwdA+JdIFKoyinQKBgQCBems9V/rTAtkk1nFdt6EGXZEbLS3PiXXhGXo4gqV+OEzf6H/i/YMwJb2hsK+5GQrcps0XQihA7PctEb9GOMa/tu5fva0ZmaDtc94SLR1p5d4okyQFGPgtIp594HpPSEN0Qb9BrUJFeRz0VP6U3dzDPGHo7V4yyqRLgIN6EIcy1QKBgAqdh6mHPaTAHspDMyjJiYEc5cJIj/8rPkmIQft0FkhMUB0IRyAALNlyAUyeK61hW8sKvz+vPR8VEEk5xpSQp41YpuU6pDZc5YILZLfca8F+8yfQbZ/jll6Foi694efezl4yE/rUQG9cbOAJfEJt4o4TEOaEK5XoMbRBKc8pl22lAoGARTq0qOr9SStihRAy9a+8wi2WEwL4QHcmOjH7iAuJxy5b5TRDSjlk6h+0dnTItiFlTXdfpO8KhWA8EoSJVBZ1kcACQDFgMIA+VM+yXydtzMotOn21W4stfZ4I6dHFiujMsnKpNYVpQh3oCrJf4SeXiQDdiSCodqb1HlKkEc6naHQ=',
// 应用公钥证书(新版资金类接口转 app_cert_sn
'app_cert' => '',
// 支付宝根证书(新版资金类接口转 alipay_root_cert_sn
'root_cert' => '',
// 支付成功通知地址 // 支付成功通知地址
'notify_url' => '', 'notify_url' => '',
// 网页支付回跳地址 // 网页支付回跳地址

View File

@ -8,7 +8,7 @@
{ {
"name": "Anyon", "name": "Anyon",
"email": "zoujingli@qq.com", "email": "zoujingli@qq.com",
"homepage": "http://ctolog.com" "homepage": "https://thinkadmin.top"
} }
], ],
"keywords": [ "keywords": [
@ -23,6 +23,7 @@
"php": ">=5.4", "php": ">=5.4",
"ext-json": "*", "ext-json": "*",
"ext-curl": "*", "ext-curl": "*",
"ext-bcmath": "*",
"ext-libxml": "*", "ext-libxml": "*",
"ext-openssl": "*", "ext-openssl": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
@ -34,8 +35,8 @@
], ],
"psr-4": { "psr-4": {
"WePay\\": "WePay", "WePay\\": "WePay",
"WeMini\\": "WeMini",
"WeChat\\": "WeChat", "WeChat\\": "WeChat",
"WeMini\\": "WeMini",
"AliPay\\": "AliPay" "AliPay\\": "AliPay"
} }
} }

View File

@ -16,7 +16,7 @@ spl_autoload_register(function ($classname) {
$pathname = __DIR__ . DIRECTORY_SEPARATOR; $pathname = __DIR__ . DIRECTORY_SEPARATOR;
$filename = str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php'; $filename = str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php';
if (file_exists($pathname . $filename)) { if (file_exists($pathname . $filename)) {
foreach (['WeChat', 'WeMini', 'AliPay', 'WePay', 'We'] as $prefix) { foreach (['AliPay', 'WeChat', 'WeMini', 'WePay', 'We'] as $prefix) {
if (stripos($classname, $prefix) === 0) { if (stripos($classname, $prefix) === 0) {
include $pathname . $filename; include $pathname . $filename;
return true; return true;