mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-05 19:41:44 +08:00
ComposerUpdate
This commit is contained in:
parent
8cd55cb49d
commit
747b3f1228
@ -187,6 +187,7 @@ class WechatService extends Service
|
||||
'appsecret' => sysconf('wechat.appsecret'),
|
||||
'encodingaeskey' => sysconf('wechat.encodingaeskey'),
|
||||
'mch_id' => sysconf('wechat.mch_id'),
|
||||
'mch_key' => sysconf('wechat.mch_key'),
|
||||
'cache_path' => $this->app->getRuntimePath() . 'wechat',
|
||||
];
|
||||
if (sysconf('wechat.mch_ssl_type') === 'p12') {
|
||||
|
@ -29,7 +29,7 @@
|
||||
"topthink/think-multi-app": "^1.0",
|
||||
"zoujingli/ip2region": "^1.0",
|
||||
"zoujingli/think-library": "6.0.*-dev",
|
||||
"zoujingli/weopen-developer": "dev-master"
|
||||
"zoujingli/wechat-developer": "^1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
60
composer.lock
generated
60
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "478fa0752e487da8e0e56bb8e664ea5b",
|
||||
"content-hash": "c55d51d2e1cb52e013e7635caf4fb45c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "endroid/qr-code",
|
||||
@ -1023,69 +1023,13 @@
|
||||
"wepay"
|
||||
],
|
||||
"time": "2019-11-25T10:40:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zoujingli/weopen-developer",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/WeOpenDeveloper.git",
|
||||
"reference": "4d0d3c064e54556621453845fc65ba52de58a880"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/WeOpenDeveloper/zipball/4d0d3c064e54556621453845fc65ba52de58a880",
|
||||
"reference": "4d0d3c064e54556621453845fc65ba52de58a880",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-openssl": "*",
|
||||
"php": ">=5.4",
|
||||
"zoujingli/wechat-developer": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WeOpen\\": "WeOpen",
|
||||
"WeChat\\": "WeChat",
|
||||
"WeMini\\": "WeMini"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anyon",
|
||||
"email": "zoujingli@qq.com",
|
||||
"homepage": "http://ctolog.com"
|
||||
}
|
||||
],
|
||||
"description": "WeChat Open development of SDK",
|
||||
"homepage": "https://github.com/zoujingli/WeOpenDeveloper",
|
||||
"keywords": [
|
||||
"WeChatOpen",
|
||||
"WeChatOpenDeveloper",
|
||||
"wechat"
|
||||
],
|
||||
"time": "2019-10-10T10:18:05+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"zoujingli/think-library": 20,
|
||||
"zoujingli/weopen-developer": 20
|
||||
"zoujingli/think-library": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitada0e677dd8f1307ba83d0cf07626e6c::getLoader();
|
||||
return ComposerAutoloaderInit2b1316f37dd8fe5c4c25969e0b842e8e::getLoader();
|
||||
|
11
vendor/composer/autoload_classmap.php
vendored
11
vendor/composer/autoload_classmap.php
vendored
@ -129,7 +129,6 @@ return array(
|
||||
'Symfony\\Component\\OptionsResolver\\Options' => $vendorDir . '/symfony/options-resolver/Options.php',
|
||||
'Symfony\\Component\\OptionsResolver\\OptionsResolver' => $vendorDir . '/symfony/options-resolver/OptionsResolver.php',
|
||||
'We' => $vendorDir . '/zoujingli/wechat-developer/We.php',
|
||||
'WeChat\\Bind' => $vendorDir . '/zoujingli/weopen-developer/WeChat/Bind.php',
|
||||
'WeChat\\Card' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Card.php',
|
||||
'WeChat\\Contracts\\BasicAliPay' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/BasicAliPay.php',
|
||||
'WeChat\\Contracts\\BasicPushEvent' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Contracts/BasicPushEvent.php',
|
||||
@ -148,7 +147,6 @@ return array(
|
||||
'WeChat\\Limit' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Limit.php',
|
||||
'WeChat\\Media' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Media.php',
|
||||
'WeChat\\Menu' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Menu.php',
|
||||
'WeChat\\Mini' => $vendorDir . '/zoujingli/weopen-developer/WeChat/Mini.php',
|
||||
'WeChat\\Oauth' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Oauth.php',
|
||||
'WeChat\\Pay' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Pay.php',
|
||||
'WeChat\\Product' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Product.php',
|
||||
@ -161,12 +159,8 @@ return array(
|
||||
'WeChat\\Template' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Template.php',
|
||||
'WeChat\\User' => $vendorDir . '/zoujingli/wechat-developer/WeChat/User.php',
|
||||
'WeChat\\Wifi' => $vendorDir . '/zoujingli/wechat-developer/WeChat/Wifi.php',
|
||||
'WeMini\\Account' => $vendorDir . '/zoujingli/weopen-developer/WeMini/Account.php',
|
||||
'WeMini\\Basic' => $vendorDir . '/zoujingli/weopen-developer/WeMini/Basic.php',
|
||||
'WeMini\\Code' => $vendorDir . '/zoujingli/weopen-developer/WeMini/Code.php',
|
||||
'WeMini\\Crypt' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Crypt.php',
|
||||
'WeMini\\Delivery' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Delivery.php',
|
||||
'WeMini\\Domain' => $vendorDir . '/zoujingli/weopen-developer/WeMini/Domain.php',
|
||||
'WeMini\\Image' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Image.php',
|
||||
'WeMini\\Logistics' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Logistics.php',
|
||||
'WeMini\\Message' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Message.php',
|
||||
@ -177,12 +171,7 @@ return array(
|
||||
'WeMini\\Security' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Security.php',
|
||||
'WeMini\\Soter' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Soter.php',
|
||||
'WeMini\\Template' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Template.php',
|
||||
'WeMini\\Tester' => $vendorDir . '/zoujingli/weopen-developer/WeMini/Tester.php',
|
||||
'WeMini\\Total' => $vendorDir . '/zoujingli/wechat-developer/WeMini/Total.php',
|
||||
'WeMini\\User' => $vendorDir . '/zoujingli/weopen-developer/WeMini/User.php',
|
||||
'WeOpen\\Login' => $vendorDir . '/zoujingli/weopen-developer/WeOpen/Login.php',
|
||||
'WeOpen\\MiniApp' => $vendorDir . '/zoujingli/weopen-developer/WeOpen/MiniApp.php',
|
||||
'WeOpen\\Service' => $vendorDir . '/zoujingli/weopen-developer/WeOpen/Service.php',
|
||||
'WePay\\Bill' => $vendorDir . '/zoujingli/wechat-developer/WePay/Bill.php',
|
||||
'WePay\\Coupon' => $vendorDir . '/zoujingli/wechat-developer/WePay/Coupon.php',
|
||||
'WePay\\Order' => $vendorDir . '/zoujingli/wechat-developer/WePay/Order.php',
|
||||
|
5
vendor/composer/autoload_psr4.php
vendored
5
vendor/composer/autoload_psr4.php
vendored
@ -12,9 +12,8 @@ return array(
|
||||
'think\\' => array($vendorDir . '/topthink/framework/src/think', $vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src', $vendorDir . '/topthink/think-template/src'),
|
||||
'app\\' => array($baseDir . '/app'),
|
||||
'WePay\\' => array($vendorDir . '/zoujingli/wechat-developer/WePay'),
|
||||
'WeOpen\\' => array($vendorDir . '/zoujingli/weopen-developer/WeOpen'),
|
||||
'WeMini\\' => array($vendorDir . '/zoujingli/wechat-developer/WeMini', $vendorDir . '/zoujingli/weopen-developer/WeMini'),
|
||||
'WeChat\\' => array($vendorDir . '/zoujingli/wechat-developer/WeChat', $vendorDir . '/zoujingli/weopen-developer/WeChat'),
|
||||
'WeMini\\' => array($vendorDir . '/zoujingli/wechat-developer/WeMini'),
|
||||
'WeChat\\' => array($vendorDir . '/zoujingli/wechat-developer/WeChat'),
|
||||
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
|
||||
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
|
||||
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
class ComposerAutoloaderInit2b1316f37dd8fe5c4c25969e0b842e8e
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -19,15 +19,15 @@ class ComposerAutoloaderInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitada0e677dd8f1307ba83d0cf07626e6c', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2b1316f37dd8fe5c4c25969e0b842e8e', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitada0e677dd8f1307ba83d0cf07626e6c', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2b1316f37dd8fe5c4c25969e0b842e8e', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2b1316f37dd8fe5c4c25969e0b842e8e::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
@ -48,19 +48,19 @@ class ComposerAutoloaderInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit2b1316f37dd8fe5c4c25969e0b842e8e::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireada0e677dd8f1307ba83d0cf07626e6c($fileIdentifier, $file);
|
||||
composerRequire2b1316f37dd8fe5c4c25969e0b842e8e($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequireada0e677dd8f1307ba83d0cf07626e6c($fileIdentifier, $file)
|
||||
function composerRequire2b1316f37dd8fe5c4c25969e0b842e8e($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
26
vendor/composer/autoload_static.php
vendored
26
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
class ComposerStaticInit2b1316f37dd8fe5c4c25969e0b842e8e
|
||||
{
|
||||
public static $files = array (
|
||||
'9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php',
|
||||
@ -27,7 +27,6 @@ class ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
'W' =>
|
||||
array (
|
||||
'WePay\\' => 6,
|
||||
'WeOpen\\' => 7,
|
||||
'WeMini\\' => 7,
|
||||
'WeChat\\' => 7,
|
||||
),
|
||||
@ -89,19 +88,13 @@ class ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay',
|
||||
),
|
||||
'WeOpen\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeOpen',
|
||||
),
|
||||
'WeMini\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini',
|
||||
1 => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini',
|
||||
),
|
||||
'WeChat\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat',
|
||||
1 => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeChat',
|
||||
),
|
||||
'Symfony\\Component\\OptionsResolver\\' =>
|
||||
array (
|
||||
@ -269,7 +262,6 @@ class ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
'Symfony\\Component\\OptionsResolver\\Options' => __DIR__ . '/..' . '/symfony/options-resolver/Options.php',
|
||||
'Symfony\\Component\\OptionsResolver\\OptionsResolver' => __DIR__ . '/..' . '/symfony/options-resolver/OptionsResolver.php',
|
||||
'We' => __DIR__ . '/..' . '/zoujingli/wechat-developer/We.php',
|
||||
'WeChat\\Bind' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeChat/Bind.php',
|
||||
'WeChat\\Card' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Card.php',
|
||||
'WeChat\\Contracts\\BasicAliPay' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/BasicAliPay.php',
|
||||
'WeChat\\Contracts\\BasicPushEvent' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Contracts/BasicPushEvent.php',
|
||||
@ -288,7 +280,6 @@ class ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
'WeChat\\Limit' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Limit.php',
|
||||
'WeChat\\Media' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Media.php',
|
||||
'WeChat\\Menu' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Menu.php',
|
||||
'WeChat\\Mini' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeChat/Mini.php',
|
||||
'WeChat\\Oauth' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Oauth.php',
|
||||
'WeChat\\Pay' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Pay.php',
|
||||
'WeChat\\Product' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Product.php',
|
||||
@ -301,12 +292,8 @@ class ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
'WeChat\\Template' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Template.php',
|
||||
'WeChat\\User' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/User.php',
|
||||
'WeChat\\Wifi' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeChat/Wifi.php',
|
||||
'WeMini\\Account' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini/Account.php',
|
||||
'WeMini\\Basic' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini/Basic.php',
|
||||
'WeMini\\Code' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini/Code.php',
|
||||
'WeMini\\Crypt' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Crypt.php',
|
||||
'WeMini\\Delivery' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Delivery.php',
|
||||
'WeMini\\Domain' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini/Domain.php',
|
||||
'WeMini\\Image' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Image.php',
|
||||
'WeMini\\Logistics' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Logistics.php',
|
||||
'WeMini\\Message' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Message.php',
|
||||
@ -317,12 +304,7 @@ class ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
'WeMini\\Security' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Security.php',
|
||||
'WeMini\\Soter' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Soter.php',
|
||||
'WeMini\\Template' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Template.php',
|
||||
'WeMini\\Tester' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini/Tester.php',
|
||||
'WeMini\\Total' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WeMini/Total.php',
|
||||
'WeMini\\User' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeMini/User.php',
|
||||
'WeOpen\\Login' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeOpen/Login.php',
|
||||
'WeOpen\\MiniApp' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeOpen/MiniApp.php',
|
||||
'WeOpen\\Service' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeOpen/Service.php',
|
||||
'WePay\\Bill' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Bill.php',
|
||||
'WePay\\Coupon' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Coupon.php',
|
||||
'WePay\\Order' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Order.php',
|
||||
@ -634,9 +616,9 @@ class ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitada0e677dd8f1307ba83d0cf07626e6c::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2b1316f37dd8fe5c4c25969e0b842e8e::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2b1316f37dd8fe5c4c25969e0b842e8e::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2b1316f37dd8fe5c4c25969e0b842e8e::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
57
vendor/composer/installed.json
vendored
57
vendor/composer/installed.json
vendored
@ -1052,62 +1052,5 @@
|
||||
"wechatpay",
|
||||
"wepay"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "zoujingli/weopen-developer",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/WeOpenDeveloper.git",
|
||||
"reference": "4d0d3c064e54556621453845fc65ba52de58a880"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/WeOpenDeveloper/zipball/4d0d3c064e54556621453845fc65ba52de58a880",
|
||||
"reference": "4d0d3c064e54556621453845fc65ba52de58a880",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-openssl": "*",
|
||||
"php": ">=5.4",
|
||||
"zoujingli/wechat-developer": "^1.0"
|
||||
},
|
||||
"time": "2019-10-10T10:18:05+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WeOpen\\": "WeOpen",
|
||||
"WeChat\\": "WeChat",
|
||||
"WeMini\\": "WeMini"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anyon",
|
||||
"email": "zoujingli@qq.com",
|
||||
"homepage": "http://ctolog.com"
|
||||
}
|
||||
],
|
||||
"description": "WeChat Open development of SDK",
|
||||
"homepage": "https://github.com/zoujingli/WeOpenDeveloper",
|
||||
"keywords": [
|
||||
"WeChatOpen",
|
||||
"WeChatOpenDeveloper",
|
||||
"wechat"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2019-12-24 17:22:31
|
||||
// This file is automatically generated at:2019-12-24 18:19:07
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\app\\Service',
|
||||
|
4
vendor/zoujingli/weopen-developer/.gitignore
vendored
4
vendor/zoujingli/weopen-developer/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
.git
|
||||
.idea
|
||||
vendor
|
||||
composer.lock
|
21
vendor/zoujingli/weopen-developer/LICENSE
vendored
21
vendor/zoujingli/weopen-developer/LICENSE
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 邹景立
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
127
vendor/zoujingli/weopen-developer/README.md
vendored
127
vendor/zoujingli/weopen-developer/README.md
vendored
@ -1,127 +0,0 @@
|
||||
[](https://packagist.org/packages/zoujingli/weopen-developer)
|
||||
[](https://packagist.org/packages/zoujingli/weopen-developer)
|
||||
[](https://packagist.org/packages/zoujingli/weopen-developer)
|
||||
[](https://packagist.org/packages/zoujingli/weopen-developer)
|
||||
|
||||
# WeOpenDeveloper
|
||||
WeOpenDeveloper 为微信开放平台服务开发工具,基于 WeChatDeveloper 可对公众号进行管理。
|
||||
更多功能可以参考下面的文档。
|
||||
|
||||
Documentation
|
||||
--
|
||||
PHP开发技术交流(QQ群 513350915)
|
||||
|
||||
[](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a)
|
||||
|
||||
> WeChatDeveloper 是基于官方接口封装,在做微信开发前,必需先阅读微信官方文档。
|
||||
>* 微信官方文档:http://mp.weixin.qq.com/wiki
|
||||
>* 开放平台文档:https://open.weixin.qq.com
|
||||
>* 商户支付文档:https://pay.weixin.qq.com/wiki/doc/api/index.html
|
||||
|
||||
> 针对 WeChatDeveloper 也有一准备了帮助资料可供参考。
|
||||
>* WeChatDeveloper 文档:http://www.kancloud.cn/zoujingli/wechat-developer
|
||||
|
||||
Repository
|
||||
--
|
||||
WeOpenDeveloper 为开源项目,允许把它用于任何地方,不受任何约束,欢迎 fork 项目。
|
||||
>* GitHub 托管地址:https://github.com/zoujingli/WeOpenDeveloper
|
||||
>* OSChina 托管地址:http://git.oschina.net/zoujingli/WeOpenDeveloper
|
||||
|
||||
更多开发可以参考项目 [ThinkService](https://github.com/zoujingli/ThinkService) 。
|
||||
此项目已经实现对接,[ThinkAdmin](https://github.com/zoujingli/ThinkAdmin) + [ThinkService](https://github.com/zoujingli/ThinkService) 组合。
|
||||
|
||||
Install
|
||||
--
|
||||
* 通过 Composer 来管理安装
|
||||
```shell
|
||||
# 首次安装 线上版本(稳定)
|
||||
composer require zoujingli/weopen-developer
|
||||
|
||||
# 首次安装 开发版本
|
||||
composer require zoujingli/weopen-developer dev-master
|
||||
|
||||
# 更新 WeChatDeveloper
|
||||
composer update zoujingli/weopen-developer
|
||||
```
|
||||
|
||||
* 接口实例所需参数
|
||||
```php
|
||||
|
||||
// 配置参数(可以公众号服务平台获取)
|
||||
$config = [
|
||||
'component_appid' => 'wx4e63e993e222df8d',
|
||||
'component_token' => 'P8QHTIxpBEq88IrxatqhgpBm2OAQROkI',
|
||||
'component_appsecret' => '7cfa1afa87a41e2ea3445cea015c0974',
|
||||
'component_encodingaeskey' => 'L5uFIa0U6KLalPyXckyqoVIJYLhsfrg8k9YzybZIHsx',
|
||||
];
|
||||
|
||||
// 注册授权公众号 AccessToken 处理
|
||||
$config['GetAccessTokenCallback'] = function ($authorizer_appid) use ($config) {
|
||||
$open = new \WeOpen\Service($config);
|
||||
$authorizer_refresh_token = ''; // 通过$authorizer_appid从数据库去找吧,在授权绑定的时候获取
|
||||
$result = $open->refreshAccessToken($authorizer_appid, $authorizer_refresh_token);
|
||||
if (empty($result['authorizer_access_token'])) {
|
||||
throw new \WeChat\Exceptions\InvalidResponseException($result['errmsg'], '0');
|
||||
}
|
||||
$data = [
|
||||
'authorizer_access_token' => $result['authorizer_access_token'],
|
||||
'authorizer_refresh_token' => $result['authorizer_refresh_token'],
|
||||
];
|
||||
// 需要把$data记录到数据库
|
||||
return $result['authorizer_access_token'];
|
||||
};
|
||||
```
|
||||
|
||||
* Ticket 接收处理
|
||||
```php
|
||||
|
||||
try{
|
||||
|
||||
// 实例公众号服务接口
|
||||
$server = new \WeOpen\Service($config);
|
||||
|
||||
// 获取并更新Ticket推送
|
||||
if (!($data = $server->getComonentTicket())) {
|
||||
return "Ticket event handling failed.";
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
// 出错啦,处理下吧
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
* 实例指定接口
|
||||
```php
|
||||
try{
|
||||
|
||||
// 实例公众号服务接口
|
||||
$open = new \WeOpen\Service($config);
|
||||
|
||||
// 获取公众号接口操作实例
|
||||
$wechat = $open->instance('User', 'wx60a43dd8161666d4');
|
||||
|
||||
// 获取公众号粉丝列表
|
||||
$list = $wechat->getUserList();
|
||||
var_export($list);
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
// 出错啦,处理下吧
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Copyright
|
||||
--
|
||||
* WeOpenDeveloper 基于`MIT`协议发布,任何人可以用在任何地方,不受约束
|
||||
* WeOpenDeveloper 部分代码来自互联网,若有异议,可以联系作者进行删除
|
||||
|
||||
|
||||
Sponsor
|
||||
--
|
||||

|
@ -1,80 +0,0 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: http://think.ctolog.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zoujingli/WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace WeChat;
|
||||
|
||||
use WeChat\Contracts\BasicWeChat;
|
||||
|
||||
/**
|
||||
* 微信开放平台帐号管理
|
||||
* Class Bind
|
||||
* @package WeChat
|
||||
*/
|
||||
class Bind extends BasicWeChat
|
||||
{
|
||||
/**
|
||||
* 创建开放平台帐号并绑定公众号
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/open/create?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $this->config->get('appid')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将公众号绑定到开放平台帐号下
|
||||
* @param string $openidAppid 开放平台帐号APPID
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function link($openidAppid)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/open/bind?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $this->config->get('appid'), 'open_appid' => $openidAppid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将公众号从开放平台帐号下解绑
|
||||
* @param string $openidAppid 开放平台帐号APPID
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function unlink($openidAppid)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/open/unbind?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $this->config->get('appid'), 'open_appid' => $openidAppid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公众号所绑定的开放平台帐号
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/open/get?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $this->config->get('appid')]);
|
||||
}
|
||||
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: http://think.ctolog.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zoujingli/WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace WeChat;
|
||||
|
||||
use WeChat\Contracts\BasicWeChat;
|
||||
|
||||
/**
|
||||
* 小程序管理权限集
|
||||
* Class Mini
|
||||
* @package WeChat
|
||||
*/
|
||||
class Mini extends BasicWeChat
|
||||
{
|
||||
/**
|
||||
* 1. 获取公众号关联的小程序
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getLinkWxamp()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/wxamplinkget?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, [], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 关联小程序
|
||||
* @param string $miniAppid 小程序appid
|
||||
* @param integer $notifyUsers 是否发送模板消息通知公众号粉丝
|
||||
* @param integer $showProfile 是否展示公众号主页中
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function linkWxamp($miniAppid, $notifyUsers = 1, $showProfile = 1)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/wxopen/wxamplink?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, [
|
||||
'appid' => $miniAppid,
|
||||
'notify_users' => $notifyUsers,
|
||||
'show_profile' => $showProfile,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.解除已关联的小程序
|
||||
* @param string $miniAppid 小程序appid
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function unlinkWxamp($miniAppid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/wxopen/wxampunlink?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $miniAppid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方平台调用快速注册API完成注册
|
||||
* @param string $ticket 公众号扫码授权的凭证(公众平台扫码页面回跳到第三方平台时携带)
|
||||
* @return array
|
||||
* @throws Exceptions\InvalidResponseException
|
||||
* @throws Exceptions\LocalCacheException
|
||||
*/
|
||||
public function fastRegister($ticket)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/account/fastregister?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['ticket' => $ticket]);
|
||||
}
|
||||
|
||||
}
|
198
vendor/zoujingli/weopen-developer/WeMini/Account.php
vendored
198
vendor/zoujingli/weopen-developer/WeMini/Account.php
vendored
@ -1,198 +0,0 @@
|
||||
<?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 Account
|
||||
* @package WeMini
|
||||
*/
|
||||
class Account extends BasicWeChat
|
||||
{
|
||||
/**
|
||||
* 2.1 获取帐号基本信息
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAccountBasicinfo()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/account/getaccountbasicinfo?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.2 小程序名称设置及改名
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function setNickname(array $data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/setnickname?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.3 小程序改名审核状态查询
|
||||
* @param integer $audit_id 审核单id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function queryChangeNicknameAuditStatus($audit_id)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/wxa/api_wxa_querynickname?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['audit_id' => $audit_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 2.4 微信认证名称检测
|
||||
* @param string $nickname 微信认证名称
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function checkWxVerifyNickname($nickname)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/wxa/api_wxa_querynickname?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['nick_name' => $nickname]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.5 修改头像
|
||||
* @param string $headImgMediaId 头像素材media_id
|
||||
* @param integer $x1 裁剪框左上角x坐标(取值范围:[0, 1])
|
||||
* @param integer $y1 裁剪框左上角y坐标(取值范围:[0, 1])
|
||||
* @param integer $x2 裁剪框右下角x坐标(取值范围:[0, 1])
|
||||
* @param integer $y2 裁剪框右下角y坐标(取值范围:[0, 1])
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function modifyHeadImage($headImgMediaId, $x1 = 0, $y1 = 0, $x2 = 1, $y2 = 1)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/account/modifyheadimage?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['head_img_media_id' => $headImgMediaId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.6 修改功能介绍
|
||||
* @param string $signature 功能介绍(简介)
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException]
|
||||
*/
|
||||
public function modifySignature($signature)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/account/modifysignature?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['signature' => $signature]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.7.3跳转至第三方平台,第三方平台调用快速注册API完成管理员换绑。
|
||||
* @param string $taskid 换绑管理员任务序列号(公众平台最终点击提交回跳到第三方平台时携带)
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function componentreBindAdmin($taskid)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi- bin/account/componentrebindadmin?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['taskid' => $taskid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1 获取账号可以设置的所有类目
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAllCategories()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/getallcategories?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.2 添加类目
|
||||
* @param array $categories
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function addCategory($categories)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/addcategory?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['categories' => $categories]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.3 删除类目
|
||||
* @param string $first 一级类目ID
|
||||
* @param string $second 二级类目ID
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function delCategroy($first, $second)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/deletecategory?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['first' => $first, 'second' => $second]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.4 获取账号已经设置的所有类目
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/getcategory?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.5 修改类目
|
||||
* @param string $first 一级类目ID
|
||||
* @param string $second 二级类目ID
|
||||
* @param array $certicates
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function modifyCategory($first, $second, $certicates)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/modifycategory?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['first' => $first, 'second' => $second, 'categories' => $categories]);
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
<?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 Basic
|
||||
* @package WeOpen\MiniApp
|
||||
*/
|
||||
class Basic extends BasicWeChat
|
||||
{
|
||||
|
||||
/**
|
||||
* 1. 设置小程序隐私设置(是否可被搜索)
|
||||
* @param integer $status 1表示不可搜索,0表示可搜索
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function changeWxaSearchStatus($status)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/changewxasearchstatus?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['status' => $status], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 查询小程序当前隐私设置(是否可被搜索)
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getWxaSearchStatus()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/getwxasearchstatus?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
}
|
346
vendor/zoujingli/weopen-developer/WeMini/Code.php
vendored
346
vendor/zoujingli/weopen-developer/WeMini/Code.php
vendored
@ -1,346 +0,0 @@
|
||||
<?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;
|
||||
use WeChat\Contracts\Tools;
|
||||
|
||||
/**
|
||||
* 代码管理
|
||||
* Class Tester
|
||||
* @package WeOpen\MiniApp
|
||||
*/
|
||||
class Code extends BasicWeChat
|
||||
{
|
||||
|
||||
/**
|
||||
* 1. 为授权的小程序帐号上传小程序代码
|
||||
* @param string $templateId 代码库中的代码模版ID
|
||||
* @param string $extJson 第三方自定义的配置
|
||||
* @param string $userVersion 代码版本号,开发者可自定义
|
||||
* @param string $userDesc 代码描述,开发者可自定义
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function commit($templateId, $extJson, $userVersion, $userDesc)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/commit?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
$data = [
|
||||
'template_id' => $templateId,
|
||||
'ext_json' => $extJson,
|
||||
'user_version' => $userVersion,
|
||||
'user_desc' => $userDesc,
|
||||
];
|
||||
return $this->httpPostForJson($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 获取体验小程序的体验二维码
|
||||
* @param null|string $path 指定体验版二维码跳转到某个具体页面
|
||||
* @param null|string $outType 指定输出类型
|
||||
* @return array|bool|string
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getQrcode($path = null, $outType = null)
|
||||
{
|
||||
$pathStr = is_null($path) ? '' : ("&path=" . urlencode($path));
|
||||
$url = "https://api.weixin.qq.com/wxa/get_qrcode?access_token=ACCESS_TOKEN{$pathStr}";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
$result = Tools::get($url);
|
||||
if (json_decode($result)) {
|
||||
return Tools::json2arr($result);
|
||||
}
|
||||
return is_null($outType) ? $result : $outType($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 获取授权小程序帐号的可选类目
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/get_category?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 获取小程序的第三方提交代码的页面配置(仅供第三方开发者代小程序调用)
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getPage()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/get_page?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 将第三方提交的代码包提交审核(仅供第三方开发者代小程序调用)
|
||||
* @param array $itemList 提交审核项的一个列表
|
||||
* @param string $feedbackInfo 反馈内容不超过200字
|
||||
* @param string $feedbackStuff 图片 media_id 列表
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function submitAudit(array $itemList, $feedbackInfo = '', $feedbackStuff = '')
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/submit_audit?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['item_list' => $itemList, 'feedback_info' => '', 'feedback_stuff' => $feedbackStuff], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 6. 获取审核结果
|
||||
* @return array
|
||||
*/
|
||||
public function getNotify()
|
||||
{
|
||||
return Tools::xml2arr(file_get_contents('php://input'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 7. 查询某个指定版本的审核状态(仅供第三方代小程序调用)
|
||||
* @param string $auditid 提交审核时获得的审核id
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAuditstatus($auditid)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/get_auditstatus?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['auditid' => $auditid], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 8、查询最新一次提交的审核状态(仅供第三方代小程序调用)
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getLatestAuditatus()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/get_latest_auditstatus?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 9、发布已通过审核的小程序(仅供第三方代小程序调用)
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function publishRelease()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/release?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, [], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 10、修改小程序线上代码的可见状态(仅供第三方代小程序调用)
|
||||
* @param string $action 设置可访问状态,发布后默认可访问,close为不可见,open为可见
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function changeVisitStatus($action)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/change_visitstatus?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['action' => $action], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 11. 小程序版本回退(仅供第三方代小程序调用)
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function revertCodeRelease()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/revertcoderelease?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 12. 查询当前设置的最低基础库版本及各版本用户占比 (仅供第三方代小程序调用)
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getWeappSupportVersion()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/getweappsupportversion?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, []);
|
||||
}
|
||||
|
||||
/**
|
||||
* 13. 设置最低基础库版本(仅供第三方代小程序调用)
|
||||
* @param string $version 版本
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function setWeappSupportVersion($version)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/setweappsupportversion?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['version' => $version]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 14. 设置小程序“扫普通链接二维码打开小程序”能力
|
||||
* (1) 增加或修改二维码规则
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function addQrcodeJump(array $data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpadd?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 14. 设置小程序“扫普通链接二维码打开小程序”能力
|
||||
* (2) 获取已设置的二维码规则
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getQrcodeJump(array $data)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpget?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 14. 设置小程序“扫普通链接二维码打开小程序”能力
|
||||
* (3)获取校验文件名称及内容
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function downloadQrcodeJump()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpdownload?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, []);
|
||||
}
|
||||
|
||||
/**
|
||||
* 14. 设置小程序“扫普通链接二维码打开小程序”能力
|
||||
* (4)删除已设置的二维码规则
|
||||
* @param string $prefix 二维码规则
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function deleteQrcodeJump($prefix)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpdelete?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['prefix' => $prefix]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 14. 设置小程序“扫普通链接二维码打开小程序”能力
|
||||
* (5)发布已设置的二维码规则
|
||||
* @param string $prefix 二维码规则
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function publishQrcodeJump($prefix)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumppublish?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['prefix' => $prefix]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 16. 小程序审核撤回
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function undoCodeAudit()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/undocodeaudit?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 17.小程序分阶段发布
|
||||
* (1)分阶段发布接口
|
||||
* @param integer $gray_percentage 灰度的百分比,1到100的整数
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function grayRelease($gray_percentage)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/grayrelease?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['gray_percentage' => $gray_percentage]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 17.小程序分阶段发布
|
||||
* (2)取消分阶段发布
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function revertGrayRelease()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/revertgrayrelease?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 17.小程序分阶段发布
|
||||
* (3)查询当前分阶段发布详情
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getGrayreLeasePlan()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/getgrayreleaseplan?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
<?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 Domain
|
||||
* @package WeOpen\MiniApp
|
||||
*/
|
||||
class Domain extends BasicWeChat
|
||||
{
|
||||
|
||||
/**
|
||||
* 1、设置小程序服务器域名
|
||||
* @param string $action add添加,delete删除,set覆盖,get获取。当参数是get时不需要填四个域名字段
|
||||
* @param array $data 需要的参数的数据
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function modifyDomain($action, $data = [])
|
||||
{
|
||||
$data['action'] = $action;
|
||||
$url = 'https://api.weixin.qq.com/wxa/modify_domain?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, $data, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2、设置小程序业务域名(仅供第三方代小程序调用)
|
||||
* @param string $action add添加, delete删除, set覆盖, get获取。
|
||||
* 当参数是get时不需要填webviewdomain字段。
|
||||
* 如果没有action字段参数,则默认见开放平台第三方登记的小程序业务域名全部添加到授权的小程序中
|
||||
* @param string $webviewdomain 小程序业务域名,当action参数是get时不需要此字段
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function setWebViewDomain($action, $webviewdomain)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/setwebviewdomain?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['action' => $action, 'webviewdomain' => $webviewdomain], true);
|
||||
}
|
||||
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
<?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 Tester
|
||||
* @package WeOpen\MiniApp
|
||||
*/
|
||||
class Tester extends BasicWeChat
|
||||
{
|
||||
|
||||
/**
|
||||
* 1、绑定微信用户为小程序体验者
|
||||
* @param string $testid 微信号
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function bindTester($testid)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/bind_tester?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['wechatid' => $testid], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2、解除绑定小程序的体验者
|
||||
* @param string $testid 微信号
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function unbindTester($testid)
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/unbind_tester?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['wechatid' => $testid], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 获取体验者列表
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getTesterList()
|
||||
{
|
||||
$url = 'https://api.weixin.qq.com/wxa/memberauth?access_token=ACCESS_TOKEN';
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['action' => 'get_experiencer'], true);
|
||||
}
|
||||
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?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 Template
|
||||
* @package WeOpen\MiniApp
|
||||
*/
|
||||
class User extends BasicWeChat
|
||||
{
|
||||
/**
|
||||
* 1. 创建开放平台帐号并绑定公众号/小程序
|
||||
* @param string $appid 授权公众号或小程序的 appid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function create($appid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/open/create?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $appid], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 将公众号/小程序绑定到开放平台帐号下
|
||||
* @param string $appid 授权公众号或小程序的appid
|
||||
* @param string $openAppid 开放平台帐号appid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function bind($appid, $openAppid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/open/bind?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $appid, 'open_appid' => $openAppid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 将公众号/小程序从开放平台帐号下解绑
|
||||
* @param string $appid 授权公众号或小程序的appid
|
||||
* @param string $openAppid 开放平台帐号appid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function unbind($appid, $openAppid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/open/unbind?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $appid, 'open_appid' => $openAppid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 获取公众号/小程序所绑定的开放平台帐号
|
||||
* @param string $appid 授权公众号或小程序的appid
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function get($appid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/open/get?access_token=ACCESS_TOKEN";
|
||||
$this->registerApi($url, __FUNCTION__, func_get_args());
|
||||
return $this->httpPostForJson($url, ['appid' => $appid]);
|
||||
}
|
||||
}
|
114
vendor/zoujingli/weopen-developer/WeOpen/Login.php
vendored
114
vendor/zoujingli/weopen-developer/WeOpen/Login.php
vendored
@ -1,114 +0,0 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: http://think.ctolog.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zoujingli/WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace WeOpen;
|
||||
|
||||
use WeChat\Contracts\DataArray;
|
||||
use WeChat\Contracts\Tools;
|
||||
use WeChat\Exceptions\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* 网站应用微信登录
|
||||
* Class Login
|
||||
* @package WeOpen
|
||||
*/
|
||||
class Login
|
||||
{
|
||||
/**
|
||||
* 当前配置对象
|
||||
* @var DataArray
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Login constructor.
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $options)
|
||||
{
|
||||
$this->config = new DataArray($options);
|
||||
if (empty($options['appid'])) {
|
||||
throw new InvalidArgumentException("Missing Config -- [appid]");
|
||||
}
|
||||
if (empty($options['appsecret'])) {
|
||||
throw new InvalidArgumentException("Missing Config -- [appsecret]");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 第一步:请求CODE
|
||||
* @param string $redirectUri 请使用urlEncode对链接进行处理
|
||||
* @return string
|
||||
*/
|
||||
public function auth($redirectUri)
|
||||
{
|
||||
$appid = $this->config->get('appid');
|
||||
$redirectUri = urlencode($redirectUri);
|
||||
return "https://open.weixin.qq.com/connect/qrconnect?appid={$appid}&redirect_uri={$redirectUri}&response_type=code&scope=snsapi_login&state={$appid}#wechat_redirect";
|
||||
}
|
||||
|
||||
/**
|
||||
* 第二步:通过code获取access_token
|
||||
* @return mixed
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAccessToken()
|
||||
{
|
||||
$appid = $this->config->get('appid');
|
||||
$secret = $this->config->get('appsecret');
|
||||
$code = isset($_GET['code']) ? $_GET['code'] : '';
|
||||
$url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$appid}&secret={$secret}&code={$code}&grant_type=authorization_code";
|
||||
return json_decode(Tools::get($url));
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新AccessToken有效期
|
||||
* @param string $refreshToken
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function refreshToken($refreshToken)
|
||||
{
|
||||
$appid = $this->config->get('appid');
|
||||
$url = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={$appid}&grant_type=refresh_token&refresh_token={$refreshToken}";
|
||||
return json_decode(Tools::get($url));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验授权凭证(access_token)是否有效
|
||||
* @param string $accessToken 调用凭证
|
||||
* @param string $openid 普通用户的标识,对当前开发者帐号唯一
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function checkAccessToken($accessToken, $openid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/sns/auth?access_token={$accessToken}&openid={$openid}";
|
||||
return json_decode(Tools::get($url));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户个人信息(UnionID机制)
|
||||
* @param string $accessToken 调用凭证
|
||||
* @param string $openid 普通用户的标识,对当前开发者帐号唯一
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getUserinfo($accessToken, $openid)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/sns/userinfo?access_token={$accessToken}&openid={$openid}";
|
||||
return json_decode(Tools::get($url));
|
||||
}
|
||||
|
||||
}
|
125
vendor/zoujingli/weopen-developer/WeOpen/MiniApp.php
vendored
125
vendor/zoujingli/weopen-developer/WeOpen/MiniApp.php
vendored
@ -1,125 +0,0 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: http://think.ctolog.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zoujingli/WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace WeOpen;
|
||||
|
||||
use WeChat\Contracts\Tools;
|
||||
|
||||
/**
|
||||
* 公众号小程序授权支持
|
||||
* Class MiniApp
|
||||
* @package WeOpen
|
||||
*/
|
||||
class MiniApp extends Service
|
||||
{
|
||||
|
||||
/**
|
||||
* code换取session_key
|
||||
* @param string $appid 小程序的AppID
|
||||
* @param string $code 登录时获取的code
|
||||
* @return mixed
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function session($appid, $code)
|
||||
{
|
||||
$component_appid = $this->config->get('component_appid');
|
||||
$component_access_token = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/sns/component/jscode2session?appid={$appid}&js_code={$code}&grant_type=authorization_code&component_appid={$component_appid}&component_access_token={$component_access_token}";
|
||||
return json_decode(Tools::get($url), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1.注册流程及接口说明
|
||||
* @param string $authorizerAppid 公众号的appid
|
||||
* @param integer $copyWxVerify 是否复用公众号的资质进行微信认证(1:申请复用资质进行微信 认证 0:不申请)
|
||||
* @param string $redirectUri 用户扫码授权后,MP 扫码页面将跳转到该地址(注:1.链接需 urlencode 2.Host 需和第三方平台在微信开放平台上面填写的登 录授权的发起页域名一致)
|
||||
* @return string
|
||||
*/
|
||||
public function getCopyRegisterMiniUrl($authorizerAppid, $copyWxVerify, $redirectUri)
|
||||
{
|
||||
$redirectUri = urlencode($redirectUri);
|
||||
$componentAppid = $this->config->get('component_appid');
|
||||
return "https://mp.weixin.qq.com/cgi-bin/fastregisterauth?appid={$authorizerAppid}&component_appid={$componentAppid}©_wx_verify={$copyWxVerify}&redirect_uri={$redirectUri}";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 2.7.1 从第三方平台跳转至微信公众平台授权注册页面
|
||||
* @param string $authorizerAppid 公众号的 appid
|
||||
* @param string $redirectUri 新管理员信息填写完成点击提交后,将跳转到该地址
|
||||
* @return string
|
||||
*/
|
||||
public function getComponentreBindAdmin($authorizerAppid, $redirectUri)
|
||||
{
|
||||
$redirectUri = urlencode($redirectUri);
|
||||
$componentAppid = $this->config->get('component_appid');
|
||||
return "https://mp.weixin.qq.com/wxopen/componentrebindadmin?appid={$authorizerAppid}&component_appid={$componentAppid}&redirect_uri={$redirectUri}";
|
||||
}
|
||||
|
||||
/**
|
||||
* 1、获取草稿箱内的所有临时代码草稿
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getTemplateDraftList()
|
||||
{
|
||||
$component_access_token = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/wxa/gettemplatedraftlist?access_token={$component_access_token}";
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2、获取代码模版库中的所有小程序代码模版
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getTemplateList()
|
||||
{
|
||||
$component_access_token = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/wxa/gettemplatelist?access_token={$component_access_token}";
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3、将草稿箱的草稿选为小程序代码模版
|
||||
* @param integer $draft_id 草稿ID,本字段可通过“ 获取草稿箱内的所有临时代码草稿 ”接口获得
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function addToTemplate($draft_id)
|
||||
{
|
||||
$component_access_token = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/wxa/addtotemplate?access_token={$component_access_token}";
|
||||
return $this->httpPostForJson($url, ['draft_id' => $draft_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4、删除指定小程序代码模版
|
||||
* @param integer $template_id 要删除的模版ID
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function deleteTemplate($template_id)
|
||||
{
|
||||
$component_access_token = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/wxa/deletetemplate?access_token={$component_access_token}";
|
||||
return $this->httpPostForJson($url, ['template_id' => $template_id]);
|
||||
}
|
||||
|
||||
}
|
396
vendor/zoujingli/weopen-developer/WeOpen/Service.php
vendored
396
vendor/zoujingli/weopen-developer/WeOpen/Service.php
vendored
@ -1,396 +0,0 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: http://think.ctolog.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zoujingli/WeChatDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace WeOpen;
|
||||
|
||||
use WeChat\Contracts\DataArray;
|
||||
use WeChat\Contracts\Tools;
|
||||
use WeChat\Exceptions\InvalidArgumentException;
|
||||
use WeChat\Exceptions\InvalidResponseException;
|
||||
use WeChat\Receive;
|
||||
|
||||
/**
|
||||
* 第三方平台支持
|
||||
* Class Service
|
||||
* @package WeOpen
|
||||
*/
|
||||
class Service
|
||||
{
|
||||
/**
|
||||
* 当前配置对象
|
||||
* @var DataArray
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Service constructor.
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(array $options)
|
||||
{
|
||||
if (empty($options['component_token'])) {
|
||||
throw new InvalidArgumentException("Missing Config -- [component_token]");
|
||||
}
|
||||
if (empty($options['component_appid'])) {
|
||||
throw new InvalidArgumentException("Missing Config -- [component_appid]");
|
||||
}
|
||||
if (empty($options['component_appsecret'])) {
|
||||
throw new InvalidArgumentException("Missing Config -- [component_appsecret]");
|
||||
}
|
||||
if (empty($options['component_encodingaeskey'])) {
|
||||
throw new InvalidArgumentException("Missing Config -- [component_encodingaeskey]");
|
||||
}
|
||||
if (!empty($options['cache_path'])) {
|
||||
Tools::$cache_path = $options['cache_path'];
|
||||
}
|
||||
$this->config = new DataArray($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收公众平台推送的 Ticket
|
||||
* @return bool|array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getComonentTicket()
|
||||
{
|
||||
$receive = new Receive([
|
||||
'token' => $this->config->get('component_token'),
|
||||
'appid' => $this->config->get('component_appid'),
|
||||
'appsecret' => $this->config->get('component_appsecret'),
|
||||
'encodingaeskey' => $this->config->get('component_encodingaeskey'),
|
||||
'cache_path' => $this->config->get('cache_path'),
|
||||
]);
|
||||
$data = $receive->getReceive();
|
||||
if (!empty($data['ComponentVerifyTicket'])) {
|
||||
Tools::setCache('component_verify_ticket', $data['ComponentVerifyTicket']);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取或刷新服务 AccessToken
|
||||
* @return bool|string
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getComponentAccessToken()
|
||||
{
|
||||
$cache = 'wechat_component_access_token';
|
||||
if (($componentAccessToken = Tools::getCache($cache))) {
|
||||
return $componentAccessToken;
|
||||
}
|
||||
$data = [
|
||||
'component_appid' => $this->config->get('component_appid'),
|
||||
'component_appsecret' => $this->config->get('component_appsecret'),
|
||||
'component_verify_ticket' => Tools::getCache('component_verify_ticket'),
|
||||
];
|
||||
$url = 'https://api.weixin.qq.com/cgi-bin/component/api_component_token';
|
||||
$result = $this->httpPostForJson($url, $data);
|
||||
if (empty($result['component_access_token'])) {
|
||||
throw new InvalidResponseException($result['errmsg'], $result['errcode'], $data);
|
||||
}
|
||||
Tools::setCache($cache, $result['component_access_token'], 7000);
|
||||
return $result['component_access_token'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取授权方的帐号基本信息
|
||||
* @param string $authorizerAppid 授权公众号或小程序的appid
|
||||
* @return array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAuthorizerInfo($authorizerAppid)
|
||||
{
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token={$componentAccessToken}";
|
||||
$data = [
|
||||
'authorizer_appid' => $authorizerAppid,
|
||||
'component_appid' => $this->config->get('component_appid'),
|
||||
];
|
||||
$result = $this->httpPostForJson($url, $data);
|
||||
if (empty($result['authorizer_info'])) {
|
||||
throw new InvalidResponseException($result['errmsg'], $result['errcode'], $data);
|
||||
}
|
||||
return $result['authorizer_info'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认接受公众号将某权限集高级权限的授权
|
||||
* @param string $authorizerAppid 授权公众号或小程序的appid
|
||||
* @param string $funcscopeCategoryId 权限集ID
|
||||
* @param string $confirmValue 是否确认(1.确认授权, 2.取消确认)
|
||||
* @return array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function setAuthorization($authorizerAppid, $funcscopeCategoryId, $confirmValue)
|
||||
{
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/api_confirm_authorization?component_access_token={$componentAccessToken}";
|
||||
return $this->httpPostForJson($url, [
|
||||
'confirm_value' => $confirmValue,
|
||||
'authorizer_appid' => $authorizerAppid,
|
||||
'funcscope_category_id' => $funcscopeCategoryId,
|
||||
'component_appid' => $this->config->get('component_appid'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置授权方的选项信息
|
||||
* @param string $authorizerAppid 授权公众号或小程序的appid
|
||||
* @param string $optionName 选项名称
|
||||
* @param string $optionValue 设置的选项值
|
||||
* @return array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function setAuthorizerOption($authorizerAppid, $optionName, $optionValue)
|
||||
{
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/api_set_authorizer_option?component_access_token={$componentAccessToken}";
|
||||
return $this->httpPostForJson($url, [
|
||||
'option_name' => $optionName,
|
||||
'option_value' => $optionValue,
|
||||
'authorizer_appid' => $authorizerAppid,
|
||||
'component_appid' => $this->config->get('component_appid'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取授权方的选项设置信息
|
||||
* @param string $authorizerAppid 授权公众号或小程序的appid
|
||||
* @param string $optionName 选项名称
|
||||
* @return array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAuthorizerOption($authorizerAppid, $optionName)
|
||||
{
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_option?component_access_token={$componentAccessToken}";
|
||||
return $this->httpPostForJson($url, [
|
||||
'option_name' => $optionName,
|
||||
'authorizer_appid' => $authorizerAppid,
|
||||
'component_appid' => $this->config->get('component_appid'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预授权码 pre_auth_code
|
||||
* @return string
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getPreauthCode()
|
||||
{
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token={$componentAccessToken}";
|
||||
$result = $this->httpPostForJson($url, ['component_appid' => $this->config->get('component_appid')]);
|
||||
if (empty($result['pre_auth_code'])) {
|
||||
throw new InvalidResponseException('GetPreauthCode Faild.', '0', $result);
|
||||
}
|
||||
return $result['pre_auth_code'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取授权回跳地址
|
||||
* @param string $redirectUri 回调URI
|
||||
* @param integer $authType 要授权的帐号类型
|
||||
* @return bool
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAuthRedirect($redirectUri, $authType = 3)
|
||||
{
|
||||
$redirectUri = urlencode($redirectUri);
|
||||
$preAuthCode = $this->getPreauthCode();
|
||||
$componentAppid = $this->config->get('component_appid');
|
||||
return "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={$componentAppid}&pre_auth_code={$preAuthCode}&redirect_uri={$redirectUri}&auth_type={$authType}";
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用授权码换取公众号或小程序的接口调用凭据和授权信息
|
||||
* @param null $authCode 授权码
|
||||
* @return bool|array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getQueryAuthorizerInfo($authCode = null)
|
||||
{
|
||||
if (is_null($authCode) && isset($_GET['auth_code'])) {
|
||||
$authCode = $_GET['auth_code'];
|
||||
}
|
||||
if (empty($authCode)) {
|
||||
return false;
|
||||
}
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token={$componentAccessToken}";
|
||||
$data = [
|
||||
'authorization_code' => $authCode,
|
||||
'component_appid' => $this->config->get('component_appid'),
|
||||
];
|
||||
$result = $this->httpPostForJson($url, $data);
|
||||
if (empty($result['authorization_info'])) {
|
||||
throw new InvalidResponseException($result['errmsg'], $result['errcode'], $data);
|
||||
}
|
||||
$authorizerAppid = $result['authorization_info']['authorizer_appid'];
|
||||
$authorizerAccessToken = $result['authorization_info']['authorizer_access_token'];
|
||||
// 缓存授权公众号访问 ACCESS_TOKEN
|
||||
Tools::setCache("{$authorizerAppid}_access_token", $authorizerAccessToken, 7000);
|
||||
return $result['authorization_info'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取(刷新)授权公众号的令牌
|
||||
* @param string $authorizerAppid 授权公众号或小程序的appid
|
||||
* @param string $authorizerRefreshToken 授权方的刷新令牌
|
||||
* @return array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function refreshAccessToken($authorizerAppid, $authorizerRefreshToken)
|
||||
{
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token?component_access_token={$componentAccessToken}";
|
||||
$data = [
|
||||
'authorizer_appid' => $authorizerAppid,
|
||||
'authorizer_refresh_token' => $authorizerRefreshToken,
|
||||
'component_appid' => $this->config->get('component_appid'),
|
||||
];
|
||||
$result = $this->httpPostForJson($url, $data);
|
||||
if (empty($result['authorizer_access_token'])) {
|
||||
throw new InvalidResponseException($result['errmsg'], $result['errcode'], $data);
|
||||
}
|
||||
// 缓存授权公众号访问 ACCESS_TOKEN
|
||||
Tools::setCache("{$authorizerAppid}_access_token", $result['authorizer_access_token'], 7000);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* oauth 授权跳转接口
|
||||
* @param string $authorizerAppid 授权公众号或小程序的appid
|
||||
* @param string $redirectUri 回调地址
|
||||
* @param string $scope snsapi_userinfo|snsapi_base
|
||||
* @return string
|
||||
*/
|
||||
public function getOauthRedirect($authorizerAppid, $redirectUri, $scope = 'snsapi_userinfo')
|
||||
{
|
||||
$redirectUri = urlencode($redirectUri);
|
||||
$componentAppid = $this->config->get('component_appid');
|
||||
return "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$authorizerAppid}&redirect_uri={$redirectUri}&response_type=code&scope={$scope}&state={$authorizerAppid}&component_appid={$componentAppid}#wechat_redirect";
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获取AccessToken
|
||||
* @param string $authorizerAppid 授权公众号或小程序的appid
|
||||
* @return bool|array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getOauthAccessToken($authorizerAppid)
|
||||
{
|
||||
if (empty($_GET['code'])) {
|
||||
return false;
|
||||
}
|
||||
$componentAppid = $this->config->get('component_appid');
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/sns/oauth2/component/access_token?appid={$authorizerAppid}&code={$_GET['code']}&grant_type=authorization_code&component_appid={$componentAppid}&component_access_token={$componentAccessToken}";
|
||||
return $this->httpGetForJson($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取当前所有已授权的帐号基本信息
|
||||
* @param integer $count 拉取数量,最大为500
|
||||
* @param integer $offset 偏移位置/起始位置
|
||||
* @return array|bool
|
||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function getAuthorizerList($count = 500, $offset = 0)
|
||||
{
|
||||
$componentAppid = $this->config->get('component_appid');
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_list?component_access_token={$componentAccessToken}";
|
||||
return $this->httpPostForJson($url, ['count' => $count, 'offset' => $offset, 'component_appid' => $componentAppid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对第三方平台所有API调用次数清零
|
||||
* @return array
|
||||
* @throws InvalidResponseException
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
public function clearQuota()
|
||||
{
|
||||
$componentAppid = $this->config->get('component_appid');
|
||||
$componentAccessToken = $this->getComponentAccessToken();
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/component/clear_quota?component_access_token={$componentAccessToken}";
|
||||
return $this->httpPostForJson($url, ['component_appid' => $componentAppid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建指定授权公众号接口实例
|
||||
* @param string $name 需要加载的接口实例名称
|
||||
* @param string $authorizerAppid 授权公众号的appid
|
||||
* @param string $type 加载SDK类型 WeChat|WeMini
|
||||
* @return \WeChat\Card|\WeChat\Custom|\WeChat\Media|\WeChat\Menu|\WeChat\Oauth|\WeChat\Pay|\WeChat\Product|\WeChat\Qrcode|\WeChat\Receive|\WeChat\Scan|\WeChat\Script|\WeChat\Shake|\WeChat\Tags|\WeChat\Template|\WeChat\User|\WeChat\Wifi
|
||||
*/
|
||||
public function instance($name, $authorizerAppid, $type = 'WeChat')
|
||||
{
|
||||
$className = "{$type}\\" . ucfirst(strtolower($name));
|
||||
return new $className($this->getConfig($authorizerAppid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取授权公众号配置参数
|
||||
* @param string $authorizerAppid 授权公众号的appid
|
||||
* @return array
|
||||
*/
|
||||
public function getConfig($authorizerAppid)
|
||||
{
|
||||
$config = $this->config->get();
|
||||
$config['appid'] = $authorizerAppid;
|
||||
$config['token'] = $this->config->get('component_token');
|
||||
$config['appsecret'] = $this->config->get('component_appsecret');
|
||||
$config['encodingaeskey'] = $this->config->get('component_encodingaeskey');
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 以POST获取接口数据并转为数组
|
||||
* @param string $url 接口地址
|
||||
* @param array $data 请求数据
|
||||
* @param bool $buildToJson
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
protected function httpPostForJson($url, array $data, $buildToJson = true)
|
||||
{
|
||||
return json_decode(Tools::post($url, $buildToJson ? Tools::arr2json($data) : $data), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以GET获取接口数据并转为数组
|
||||
* @param string $url 接口地址
|
||||
* @return array
|
||||
* @throws \WeChat\Exceptions\LocalCacheException
|
||||
*/
|
||||
protected function httpGetForJson($url)
|
||||
{
|
||||
return json_decode(Tools::get($url), true);
|
||||
}
|
||||
|
||||
}
|
57
vendor/zoujingli/weopen-developer/_test/open.php
vendored
57
vendor/zoujingli/weopen-developer/_test/open.php
vendored
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | WeOpenDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方网站: http://think.ctolog.com
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zoujingli/WeOpenDeveloper
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
try {
|
||||
|
||||
// 1. 手动加载入口文件
|
||||
include "../vendor/autoload.php";
|
||||
include "../WeOpen/Service.php";
|
||||
|
||||
// 2. 准备配置参数
|
||||
$config = [
|
||||
'component_appid' => 'wx4e63e993e222df8d',
|
||||
'component_token' => 'P8QHTIxpBEq88IrxatqhgpBm2OAQROkI',
|
||||
'component_appsecret' => '7cfa1afa87a41e2ea3445cea015c0974',
|
||||
'component_encodingaeskey' => 'L5uFIa0U6KLalPyXckyqoVIJYLhsfrg8k9YzybZIHsx',
|
||||
];
|
||||
|
||||
// 注册授权公众号 AccessToken 处理
|
||||
$config['GetAccessTokenCallback'] = function ($authorizer_appid) use ($config) {
|
||||
$open = new \WeOpen\Service($config);
|
||||
$authorizer_refresh_token = ''; // 从数据库去找吧,在授权绑定的时候获取到了
|
||||
$authorizer_refresh_token = 'L5uFIa0U6KLalPyXckyqoVIJYLhsfrg8k9YzybZIHsx'; // 从数据库去找吧,在授权绑定的时候获取到了
|
||||
$result = $open->refreshAccessToken($authorizer_appid, $authorizer_refresh_token);
|
||||
if (empty($result['authorizer_access_token'])) {
|
||||
throw new \WeChat\Exceptions\InvalidResponseException($result['errmsg'], '0');
|
||||
}
|
||||
$data = [
|
||||
'authorizer_access_token' => $result['authorizer_access_token'],
|
||||
'authorizer_refresh_token' => $result['authorizer_refresh_token'],
|
||||
];
|
||||
// 需要把$data记录到数据库
|
||||
return $result['authorizer_access_token'];
|
||||
};
|
||||
|
||||
// 3 使用第三方服务创建接口实例
|
||||
$open = new \WeOpen\Service($config);
|
||||
$wechat = $open->instance('User', 'wx60a43dd8161666d4');
|
||||
$list = $wechat->getUserList();
|
||||
var_export($list);
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
// 出错啦,处理下吧
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`authorizer_appid` varchar(100) DEFAULT NULL COMMENT '公众号APPID',
|
||||
`authorizer_access_token` varchar(200) DEFAULT NULL COMMENT '公众号Token',
|
||||
`authorizer_refresh_token` varchar(200) DEFAULT NULL COMMENT '公众号刷新Token',
|
||||
`func_info` varchar(100) DEFAULT NULL COMMENT '公众号集权',
|
||||
`nick_name` varchar(50) DEFAULT NULL COMMENT '公众号昵称',
|
||||
`head_img` varchar(200) DEFAULT NULL COMMENT '公众号头像',
|
||||
`expires_in` bigint(20) DEFAULT NULL COMMENT 'Token有效时间',
|
||||
`service_type` tinyint(2) DEFAULT NULL COMMENT '公众号实际类型',
|
||||
`service_type_info` tinyint(2) DEFAULT NULL COMMENT '服务类型信息',
|
||||
`verify_type` tinyint(2) DEFAULT NULL COMMENT '公众号实际认证类型',
|
||||
`verify_type_info` tinyint(2) DEFAULT NULL COMMENT '公众号认证类型',
|
||||
`user_name` varchar(100) DEFAULT NULL COMMENT '众众号原始账号',
|
||||
`alias` varchar(100) DEFAULT NULL COMMENT '公众号别名',
|
||||
`qrcode_url` varchar(200) DEFAULT NULL COMMENT '公众号二维码地址',
|
||||
`business_info` varchar(255) DEFAULT NULL,
|
||||
`principal_name` varchar(255) DEFAULT NULL COMMENT '公司名称',
|
||||
`idc` tinyint(1) unsigned DEFAULT NULL,
|
||||
`status` tinyint(1) unsigned DEFAULT '1' COMMENT '状态(1正常授权,0取消授权)',
|
||||
`total` bigint(20) unsigned DEFAULT '0' COMMENT '统计调用次数',
|
||||
`appkey` char(32) DEFAULT NULL COMMENT '接口KEY',
|
||||
`appuri` varchar(255) DEFAULT NULL COMMENT '响应接口APP',
|
||||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `index_wechat_config_authorizer_appid` (`authorizer_appid`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='公众号授权参数';
|
33
vendor/zoujingli/weopen-developer/composer.json
vendored
33
vendor/zoujingli/weopen-developer/composer.json
vendored
@ -1,33 +0,0 @@
|
||||
{
|
||||
"type": "library",
|
||||
"name": "zoujingli/weopen-developer",
|
||||
"homepage": "https://github.com/zoujingli/WeOpenDeveloper",
|
||||
"description": "WeChat Open development of SDK",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Anyon",
|
||||
"email": "zoujingli@qq.com",
|
||||
"homepage": "http://ctolog.com"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"WeChat",
|
||||
"WeChatOpen",
|
||||
"WeChatOpenDeveloper"
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-openssl": "*",
|
||||
"zoujingli/wechat-developer": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WeOpen\\": "WeOpen",
|
||||
"WeChat\\": "WeChat",
|
||||
"WeMini\\": "WeMini"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user