From 39246f78a10e9e27fefc19be3adfa1174c098f3e Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 18 Jul 2019 11:46:11 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]CompoesrUpdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 9 +- vendor/composer/autoload_psr4.php | 3 +- vendor/composer/autoload_real.php | 14 +- vendor/composer/autoload_static.php | 25 +- vendor/composer/installed.json | 75 +- vendor/qiniu/php-sdk/.travis.yml | 5 + vendor/qiniu/php-sdk/docs/sms/example.php | 70 ++ .../php-sdk/examples/bucket_lifecycleRule.php | 30 + .../qiniu/php-sdk/examples/delete_bucket.php | 20 + .../php-sdk/examples/delete_bucketEvent.php | 21 + .../examples/delete_bucketLifecycleRule.php | 21 + .../php-sdk/examples/get_bucketEvents.php | 20 + .../examples/get_bucketLifecycleRules.php | 20 + .../qiniu/php-sdk/examples/get_bucketList.php | 20 + .../php-sdk/examples/get_bucketQuota.php | 20 + .../qiniu/php-sdk/examples/get_bucketinfo.php | 20 + .../php-sdk/examples/get_bucketinfos.php | 20 + .../qiniu/php-sdk/examples/get_corsRules.php | 20 + .../php-sdk/examples/put_bucketAccessMode.php | 21 + .../examples/put_bucketAccessStyleMode.php | 21 + .../php-sdk/examples/put_bucketEvent.php | 25 + .../php-sdk/examples/put_bucketMaxAge.php | 21 + .../php-sdk/examples/put_bucketQuota.php | 22 + .../php-sdk/examples/put_referAntiLeech.php | 23 + .../qiniu/php-sdk/examples/rs_pub_domain.php | 19 + .../php-sdk/examples/rsf_v2list_bucket.php | 33 + .../php-sdk/examples/update_bucketEvent.php | 25 + .../examples/update_bucketLifecycleRule.php | 30 + .../php-sdk/examples/upload_and_callback.php | 8 +- vendor/qiniu/php-sdk/phpunit.xml.dist | 1 - .../php-sdk/src/Qiniu/Cdn/CdnManager.php | 9 +- vendor/qiniu/php-sdk/src/Qiniu/Config.php | 61 +- .../qiniu/php-sdk/src/Qiniu/Http/Client.php | 10 +- vendor/qiniu/php-sdk/src/Qiniu/Region.php | 196 ++++++ .../qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php | 11 +- vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php | 337 +++++++++ .../src/Qiniu/Storage/BucketManager.php | 653 +++++++++++++++++- .../src/Qiniu/Storage/FormUploader.php | 2 - vendor/qiniu/php-sdk/src/Qiniu/Zone.php | 200 +----- .../tests/Qiniu/Tests/CdnManagerTest.php | 11 +- .../tests/Qiniu/Tests/ResumeUpTest.php | 2 +- vendor/qiniu/php-sdk/tests/bootstrap.php | 2 +- vendor/topthink/think-helper/.gitignore | 3 +- vendor/topthink/think-helper/README.md | 5 +- vendor/topthink/think-helper/composer.json | 7 +- vendor/topthink/think-helper/src/Arr.php | 41 -- .../topthink/think-helper/src/Collection.php | 651 +++++++++++++++++ .../think-helper/src/contract/Arrayable.php | 8 + .../think-helper/src/contract/Jsonable.php | 8 + vendor/topthink/think-helper/src/helper.php | 285 +++++++- .../topthink/think-helper/src/helper/Arr.php | 634 +++++++++++++++++ .../think-helper/src/{ => helper}/Str.php | 30 +- vendor/zoujingli/think-library/readme.md | 51 +- .../think-library/src/Controller.php | 150 +++- vendor/zoujingli/think-library/src/File.php | 47 +- .../think-library/src/command/Sess.php | 7 +- .../think-library/src/command/Sync.php | 77 ++- .../think-library/src/command/Task.php | 5 +- .../think-library/src/command/sync/Admin.php | 7 +- .../think-library/src/command/sync/Config.php | 7 +- .../think-library/src/command/sync/Plugs.php | 7 +- .../src/command/sync/Service.php | 7 +- .../think-library/src/command/sync/Wechat.php | 7 +- .../think-library/src/command/task/Reset.php | 7 +- .../think-library/src/command/task/Start.php | 7 +- .../think-library/src/command/task/State.php | 7 +- .../think-library/src/command/task/Stop.php | 7 +- vendor/zoujingli/think-library/src/common.php | 74 +- .../think-library/src/driver/Local.php | 5 +- .../think-library/src/driver/Oss.php | 105 +-- .../think-library/src/driver/Qiniu.php | 60 +- .../think-library/src/logic/Delete.php | 5 +- .../think-library/src/logic/Form.php | 5 +- .../think-library/src/logic/Input.php | 8 +- .../think-library/src/logic/Logic.php | 5 +- .../think-library/src/logic/Page.php | 11 +- .../think-library/src/logic/Query.php | 7 +- .../think-library/src/logic/Save.php | 9 +- .../think-library/src/tools/Crypt.php | 5 +- .../think-library/src/tools/Csrf.php | 9 +- .../zoujingli/think-library/src/tools/Csv.php | 5 +- .../think-library/src/tools/Data.php | 14 +- .../think-library/src/tools/Emoji.php | 5 +- .../think-library/src/tools/Express.php | 5 +- .../think-library/src/tools/Http.php | 5 +- .../think-library/src/tools/Node.php | 126 ++-- .../think-library/src/tools/Options.php | 5 +- vendor/zoujingli/weopen-developer/README.md | 2 +- .../weopen-developer/WeMini/User.php | 2 +- .../weopen-developer/WeOpen/Login.php | 4 + .../weopen-developer/WeOpen/Service.php | 2 + 93 files changed, 4009 insertions(+), 726 deletions(-) create mode 100644 vendor/qiniu/php-sdk/docs/sms/example.php create mode 100644 vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php create mode 100644 vendor/qiniu/php-sdk/examples/delete_bucket.php create mode 100644 vendor/qiniu/php-sdk/examples/delete_bucketEvent.php create mode 100644 vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php create mode 100644 vendor/qiniu/php-sdk/examples/get_bucketEvents.php create mode 100644 vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php create mode 100644 vendor/qiniu/php-sdk/examples/get_bucketList.php create mode 100644 vendor/qiniu/php-sdk/examples/get_bucketQuota.php create mode 100644 vendor/qiniu/php-sdk/examples/get_bucketinfo.php create mode 100644 vendor/qiniu/php-sdk/examples/get_bucketinfos.php create mode 100644 vendor/qiniu/php-sdk/examples/get_corsRules.php create mode 100644 vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php create mode 100644 vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php create mode 100644 vendor/qiniu/php-sdk/examples/put_bucketEvent.php create mode 100644 vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php create mode 100644 vendor/qiniu/php-sdk/examples/put_bucketQuota.php create mode 100644 vendor/qiniu/php-sdk/examples/put_referAntiLeech.php create mode 100644 vendor/qiniu/php-sdk/examples/rs_pub_domain.php create mode 100644 vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php create mode 100644 vendor/qiniu/php-sdk/examples/update_bucketEvent.php create mode 100644 vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php create mode 100644 vendor/qiniu/php-sdk/src/Qiniu/Region.php create mode 100644 vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php delete mode 100644 vendor/topthink/think-helper/src/Arr.php create mode 100644 vendor/topthink/think-helper/src/Collection.php create mode 100644 vendor/topthink/think-helper/src/contract/Arrayable.php create mode 100644 vendor/topthink/think-helper/src/contract/Jsonable.php create mode 100644 vendor/topthink/think-helper/src/helper/Arr.php rename vendor/topthink/think-helper/src/{ => helper}/Str.php (82%) diff --git a/composer.json b/composer.json index 400046468..a3704497a 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "repositories": { "packagist": { "type": "composer", - "url": "https://packagist.laravel-china.org" + "url": "https://mirrors.aliyun.com/composer" } } } diff --git a/vendor/autoload.php b/vendor/autoload.php index 1c7d28307..814a39a68 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitbe3e9ba0155bdb933f2ae90b5ee37778::getLoader(); +return ComposerAutoloaderInitccfdca557bd97f1171d02669ad019e77::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index dd2519005..d3231b8ea 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -103,7 +103,9 @@ return array( 'Qiniu\\Processing\\ImageUrlBuilder' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php', 'Qiniu\\Processing\\Operation' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php', 'Qiniu\\Processing\\PersistentFop' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php', + 'Qiniu\\Region' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Region.php', 'Qiniu\\Rtc\\AppClient' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php', + 'Qiniu\\Sms\\Sms' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Sms/Sms.php', 'Qiniu\\Storage\\ArgusManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php', 'Qiniu\\Storage\\BucketManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php', 'Qiniu\\Storage\\FormUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php', @@ -210,13 +212,16 @@ return array( 'library\\tools\\Http' => $vendorDir . '/zoujingli/think-library/src/tools/Http.php', 'library\\tools\\Node' => $vendorDir . '/zoujingli/think-library/src/tools/Node.php', 'library\\tools\\Options' => $vendorDir . '/zoujingli/think-library/src/tools/Options.php', + 'think\\Collection' => $vendorDir . '/topthink/think-helper/src/Collection.php', 'think\\Queue' => $vendorDir . '/topthink/think-queue/src/Queue.php', 'think\\composer\\Plugin' => $vendorDir . '/topthink/think-installer/src/Plugin.php', 'think\\composer\\ThinkExtend' => $vendorDir . '/topthink/think-installer/src/ThinkExtend.php', 'think\\composer\\ThinkFramework' => $vendorDir . '/topthink/think-installer/src/ThinkFramework.php', 'think\\composer\\ThinkTesting' => $vendorDir . '/topthink/think-installer/src/ThinkTesting.php', - 'think\\helper\\Arr' => $vendorDir . '/topthink/think-helper/src/Arr.php', - 'think\\helper\\Str' => $vendorDir . '/topthink/think-helper/src/Str.php', + 'think\\contract\\Arrayable' => $vendorDir . '/topthink/think-helper/src/contract/Arrayable.php', + 'think\\contract\\Jsonable' => $vendorDir . '/topthink/think-helper/src/contract/Jsonable.php', + 'think\\helper\\Arr' => $vendorDir . '/topthink/think-helper/src/helper/Arr.php', + 'think\\helper\\Str' => $vendorDir . '/topthink/think-helper/src/helper/Str.php', 'think\\queue\\CallQueuedHandler' => $vendorDir . '/topthink/think-queue/src/queue/CallQueuedHandler.php', 'think\\queue\\Connector' => $vendorDir . '/topthink/think-queue/src/queue/Connector.php', 'think\\queue\\Job' => $vendorDir . '/topthink/think-queue/src/queue/Job.php', diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 48e751d8f..7631ea36c 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,9 +6,8 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'), 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'), - 'think\\' => array($vendorDir . '/topthink/think-queue/src'), + 'think\\' => array($vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-queue/src'), 'library\\' => array($vendorDir . '/zoujingli/think-library/src'), 'WePay\\' => array($vendorDir . '/zoujingli/wechat-developer/WePay'), 'WeOpen\\' => array($vendorDir . '/zoujingli/weopen-developer/WeOpen'), diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 703c6bafc..3e57291aa 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitbe3e9ba0155bdb933f2ae90b5ee37778 +class ComposerAutoloaderInitccfdca557bd97f1171d02669ad019e77 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInitbe3e9ba0155bdb933f2ae90b5ee37778 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitbe3e9ba0155bdb933f2ae90b5ee37778', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitccfdca557bd97f1171d02669ad019e77', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitbe3e9ba0155bdb933f2ae90b5ee37778', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitccfdca557bd97f1171d02669ad019e77', '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\ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitccfdca557bd97f1171d02669ad019e77::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInitbe3e9ba0155bdb933f2ae90b5ee37778 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitccfdca557bd97f1171d02669ad019e77::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirebe3e9ba0155bdb933f2ae90b5ee37778($fileIdentifier, $file); + composerRequireccfdca557bd97f1171d02669ad019e77($fileIdentifier, $file); } return $loader; } } -function composerRequirebe3e9ba0155bdb933f2ae90b5ee37778($fileIdentifier, $file) +function composerRequireccfdca557bd97f1171d02669ad019e77($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index ade0f4f5e..2ba7f44cf 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778 +class ComposerStaticInitccfdca557bd97f1171d02669ad019e77 { public static $files = array ( '841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php', @@ -16,7 +16,6 @@ class ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778 public static $prefixLengthsPsr4 = array ( 't' => array ( - 'think\\helper\\' => 13, 'think\\composer\\' => 15, 'think\\' => 6, ), @@ -54,17 +53,14 @@ class ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778 ); public static $prefixDirsPsr4 = array ( - 'think\\helper\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-helper/src', - ), 'think\\composer\\' => array ( 0 => __DIR__ . '/..' . '/topthink/think-installer/src', ), 'think\\' => array ( - 0 => __DIR__ . '/..' . '/topthink/think-queue/src', + 0 => __DIR__ . '/..' . '/topthink/think-helper/src', + 1 => __DIR__ . '/..' . '/topthink/think-queue/src', ), 'library\\' => array ( @@ -208,7 +204,9 @@ class ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778 'Qiniu\\Processing\\ImageUrlBuilder' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php', 'Qiniu\\Processing\\Operation' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php', 'Qiniu\\Processing\\PersistentFop' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php', + 'Qiniu\\Region' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Region.php', 'Qiniu\\Rtc\\AppClient' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php', + 'Qiniu\\Sms\\Sms' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Sms/Sms.php', 'Qiniu\\Storage\\ArgusManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php', 'Qiniu\\Storage\\BucketManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php', 'Qiniu\\Storage\\FormUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php', @@ -315,13 +313,16 @@ class ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778 'library\\tools\\Http' => __DIR__ . '/..' . '/zoujingli/think-library/src/tools/Http.php', 'library\\tools\\Node' => __DIR__ . '/..' . '/zoujingli/think-library/src/tools/Node.php', 'library\\tools\\Options' => __DIR__ . '/..' . '/zoujingli/think-library/src/tools/Options.php', + 'think\\Collection' => __DIR__ . '/..' . '/topthink/think-helper/src/Collection.php', 'think\\Queue' => __DIR__ . '/..' . '/topthink/think-queue/src/Queue.php', 'think\\composer\\Plugin' => __DIR__ . '/..' . '/topthink/think-installer/src/Plugin.php', 'think\\composer\\ThinkExtend' => __DIR__ . '/..' . '/topthink/think-installer/src/ThinkExtend.php', 'think\\composer\\ThinkFramework' => __DIR__ . '/..' . '/topthink/think-installer/src/ThinkFramework.php', 'think\\composer\\ThinkTesting' => __DIR__ . '/..' . '/topthink/think-installer/src/ThinkTesting.php', - 'think\\helper\\Arr' => __DIR__ . '/..' . '/topthink/think-helper/src/Arr.php', - 'think\\helper\\Str' => __DIR__ . '/..' . '/topthink/think-helper/src/Str.php', + 'think\\contract\\Arrayable' => __DIR__ . '/..' . '/topthink/think-helper/src/contract/Arrayable.php', + 'think\\contract\\Jsonable' => __DIR__ . '/..' . '/topthink/think-helper/src/contract/Jsonable.php', + 'think\\helper\\Arr' => __DIR__ . '/..' . '/topthink/think-helper/src/helper/Arr.php', + 'think\\helper\\Str' => __DIR__ . '/..' . '/topthink/think-helper/src/helper/Str.php', 'think\\queue\\CallQueuedHandler' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/CallQueuedHandler.php', 'think\\queue\\Connector' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/Connector.php', 'think\\queue\\Job' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/Job.php', @@ -346,9 +347,9 @@ class ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitbe3e9ba0155bdb933f2ae90b5ee37778::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitccfdca557bd97f1171d02669ad019e77::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitccfdca557bd97f1171d02669ad019e77::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitccfdca557bd97f1171d02669ad019e77::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 62b56a876..64c1b2aaa 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -15,7 +15,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -64,7 +64,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -118,21 +118,21 @@ }, { "name": "qiniu/php-sdk", - "version": "v7.2.7", - "version_normalized": "7.2.7.0", + "version": "v7.2.9", + "version_normalized": "7.2.9.0", "source": { "type": "git", "url": "https://github.com/qiniu/php-sdk.git", - "reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6" + "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/88d11a5857ebc6871204e9be6ceec54bf5f381e6", - "reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6", + "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/afe7d8715d8a688b1d8d8cdf031240d2363dad90", + "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -144,7 +144,7 @@ "phpunit/phpunit": "~4.0", "squizlabs/php_codesniffer": "~2.3" }, - "time": "2018-11-06T13:34:32+00:00", + "time": "2019-07-09T07:55:07+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -177,8 +177,8 @@ }, { "name": "symfony/options-resolver", - "version": "v3.4.28", - "version_normalized": "3.4.28.0", + "version": "v3.4.29", + "version_normalized": "3.4.29.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -191,7 +191,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -253,7 +253,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -298,31 +298,34 @@ }, { "name": "topthink/think-helper", - "version": "v3.0.0", - "version_normalized": "3.0.0.0", + "version": "v3.1.2", + "version_normalized": "3.1.2.0", "source": { "type": "git", "url": "https://github.com/top-think/think-helper.git", - "reference": "8ba5f66e68106369fcc3211e7d2dbaf7bc9ce455" + "reference": "a629c4271fdf3d7e7c6d89089791417cb4796a2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-helper/zipball/8ba5f66e68106369fcc3211e7d2dbaf7bc9ce455", - "reference": "8ba5f66e68106369fcc3211e7d2dbaf7bc9ce455", + "url": "https://api.github.com/repos/top-think/think-helper/zipball/a629c4271fdf3d7e7c6d89089791417cb4796a2c", + "reference": "a629c4271fdf3d7e7c6d89089791417cb4796a2c", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] }, - "time": "2019-03-14T09:28:59+00:00", + "require": { + "php": ">=7.1.0" + }, + "time": "2019-07-11T04:35:03+00:00", "type": "library", "installation-source": "dist", "autoload": { "psr-4": { - "think\\helper\\": "src" + "think\\": "src" }, "files": [ "src/helper.php" @@ -338,7 +341,7 @@ "email": "448901948@qq.com" } ], - "description": "The ThinkPHP5 Helper Package" + "description": "The ThinkPHP6 Helper Package" }, { "name": "topthink/think-installer", @@ -356,7 +359,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -405,7 +408,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -459,7 +462,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -499,16 +502,16 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "d4366fa9d4f48400391f9983c9771494c75aba95" + "reference": "5fae7920d5b8ea47cfc4ed114dc36c4dcc4e8b28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/d4366fa9d4f48400391f9983c9771494c75aba95", - "reference": "d4366fa9d4f48400391f9983c9771494c75aba95", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/5fae7920d5b8ea47cfc4ed114dc36c4dcc4e8b28", + "reference": "5fae7920d5b8ea47cfc4ed114dc36c4dcc4e8b28", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -523,7 +526,7 @@ "qiniu/php-sdk": "^7.2", "topthink/framework": "5.1.*" }, - "time": "2019-06-15T04:07:28+00:00", + "time": "2019-07-18T03:17:34+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -557,7 +560,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -614,16 +617,16 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/WeOpenDeveloper.git", - "reference": "ce6e66eb2531da89a4463f595797258ad2bae385" + "reference": "629f14c1586ac51bdcef47b17d68a70b89d28897" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/WeOpenDeveloper/zipball/ce6e66eb2531da89a4463f595797258ad2bae385", - "reference": "ce6e66eb2531da89a4463f595797258ad2bae385", + "url": "https://api.github.com/repos/zoujingli/WeOpenDeveloper/zipball/629f14c1586ac51bdcef47b17d68a70b89d28897", + "reference": "629f14c1586ac51bdcef47b17d68a70b89d28897", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -635,7 +638,7 @@ "php": ">=5.4", "zoujingli/wechat-developer": "^1.0" }, - "time": "2019-05-09T03:34:57+00:00", + "time": "2019-07-08T07:11:04+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/qiniu/php-sdk/.travis.yml b/vendor/qiniu/php-sdk/.travis.yml index 60951b15c..cada8cd09 100644 --- a/vendor/qiniu/php-sdk/.travis.yml +++ b/vendor/qiniu/php-sdk/.travis.yml @@ -21,3 +21,8 @@ script: after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + +env: + global: + - secure: "V9BsntXQZwvO9EOD6itzaae2uq+GemzyTUTxMTJx1/jFoUNpCU2O2UAgjA2XSEr5sgci0KWDV4Krbzv3EBB4uplOFLMI3w32256UHbT9E0x3YjhfPJZk68MH1iS1be7X81LDHON7yveavK8987s3qzjeUcbfLSPgccT+cvf7+dc=" + - QINIU_ACCESS_KEY=vHg2e7nOh7Jsucv2Azr5FH6omPgX22zoJRWa0FN5 \ No newline at end of file diff --git a/vendor/qiniu/php-sdk/docs/sms/example.php b/vendor/qiniu/php-sdk/docs/sms/example.php new file mode 100644 index 000000000..541c0d6c2 --- /dev/null +++ b/vendor/qiniu/php-sdk/docs/sms/example.php @@ -0,0 +1,70 @@ + 'code' ); +try { + //发送短信 + $resp = $client->sendMessage($template_id, $mobiles, $code); + print_r($resp); +} catch (\Exception $e) { + echo "Error:", $e, "\n"; +}exit; +//模板模块 +$name="tstest001"; +$template="tesy001 ${code}"; +$type="notification"; +$description="tstest001"; +$signature_id="1131464448834277376"; +$id="1131810682442883072"; + +try { + //创建模板 + $resp = $client->createTemplate($name, $template, $type, $description, $signature_id); + print_r($resp); + //查询模板 + $resp = $client->queryTemplate(); + print_r($resp); + //修改模板 + $resp = $client->updateTemplate($id, $name, $template, $description, $signature_id); + print_r($resp); + //删除模板 + $resp = $client->deleteTemplate($id); + print_r($resp); +} catch (\Exception $e) { + echo "Error:", $e, "\n"; +} +//签名模块 +$signature = 'lfxlive2'; +$source = 'enterprises_and_institutions'; +$pic="/Users/Desktop/sss.jpg"; +$audit_status="passed"; +$page=1; +$page_size=1; +$id="1131464448834277376"; + +try { + //创建签名 + $resp = $client->createSignature($signature, $source, $pic); + print_r($resp); + //查询签名 + $resp = $client->checkSignature($audit_status); + //修改签名 + $resp = $client->updateSignature($id, $signature, $source, $pic); + print_r($resp); + //删除ID + $resp = $client->deleteSignature($id); + print_r($resp); +} catch (\Exception $e) { + echo "Error:", $e, "\n"; +} diff --git a/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php b/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php new file mode 100644 index 000000000..3f7fefd5b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php @@ -0,0 +1,30 @@ +bucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days +); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucket.php b/vendor/qiniu/php-sdk/examples/delete_bucket.php new file mode 100644 index 000000000..dc2e30505 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucket.php @@ -0,0 +1,20 @@ +deleteBucket($name); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php b/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php new file mode 100644 index 000000000..00df6cae2 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php @@ -0,0 +1,21 @@ +deleteBucketEvent($bucket, $name); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php b/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php new file mode 100644 index 000000000..a53699267 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php @@ -0,0 +1,21 @@ +deleteBucketLifecycleRule($bucket, $name); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketEvents.php b/vendor/qiniu/php-sdk/examples/get_bucketEvents.php new file mode 100644 index 000000000..53a5c88d2 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketEvents.php @@ -0,0 +1,20 @@ +getBucketEvents($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php b/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php new file mode 100644 index 000000000..652bee8ce --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php @@ -0,0 +1,20 @@ +getBucketLifecycleRules($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketList.php b/vendor/qiniu/php-sdk/examples/get_bucketList.php new file mode 100644 index 000000000..74aaa65f3 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketList.php @@ -0,0 +1,20 @@ +listbuckets($region); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketQuota.php b/vendor/qiniu/php-sdk/examples/get_bucketQuota.php new file mode 100644 index 000000000..563395d61 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketQuota.php @@ -0,0 +1,20 @@ +getBucketQuota($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketinfo.php b/vendor/qiniu/php-sdk/examples/get_bucketinfo.php new file mode 100644 index 000000000..ff052a436 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketinfo.php @@ -0,0 +1,20 @@ +bucketInfo($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketinfos.php b/vendor/qiniu/php-sdk/examples/get_bucketinfos.php new file mode 100644 index 000000000..0ad650325 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketinfos.php @@ -0,0 +1,20 @@ +bucketInfos($region); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_corsRules.php b/vendor/qiniu/php-sdk/examples/get_corsRules.php new file mode 100644 index 000000000..fbfde2d21 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_corsRules.php @@ -0,0 +1,20 @@ +getCorsRules($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php b/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php new file mode 100644 index 000000000..b4539264a --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php @@ -0,0 +1,21 @@ +putBucketAccessMode($bucket, $private); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php b/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php new file mode 100644 index 000000000..2f7c27f2b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php @@ -0,0 +1,21 @@ +putBucketAccessStyleMode($bucket, $mode); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketEvent.php b/vendor/qiniu/php-sdk/examples/put_bucketEvent.php new file mode 100644 index 000000000..33dbb44c0 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketEvent.php @@ -0,0 +1,25 @@ +putBucketEvent($bucket, $name, $prefix, $suffix, $event, $callbackURL); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php b/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php new file mode 100644 index 000000000..77092e90a --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php @@ -0,0 +1,21 @@ +putBucketMaxAge($bucket, $maxAge); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketQuota.php b/vendor/qiniu/php-sdk/examples/put_bucketQuota.php new file mode 100644 index 000000000..18082b631 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketQuota.php @@ -0,0 +1,22 @@ +putBucketQuota($bucket, $size, $count); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php b/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php new file mode 100644 index 000000000..6828bc9ac --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php @@ -0,0 +1,23 @@ +putReferAntiLeech($bucket, $mode, $norefer, $pattern); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_pub_domain.php b/vendor/qiniu/php-sdk/examples/rs_pub_domain.php new file mode 100644 index 000000000..2e81922eb --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_pub_domain.php @@ -0,0 +1,19 @@ +publishDomain($bucket, $domain); +if ($err) { + print_r($err); +} diff --git a/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php b/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php new file mode 100644 index 000000000..4dcf27096 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php @@ -0,0 +1,33 @@ +listFilesv2($bucket, $prefix, $marker, $limit, $delimiter, true); + +if ($err) { + print_r($err); +} else { + print_r($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/update_bucketEvent.php b/vendor/qiniu/php-sdk/examples/update_bucketEvent.php new file mode 100644 index 000000000..26347ac41 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/update_bucketEvent.php @@ -0,0 +1,25 @@ +updateBucketEvent($bucket, $name, $prefix, $suffix, $event, $callbackURL); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php b/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php new file mode 100644 index 000000000..85eb07a6b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php @@ -0,0 +1,30 @@ +updateBucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days +); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/upload_and_callback.php b/vendor/qiniu/php-sdk/examples/upload_and_callback.php index 4762bd330..1a7070557 100644 --- a/vendor/qiniu/php-sdk/examples/upload_and_callback.php +++ b/vendor/qiniu/php-sdk/examples/upload_and_callback.php @@ -1,6 +1,5 @@ 'filename=$(fname)&filesize=$(fsize)' ); $uptoken = $auth->uploadToken($bucket, null, 3600, $policy); - //上传文件的本地路径 $filePath = './php-logo.png'; - //指定 config // $uploadMgr = new UploadManager($config); $uploadMgr = new UploadManager(); - list($ret, $err) = $uploadMgr->putFile($uptoken, null, $filePath); echo "\n====> putFile result: \n"; if ($err !== null) { diff --git a/vendor/qiniu/php-sdk/phpunit.xml.dist b/vendor/qiniu/php-sdk/phpunit.xml.dist index 72ff67f97..840f6e568 100644 --- a/vendor/qiniu/php-sdk/phpunit.xml.dist +++ b/vendor/qiniu/php-sdk/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="true" > diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php index 0e6abac08..c32475793 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php @@ -169,21 +169,22 @@ final class CdnManager */ public static function createTimestampAntiLeechUrl($rawUrl, $encryptKey, $durationInSeconds) { - $parsedUrl = parse_url($rawUrl); $deadline = time() + $durationInSeconds; $expireHex = dechex($deadline); + $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : ''; $path = implode('/', array_map('rawurlencode', explode('/', $path))); - $strToSign = $encryptKey . $path . $expireHex; $signStr = md5($strToSign); + $url = $parsedUrl['scheme'].'://'.$parsedUrl['host'].$path; + if (isset($parsedUrl['query'])) { - $signedUrl = $rawUrl . '&sign=' . $signStr . '&t=' . $expireHex; + $signedUrl = $url . '&sign=' . $signStr . '&t=' . $expireHex; } else { - $signedUrl = $rawUrl . '?sign=' . $signStr . '&t=' . $expireHex; + $signedUrl = $url . '?sign=' . $signStr . '&t=' . $expireHex; } return $signedUrl; diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Config.php b/vendor/qiniu/php-sdk/src/Qiniu/Config.php index b1f63674b..ec75df68b 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Config.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Config.php @@ -3,48 +3,51 @@ namespace Qiniu; final class Config { - const SDK_VER = '7.2.7'; + const SDK_VER = '7.2.9'; const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改 const RSF_HOST = 'rsf.qiniu.com'; const API_HOST = 'api.qiniu.com'; const RS_HOST = 'rs.qiniu.com'; //RS Host - const UC_HOST = 'https://api.qiniu.com'; //UC Host + const UC_HOST = 'uc.qbox.me'; //UC Host const RTCAPI_HOST = 'http://rtc.qiniuapi.com'; const ARGUS_HOST = 'argus.atlab.ai'; + const CASTER_HOST = 'pili-caster.qiniuapi.com'; + const SMS_HOST="https://sms.qiniuapi.com"; const RTCAPI_VERSION = 'v3'; + const SMS_VERSION='v1'; - // Zone 空间对应的机房 - public $zone; + // Zone 空间对应的存储区域 + public $region; //BOOL 是否使用https域名 public $useHTTPS; //BOOL 是否使用CDN加速上传域名 public $useCdnDomains; // Zone Cache - private $zoneCache; + private $regionCache; // 构造函数 - public function __construct(Zone $z = null) + public function __construct(Region $z = null) { $this->zone = $z; $this->useHTTPS = false; $this->useCdnDomains = false; - $this->zoneCache = array(); + $this->regionCache = array(); } public function getUpHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; } else { $scheme = "http://"; } - $host = $zone->srcUpHosts[0]; + $host = $region->srcUpHosts[0]; if ($this->useCdnDomains === true) { - $host = $zone->cdnUpHosts[0]; + $host = $region->cdnUpHosts[0]; } return $scheme . $host; @@ -52,16 +55,16 @@ final class Config public function getUpBackupHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; } else { $scheme = "http://"; } - $host = $zone->cdnUpHosts[0]; + $host = $region->cdnUpHosts[0]; if ($this->useCdnDomains === true) { - $host = $zone->srcUpHosts[0]; + $host = $region->srcUpHosts[0]; } return $scheme . $host; @@ -69,7 +72,7 @@ final class Config public function getRsHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; @@ -77,12 +80,12 @@ final class Config $scheme = "http://"; } - return $scheme . $zone->rsHost; + return $scheme . $region->rsHost; } public function getRsfHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; @@ -90,12 +93,12 @@ final class Config $scheme = "http://"; } - return $scheme . $zone->rsfHost; + return $scheme . $region->rsfHost; } public function getIovipHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; @@ -103,12 +106,12 @@ final class Config $scheme = "http://"; } - return $scheme . $zone->iovipHost; + return $scheme . $region->iovipHost; } public function getApiHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; @@ -116,22 +119,22 @@ final class Config $scheme = "http://"; } - return $scheme . $zone->apiHost; + return $scheme . $region->apiHost; } - private function getZone($accessKey, $bucket) + private function getRegion($accessKey, $bucket) { $cacheId = "$accessKey:$bucket"; - if (isset($this->zoneCache[$cacheId])) { - $zone = $this->zoneCache[$cacheId]; + if (isset($this->regionCache[$cacheId])) { + $region = $this->regionCache[$cacheId]; } elseif (isset($this->zone)) { - $zone = $this->zone; - $this->zoneCache[$cacheId] = $zone; + $region = $this->zone; + $this->regionCache[$cacheId] = $region; } else { - $zone = Zone::queryZone($accessKey, $bucket); - $this->zoneCache[$cacheId] = $zone; + $region = Zone::queryZone($accessKey, $bucket); + $this->regionCache[$cacheId] = $region; } - return $zone; + return $region; } } diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php b/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php index 425c314cf..0fe03ceed 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php @@ -25,6 +25,12 @@ final class Client return self::sendRequest($request); } + public static function PUT($url, $body, array $headers = array()) + { + $request = new Request('PUT', $url, $headers, $body); + return self::sendRequest($request); + } + public static function multipartPost( $url, $fields, @@ -56,6 +62,7 @@ final class Client array_push($data, ''); $body = implode("\r\n", $data); + // var_dump($data);exit; $contentType = 'multipart/form-data; boundary=' . $mimeBoundary; $headers['Content-Type'] = $contentType; $request = new Request('POST', $url, $headers, $body); @@ -91,12 +98,10 @@ final class Client CURLOPT_CUSTOMREQUEST => $request->method, CURLOPT_URL => $request->url, ); - // Handle open_basedir & safe mode if (!ini_get('safe_mode') && !ini_get('open_basedir')) { $options[CURLOPT_FOLLOWLOCATION] = true; } - if (!empty($request->headers)) { $headers = array(); foreach ($request->headers as $key => $val) { @@ -105,7 +110,6 @@ final class Client $options[CURLOPT_HTTPHEADER] = $headers; } curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); - if (!empty($request->body)) { $options[CURLOPT_POSTFIELDS] = $request->body; } diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Region.php b/vendor/qiniu/php-sdk/src/Qiniu/Region.php new file mode 100644 index 000000000..eae21d199 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Region.php @@ -0,0 +1,196 @@ +srcUpHosts = $srcUpHosts; + $this->cdnUpHosts = $cdnUpHosts; + $this->rsHost = $rsHost; + $this->rsfHost = $rsfHost; + $this->apiHost = $apiHost; + $this->iovipHost = $iovipHost; + } + + //华东机房 + public static function regionHuadong() + { + $regionHuadong = new Region( + array("up.qiniup.com", 'up-jjh.qiniup.com', 'up-xs.qiniup.com'), + array('upload.qiniup.com', 'upload-jjh.qiniup.com', 'upload-xs.qiniup.com'), + 'rs.qbox.me', + 'rsf.qbox.me', + 'api.qiniu.com', + 'iovip.qbox.me' + ); + return $regionHuadong; + } + + //华东机房内网上传 + public static function qvmRegionHuadong() + { + $qvmRegionHuadong = new Region( + array("free-qvm-z0-xs.qiniup.com"), + 'rs.qbox.me', + 'rsf.qbox.me', + 'api.qiniu.com', + 'iovip.qbox.me' + ); + return $qvmRegionHuadong; + } + + //华北机房内网上传 + public static function qvmRegionHuabei() + { + $qvmRegionHuabei = new Region( + array("free-qvm-z1-zz.qiniup.com"), + "rs-z1.qbox.me", + "rsf-z1.qbox.me", + "api-z1.qiniu.com", + "iovip-z1.qbox.me" + ); + return $qvmRegionHuabei; + } + + //华北机房 + public static function regionHuabei() + { + $regionHuabei = new Region( + array('up-z1.qiniup.com'), + array('upload-z1.qiniup.com'), + "rs-z1.qbox.me", + "rsf-z1.qbox.me", + "api-z1.qiniu.com", + "iovip-z1.qbox.me" + ); + + return $regionHuabei; + } + + //华南机房 + public static function regionHuanan() + { + $regionHuanan = new Region( + array('up-z2.qiniup.com', 'up-dg.qiniup.com', 'up-fs.qiniup.com'), + array('upload-z2.qiniup.com', 'upload-dg.qiniup.com', 'upload-fs.qiniup.com'), + "rs-z2.qbox.me", + "rsf-z2.qbox.me", + "api-z2.qiniu.com", + "iovip-z2.qbox.me" + ); + return $regionHuanan; + } + + //北美机房 + public static function regionNorthAmerica() + { + //北美机房 + $regionNorthAmerica = new Region( + array('up-na0.qiniup.com'), + array('upload-na0.qiniup.com'), + "rs-na0.qbox.me", + "rsf-na0.qbox.me", + "api-na0.qiniu.com", + "iovip-na0.qbox.me" + ); + return $regionNorthAmerica; + } + + //新加坡机房 + public static function regionSingapore() + { + //新加坡机房 + $regionSingapore = new Region( + array('up-as0.qiniup.com'), + array('upload-as0.qiniup.com'), + "rs-as0.qbox.me", + "rsf-as0.qbox.me", + "api-as0.qiniu.com", + "iovip-as0.qbox.me" + ); + return $regionSingapore; + } + + /* + * GET /v2/query?ak=&&bucket= + **/ + public static function queryRegion($ak, $bucket) + { + $Region = new Region(); + $url = Config::API_HOST . '/v2/query' . "?ak=$ak&bucket=$bucket"; + $ret = Client::Get($url); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + //parse Region; + + $iovipHost = $r['io']['src']['main'][0]; + $Region->iovipHost = $iovipHost; + $accMain = $r['up']['acc']['main'][0]; + array_push($Region->cdnUpHosts, $accMain); + if (isset($r['up']['acc']['backup'])) { + foreach ($r['up']['acc']['backup'] as $key => $value) { + array_push($Region->cdnUpHosts, $value); + } + } + $srcMain = $r['up']['src']['main'][0]; + array_push($Region->srcUpHosts, $srcMain); + if (isset($r['up']['src']['backup'])) { + foreach ($r['up']['src']['backup'] as $key => $value) { + array_push($Region->srcUpHosts, $value); + } + } + + //set specific hosts + if (strstr($Region->iovipHost, "z1") !== false) { + $Region->rsHost = "rs-z1.qbox.me"; + $Region->rsfHost = "rsf-z1.qbox.me"; + $Region->apiHost = "api-z1.qiniu.com"; + } elseif (strstr($Region->iovipHost, "z2") !== false) { + $Region->rsHost = "rs-z2.qbox.me"; + $Region->rsfHost = "rsf-z2.qbox.me"; + $Region->apiHost = "api-z2.qiniu.com"; + } elseif (strstr($Region->iovipHost, "na0") !== false) { + $Region->rsHost = "rs-na0.qbox.me"; + $Region->rsfHost = "rsf-na0.qbox.me"; + $Region->apiHost = "api-na0.qiniu.com"; + } elseif (strstr($Region->iovipHost, "as0") !== false) { + $Region->rsHost = "rs-as0.qbox.me"; + $Region->rsfHost = "rsf-as0.qbox.me"; + $Region->apiHost = "api-as0.qiniu.com"; + } else { + $Region->rsHost = "rs.qbox.me"; + $Region->rsfHost = "rsf.qbox.me"; + $Region->apiHost = "api.qiniu.com"; + } + + return $Region; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php index c07ee72f3..0fd0019a4 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php @@ -19,6 +19,7 @@ class AppClient } /* + * 创建应用 * hub: 直播空间名 * title: app 的名称 注意,Title 不是唯一标识,重复 create 动作将生成多个 app * maxUsers:人数限制 @@ -41,6 +42,7 @@ class AppClient } /* + * 更新应用 * appId: app 的唯一标识,创建的时候由系统生成。 * Title: app 的名称, 可选。 * Hub: 绑定的直播 hub,可选,用于合流后 rtmp 推流。 @@ -75,6 +77,7 @@ class AppClient } /* + * 获取应用信息 * appId: app 的唯一标识,创建的时候由系统生成。 */ public function getApp($appId) @@ -85,6 +88,7 @@ class AppClient } /* + * 删除应用 * appId: app 的唯一标识,创建的时候由系统生成 */ public function deleteApp($appId) @@ -95,7 +99,7 @@ class AppClient } /* - * 获取房间的人数 + * 获取房间内用户列表 * appId: app 的唯一标识,创建的时候由系统生成。 * roomName: 操作所查询的连麦房间。 */ @@ -107,7 +111,7 @@ class AppClient } /* - * 踢出玩家 + * 踢出用户 * appId: app 的唯一标识,创建的时候由系统生成。 * roomName: 连麦房间 * userId: 请求加入房间的用户ID @@ -120,7 +124,7 @@ class AppClient } /* - * 获取房间的人数 + * 获取应用中活跃房间 * appId: app 的唯一标识,创建的时候由系统生成。 * prefix: 所查询房间名的前缀索引,可以为空。 * offset: int 类型,分页查询的位移标记。 @@ -149,6 +153,7 @@ class AppClient } /* + * 生成加入房间的令牌 * appId: app 的唯一标识,创建的时候由系统生成。 * roomName: 房间名称,需满足规格 ^[a-zA-Z0-9_-]{3,64}$ * userId: 请求加入房间的用户 ID,需满足规格 ^[a-zA-Z0-9_-]{3,50}$ diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php b/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php new file mode 100644 index 000000000..592d6ba70 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php @@ -0,0 +1,337 @@ +auth = $auth; + + $this->baseURL = sprintf("%s/%s/", Config::SMS_HOST, Config::SMS_VERSION); + } + + /* + * 创建签名 + * signature: string 类型,必填,【长度限制8个字符内】超过长度会报错 + * source: string 类型,必填,申请签名时必须指定签名来源。取值范围为: + nterprises_and_institutions 企事业单位的全称或简称 + website 工信部备案网站的全称或简称 + app APP应用的全称或简称 + public_number_or_small_program 公众号或小程序的全称或简称 + store_name 电商平台店铺名的全称或简称 + trade_name 商标名的全称或简称, + * pics: 本地的图片路径 string 类型,可选 + *@return: 类型array { + "signature_id": + } + */ + public function createSignature(string $signature, string $source, string $pics = null) + { + $params['signature'] = $signature; + $params['source'] = $source; + if (!empty($pics)) { + $params['pics'] = $this->imgToBase64($pics); + } + $body = json_encode($params); + $url =$this->baseURL.'signature'; + $ret = $this->post($url, $body); + return $ret; + } + + /* + * 编辑签名 + * id 签名id : string 类型,必填, + * signature: string 类型,必填, + * source: string 类型,必填,申请签名时必须指定签名来源。取值范围为: + enterprises_and_institutions 企事业单位的全称或简称 + website 工信部备案网站的全称或简称 + app APP应用的全称或简称 + public_number_or_small_program 公众号或小程序的全称或简称 + store_name 电商平台店铺名的全称或简称 + trade_name 商标名的全称或简称, + * pics: 本地的图片路径 string 类型,可选, + * @return: 类型array { + "signature": string + } + */ + public function updateSignature(string $id, string $signature, string $source, string $pics = null) + { + $params['signature'] = $signature; + $params['source'] = $source; + if (!empty($pics)) { + $params['pics'] = $this->imgToBase64($pics); + } + $body = json_encode($params); + $url =$this->baseURL.'signature/'.$id; + $ret = $this->PUT($url, $body); + return $ret; + } + + /* + * 查询签名 + * audit_status: 审核状态 string 类型,可选, + 取值范围为: "passed"(通过), "rejected"(未通过), "reviewing"(审核中) + * page:页码 int 类型, + * page_size: 分页大小 int 类型,可选, 默认为20 + *@return: 类型array { + "items": [{ + "id": string, + "signature": string, + "source": string, + "audit_status": string, + "reject_reason": string, + "created_at": int64, + "updated_at": int64 + }...], + "total": int, + "page": int, + "page_size": int, + } + */ + public function checkSignature(string $audit_status = null, int $page = 1, int $page_size = 20) + { + + $url = sprintf( + "%s?audit_status=%s&page=%s&page_size=%s", + $this->baseURL.'signature', + $audit_status, + $page, + $page_size + ); + $ret = $this->get($url); + return $ret; + } + + + /* + * 删除签名 + * id 签名id string 类型,必填, + * @retrun : 请求成功 HTTP 状态码为 200 + */ + public function deleteSignature(string $id) + { + $url = $this->baseURL . 'signature/' . $id; + list(, $err) = $this->delete($url); + return $err; + } + + + + + /* + * 创建模板 + * name : 模板名称 string 类型 ,必填 + * template: 模板内容 string 类型,必填 + * type: 模板类型 string 类型,必填, + 取值范围为: notification (通知类短信), verification (验证码短信), marketing (营销类短信) + * description: 申请理由简述 string 类型,必填 + * signature_id: 已经审核通过的签名 string 类型,必填 + * @return: 类型 array { + "template_id": string + } + */ + public function createTemplate( + string $name, + string $template, + string $type, + string $description, + string $signture_id + ) { + $params['name'] = $name; + $params['template'] = $template; + $params['type'] = $type; + $params['description'] = $description; + $params['signature_id'] = $signture_id; + + $body = json_encode($params); + $url =$this->baseURL.'template'; + $ret = $this->post($url, $body); + return $ret; + } + + /* + * 查询模板 + * audit_status: 审核状态 string 类型 ,可选, + 取值范围为: passed (通过), rejected (未通过), reviewing (审核中) + * page: 页码 int 类型,可选,默认为 1 + * page_size: 分页大小 int 类型,可选,默认为 20 + * @return: 类型array{ + "items": [{ + "id": string, + "name": string, + "template": string, + "audit_status": string, + "reject_reason": string, + "type": string, + "signature_id": string, // 模版绑定的签名ID + "signature_text": string, // 模版绑定的签名内容 + "created_at": int64, + "updated_at": int64 + }...], + "total": int, + "page": int, + "page_size": int + } + */ + public function queryTemplate(string $audit_status = null, int $page = 1, int $page_size = 20) + { + + $url = sprintf( + "%s?audit_status=%s&page=%s&page_size=%s", + $this->baseURL.'template', + $audit_status, + $page, + $page_size + ); + $ret = $this->get($url); + return $ret; + } + + /* + * 编辑模板 + * id :模板id + * name : 模板名称 string 类型 ,必填 + * template: 模板内容 string 类型,必填 + * description: 申请理由简述 string 类型,必填 + * signature_id: 已经审核通过的签名 string 类型,必填 + * @retrun : 请求成功 HTTP 状态码为 200 + */ + public function updateTemplate( + string $id, + string $name, + string $template, + string $description, + string $signature_id + ) { + $params['name'] = $name; + $params['template'] = $template; + $params['description'] = $description; + $params['signature_id'] = $signature_id; + $body = json_encode($params); + $url =$this->baseURL.'template/'.$id; + $ret = $this->PUT($url, $body); + return $ret; + } + + /* + * 删除模板 + * id :模板id string 类型,必填, + * @retrun : 请求成功 HTTP 状态码为 200 + */ + public function deleteTemplate(string $id) + { + $url = $this->baseURL . 'template/' . $id; + list(, $err) = $this->delete($url); + return $err; + } + + /* + * 发送短信 + * 编辑模板 + * template_id :模板id string类型,必填 + * mobiles : 手机号数组 []string 类型 ,必填 + * parameters: 模板内容 map[string]string 类型,可选 + * @return: 类型json { + "job_id": string + } + */ + public function sendMessage(string $template_id, array $mobiles, array $parameters = null) + { + $params['template_id'] = $template_id; + $params['mobiles'] = $mobiles; + if (!empty($parameters)) { + $params['parameters'] = $parameters; + } + $body = json_encode($params); + $url =$this->baseURL.'message'; + $ret = $this->post($url, $body); + return $ret; + } + + public function imgToBase64(string $img_file) + { + $img_base64 = ''; + if (file_exists($img_file)) { + $app_img_file = $img_file; // 图片路径 + $img_info = getimagesize($app_img_file); // 取得图片的大小,类型等 + $fp = fopen($app_img_file, "r"); // 图片是否可读权限 + if ($fp) { + $filesize = filesize($app_img_file); + if ($filesize > 5*1024*1024) { + die("pic size < 5M !"); + } + $content = fread($fp, $filesize); + $file_content = chunk_split(base64_encode($content)); // base64编码 + switch ($img_info[2]) { //判读图片类型 + case 1: + $img_type = 'gif'; + break; + case 2: + $img_type = 'jpg'; + break; + case 3: + $img_type = 'png'; + break; + } + //合成图片的base64编码 + $img_base64 = 'data:image/' . $img_type . ';base64,' . $file_content; + } + fclose($fp); + } + + return $img_base64; + } + + private function get($url, $cType = null) + { + $rtcToken = $this->auth->authorizationV2($url, "GET", null, $cType); + $rtcToken['Content-Type'] = $cType; + $ret = Client::get($url, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function delete($url, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "DELETE", null, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::delete($url, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function post($url, $body, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "POST", $body, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::post($url, $body, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } + private function PUT($url, $body, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "PUT", $body, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::put($url, $body, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php index 2e82a1477..e38f433ea 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php @@ -41,6 +41,56 @@ final class BucketManager return $this->rsGet('/buckets?shared=' . $includeShared); } + /** + * 列举空间,返回bucket列表 + * region 指定区域,global 指定全局空间。 + * 在指定了 region 参数时, + * 如果指定 global 为 true,那么忽略 region 参数指定的区域,返回所有区域的全局空间。 + * 如果没有指定 global 为 true,那么返回指定区域中非全局空间。 + * 在没有指定 region 参数时(包括指定为空""), + * 如果指定 global 为 true,那么返回所有区域的全局空间。 + * 如果没有指定 global 为 true,那么返回指定区域中所有的空间,包括全局空间。 + * 在指定了line为 true 时,只返回 Line 空间;否则,只返回非 Line 空间。 + * share 参数用于指定共享空间。 + */ + + public function listbuckets( + $region = null, + $line = 'false', + $shared = 'false' + ) { + $path = '/v3/buckets?region=' . $region . '&line=' . $line . '&shared=' . $share; + $info = $this->ucPost($path); + return $info; + } + + /** + * 创建空间 + * + * @param $name 创建的空间名 + * @param $region 创建的区域,默认华东 + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function createBucket($name, $region = 'z0') + { + $path = '/mkbucketv2/'.$name.'/region/' . $region; + return $this->rsPost($path, null); + } + + /** + * 删除空间 + * + * @param $name 删除的空间名 + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function deleteBucket($name) + { + $path = '/drop/'.$name; + return $this->rsPost($path, null); + } + /** * 获取指定空间绑定的所有的域名 * @@ -51,6 +101,34 @@ final class BucketManager return $this->apiGet('/v6/domain/list?tbl=' . $bucket); } + /** + * 获取指定空间的相关信息 + * + * @return string[] 包含空间信息 + */ + public function bucketInfo($bucket) + { + $path = '/v2/bucketInfo?bucket=' . $bucket; + $info = $this->ucPost($path); + return $info; + } + + /** + * 获取指定zone的空间信息列表 + * 在Region 未指定且Global 不为 true 时(包含未指定的情况,下同),返回用户的所有空间。 + * 在指定了 region 参数且 global 不为 true 时,只列举非全局空间。 + * shared 不指定shared参数或指定shared为rw或false时,返回包含具有读写权限空间, + * 指定shared为rd或true时,返回包含具有读权限空间。 + * fs:如果为 true,会返回每个空间当前的文件数和存储量(实时数据)。 + * @return string[] 包含空间信息 + */ + public function bucketInfos($region = null, $shared = 'false', $fs = 'false') + { + $path = '/v2/bucketInfos?region=' . $region . '&shared=' . $shared . '&fs=' . $fs; + $info = $this->ucPost($path); + return $info; + } + /** * 获取空间绑定的域名列表 * @return string[] 包含空间绑定的所有域名 @@ -66,18 +144,23 @@ final class BucketManager * @param $delimiter 指定目录分隔符 * * @return array 包含文件信息的数组,类似:[ - * { - * "hash" => "", - * "key" => "", - * "fsize" => "", - * "putTime" => "" - * }, - * ... - * ] +* { +* "hash" => "", +* "key" => "", +* "fsize" => "", +* "putTime" => "" +* }, +* ... +* ] * @link http://developer.qiniu.com/docs/v6/api/reference/rs/list.html */ - public function listFiles($bucket, $prefix = null, $marker = null, $limit = 1000, $delimiter = null) - { + public function listFiles( + $bucket, + $prefix = null, + $marker = null, + $limit = 1000, + $delimiter = null + ) { $query = array('bucket' => $bucket); \Qiniu\setWithoutEmpty($query, 'prefix', $prefix); \Qiniu\setWithoutEmpty($query, 'marker', $marker); @@ -87,6 +170,493 @@ final class BucketManager return $this->get($url); } + /** + * 列取空间的文件列表 + * + * @param $bucket 空间名 + * @param $prefix 列举前缀 + * @param $marker 列举标识符 + * @param $limit 单次列举个数限制 + * @param $delimiter 指定目录分隔符 + * @param $skipconfirm 是否跳过已删除条目的确认机制 + * + * @return array 包含文件信息的数组,类似:[ +* { +* "hash" => "", +* "key" => "", +* "fsize" => "", +* "putTime" => "" +* }, +* ... +* ] + * @link http://developer.qiniu.com/docs/v6/api/reference/rs/list.html + */ + public function listFilesv2( + $bucket, + $prefix = null, + $marker = null, + $limit = 1000, + $delimiter = null, + $skipconfirm = true + ) { + $query = array('bucket' => $bucket); + \Qiniu\setWithoutEmpty($query, 'prefix', $prefix); + \Qiniu\setWithoutEmpty($query, 'marker', $marker); + \Qiniu\setWithoutEmpty($query, 'limit', $limit); + \Qiniu\setWithoutEmpty($query, 'delimiter', $delimiter); + \Qiniu\setWithoutEmpty($query, 'skipconfirm', $skipconfirm); + $path = '/v2/list?' . http_build_query($query); + $url = $this->getRsfHost() . $path; + $headers = $this->auth->authorization($url, null, 'application/x-www-form-urlencoded'); + $ret = Client::post($url, null, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = explode("\n", $ret->body); + $pop = array_pop($r); + return array($r, null); + } + + /** + * 设置Referer防盗链 + * + * @param $bucket 空间名 + * @param $mode 0: 表示关闭Referer(使用此选项将会忽略以下参数并将恢复默认值); + * 1: 表示设置Referer白名单; 2:表示设置Referer黑名单 + * @param $norefer 0: 表示不允许空 Refer 访问; 1: 表示允许空 Refer 访问 + * @param $pattern 规则字符串, 当前允许格式分为三种: 一种为空主机头域名, + * 比如 foo.com; 一种是泛域名,比如 *.bar.com; 一种是完全通配符, + * 即一个 *; 多个规则之间用;隔开, 比如: foo.com;*.bar.com;sub.foo.com;*.sub.bar.com + * @param $source_enabled 源站是否支持,默认为0只给CDN配置, 设置为1表示开启源站防盗链 + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + // public function referAntiLeech(){ + + // } + + /** + * 增加bucket生命规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空,只能为 + * 字母、数字、下划线 + * @param $prefix 同一个 bucket 里面前缀不能重复 + * @param $delete_after_days 指定上传文件多少天后删除,指定为0表示不删除, + * 大于0表示多少天后删除,需大于 to_line_after_days + * @param $to_line_after_days 指定文件上传多少天后转低频存储。指定为0表示 + * 不转低频存储,小于0表示上传的文件立即变低频存储 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function bucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days + ) { + $path = '/rules/add'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($delete_after_days) { + $params['delete_after_days'] = $delete_after_days; + } + if ($to_line_after_days) { + $params['to_line_after_days'] = $to_line_after_days; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 更新bucket生命规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、 + * 数字、下划线 + * @param $prefix 同一个 bucket 里面前缀不能重复 + * @param $delete_after_days 指定上传文件多少天后删除,指定为0表示不删除, + * 大于0表示多少天后删除,需大于 to_line_after_days + * @param $to_line_after_days 指定文件上传多少天后转低频存储。指定为0表示不 + * 转低频存储,小于0表示上传的文件立即变低频存储 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function updateBucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days + ) { + $path = '/rules/update'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($delete_after_days) { + $params['delete_after_days'] = $delete_after_days; + } + if ($to_line_after_days) { + $params['to_line_after_days'] = $to_line_after_days; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 获取bucket生命规则 + * + * @param $bucket 空间名 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function getBucketLifecycleRules($bucket) + { + $path = '/rules/get?bucket=' . $bucket; + $info = $this->ucGet($path); + return $info; + } + + /** + * 删除bucket生命规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function deleteBucketLifecycleRule($bucket, $name) + { + $path = '/rules/delete'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 增加bucket事件通知规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @param $prefix 同一个 bucket 里面前缀不能重复 + * @param $suffix 可选,文件配置的后缀 + * @param $event 事件类型,可以指定多个,包括 put,mkfile,delete,copy,move,append, + * disable,enable,deleteMarkerCreate + * @param $callbackURL 通知URL,可以指定多个,失败依次重试 + * @param $access_key 可选,设置的话会对通知请求用对应的ak、sk进行签名 + * @param $host 可选,通知请求的host + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function putBucketEvent( + $bucket, + $name, + $prefix, + $suffix, + $event, + $callbackURL, + $access_key = null, + $host = null + ) { + $path = '/events/add'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($suffix) { + $params['suffix'] = $suffix; + } + if ($callbackURL) { + $params['callbackURL'] = $callbackURL; + } + if ($access_key) { + $params['access_key'] = $access_key; + } + if ($host) { + $params['host'] = $host; + } + $data = http_build_query($params); + if ($event) { + $eventpath = ""; + foreach ($event as $key => $value) { + $eventpath .= "&event=$value"; + } + $data .= $eventpath; + } + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 更新bucket事件通知规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @param $prefix 同一个 bucket 里面前缀不能重复 + * @param $suffix 可选,文件配置的后缀 + * @param $event 事件类型,可以指定多个,包括 put,mkfile,delete,copy,move,append,disable, + * enable,deleteMarkerCreate + * @param $callbackURL 通知URL,可以指定多个,失败依次重试 + * @param $access_key 可选,设置的话会对通知请求用对应的ak、sk进行签名 + * @param $host 可选,通知请求的host + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function updateBucketEvent( + $bucket, + $name, + $prefix, + $suffix, + $event, + $callbackURL, + $access_key = null, + $host = null + ) { + $path = '/events/update'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($suffix) { + $params['suffix'] = $suffix; + } + if ($event) { + $params['event'] = $event; + } + if ($callbackURL) { + $params['callbackURL'] = $callbackURL; + } + if ($access_key) { + $params['access_key'] = $access_key; + } + if ($host) { + $params['host'] = $host; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 获取bucket事件通知规则 + * + * @param $bucket 空间名 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function getBucketEvents($bucket) + { + $path = '/events/get?bucket=' . $bucket; + $info = $this->ucGet($path); + return $info; + } + + /** + * 删除bucket事件通知规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function deleteBucketEvent($bucket, $name) + { + $path = '/events/delete'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 设置bucket的跨域信息,最多允许设置10条跨域规则。 + * 对于同一个域名如果设置了多条规则,那么按顺序使用第一条匹配的规则去生成返回值。 + * 对于简单跨域请求,只匹配 Origin; + * allowed_orgin: 允许的域名。必填;支持通配符*;*表示全部匹配;只有第一个*生效; + * 需要设置"Scheme";大小写敏感。例如 + * 规则:http://*.abc.*.com 请求:"http://test.abc.test.com" 结果:不通过 + * 规则:"http://abc.com" 请求:"https://abc.com"/"abc.com" 结果:不通过 + * 规则:"abc.com" 请求:"http://abc.com" 结果:不通过 + * allowed_method: 允许的方法。必填;不支持通配符;大小写不敏感; + * allowed_header: 允许的header。选填;支持通配符*, + * 但只能是单独的*,表示允许全部header,其他*不生效; + * 空则不允许任何header;大小写不敏感; + * exposed_header: 暴露的header。选填;不支持通配符; + * X-Log, X-Reqid是默认会暴露的两个header; + * 其他的header如果没有设置,则不会暴露;大小写不敏感; + * max_age: 结果可以缓存的时间。选填;空则不缓存; + * allowed_credentials:该配置不支持设置,默认为true。 + * 备注:如果没有设置任何corsRules,那么默认允许所有的跨域请求 + */ + // public function putCorsRules(string $bucket, array $params) + // { + // $path = '/corsRules/set/' . $bucket; + // $data = json_encode($params); + // $info = $this->ucPost($path, $data); + // return $info; + // } + + /** + * 获取bucket的跨域信息 + * $bucket 空间名 + */ + public function getCorsRules($bucket) + { + $path = '/corsRules/get/' . $bucket; + $info = $this->ucGet($path); + return $info; + } + + /** + * 设置回源规则 + * 使用该API设置源站优先级高于/image设置的源站,即IO优先读取source接口设置的源站配置, + * 如果存在会忽略/image设置的源站 + * Bucket 空间名 + * Host(可选)回源Host + * RetryCodes(可选),镜像回源时源站返回Code可以重试,最多指定3个,当前只支持4xx错误码重试 + * SourceQiniuAK,SourceQiniuSK(可选)如果存在将在回源时对URL进行签名,客户源站可以验证 + * 以保证请求来自Qiniu服务器 + * Expires(可选) 签名过期时间,如果不设置默认为1小时 + * Addr 回源地址,不可重复。 + * Weight 权重,范围限制1-100,不填默认为1,回源时会根据所有源的权重值进行源站选择, + * 主备源会分开计算. + * Backup 是否备用回源,回源优先尝试主源 + */ + // public function putBucktSourceConfig(array $params) + // { + // $path = '/mirrorConfig/set'; + // $data = json_encode($params); + // $info = $this->ucPostV2($path, $data); + // return $info; + // } + + /** + * 获取空间回源配置 + */ + public function getBucktSourceConfig(array $params) + { + $path = '/mirrorConfig/get'; + $data = json_encode($params); + $info = $this->ucPostV2($path, $data); + return $info; + } + + /** + * 开关原图保护 + * mode 为1表示开启原图保护,0表示关闭 + */ + public function putBucketAccessStyleMode($bucket, $mode) + { + $path = '/accessMode/' . $bucket . '/mode/' . $mode; + $info = $this->ucPost($path, null); + return $info; + } + + /** + * 设置私有属性 + * private为0表示公开,为1表示私有 + */ + public function putBucketAccessMode($bucket, $private) + { + $path = '/bucket/' . $bucket . '/private/' . $private; + $info = $this->ucPost($path, null); + return $info; + } + + /** + * 设置referer防盗链 + * bucket=: bucket 名 + * mode=: + * 0: 表示关闭Referer(使用此选项将会忽略以下参数并将恢复默认值); + * 1: 表示设置Referer白名单; 2: 表示设置Referer黑名单 + * norefer=: 0: 表示不允许空 Refer 访问; + * 1: 表示允许空 Refer 访问 + * pattern=: 规则字符串, 当前允许格式分为三种: + * 一种为空主机头域名, 比如 foo.com; + * 一种是泛域名, 比如 *.bar.com; 一种是完全通配符, 即一个 *; + * 多个规则之间用;隔开, 比如: foo.com;*.bar.com;sub.foo.com;*.sub.bar.com + * 空主机头域名可以是多级域名,比如 foo.bar.com。 + * 多个域名之间不允许夹带空白字符。 + * source_enabled=:1 + */ + public function putReferAntiLeech($bucket, $mode, $norefer, $pattern, $enabled = 1) + { + $path = "/referAntiLeech?bucket=$bucket&mode=$mode&norefer=$norefer&pattern=$pattern&source_enabled=$enabled"; + $info = $this->ucPost($path, null); + return $info; + } + + /** + * 设置Bucket的maxAge + * maxAge为0或者负数表示为默认值(31536000) + */ + public function putBucketMaxAge($bucket, $maxAge) + { + $path = '/maxAge?bucket=' . $bucket . '&maxAge=' . $maxAge; + $info = $this->ucPost($path, null); + return $info; + } + + /** + * 设置配额 + * : 空间名称,不支持授权空间 + * : 空间存储量配额,参数传入0或不传表示不更改当前配置,传入-1表示取消限额, + * 新创建的空间默认没有限额。 + * : 空间文件数配额,参数含义同 + */ + public function putBucketQuota($bucket, $size, $count) + { + $path = '/setbucketquota/' . $bucket . '/size/' . $size . '/count/' . $count; + $info = $this->apiPost($path, null); + return $info; + } + + /** + * 获取配额 + * bucket 空间名称 + */ + public function getBucketQuota($bucket) + { + $path = '/getbucketquota/' . $bucket; + $info = $this->apiPost($path, null); + return $info; + } + /** * 获取资源的元信息,但不返回文件内容 * @@ -94,13 +664,13 @@ final class BucketManager * @param $key 待获取资源的文件名 * * @return array 包含文件信息的数组,类似: - * [ - * "hash" => "", - * "key" => "", - * "fsize" => , - * "putTime" => "" - * "fileType" => - * ] +* [ +* "hash" => "", +* "key" => "", +* "fsize" => , +* "putTime" => "" +* "fileType" => +* ] * * @link http://developer.qiniu.com/docs/v6/api/reference/rs/stat.html */ @@ -142,7 +712,7 @@ final class BucketManager } /** - * 给资源进行重命名,本质为move操作。 + * 对资源进行复制。 * * @param $from_bucket 待操作资源所在空间 * @param $from_key 待操作资源文件名 @@ -188,7 +758,7 @@ final class BucketManager } /** - * 主动修改指定资源的文件类型 + * 主动修改指定资源的文件元信息 * * @param $bucket 待操作资源所在空间 * @param $key 待操作资源文件名 @@ -368,12 +938,39 @@ final class BucketManager return $scheme . Config::API_HOST; } + private function getUcHost() + { + $scheme = "http://"; + if ($this->config->useHTTPS == true) { + $scheme = "https://"; + } + return $scheme . Config::UC_HOST; + } + private function rsPost($path, $body = null) { $url = $this->getRsHost() . $path; return $this->post($url, $body); } + private function apiPost($path, $body = null) + { + $url = $this->getApiHost() . $path; + return $this->post($url, $body); + } + + private function ucPost($path, $body = null) + { + $url = $this->getUcHost() . $path; + return $this->post($url, $body); + } + + private function ucGet($path) + { + $url = $this->getUcHost() . $path; + return $this->get($url); + } + private function apiGet($path) { $url = $this->getApiHost() . $path; @@ -407,6 +1004,24 @@ final class BucketManager return array($r, null); } + private function ucPostV2($path, $body) + { + $url = $this->getUcHost() . $path; + return $this->postV2($url, $body); + } + + private function postV2($url, $body) + { + $headers = $this->auth->authorizationV2($url, 'POST', $body, 'application/json'); + $headers["Content-Type"] = 'application/json'; + $ret = Client::post($url, $body, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } + public static function buildBatchCopy($source_bucket, $key_pairs, $target_bucket, $force) { return self::twoKeyBatch('/copy', $source_bucket, $key_pairs, $target_bucket, $force); diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php index 5c3361f96..d87756a02 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php @@ -33,10 +33,8 @@ final class FormUploader $mime, $fname ) { - $fields = array('token' => $upToken); if ($key === null) { - $fname='nullkey'; } else { $fields['key'] = $key; } diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Zone.php b/vendor/qiniu/php-sdk/src/Qiniu/Zone.php index 9b142dcc7..7af0e3f54 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Zone.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Zone.php @@ -1,197 +1,47 @@ srcUpHosts = $srcUpHosts; - $this->cdnUpHosts = $cdnUpHosts; - $this->rsHost = $rsHost; - $this->rsfHost = $rsfHost; - $this->apiHost = $apiHost; - $this->iovipHost = $iovipHost; - } - - //华东机房 - public static function zone0() + public static function zonez0() { - $Zone_z0 = new Zone( - array("up.qiniup.com", 'up-jjh.qiniup.com', 'up-xs.qiniup.com'), - array('upload.qiniup.com', 'upload-jjh.qiniup.com', 'upload-xs.qiniup.com'), - 'rs.qbox.me', - 'rsf.qbox.me', - 'api.qiniu.com', - 'iovip.qbox.me' - ); - return $Zone_z0; + return parent::regionHuadong(); } - //华东机房内网上传 - public static function zoneZ0() + public static function zonez1() { - $Zone_z01 = new Zone( - array("free-qvm-z0-xs.qiniup.com"), - 'rs.qbox.me', - 'rsf.qbox.me', - 'api.qiniu.com', - 'iovip.qbox.me' - ); - return $Zone_z01; + return parent::regionHuabei(); } - //华北机房内网上传 - public static function zoneZ1() + public static function zonez2() { - $Zone_z12 = new Zone( - array("free-qvm-z1-zz.qiniup.com"), - "rs-z1.qbox.me", - "rsf-z1.qbox.me", - "api-z1.qiniu.com", - "iovip-z1.qbox.me" - ); - return $Zone_z12; + return parent::regionHuanan(); } - //华北机房 - public static function zone1() - { - $Zone_z1 = new Zone( - array('up-z1.qiniup.com'), - array('upload-z1.qiniup.com'), - "rs-z1.qbox.me", - "rsf-z1.qbox.me", - "api-z1.qiniu.com", - "iovip-z1.qbox.me" - ); - - return $Zone_z1; - } - - //华南机房 - public static function zone2() - { - $Zone_z2 = new Zone( - array('up-z2.qiniup.com', 'up-dg.qiniup.com', 'up-fs.qiniup.com'), - array('upload-z2.qiniup.com', 'upload-dg.qiniup.com', 'upload-fs.qiniup.com'), - "rs-z2.qbox.me", - "rsf-z2.qbox.me", - "api-z2.qiniu.com", - "iovip-z2.qbox.me" - ); - return $Zone_z2; - } - - //北美机房 - public static function zoneNa0() - { - //北美机房 - $Zone_na0 = new Zone( - array('up-na0.qiniup.com'), - array('upload-na0.qiniup.com'), - "rs-na0.qbox.me", - "rsf-na0.qbox.me", - "api-na0.qiniu.com", - "iovip-na0.qbox.me" - ); - return $Zone_na0; - } - - //新加坡机房 public static function zoneAs0() { - //新加坡机房 - $Zone_as0 = new Zone( - array('up-as0.qiniup.com'), - array('upload-as0.qiniup.com'), - "rs-as0.qbox.me", - "rsf-as0.qbox.me", - "api-as0.qiniu.com", - "iovip-as0.qbox.me" - ); - return $Zone_as0; + return parent::regionSingapore(); + } + + public static function zoneNa0() + { + return parent::regionNorthAmerica(); + } + + public static function qvmZonez0() + { + return parent::qvmRegionHuadong(); + } + + public static function qvmZonez1() + { + return parent::qvmRegionHuabei(); } - /* - * GET /v2/query?ak=&&bucket= - **/ public static function queryZone($ak, $bucket) { - $zone = new Zone(); - $url = Config::UC_HOST . '/v2/query' . "?ak=$ak&bucket=$bucket"; - $ret = Client::Get($url); - if (!$ret->ok()) { - return array(null, new Error($url, $ret)); - } - $r = ($ret->body === null) ? array() : $ret->json(); - //print_r($ret); - //parse zone; - - $iovipHost = $r['io']['src']['main'][0]; - $zone->iovipHost = $iovipHost; - $accMain = $r['up']['acc']['main'][0]; - array_push($zone->cdnUpHosts, $accMain); - if (isset($r['up']['acc']['backup'])) { - foreach ($r['up']['acc']['backup'] as $key => $value) { - array_push($zone->cdnUpHosts, $value); - } - } - $srcMain = $r['up']['src']['main'][0]; - array_push($zone->srcUpHosts, $srcMain); - if (isset($r['up']['src']['backup'])) { - foreach ($r['up']['src']['backup'] as $key => $value) { - array_push($zone->srcUpHosts, $value); - } - } - - //set specific hosts - if (strstr($zone->iovipHost, "z1") !== false) { - $zone->rsHost = "rs-z1.qbox.me"; - $zone->rsfHost = "rsf-z1.qbox.me"; - $zone->apiHost = "api-z1.qiniu.com"; - } elseif (strstr($zone->iovipHost, "z2") !== false) { - $zone->rsHost = "rs-z2.qbox.me"; - $zone->rsfHost = "rsf-z2.qbox.me"; - $zone->apiHost = "api-z2.qiniu.com"; - } elseif (strstr($zone->iovipHost, "na0") !== false) { - $zone->rsHost = "rs-na0.qbox.me"; - $zone->rsfHost = "rsf-na0.qbox.me"; - $zone->apiHost = "api-na0.qiniu.com"; - } elseif (strstr($zone->iovipHost, "as0") !== false) { - $zone->rsHost = "rs-as0.qbox.me"; - $zone->rsfHost = "rsf-as0.qbox.me"; - $zone->apiHost = "api-as0.qiniu.com"; - } else { - $zone->rsHost = "rs.qbox.me"; - $zone->rsfHost = "rsf.qbox.me"; - $zone->apiHost = "api.qiniu.com"; - } - - return $zone; + return parent::queryRegion($ak, $bucket); } } diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php index 5a858dfa2..3c45bbdfd 100644 --- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php @@ -34,17 +34,8 @@ class CdnManagerTest extends \PHPUnit_Framework_TestCase $signUrl = $this->cdnManager->createTimestampAntiLeechUrl($this->imgUrl, $this->encryptKey, 3600); $response = Client::get($signUrl); + $this->assertEquals($response->statusCode, 200); $this->assertNull($response->error); - - $url2 = $this->imgUrl . '?imageInfo'; - $signUrl2 = $this->cdnManager->createTimestampAntiLeechUrl($url2, $this->encryptKey, 3600); - - $response = Client::get($signUrl2); - $imgInfo = $response->json(); - - $this->assertEquals($response->statusCode, 200); - $this->assertEquals($imgInfo['size'], 2196145); - $this->assertNull($response->error); } } diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php index 00008d457..41e6ea8ab 100644 --- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php @@ -35,7 +35,7 @@ class ResumeUpTest extends \PHPUnit_Framework_TestCase public function test4ML2() { $key = 'resumePutFile4ML'; - $zone = new Zone(array('up.qiniup.com')); + $zone = new Zone(array('up.fake.qiniu.com'), array('up.qiniup.com')); $cfg = new Config($zone); $upManager = new UploadManager($cfg); $token = $this->auth->uploadToken($this->bucketName, $key); diff --git a/vendor/qiniu/php-sdk/tests/bootstrap.php b/vendor/qiniu/php-sdk/tests/bootstrap.php index 5bd8b0569..c300057c2 100644 --- a/vendor/qiniu/php-sdk/tests/bootstrap.php +++ b/vendor/qiniu/php-sdk/tests/bootstrap.php @@ -21,7 +21,7 @@ $dummyAuth = new Auth($dummyAccessKey, $dummySecretKey); //cdn $timestampAntiLeechEncryptKey = getenv('QINIU_TIMESTAMP_ENCRPTKEY'); -$customDomain = "http://phpsdk.qiniuts.com"; +$customDomain = "http://phpsdk.peterpy.cn"; $tid = getenv('TRAVIS_JOB_NUMBER'); if (!empty($tid)) { diff --git a/vendor/topthink/think-helper/.gitignore b/vendor/topthink/think-helper/.gitignore index e244eda0b..d851bdbff 100644 --- a/vendor/topthink/think-helper/.gitignore +++ b/vendor/topthink/think-helper/.gitignore @@ -1,2 +1,3 @@ /vendor/ -/.idea/ \ No newline at end of file +/.idea/ +composer.lock \ No newline at end of file diff --git a/vendor/topthink/think-helper/README.md b/vendor/topthink/think-helper/README.md index 51b69c53f..7baf8f7b5 100644 --- a/vendor/topthink/think-helper/README.md +++ b/vendor/topthink/think-helper/README.md @@ -1,10 +1,11 @@ -# thinkphp5 常用的一些扩展类库 +# thinkphp6 常用的一些扩展类库 -> 更新完善中 +基于PHP7.1+ > 以下类库都在`\\think\\helper`命名空间下 ## Str + > 字符串操作 ``` diff --git a/vendor/topthink/think-helper/composer.json b/vendor/topthink/think-helper/composer.json index d246fa3c9..b68c43b51 100644 --- a/vendor/topthink/think-helper/composer.json +++ b/vendor/topthink/think-helper/composer.json @@ -1,6 +1,6 @@ { "name": "topthink/think-helper", - "description": "The ThinkPHP5 Helper Package", + "description": "The ThinkPHP6 Helper Package", "license": "Apache-2.0", "authors": [ { @@ -8,9 +8,12 @@ "email": "448901948@qq.com" } ], + "require": { + "php": ">=7.1.0" + }, "autoload": { "psr-4": { - "think\\helper\\": "src" + "think\\": "src" }, "files": [ "src/helper.php" diff --git a/vendor/topthink/think-helper/src/Arr.php b/vendor/topthink/think-helper/src/Arr.php deleted file mode 100644 index 7350bb245..000000000 --- a/vendor/topthink/think-helper/src/Arr.php +++ /dev/null @@ -1,41 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\helper; - - -class Arr -{ - - public static function isAssoc(array $array) - { - $keys = array_keys($array); - - return array_keys($keys) !== $keys; - } - - public static function sortRecursive($array) - { - foreach ($array as &$value) { - if (is_array($value)) { - $value = static::sortRecursive($value); - } - } - - if (static::isAssoc($array)) { - ksort($array); - } else { - sort($array); - } - - return $array; - } -} \ No newline at end of file diff --git a/vendor/topthink/think-helper/src/Collection.php b/vendor/topthink/think-helper/src/Collection.php new file mode 100644 index 000000000..c6df69b36 --- /dev/null +++ b/vendor/topthink/think-helper/src/Collection.php @@ -0,0 +1,651 @@ + +// +---------------------------------------------------------------------- +declare (strict_types = 1); + +namespace think; + +use ArrayAccess; +use ArrayIterator; +use Countable; +use IteratorAggregate; +use JsonSerializable; +use think\contract\Arrayable; +use think\contract\Jsonable; +use think\helper\Arr; + +/** + * 数据集管理类 + */ +class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable, Arrayable, Jsonable +{ + /** + * 数据集数据 + * @var array + */ + protected $items = []; + + public function __construct($items = []) + { + $this->items = $this->convertToArray($items); + } + + public static function make($items = []) + { + return new static($items); + } + + /** + * 是否为空 + * @access public + * @return bool + */ + public function isEmpty(): bool + { + return empty($this->items); + } + + public function toArray(): array + { + return array_map(function ($value) { + return $value instanceof Arrayable ? $value->toArray() : $value; + }, $this->items); + } + + public function all(): array + { + return $this->items; + } + + /** + * 合并数组 + * + * @access public + * @param mixed $items 数据 + * @return static + */ + public function merge($items) + { + return new static(array_merge($this->items, $this->convertToArray($items))); + } + + /** + * 按指定键整理数据 + * + * @access public + * @param mixed $items 数据 + * @param string $indexKey 键名 + * @return array + */ + public function dictionary($items = null, string &$indexKey = null) + { + if ($items instanceof self) { + $items = $items->all(); + } + + $items = is_null($items) ? $this->items : $items; + + if ($items && empty($indexKey)) { + $indexKey = is_array($items[0]) ? 'id' : $items[0]->getPk(); + } + + if (isset($indexKey) && is_string($indexKey)) { + return array_column($items, null, $indexKey); + } + + return $items; + } + + /** + * 比较数组,返回差集 + * + * @access public + * @param mixed $items 数据 + * @param string $indexKey 指定比较的键名 + * @return static + */ + public function diff($items, string $indexKey = null) + { + if ($this->isEmpty() || is_scalar($this->items[0])) { + return new static(array_diff($this->items, $this->convertToArray($items))); + } + + $diff = []; + $dictionary = $this->dictionary($items, $indexKey); + + if (is_string($indexKey)) { + foreach ($this->items as $item) { + if (!isset($dictionary[$item[$indexKey]])) { + $diff[] = $item; + } + } + } + + return new static($diff); + } + + /** + * 比较数组,返回交集 + * + * @access public + * @param mixed $items 数据 + * @param string $indexKey 指定比较的键名 + * @return static + */ + public function intersect($items, string $indexKey = null) + { + if ($this->isEmpty() || is_scalar($this->items[0])) { + return new static(array_diff($this->items, $this->convertToArray($items))); + } + + $intersect = []; + $dictionary = $this->dictionary($items, $indexKey); + + if (is_string($indexKey)) { + foreach ($this->items as $item) { + if (isset($dictionary[$item[$indexKey]])) { + $intersect[] = $item; + } + } + } + + return new static($intersect); + } + + /** + * 交换数组中的键和值 + * + * @access public + * @return static + */ + public function flip() + { + return new static(array_flip($this->items)); + } + + /** + * 返回数组中所有的键名 + * + * @access public + * @return static + */ + public function keys() + { + return new static(array_keys($this->items)); + } + + /** + * 返回数组中所有的值组成的新 Collection 实例 + * @access public + * @return static + */ + public function values() + { + return new static(array_values($this->items)); + } + + /** + * 删除数组的最后一个元素(出栈) + * + * @access public + * @return mixed + */ + public function pop() + { + return array_pop($this->items); + } + + /** + * 通过使用用户自定义函数,以字符串返回数组 + * + * @access public + * @param callable $callback 调用方法 + * @param mixed $initial + * @return mixed + */ + public function reduce(callable $callback, $initial = null) + { + return array_reduce($this->items, $callback, $initial); + } + + /** + * 以相反的顺序返回数组。 + * + * @access public + * @return static + */ + public function reverse() + { + return new static(array_reverse($this->items)); + } + + /** + * 删除数组中首个元素,并返回被删除元素的值 + * + * @access public + * @return mixed + */ + public function shift() + { + return array_shift($this->items); + } + + /** + * 在数组结尾插入一个元素 + * @access public + * @param mixed $value 元素 + * @param string $key KEY + * @return void + */ + public function push($value, string $key = null): void + { + if (is_null($key)) { + $this->items[] = $value; + } else { + $this->items[$key] = $value; + } + } + + /** + * 把一个数组分割为新的数组块. + * + * @access public + * @param int $size 块大小 + * @param bool $preserveKeys + * @return static + */ + public function chunk(int $size, bool $preserveKeys = false) + { + $chunks = []; + + foreach (array_chunk($this->items, $size, $preserveKeys) as $chunk) { + $chunks[] = new static($chunk); + } + + return new static($chunks); + } + + /** + * 在数组开头插入一个元素 + * @access public + * @param mixed $value 元素 + * @param string $key KEY + * @return void + */ + public function unshift($value, string $key = null): void + { + if (is_null($key)) { + array_unshift($this->items, $value); + } else { + $this->items = [$key => $value] + $this->items; + } + } + + /** + * 给每个元素执行个回调 + * + * @access public + * @param callable $callback 回调 + * @return $this + */ + public function each(callable $callback) + { + foreach ($this->items as $key => $item) { + $result = $callback($item, $key); + + if (false === $result) { + break; + } elseif (!is_object($item)) { + $this->items[$key] = $result; + } + } + + return $this; + } + + /** + * 用回调函数处理数组中的元素 + * @access public + * @param callable|null $callback 回调 + * @return static + */ + public function map(callable $callback) + { + return new static(array_map($callback, $this->items)); + } + + /** + * 用回调函数过滤数组中的元素 + * @access public + * @param callable|null $callback 回调 + * @return static + */ + public function filter(callable $callback = null) + { + if ($callback) { + return new static(array_filter($this->items, $callback)); + } + + return new static(array_filter($this->items)); + } + + /** + * 根据字段条件过滤数组中的元素 + * @access public + * @param string $field 字段名 + * @param mixed $operator 操作符 + * @param mixed $value 数据 + * @return static + */ + public function where(string $field, $operator, $value = null) + { + if (is_null($value)) { + $value = $operator; + $operator = '='; + } + + return $this->filter(function ($data) use ($field, $operator, $value) { + if (strpos($field, '.')) { + list($field, $relation) = explode('.', $field); + + $result = $data[$field][$relation] ?? null; + } else { + $result = $data[$field] ?? null; + } + + switch ($operator) { + case '===': + return $result === $value; + case '!==': + return $result !== $value; + case '!=': + case '<>': + return $result != $value; + case '>': + return $result > $value; + case '>=': + return $result >= $value; + case '<': + return $result < $value; + case '<=': + return $result <= $value; + case 'like': + return is_string($result) && false !== strpos($result, $value); + case 'not like': + return is_string($result) && false === strpos($result, $value); + case 'in': + return is_scalar($result) && in_array($result, $value, true); + case 'not in': + return is_scalar($result) && !in_array($result, $value, true); + case 'between': + list($min, $max) = is_string($value) ? explode(',', $value) : $value; + return is_scalar($result) && $result >= $min && $result <= $max; + case 'not between': + list($min, $max) = is_string($value) ? explode(',', $value) : $value; + return is_scalar($result) && $result > $max || $result < $min; + case '==': + case '=': + default: + return $result == $value; + } + }); + } + + /** + * LIKE过滤 + * @access public + * @param string $field 字段名 + * @param string $value 数据 + * @return static + */ + public function whereLike(string $field, string $value) + { + return $this->where($field, 'like', $value); + } + + /** + * NOT LIKE过滤 + * @access public + * @param string $field 字段名 + * @param string $value 数据 + * @return static + */ + public function whereNotLike(string $field, string $value) + { + return $this->where($field, 'not like', $value); + } + + /** + * IN过滤 + * @access public + * @param string $field 字段名 + * @param array $value 数据 + * @return static + */ + public function whereIn(string $field, array $value) + { + return $this->where($field, 'in', $value); + } + + /** + * NOT IN过滤 + * @access public + * @param string $field 字段名 + * @param array $value 数据 + * @return static + */ + public function whereNotIn(string $field, array $value) + { + return $this->where($field, 'not in', $value); + } + + /** + * BETWEEN 过滤 + * @access public + * @param string $field 字段名 + * @param mixed $value 数据 + * @return static + */ + public function whereBetween(string $field, $value) + { + return $this->where($field, 'between', $value); + } + + /** + * NOT BETWEEN 过滤 + * @access public + * @param string $field 字段名 + * @param mixed $value 数据 + * @return static + */ + public function whereNotBetween(string $field, $value) + { + return $this->where($field, 'not between', $value); + } + + /** + * 返回数据中指定的一列 + * @access public + * @param string $columnKey 键名 + * @param string $indexKey 作为索引值的列 + * @return array + */ + public function column(string $columnKey, string $indexKey = null) + { + return array_column($this->items, $columnKey, $indexKey); + } + + /** + * 对数组排序 + * + * @access public + * @param callable|null $callback 回调 + * @return static + */ + public function sort(callable $callback = null) + { + $items = $this->items; + + $callback = $callback ?: function ($a, $b) { + return $a == $b ? 0 : (($a < $b) ? -1 : 1); + }; + + uasort($items, $callback); + + return new static($items); + } + + /** + * 指定字段排序 + * @access public + * @param string $field 排序字段 + * @param string $order 排序 + * @return $this + */ + public function order(string $field, string $order = null) + { + return $this->sort(function ($a, $b) use ($field, $order) { + $fieldA = $a[$field] ?? null; + $fieldB = $b[$field] ?? null; + + return 'desc' == strtolower($order) ? strcmp($fieldB, $fieldA) : strcmp($fieldA, $fieldB); + }); + } + + /** + * 将数组打乱 + * + * @access public + * @return static + */ + public function shuffle() + { + $items = $this->items; + + shuffle($items); + + return new static($items); + } + + /** + * 获取最后一个单元数据 + * + * @access public + * @param callable|null $callback + * @param null $default + * @return mixed + */ + public function first(callable $callback = null, $default = null) + { + return Arr::first($this->items, $callback, $default); + } + + /** + * 获取第一个单元数据 + * + * @access public + * @param callable|null $callback + * @param null $default + * @return mixed + */ + public function last(callable $callback = null, $default = null) + { + return Arr::last($this->items, $callback, $default); + } + + /** + * 截取数组 + * + * @access public + * @param int $offset 起始位置 + * @param int $length 截取长度 + * @param bool $preserveKeys preserveKeys + * @return static + */ + public function slice(int $offset, int $length = null, bool $preserveKeys = false) + { + return new static(array_slice($this->items, $offset, $length, $preserveKeys)); + } + + // ArrayAccess + public function offsetExists($offset) + { + return array_key_exists($offset, $this->items); + } + + public function offsetGet($offset) + { + return $this->items[$offset]; + } + + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->items[] = $value; + } else { + $this->items[$offset] = $value; + } + } + + public function offsetUnset($offset) + { + unset($this->items[$offset]); + } + + //Countable + public function count() + { + return count($this->items); + } + + //IteratorAggregate + public function getIterator() + { + return new ArrayIterator($this->items); + } + + //JsonSerializable + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * 转换当前数据集为JSON字符串 + * @access public + * @param integer $options json参数 + * @return string + */ + public function toJson(int $options = JSON_UNESCAPED_UNICODE): string + { + return json_encode($this->toArray(), $options); + } + + public function __toString() + { + return $this->toJson(); + } + + /** + * 转换成数组 + * + * @access public + * @param mixed $items 数据 + * @return array + */ + protected function convertToArray($items): array + { + if ($items instanceof self) { + return $items->all(); + } + + return (array) $items; + } +} diff --git a/vendor/topthink/think-helper/src/contract/Arrayable.php b/vendor/topthink/think-helper/src/contract/Arrayable.php new file mode 100644 index 000000000..7c6b992b0 --- /dev/null +++ b/vendor/topthink/think-helper/src/contract/Arrayable.php @@ -0,0 +1,8 @@ + // +---------------------------------------------------------------------- +use think\Collection; +use think\helper\Arr; -if (!function_exists('classnames')) { +if (!function_exists('throw_if')) { /** - * css样式名生成器 - * classnames("foo", "bar"); // => "foo bar" - * classnames("foo", [ "bar"=> true ]); // => "foo bar" - * classnames([ "foo-bar"=> true ]); // => "foo-bar" - * classnames([ "foo-bar"=> false ]); // => " - * classnames([ "foo" => true ], [ "bar"=> true ]); // => "foo bar" - * classnames([ "foo" => true, "bar"=> true ]); // => "foo bar" - * classnames("foo", [ "bar"=> true, "duck"=> false ], "baz", [ "quux"=> true ]); // => "foo bar baz quux" - * classnames(null, false, "bar", 0, 1, [ "baz"=> null ]); // => "bar 1" + * 按条件抛异常 + * + * @param mixed $condition + * @param Throwable|string $exception + * @param array ...$parameters + * @return mixed + * + * @throws Throwable */ - function classnames() + function throw_if($condition, $exception, ...$parameters) { - $args = func_get_args(); - $classes = array_map(function ($arg) { - if (is_array($arg)) { - return implode(" ", array_filter(array_map(function ($expression, $class) { - return $expression ? $class : false; - }, $arg, array_keys($arg)))); - } - return $arg; - }, $args); - return implode(" ", array_filter($classes)); + if ($condition) { + throw (is_string($exception) ? new $exception(...$parameters) : $exception); + } + + return $condition; } -} \ No newline at end of file +} + +if (!function_exists('throw_unless')) { + /** + * 按条件抛异常 + * + * @param mixed $condition + * @param Throwable|string $exception + * @param array ...$parameters + * @return mixed + * @throws Throwable + */ + function throw_unless($condition, $exception, ...$parameters) + { + if (!$condition) { + throw (is_string($exception) ? new $exception(...$parameters) : $exception); + } + + return $condition; + } +} + +if (!function_exists('tap')) { + /** + * 对一个值调用给定的闭包,然后返回该值 + * + * @param mixed $value + * @param callable|null $callback + * @return mixed + */ + function tap($value, $callback = null) + { + if (is_null($callback)) { + return $value; + } + + $callback($value); + + return $value; + } +} + +if (!function_exists('value')) { + /** + * Return the default value of the given value. + * + * @param mixed $value + * @return mixed + */ + function value($value) + { + return $value instanceof Closure ? $value() : $value; + } +} + +if (!function_exists('collect')) { + /** + * Create a collection from the given value. + * + * @param mixed $value + * @return Collection + */ + function collect($value = null) + { + return new Collection($value); + } +} + +if (!function_exists('data_fill')) { + /** + * Fill in data where it's missing. + * + * @param mixed $target + * @param string|array $key + * @param mixed $value + * @return mixed + */ + function data_fill(&$target, $key, $value) + { + return data_set($target, $key, $value, false); + } +} + +if (!function_exists('data_get')) { + /** + * Get an item from an array or object using "dot" notation. + * + * @param mixed $target + * @param string|array|int $key + * @param mixed $default + * @return mixed + */ + function data_get($target, $key, $default = null) + { + if (is_null($key)) { + return $target; + } + + $key = is_array($key) ? $key : explode('.', $key); + + while (!is_null($segment = array_shift($key))) { + if ('*' === $segment) { + if ($target instanceof Collection) { + $target = $target->all(); + } elseif (!is_array($target)) { + return value($default); + } + + $result = []; + + foreach ($target as $item) { + $result[] = data_get($item, $key); + } + + return in_array('*', $key) ? Arr::collapse($result) : $result; + } + + if (Arr::accessible($target) && Arr::exists($target, $segment)) { + $target = $target[$segment]; + } elseif (is_object($target) && isset($target->{$segment})) { + $target = $target->{$segment}; + } else { + return value($default); + } + } + + return $target; + } +} + +if (!function_exists('data_set')) { + /** + * Set an item on an array or object using dot notation. + * + * @param mixed $target + * @param string|array $key + * @param mixed $value + * @param bool $overwrite + * @return mixed + */ + function data_set(&$target, $key, $value, $overwrite = true) + { + $segments = is_array($key) ? $key : explode('.', $key); + + if (($segment = array_shift($segments)) === '*') { + if (!Arr::accessible($target)) { + $target = []; + } + + if ($segments) { + foreach ($target as &$inner) { + data_set($inner, $segments, $value, $overwrite); + } + } elseif ($overwrite) { + foreach ($target as &$inner) { + $inner = $value; + } + } + } elseif (Arr::accessible($target)) { + if ($segments) { + if (!Arr::exists($target, $segment)) { + $target[$segment] = []; + } + + data_set($target[$segment], $segments, $value, $overwrite); + } elseif ($overwrite || !Arr::exists($target, $segment)) { + $target[$segment] = $value; + } + } elseif (is_object($target)) { + if ($segments) { + if (!isset($target->{$segment})) { + $target->{$segment} = []; + } + + data_set($target->{$segment}, $segments, $value, $overwrite); + } elseif ($overwrite || !isset($target->{$segment})) { + $target->{$segment} = $value; + } + } else { + $target = []; + + if ($segments) { + data_set($target[$segment], $segments, $value, $overwrite); + } elseif ($overwrite) { + $target[$segment] = $value; + } + } + + return $target; + } +} + +if (!function_exists('trait_uses_recursive')) { + /** + * 获取一个trait里所有引用到的trait + * + * @param string $trait Trait + * @return array + */ + function trait_uses_recursive(string $trait): array + { + $traits = class_uses($trait); + foreach ($traits as $trait) { + $traits += trait_uses_recursive($trait); + } + + return $traits; + } +} + +if (!function_exists('class_basename')) { + /** + * 获取类名(不包含命名空间) + * + * @param mixed $class 类名 + * @return string + */ + function class_basename($class): string + { + $class = is_object($class) ? get_class($class) : $class; + return basename(str_replace('\\', '/', $class)); + } +} + +if (!function_exists('class_uses_recursive')) { + /** + *获取一个类里所有用到的trait,包括父类的 + * + * @param mixed $class 类名 + * @return array + */ + function class_uses_recursive($class): array + { + if (is_object($class)) { + $class = get_class($class); + } + + $results = []; + $classes = array_merge([$class => $class], class_parents($class)); + foreach ($classes as $class) { + $results += trait_uses_recursive($class); + } + + return array_unique($results); + } +} diff --git a/vendor/topthink/think-helper/src/helper/Arr.php b/vendor/topthink/think-helper/src/helper/Arr.php new file mode 100644 index 000000000..ed4d6a9ef --- /dev/null +++ b/vendor/topthink/think-helper/src/helper/Arr.php @@ -0,0 +1,634 @@ + +// +---------------------------------------------------------------------- + +namespace think\helper; + +use ArrayAccess; +use InvalidArgumentException; +use think\Collection; + +class Arr +{ + + /** + * Determine whether the given value is array accessible. + * + * @param mixed $value + * @return bool + */ + public static function accessible($value) + { + return is_array($value) || $value instanceof ArrayAccess; + } + + /** + * Add an element to an array using "dot" notation if it doesn't exist. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + public static function add($array, $key, $value) + { + if (is_null(static::get($array, $key))) { + static::set($array, $key, $value); + } + + return $array; + } + + /** + * Collapse an array of arrays into a single array. + * + * @param array $array + * @return array + */ + public static function collapse($array) + { + $results = []; + + foreach ($array as $values) { + if ($values instanceof Collection) { + $values = $values->all(); + } elseif (!is_array($values)) { + continue; + } + + $results = array_merge($results, $values); + } + + return $results; + } + + /** + * Cross join the given arrays, returning all possible permutations. + * + * @param array ...$arrays + * @return array + */ + public static function crossJoin(...$arrays) + { + $results = [[]]; + + foreach ($arrays as $index => $array) { + $append = []; + + foreach ($results as $product) { + foreach ($array as $item) { + $product[$index] = $item; + + $append[] = $product; + } + } + + $results = $append; + } + + return $results; + } + + /** + * Divide an array into two arrays. One with keys and the other with values. + * + * @param array $array + * @return array + */ + public static function divide($array) + { + return [array_keys($array), array_values($array)]; + } + + /** + * Flatten a multi-dimensional associative array with dots. + * + * @param array $array + * @param string $prepend + * @return array + */ + public static function dot($array, $prepend = '') + { + $results = []; + + foreach ($array as $key => $value) { + if (is_array($value) && !empty($value)) { + $results = array_merge($results, static::dot($value, $prepend . $key . '.')); + } else { + $results[$prepend . $key] = $value; + } + } + + return $results; + } + + /** + * Get all of the given array except for a specified array of keys. + * + * @param array $array + * @param array|string $keys + * @return array + */ + public static function except($array, $keys) + { + static::forget($array, $keys); + + return $array; + } + + /** + * Determine if the given key exists in the provided array. + * + * @param \ArrayAccess|array $array + * @param string|int $key + * @return bool + */ + public static function exists($array, $key) + { + if ($array instanceof ArrayAccess) { + return $array->offsetExists($key); + } + + return array_key_exists($key, $array); + } + + /** + * Return the first element in an array passing a given truth test. + * + * @param array $array + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public static function first($array, callable $callback = null, $default = null) + { + if (is_null($callback)) { + if (empty($array)) { + return value($default); + } + + foreach ($array as $item) { + return $item; + } + } + + foreach ($array as $key => $value) { + if (call_user_func($callback, $value, $key)) { + return $value; + } + } + + return value($default); + } + + /** + * Return the last element in an array passing a given truth test. + * + * @param array $array + * @param callable|null $callback + * @param mixed $default + * @return mixed + */ + public static function last($array, callable $callback = null, $default = null) + { + if (is_null($callback)) { + return empty($array) ? value($default) : end($array); + } + + return static::first(array_reverse($array, true), $callback, $default); + } + + /** + * Flatten a multi-dimensional array into a single level. + * + * @param array $array + * @param int $depth + * @return array + */ + public static function flatten($array, $depth = INF) + { + $result = []; + + foreach ($array as $item) { + $item = $item instanceof Collection ? $item->all() : $item; + + if (!is_array($item)) { + $result[] = $item; + } elseif ($depth === 1) { + $result = array_merge($result, array_values($item)); + } else { + $result = array_merge($result, static::flatten($item, $depth - 1)); + } + } + + return $result; + } + + /** + * Remove one or many array items from a given array using "dot" notation. + * + * @param array $array + * @param array|string $keys + * @return void + */ + public static function forget(&$array, $keys) + { + $original = &$array; + + $keys = (array) $keys; + + if (count($keys) === 0) { + return; + } + + foreach ($keys as $key) { + // if the exact key exists in the top-level, remove it + if (static::exists($array, $key)) { + unset($array[$key]); + + continue; + } + + $parts = explode('.', $key); + + // clean up before each pass + $array = &$original; + + while (count($parts) > 1) { + $part = array_shift($parts); + + if (isset($array[$part]) && is_array($array[$part])) { + $array = &$array[$part]; + } else { + continue 2; + } + } + + unset($array[array_shift($parts)]); + } + } + + /** + * Get an item from an array using "dot" notation. + * + * @param \ArrayAccess|array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function get($array, $key, $default = null) + { + if (!static::accessible($array)) { + return value($default); + } + + if (is_null($key)) { + return $array; + } + + if (static::exists($array, $key)) { + return $array[$key]; + } + + if (strpos($key, '.') === false) { + return $array[$key] ?? value($default); + } + + foreach (explode('.', $key) as $segment) { + if (static::accessible($array) && static::exists($array, $segment)) { + $array = $array[$segment]; + } else { + return value($default); + } + } + + return $array; + } + + /** + * Check if an item or items exist in an array using "dot" notation. + * + * @param \ArrayAccess|array $array + * @param string|array $keys + * @return bool + */ + public static function has($array, $keys) + { + $keys = (array) $keys; + + if (!$array || $keys === []) { + return false; + } + + foreach ($keys as $key) { + $subKeyArray = $array; + + if (static::exists($array, $key)) { + continue; + } + + foreach (explode('.', $key) as $segment) { + if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) { + $subKeyArray = $subKeyArray[$segment]; + } else { + return false; + } + } + } + + return true; + } + + /** + * Determines if an array is associative. + * + * An array is "associative" if it doesn't have sequential numerical keys beginning with zero. + * + * @param array $array + * @return bool + */ + public static function isAssoc(array $array) + { + $keys = array_keys($array); + + return array_keys($keys) !== $keys; + } + + /** + * Get a subset of the items from the given array. + * + * @param array $array + * @param array|string $keys + * @return array + */ + public static function only($array, $keys) + { + return array_intersect_key($array, array_flip((array) $keys)); + } + + /** + * Pluck an array of values from an array. + * + * @param array $array + * @param string|array $value + * @param string|array|null $key + * @return array + */ + public static function pluck($array, $value, $key = null) + { + $results = []; + + [$value, $key] = static::explodePluckParameters($value, $key); + + foreach ($array as $item) { + $itemValue = data_get($item, $value); + + // If the key is "null", we will just append the value to the array and keep + // looping. Otherwise we will key the array using the value of the key we + // received from the developer. Then we'll return the final array form. + if (is_null($key)) { + $results[] = $itemValue; + } else { + $itemKey = data_get($item, $key); + + if (is_object($itemKey) && method_exists($itemKey, '__toString')) { + $itemKey = (string) $itemKey; + } + + $results[$itemKey] = $itemValue; + } + } + + return $results; + } + + /** + * Explode the "value" and "key" arguments passed to "pluck". + * + * @param string|array $value + * @param string|array|null $key + * @return array + */ + protected static function explodePluckParameters($value, $key) + { + $value = is_string($value) ? explode('.', $value) : $value; + + $key = is_null($key) || is_array($key) ? $key : explode('.', $key); + + return [$value, $key]; + } + + /** + * Push an item onto the beginning of an array. + * + * @param array $array + * @param mixed $value + * @param mixed $key + * @return array + */ + public static function prepend($array, $value, $key = null) + { + if (is_null($key)) { + array_unshift($array, $value); + } else { + $array = [$key => $value] + $array; + } + + return $array; + } + + /** + * Get a value from the array, and remove it. + * + * @param array $array + * @param string $key + * @param mixed $default + * @return mixed + */ + public static function pull(&$array, $key, $default = null) + { + $value = static::get($array, $key, $default); + + static::forget($array, $key); + + return $value; + } + + /** + * Get one or a specified number of random values from an array. + * + * @param array $array + * @param int|null $number + * @return mixed + * + * @throws \InvalidArgumentException + */ + public static function random($array, $number = null) + { + $requested = is_null($number) ? 1 : $number; + + $count = count($array); + + if ($requested > $count) { + throw new InvalidArgumentException( + "You requested {$requested} items, but there are only {$count} items available." + ); + } + + if (is_null($number)) { + return $array[array_rand($array)]; + } + + if ((int) $number === 0) { + return []; + } + + $keys = array_rand($array, $number); + + $results = []; + + foreach ((array) $keys as $key) { + $results[] = $array[$key]; + } + + return $results; + } + + /** + * Set an array item to a given value using "dot" notation. + * + * If no key is given to the method, the entire array will be replaced. + * + * @param array $array + * @param string $key + * @param mixed $value + * @return array + */ + public static function set(&$array, $key, $value) + { + if (is_null($key)) { + return $array = $value; + } + + $keys = explode('.', $key); + + while (count($keys) > 1) { + $key = array_shift($keys); + + // If the key doesn't exist at this depth, we will just create an empty array + // to hold the next value, allowing us to create the arrays to hold final + // values at the correct depth. Then we'll keep digging into the array. + if (!isset($array[$key]) || !is_array($array[$key])) { + $array[$key] = []; + } + + $array = &$array[$key]; + } + + $array[array_shift($keys)] = $value; + + return $array; + } + + /** + * Shuffle the given array and return the result. + * + * @param array $array + * @param int|null $seed + * @return array + */ + public static function shuffle($array, $seed = null) + { + if (is_null($seed)) { + shuffle($array); + } else { + srand($seed); + + usort($array, function () { + return rand(-1, 1); + }); + } + + return $array; + } + + /** + * Sort the array using the given callback or "dot" notation. + * + * @param array $array + * @param callable|string|null $callback + * @return array + */ + public static function sort($array, $callback = null) + { + return Collection::make($array)->sort($callback)->all(); + } + + /** + * Recursively sort an array by keys and values. + * + * @param array $array + * @return array + */ + public static function sortRecursive($array) + { + foreach ($array as &$value) { + if (is_array($value)) { + $value = static::sortRecursive($value); + } + } + + if (static::isAssoc($array)) { + ksort($array); + } else { + sort($array); + } + + return $array; + } + + /** + * Convert the array into a query string. + * + * @param array $array + * @return string + */ + public static function query($array) + { + return http_build_query($array, null, '&', PHP_QUERY_RFC3986); + } + + /** + * Filter the array using the given callback. + * + * @param array $array + * @param callable $callback + * @return array + */ + public static function where($array, callable $callback) + { + return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH); + } + + /** + * If the given value is not an array and not null, wrap it in one. + * + * @param mixed $value + * @return array + */ + public static function wrap($value) + { + if (is_null($value)) { + return []; + } + + return is_array($value) ? $value : [$value]; + } +} \ No newline at end of file diff --git a/vendor/topthink/think-helper/src/Str.php b/vendor/topthink/think-helper/src/helper/Str.php similarity index 82% rename from vendor/topthink/think-helper/src/Str.php rename to vendor/topthink/think-helper/src/helper/Str.php index ba56cb44a..b9807c272 100644 --- a/vendor/topthink/think-helper/src/Str.php +++ b/vendor/topthink/think-helper/src/helper/Str.php @@ -25,10 +25,10 @@ class Str * @param string|array $needles * @return bool */ - public static function contains($haystack, $needles) + public static function contains(string $haystack, $needles): bool { foreach ((array) $needles as $needle) { - if ($needle != '' && mb_strpos($haystack, $needle) !== false) { + if ('' != $needle && mb_strpos($haystack, $needle) !== false) { return true; } } @@ -43,7 +43,7 @@ class Str * @param string|array $needles * @return bool */ - public static function endsWith($haystack, $needles) + public static function endsWith(string $haystack, $needles): bool { foreach ((array) $needles as $needle) { if ((string) $needle === static::substr($haystack, -static::length($needle))) { @@ -61,10 +61,10 @@ class Str * @param string|array $needles * @return bool */ - public static function startsWith($haystack, $needles) + public static function startsWith(string $haystack, $needles): bool { foreach ((array) $needles as $needle) { - if ($needle != '' && mb_strpos($haystack, $needle) === 0) { + if ('' != $needle && mb_strpos($haystack, $needle) === 0) { return true; } } @@ -78,7 +78,7 @@ class Str * @param int $length * @return string */ - public static function random($length = 16) + public static function random(int $length = 16): string { $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; @@ -91,7 +91,7 @@ class Str * @param string $value * @return string */ - public static function lower($value) + public static function lower(string $value): string { return mb_strtolower($value, 'UTF-8'); } @@ -102,7 +102,7 @@ class Str * @param string $value * @return string */ - public static function upper($value) + public static function upper(string $value): string { return mb_strtoupper($value, 'UTF-8'); } @@ -113,7 +113,7 @@ class Str * @param string $value * @return int */ - public static function length($value) + public static function length(string $value): string { return mb_strlen($value); } @@ -126,7 +126,7 @@ class Str * @param int|null $length * @return string */ - public static function substr($string, $start, $length = null) + public static function substr(string $string, int $start, int $length = null): string { return mb_substr($string, $start, $length, 'UTF-8'); } @@ -138,7 +138,7 @@ class Str * @param string $delimiter * @return string */ - public static function snake($value, $delimiter = '_') + public static function snake(string $value, string $delimiter = '_'): string { $key = $value; @@ -161,7 +161,7 @@ class Str * @param string $value * @return string */ - public static function camel($value) + public static function camel(string $value): string { if (isset(static::$camelCache[$value])) { return static::$camelCache[$value]; @@ -176,7 +176,7 @@ class Str * @param string $value * @return string */ - public static function studly($value) + public static function studly(string $value): string { $key = $value; @@ -195,8 +195,8 @@ class Str * @param string $value * @return string */ - public static function title($value) + public static function title(string $value): string { return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8'); } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/readme.md b/vendor/zoujingli/think-library/readme.md index 93c9957de..b355c8a3b 100644 --- a/vendor/zoujingli/think-library/readme.md +++ b/vendor/zoujingli/think-library/readme.md @@ -3,7 +3,7 @@ # ThinkLibrary for ThinkPHP5.1 ThinkLibrary 是针对 ThinkPHP5.1 版本封装的一套工具类库,方便快速构建 WEB 应用。 -## 主要包含内容 +## 包含组件 * 数据列表展示(可带高级搜索器) * FORM表单处理器(表单展示及数据入库) * 数据状态快速处理(数据指定字段更新,支持多字段同时) @@ -11,29 +11,36 @@ ThinkLibrary 是针对 ThinkPHP5.1 版本封装的一套工具类库,方便快 * 文件存储通用组件(本地服务存储 + 阿里云OSS存储 + 七牛云存储) * 通用数据保存更新(通过 key 值及 where 判定是否存在,存在则更新,不存在则新增) * 通用网络请求 (支持 get 及 post,可配置请求证书等) -* emoji 表情转义处理(部分数据库不支持保存 Emoji 表情,可用这个方法哦) +* Emoji 表情转义处理(部分数据库不支持保存 Emoji 表情,可用这个方法哦) * 系统参数通用 k-v 配置(快速参数长久化配置) * UTF8加密算法支持(安全URL参数传参数) * 接口 CORS 跨域默认支持(输出 JSON 标准化) -* 支持表单CSRF安全验证(自动化form标签替换) +* 支持表单CSRF安全验证(自动化 FORM 标签替换) * 更新功能等待您来发现哦.... ## 参考项目 -* Gitee 仓库:https://gitee.com/zoujingli/framework -* Github 仓库:https://github.com/zoujingli/framework -代码仓库 --- +#### framework - V1.0 / V2.0 +* Gitee 仓库 https://gitee.com/zoujingli/framework +* Github 仓库 https://github.com/zoujingli/framework +* 体验地址(账号密码都是admin)https://framework.thinkadmin.top + +#### ThinkAdmin - V4.0 / V4.1 +* Gitee 仓库 https://gitee.com/zoujingli/ThinkAdmin +* Github 仓库 https://github.com/zoujingli/ThinkAdmin +* 体验地址(账号密码都是admin)https://demo.thinkadmin.top + +## 代码仓库 ThinkLibrary 为 MIT 协议开源项目,安装使用或二次开发不受约束,欢迎 fork 项目。 部分代码来自互联网,若有异议可以联系作者进行删除。 - * 在线体验地址:https://framework.thinkadmin.top (账号和密码都是 admin ) + * 在线体验地址:https://demo.thinkadmin.top (账号和密码都是 admin ) * Gitee仓库地址:https://gitee.com/zoujingli/ThinkLibrary * GitHub仓库地址:https://github.com/zoujingli/ThinkLibrary ## 使用说明 -* ThinkLibrary 需要Composer支持 +* ThinkLibrary 需要 Composer 支持 * 安装命令 ` composer require zoujingli/think-library 5.1.x-dev` * 案例代码: 控制器需要继承 `library\Controller`,然后`$this`就可能使用全部功能 @@ -69,7 +76,7 @@ CREATE TABLE `system_config` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统配置'; ``` -## 列表处理 +#### 列表处理 ```php // 列表展示 $this->_page($dbQuery, $isPage, $isDisplay, $total); @@ -83,19 +90,19 @@ $db = $query->db(); // @todo 这里可以对db进行操作 $this->_page($db); // 显示列表分页 ``` -## 表单处理 +#### 表单处理 ```php // 表单显示及数据更新 $this->_form($dbQuery, $tplFile, $pkField , $where, $data); ``` -## 删除处理 +#### 删除处理 ```php // 数据删除处理 $this->_deleted($dbQuery); ``` -## 禁用启用处理 +#### 禁用启用处理 ```php // 数据禁用处理 $this->_save($dbQuery,['status'=>'0']); @@ -104,7 +111,7 @@ $this->_save($dbQuery,['status'=>'0']); $this->_save($dbQuery,['status'=>'1']); ``` -## 文件存储组件( oss 及 qiniu 需要配置参数) +#### 文件存储组件( oss 及 qiniu 需要配置参数) ```php // 配置默认存储方式 @@ -160,13 +167,13 @@ $resutl = \library\File::instance('local')->info($filename); $resutl = \library\File::instance('qiniu')->info($filename); ``` -## 通用数据保存 +#### 通用数据保存 ```php // 指定关键列更新($where 为扩展条件) boolean data_save($dbQuery,$data,'pkname',$where); ``` -## 通用网络请求 +#### 通用网络请求 ```php // 发起get请求 $result = http_get($url,$query,$options); @@ -177,7 +184,7 @@ $result = http_post($url,$data,$options); $result = \library\tools\Http::post($url,$data,$options); ``` -## emoji 表情转义(部分数据库不支持可以用这个) +#### emoji 表情转义(部分数据库不支持可以用这个) ```php // 输入数据库前转义 $content = emoji_encode($content); @@ -186,7 +193,7 @@ $content = emoji_encode($content); $content = emoji_decode($content); ``` -## 系统参数配置(基于 system_config 数据表) +#### 系统参数配置(基于 system_config 数据表) ```php // 设置参数 sysconf($keyname,$keyvalue); @@ -195,11 +202,15 @@ sysconf($keyname,$keyvalue); $keyvalue = sysconf($kename); ``` -## UTF8加密算法 +#### UTF8加密算法 ```php // 字符串加密操作 $string = encode($content); // 加密字符串解密 $content = decode($string); -``` \ No newline at end of file +``` + +## 赞助打赏 + +![赞助](http://static.thinkadmin.top/pay.png) diff --git a/vendor/zoujingli/think-library/src/Controller.php b/vendor/zoujingli/think-library/src/Controller.php index b4929ab1b..7f0fdf286 100644 --- a/vendor/zoujingli/think-library/src/Controller.php +++ b/vendor/zoujingli/think-library/src/Controller.php @@ -3,31 +3,31 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- namespace library; +use library\logic\Delete; +use library\logic\Form; +use library\logic\Input; +use library\logic\Page; +use library\logic\Query; +use library\logic\Save; use library\tools\Csrf; +use think\exception\HttpResponseException; /** * 标准控制器基类 * -------------------------------- * Class Controller - * @package library - * -------------------------------- - * @method logic\Query _query($dbQuery) - * @method array _input($data, $rule = [], $info = []) - * @method mixed _delete($dbQuery, $pkField = '', $where = []) - * @method mixed _save($dbQuery, $data = [], $pkField = '', $where = []) - * @method mixed _form($dbQuery, $tplFile = '', $pkField = '', $where = [], $data = []) - * @method array _page($dbQuery, $isPage = true, $isDisplay = true, $total = false, $limit = 0) */ class Controller extends \stdClass { @@ -42,11 +42,16 @@ class Controller extends \stdClass * 表单CSRF验证状态 * @var boolean */ - private $_csrf = false; + private $csrf_state = false; + + /** + * 表单CSRF验证失败提示消息 + * @var string + */ + protected $csrf_message = '表单令牌验证失败,请刷新页面再试!'; /** * Controller constructor. - * @throws \think\Exception */ public function __construct() { @@ -69,22 +74,6 @@ class Controller extends \stdClass } } - /** - * 实例方法调用 - * @param string $method 函数名称 - * @param array $arguments 调用参数 - * @return mixed - * @throws \ReflectionException - * @throws \think\Exception - */ - public function __call($method, $arguments = []) - { - if (class_exists($name = "library\\logic\\" . ucfirst(ltrim($method, '_')))) { - return (new \ReflectionClass($name))->newInstanceArgs($arguments)->init($this); - } - throw new \think\Exception('method not exists:' . get_class($this) . '->' . $method); - } - /** * 返回失败的操作 * @param mixed $info 消息内容 @@ -94,7 +83,7 @@ class Controller extends \stdClass public function error($info, $data = [], $code = 0) { $result = ['code' => $code, 'info' => $info, 'data' => $data]; - throw new \think\exception\HttpResponseException(json($result)); + throw new HttpResponseException(json($result)); } /** @@ -106,8 +95,8 @@ class Controller extends \stdClass public function success($info, $data = [], $code = 1) { $result = ['code' => $code, 'info' => $info, 'data' => $data]; - if ($this->_csrf) Csrf::clearFormToken(Csrf::getToken()); - throw new \think\exception\HttpResponseException(json($result)); + if ($this->csrf_state) Csrf::clearFormToken(Csrf::getToken()); + throw new HttpResponseException(json($result)); } /** @@ -118,7 +107,7 @@ class Controller extends \stdClass */ public function redirect($url, $vars = [], $code = 301) { - throw new \think\exception\HttpResponseException(redirect($url, $vars, $code)); + throw new HttpResponseException(redirect($url, $vars, $code)); } /** @@ -130,10 +119,10 @@ class Controller extends \stdClass public function fetch($tpl = '', $vars = [], $node = null) { foreach ($this as $name => $value) $vars[$name] = $value; - if ($this->_csrf) { + if ($this->csrf_state) { Csrf::fetchTemplate($tpl, $vars, $node); } else { - throw new \think\exception\HttpResponseException(view($tpl, $vars)); + throw new HttpResponseException(view($tpl, $vars)); } } @@ -182,13 +171,102 @@ class Controller extends \stdClass */ protected function applyCsrfToken($return = false) { - $this->_csrf = true; + $this->csrf_state = true; if ($this->request->isPost() && !Csrf::checkFormToken()) { if ($return) return false; - $this->error('表单令牌验证失败,请刷新页面再试!'); + $this->error($this->csrf_message); } else { return true; } } -} \ No newline at end of file + /** + * 快捷查询逻辑器 + * @param string|\think\db\Query $dbQuery + * @return Query + */ + protected function _query($dbQuery) + { + return (new Query($dbQuery))->init($this); + } + + /** + * 快捷分页逻辑器 + * @param string|\think\db\Query $dbQuery + * @param boolean $isPage 是否启用分页 + * @param boolean $isDisplay 是否渲染模板 + * @param boolean $total 集合分页记录数 + * @param integer $limit 集合每页记录数 + * @return array + * @throws \think\Exception + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + protected function _page($dbQuery, $isPage = true, $isDisplay = true, $total = false, $limit = 0) + { + return (new Page($dbQuery, $isPage, $isDisplay, $total, $limit))->init($this); + } + + /** + * 快捷表单逻辑器 + * @param string|\think\db\Query $dbQuery + * @param string $tpl 模板名称 + * @param string $pkField 指定数据对象主键 + * @param array $where 额外更新条件 + * @param array $data 表单扩展数据 + * @return array|boolean + * @throws \think\Exception + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + protected function _form($dbQuery, $tpl = '', $pkField = '', $where = [], $data = []) + { + return (new Form($dbQuery, $tpl, $pkField, $where, $data))->init($this); + } + + /** + * 快捷更新逻辑器 + * @param string|\think\db\Query $dbQuery + * @param array $data 表单扩展数据 + * @param string $pkField 数据对象主键 + * @param array $where 额外更新条件 + * @return boolean + * @throws \think\Exception + * @throws \think\exception\PDOException + */ + protected function _save($dbQuery, $data = [], $pkField = '', $where = []) + { + return (new Save($dbQuery, $data, $pkField, $where))->init($this); + } + + /** + * 快捷输入逻辑器 + * @param array|string $data 验证数据 + * @param array $rule 验证规则 + * @param array $info 验证消息 + * @return array + */ + protected function _input($data, $rule = [], $info = []) + { + return (new Input($data, $rule, $info))->init($this); + } + + /** + * 快捷删除逻辑器 + * @param string|\think\db\Query $dbQuery + * @param string $pkField 数据对象主键 + * @param array $where 额外更新条件 + * @return boolean|null + * @throws \think\Exception + * @throws \think\exception\PDOException + */ + protected function _delete($dbQuery, $pkField = '', $where = []) + { + return (new Delete($dbQuery, $pkField, $where))->init($this); + } + +} diff --git a/vendor/zoujingli/think-library/src/File.php b/vendor/zoujingli/think-library/src/File.php index 11716687c..01ddfffcb 100644 --- a/vendor/zoujingli/think-library/src/File.php +++ b/vendor/zoujingli/think-library/src/File.php @@ -3,34 +3,43 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- namespace library; use library\tools\Options; +use think\Exception; +use think\facade\Log; /** * 文件管理逻辑 * Class File * @package library - * @method bool has($name) static 判断文件上否已经上传 - * @method array save($name, $content) static 保存二进制文件 - * @method string url($name) static 获取文件对应地址 - * @method string get($name) static 获取文件二进制内容 - * @method string base($name) static 获取文件存储基础目录 - * @method string remove($name) static 删除已经上传的文件 - * @method string upload($client) static 获取文件上传地址 - * @method string setBucket($name) static 动态创建指定空间名称 + * @method bool has($name, $safe = false) static 判断文件是否已经上传 + * @method array save($name, $content, $safe = false) static 保存二进制文件 + * @method array info($name, $safe = false) static 获取文件信息 + * @method string url($name, $safe = false) static 获取文件URL地址 + * @method string get($name, $safe = false) static 获取文件二进制内容 + * @method string base($name, $safe = false) static 获取文件存储根目录 + * @method string path($name, $safe = false) static 获取文件存储物理路径 + * @method string remove($name, $safe = false) static 删除已经上传的文件 + * @method string upload($client = false) static 获取文件上传目标地址 + * @method string setBucket($name) static 阿里云OSS专属创建Bucket空间 */ class File { + const DEVER_LOCAL = 'local'; + const DERVER_QINIU = 'qiniu'; + const DERVER_ALIOSS = 'oss'; + /** * 当前配置对象 * @var Options @@ -77,21 +86,21 @@ class File * @param string $name * @param array $arguments * @return mixed - * @throws \think\Exception + * @throws Exception */ public static function __callStatic($name, $arguments) { if (method_exists($class = self::instance(self::$config->get('storage_type')), $name)) { return call_user_func_array([$class, $name], $arguments); } - throw new \think\Exception("File driver method not exists: " . get_class($class) . "->{$name}"); + throw new Exception("File driver method not exists: " . get_class($class) . "->{$name}"); } /** * 设置文件驱动名称 * @param string $name * @return \library\driver\Local - * @throws \think\Exception + * @throws Exception */ public static function instance($name) { @@ -101,7 +110,7 @@ class File if (class_exists($object = __NAMESPACE__ . "\\driver\\{$class}")) { return self::$object[$class] = new $object; } - throw new \think\Exception("File driver [{$class}] does not exist."); + throw new Exception("File driver [{$class}] does not exist."); } /** @@ -167,7 +176,7 @@ class File if (empty($force) && $file->has($name)) return $file->info($name); return $file->save($name, file_get_contents($url)); } catch (\Exception $e) { - \think\facade\Log::error(__METHOD__ . " File download failed [ {$url} ] {$e->getMessage()}"); + Log::error(__METHOD__ . " File download failed [ {$url} ] {$e->getMessage()}"); return ['url' => $url, 'hash' => md5($url), 'key' => $url, 'file' => $url]; } } @@ -175,13 +184,17 @@ class File /** * 文件储存初始化 * @param array $data - * @throws \think\Exception + * @throws Exception * @throws \think\exception\PDOException */ public static function init($data = []) { if (empty(self::$config) && function_exists('sysconf')) { - foreach (self::$params as $arr) foreach (array_keys($arr) as $key) $data[$key] = sysconf($key); + foreach (self::$params as $arr) { + foreach (array_keys($arr) as $key) { + $data[$key] = sysconf($key); + } + } } self::$config = new Options($data); } @@ -193,5 +206,5 @@ try { File::init(); // \think\facade\Log::info(__METHOD__ . ' File storage initialization success'); } catch (\Exception $e) { - \think\facade\Log::error(__METHOD__ . " File storage initialization exception. [{$e->getMessage()}]"); + Log::error(__METHOD__ . " File storage initialization exception. [{$e->getMessage()}]"); } diff --git a/vendor/zoujingli/think-library/src/command/Sess.php b/vendor/zoujingli/think-library/src/command/Sess.php index 7d1c4733c..7e6edd622 100644 --- a/vendor/zoujingli/think-library/src/command/Sess.php +++ b/vendor/zoujingli/think-library/src/command/Sess.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -26,7 +27,7 @@ class Sess extends Command protected function configure() { - $this->setName('xclean:session')->setDescription('clean up invalid session files'); + $this->setName('xclean:session')->setDescription('清理失效过期的会话文件'); } protected function execute(\think\console\Input $input, \think\console\Output $output) @@ -42,4 +43,4 @@ class Sess extends Command $output->writeln('Complete cleaning of invalid session files'); } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/Sync.php b/vendor/zoujingli/think-library/src/command/Sync.php index c822368d6..ea5fff1f3 100644 --- a/vendor/zoujingli/think-library/src/command/Sync.php +++ b/vendor/zoujingli/think-library/src/command/Sync.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -26,6 +27,18 @@ use think\console\Output; class Sync extends Command { + /** + * 当前Admin版本号 + * @var string + */ + protected $version; + + /** + * 基础URL地址 + * @var string + */ + protected $baseUri; + /** * 指定更新模块 * @var array @@ -33,10 +46,16 @@ class Sync extends Command protected $modules = []; /** - * 基础URL地址 - * @var string + * Sync constructor. + * @param null $name */ - protected static $baseUri = 'https://framework.thinkadmin.top'; + public function __construct($name = null) + { + $this->version = config('app.thinkadmin_ver'); + if (empty($this->version)) $this->version = 'v4'; + $this->baseUri = "https://{$this->version}.thinkadmin.top"; + parent::__construct($name); + } /** * 执行指令 @@ -46,7 +65,7 @@ class Sync extends Command protected function execute(Input $input, Output $output) { $output->comment('start updating difference files'); - foreach (self::diff() as $file) foreach ($this->modules as $module) { + foreach ($this->diff() as $file) foreach ($this->modules as $module) { if (stripos($file['name'], $module) === 0) { $this->syncFile($file, $output); break; @@ -58,10 +77,10 @@ class Sync extends Command /** * 同步所有差异文件 */ - public static function sync() + public function sync() { - foreach (self::diff() as $file) { - self::syncFile($file, new Output()); + foreach ($this->diff() as $file) { + $this->syncFile($file, new Output()); } } @@ -70,10 +89,10 @@ class Sync extends Command * @param array $file * @param Output $output */ - private static function syncFile($file, $output) + private function syncFile($file, $output) { if (in_array($file['type'], ['add', 'mod'])) { - if (self::down(encode($file['name']))) { + if ($this->down(encode($file['name']))) { $output->writeln("{$file['name']} updated successfully."); } else { $output->error("{$file['name']} update failed."); @@ -81,7 +100,7 @@ class Sync extends Command } elseif (in_array($file['type'], ['del'])) { $realfile = realpath(env('root_path') . $file['name']); if (is_file($realfile) && unlink($realfile)) { - self::removeEmptyDir(dirname($realfile)); + $this->removeEmptyDir(dirname($realfile)); $output->writeln("{$file['name']} remove successfully."); } else { $output->error("{$file['name']} remove failed."); @@ -93,10 +112,10 @@ class Sync extends Command * 清理指定的空目录 * @param string $dir */ - private static function removeEmptyDir($dir) + private function removeEmptyDir($dir) { if (is_dir($dir) && count(scandir($dir)) === 2) { - if (rmdir($dir)) self::removeEmptyDir(dirname($dir)); + if (rmdir($dir)) $this->removeEmptyDir(dirname($dir)); } } @@ -104,9 +123,9 @@ class Sync extends Command * 获取当前系统文件列表 * @return array */ - public static function build() + public function build() { - return self::tree([ + return $this->tree([ 'think', 'config/log.php', 'config/cookie.php', @@ -127,12 +146,12 @@ class Sync extends Command * @param array $maps 扫描结果列表 * @return array */ - public static function tree(array $paths, array $ignores = [], array $maps = []) + public function tree(array $paths, array $ignores = [], array $maps = []) { $root = str_replace('\\', '/', env('root_path')); foreach ($paths as $key => $dir) { $paths[$key] = str_replace('\\', '/', $dir); - $maps = array_merge($maps, self::scanDir("{$root}{$paths[$key]}", $root)); + $maps = array_merge($maps, $this->scanDir("{$root}{$paths[$key]}", $root)); } // 清除忽略文件 foreach ($maps as $key => $map) foreach ($ignores as $ingore) { @@ -147,7 +166,7 @@ class Sync extends Command * @param array $local 本地文件列表信息 * @return array */ - public static function contrast(array $serve = [], array $local = []) + public function contrast(array $serve = [], array $local = []) { // 数据扁平化 list($_serve, $_local, $_new) = [[], [], []]; @@ -173,9 +192,9 @@ class Sync extends Command * @param string $encode * @return boolean|integer */ - public static function down($encode) + public function down($encode) { - $result = json_decode(http_get(self::$baseUri . "?s=admin/api.update/read/{$encode}"), true); + $result = json_decode(http_get("{$this->baseUri}?s=admin/api.update/read/{$encode}"), true); if (empty($result['code'])) return false; $pathname = env('root_path') . decode($encode); file_exists(dirname($pathname)) || mkdir(dirname($pathname), 0755, true); @@ -186,12 +205,12 @@ class Sync extends Command * 获取文件差异数据 * @return array */ - public static function diff() + public function diff() { - $result = json_decode(http_get(self::$baseUri . "?s=/admin/api.update/tree"), true); + $result = json_decode(http_get("{$this->baseUri}?s=/admin/api.update/tree"), true); if (empty($result['code'])) return []; - $new = self::tree($result['data']['paths'], $result['data']['ignores']); - return self::contrast($result['data']['list'], $new['list']); + $new = $this->tree($result['data']['paths'], $result['data']['ignores']); + return $this->contrast($result['data']['list'], $new['list']); } /** @@ -201,15 +220,15 @@ class Sync extends Command * @param array $data 扫描结果 * @return array */ - private static function scanDir($dir, $root = '', $data = []) + private function scanDir($dir, $root = '', $data = []) { if (file_exists($dir) && is_file($dir)) { - return [self::getFileInfo($dir, $root)]; + return [$this->getFileInfo($dir, $root)]; } if (file_exists($dir)) foreach (scandir($dir) as $sub) if (strpos($sub, '.') !== 0) { if (is_dir($temp = "{$dir}/{$sub}")) { - $data = array_merge($data, self::scanDir($temp, $root)); - } else array_push($data, self::getFileInfo($temp, $root)); + $data = array_merge($data, $this->scanDir($temp, $root)); + } else array_push($data, $this->getFileInfo($temp, $root)); } return $data; } @@ -220,7 +239,7 @@ class Sync extends Command * @param string $root * @return array */ - private static function getFileInfo($file, $root) + private function getFileInfo($file, $root) { $hash = md5(preg_replace('/\s{1,}/', '', file_get_contents($file))); $name = str_replace($root, '', str_replace('\\', '/', realpath($file))); diff --git a/vendor/zoujingli/think-library/src/command/Task.php b/vendor/zoujingli/think-library/src/command/Task.php index 3e0af95d3..811305c07 100644 --- a/vendor/zoujingli/think-library/src/command/Task.php +++ b/vendor/zoujingli/think-library/src/command/Task.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -101,4 +102,4 @@ class Task extends Command return PATH_SEPARATOR === ';'; } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/sync/Admin.php b/vendor/zoujingli/think-library/src/command/sync/Admin.php index bfc6e9643..9c0d84971 100644 --- a/vendor/zoujingli/think-library/src/command/sync/Admin.php +++ b/vendor/zoujingli/think-library/src/command/sync/Admin.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -27,7 +28,7 @@ class Admin extends Sync protected function configure() { $this->modules = ['application/admin/', 'think']; - $this->setName('xsync:admin')->setDescription('synchronize update admin module files'); + $this->setName('xsync:admin')->setDescription('从远程覆盖本地Admin模块的所有代码'); } protected function execute(Input $input, Output $output) @@ -40,4 +41,4 @@ class Admin extends Sync } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/sync/Config.php b/vendor/zoujingli/think-library/src/command/sync/Config.php index 8610913fc..2bb4d3765 100644 --- a/vendor/zoujingli/think-library/src/command/sync/Config.php +++ b/vendor/zoujingli/think-library/src/command/sync/Config.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -27,7 +28,7 @@ class Config extends Sync protected function configure() { $this->modules = ['config/']; - $this->setName('xsync:config')->setDescription('synchronize update config php files'); + $this->setName('xsync:config')->setDescription('从远程覆盖本地Config的部分配置文件'); } protected function execute(Input $input, Output $output) @@ -39,4 +40,4 @@ class Config extends Sync parent::execute($input, $output); } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/sync/Plugs.php b/vendor/zoujingli/think-library/src/command/sync/Plugs.php index ed3a4e824..a5b70136e 100644 --- a/vendor/zoujingli/think-library/src/command/sync/Plugs.php +++ b/vendor/zoujingli/think-library/src/command/sync/Plugs.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -27,7 +28,7 @@ class Plugs extends Sync protected function configure() { $this->modules = ['public/static/']; - $this->setName('xsync:plugs')->setDescription('synchronize update plugs static files'); + $this->setName('xsync:plugs')->setDescription('从远程覆盖本地Plugs资源插件等代码'); } protected function execute(Input $input, Output $output) @@ -39,4 +40,4 @@ class Plugs extends Sync parent::execute($input, $output); } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/sync/Service.php b/vendor/zoujingli/think-library/src/command/sync/Service.php index 89e2d2695..d9f85a018 100644 --- a/vendor/zoujingli/think-library/src/command/sync/Service.php +++ b/vendor/zoujingli/think-library/src/command/sync/Service.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -27,7 +28,7 @@ class Service extends Sync protected function configure() { $this->modules = ['application/service/']; - $this->setName('xsync:service')->setDescription('synchronize update service module files'); + $this->setName('xsync:service')->setDescription('从远程覆盖本地Service模块的所有代码'); } protected function execute(Input $input, Output $output) @@ -39,4 +40,4 @@ class Service extends Sync parent::execute($input, $output); } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/sync/Wechat.php b/vendor/zoujingli/think-library/src/command/sync/Wechat.php index 7fe28af6a..8d0498b09 100644 --- a/vendor/zoujingli/think-library/src/command/sync/Wechat.php +++ b/vendor/zoujingli/think-library/src/command/sync/Wechat.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -27,7 +28,7 @@ class Wechat extends Sync protected function configure() { $this->modules = ['application/wechat/']; - $this->setName('xsync:wechat')->setDescription('synchronize update wechat module files'); + $this->setName('xsync:wechat')->setDescription('从远程覆盖本地Wechat模块的所有代码'); } protected function execute(Input $input, Output $output) @@ -39,4 +40,4 @@ class Wechat extends Sync parent::execute($input, $output); } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/task/Reset.php b/vendor/zoujingli/think-library/src/command/task/Reset.php index 7da0ceb24..7d0723838 100644 --- a/vendor/zoujingli/think-library/src/command/task/Reset.php +++ b/vendor/zoujingli/think-library/src/command/task/Reset.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -25,7 +26,7 @@ class Reset extends Task protected function configure() { - $this->setName('xtask:reset')->setDescription('reset message queue daemon'); + $this->setName('xtask:reset')->setDescription('重新启动消息队列守护进程'); } protected function execute(\think\console\Input $input, \think\console\Output $output) @@ -41,4 +42,4 @@ class Reset extends Task $output->error('message queue daemon creation failed, try again later!'); } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/task/Start.php b/vendor/zoujingli/think-library/src/command/task/Start.php index 364b2e788..0b203661b 100644 --- a/vendor/zoujingli/think-library/src/command/task/Start.php +++ b/vendor/zoujingli/think-library/src/command/task/Start.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -25,7 +26,7 @@ class Start extends Task protected function configure() { - $this->setName('xtask:start')->setDescription('start message queue daemon'); + $this->setName('xtask:start')->setDescription('开始启动消息队列守护进程'); } protected function execute(\think\console\Input $input, \think\console\Output $output) @@ -42,4 +43,4 @@ class Start extends Task } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/task/State.php b/vendor/zoujingli/think-library/src/command/task/State.php index f9c9f189f..9d8db3339 100644 --- a/vendor/zoujingli/think-library/src/command/task/State.php +++ b/vendor/zoujingli/think-library/src/command/task/State.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -25,7 +26,7 @@ class State extends Task protected function configure() { - $this->setName('xtask:state')->setDescription('view message queue daemon'); + $this->setName('xtask:state')->setDescription('查看消息队列守护进程状态'); } protected function execute(\think\console\Input $input, \think\console\Output $output) @@ -37,4 +38,4 @@ class State extends Task } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/command/task/Stop.php b/vendor/zoujingli/think-library/src/command/task/Stop.php index e838fe643..8c15ee375 100644 --- a/vendor/zoujingli/think-library/src/command/task/Stop.php +++ b/vendor/zoujingli/think-library/src/command/task/Stop.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -25,7 +26,7 @@ class Stop extends Task protected function configure() { - $this->setName('xtask:stop')->setDescription('stop message queue daemon'); + $this->setName('xtask:stop')->setDescription('立即停止消息队列守护进程'); } protected function execute(\think\console\Input $input, \think\console\Output $output) @@ -38,4 +39,4 @@ class Stop extends Task } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/common.php b/vendor/zoujingli/think-library/src/common.php index c7205f56e..7edef2a7c 100644 --- a/vendor/zoujingli/think-library/src/common.php +++ b/vendor/zoujingli/think-library/src/common.php @@ -3,15 +3,29 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- +use library\tools\Crypt; +use library\tools\Csrf; +use library\tools\Data; +use library\tools\Emoji; +use library\tools\Http; +use library\tools\Node; +use think\Console; +use think\Db; +use think\facade\Cache; +use think\facade\Middleware; +use think\facade\Response; +use think\Request; + if (!function_exists('p')) { /** * 打印输出数据到文件 @@ -21,7 +35,7 @@ if (!function_exists('p')) { */ function p($data, $force = false, $file = null) { - is_null($file) && $file = env('runtime_path') . date('Ymd') . '.txt'; + if (is_null($file)) $file = env('runtime_path') . date('Ymd') . '.txt'; $str = (is_string($data) ? $data : (is_array($data) || is_object($data)) ? print_r($data, true) : var_export($data, true)) . PHP_EOL; $force ? file_put_contents($file, $str) : file_put_contents($file, $str, FILE_APPEND); } @@ -37,8 +51,11 @@ if (!function_exists('format_datetime')) { function format_datetime($datetime, $format = 'Y年m月d日 H:i:s') { if (empty($datetime)) return '-'; - if (is_numeric($datetime)) return date($format, $datetime); - return date($format, strtotime($datetime)); + if (is_numeric($datetime)) { + return date($format, $datetime); + } else { + return date($format, strtotime($datetime)); + } } } @@ -57,18 +74,26 @@ if (!function_exists('sysconf')) { list($field, $raw) = explode('|', "{$name}|"); $key = md5(config('database.hostname') . '#' . config('database.database')); if ($value !== null) { - \think\facade\Cache::tag('system')->rm("_sysconfig_{$key}"); + Cache::tag('system')->rm("_sysconfig_{$key}"); list($row, $data) = [['name' => $field, 'value' => $value], []]; - return \library\tools\Data::save('SystemConfig', $row, 'name'); + return Data::save('SystemConfig', $row, 'name'); } if (empty($data)) { - $data = \think\facade\Cache::tag('system')->get("_sysconfig_{$key}", []); + $data = Cache::tag('system')->get("_sysconfig_{$key}", []); if (empty($data)) { - $data = \think\Db::name('SystemConfig')->column('name,value'); - \think\facade\Cache::tag('system')->set("_sysconfig_{$key}", $data, 60); + $data = Db::name('SystemConfig')->column('name,value'); + Cache::tag('system')->set("_sysconfig_{$key}", $data, 60); } } - return isset($data[$field]) ? (strtolower($raw) === 'raw' ? $data[$field] : htmlspecialchars($data[$field])) : ''; + if (isset($data[$field])) { + if (strtolower($raw) === 'raw') { + return $data[$field]; + } else { + return htmlspecialchars($data[$field]); + } + } else { + return ''; + } } } @@ -80,8 +105,7 @@ if (!function_exists('systoken')) { */ function systoken($node = null) { - $real = \library\tools\Node::get($node); - $csrf = \library\tools\Csrf::buildFormToken($real); + $csrf = Csrf::buildFormToken(Node::get($node)); return $csrf['token']; } } @@ -96,7 +120,7 @@ if (!function_exists('http_get')) { */ function http_get($url, $query = [], $options = []) { - return \library\tools\Http::get($url, $query, $options); + return Http::get($url, $query, $options); } } @@ -110,7 +134,7 @@ if (!function_exists('http_post')) { */ function http_post($url, $data, $options = []) { - return \library\tools\Http::post($url, $data, $options); + return Http::post($url, $data, $options); } } @@ -127,7 +151,7 @@ if (!function_exists('data_save')) { */ function data_save($dbQuery, $data, $key = 'id', $where = []) { - return \library\tools\Data::save($dbQuery, $data, $key, $where); + return Data::save($dbQuery, $data, $key, $where); } } @@ -144,7 +168,7 @@ if (!function_exists('data_batch_save')) { */ function data_batch_save($dbQuery, $data, $key = 'id', $where = []) { - return \library\tools\Data::batchSave($dbQuery, $data, $key, $where); + return Data::batchSave($dbQuery, $data, $key, $where); } } @@ -156,7 +180,7 @@ if (!function_exists('encode')) { */ function encode($content) { - return \library\tools\Crypt::encode($content); + return Crypt::encode($content); } } @@ -168,7 +192,7 @@ if (!function_exists('decode')) { */ function decode($content) { - return \library\tools\Crypt::decode($content); + return Crypt::decode($content); } } @@ -180,7 +204,7 @@ if (!function_exists('emoji_encode')) { */ function emoji_encode($content) { - return \library\tools\Emoji::encode($content); + return Emoji::encode($content); } } @@ -192,7 +216,7 @@ if (!function_exists('emoji_decode')) { */ function emoji_decode($content) { - return \library\tools\Emoji::decode($content); + return Emoji::decode($content); } } @@ -204,12 +228,12 @@ if (!function_exists('emoji_clear')) { */ function emoji_clear($content) { - return \library\tools\Emoji::clear($content); + return Emoji::clear($content); } } // 注册跨域中间键 -\think\facade\Middleware::add(function (\think\Request $request, \Closure $next, $header = []) { +Middleware::add(function (Request $request, \Closure $next, $header = []) { if (($origin = $request->header('origin', '*')) !== '*') { $header['Access-Control-Allow-Origin'] = $origin; $header['Access-Control-Allow-Methods'] = 'GET,POST,PATCH,PUT,DELETE'; @@ -217,14 +241,14 @@ if (!function_exists('emoji_clear')) { $header['Access-Control-Expose-Headers'] = 'User-Token-Csrf'; } if ($request->isOptions()) { - return \think\Response::create()->code(204)->header($header); + return Response::create()->code(204)->header($header); } else { return $next($request)->header($header); } }); // 注册系统常用指令 -\think\Console::addDefaultCommands([ +Console::addDefaultCommands([ 'library\command\Sess', 'library\command\task\Stop', 'library\command\task\State', @@ -241,4 +265,4 @@ if (!function_exists('emoji_clear')) { if (function_exists('think\__include_file')) { $root = rtrim(str_replace('\\', '/', env('app_path')), '/'); foreach (glob("{$root}/*/sys.php") as $file) \think\__include_file($file); -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/driver/Local.php b/vendor/zoujingli/think-library/src/driver/Local.php index ee29099bb..7ad625d67 100644 --- a/vendor/zoujingli/think-library/src/driver/Local.php +++ b/vendor/zoujingli/think-library/src/driver/Local.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -140,4 +141,4 @@ class Local extends File return true; } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/driver/Oss.php b/vendor/zoujingli/think-library/src/driver/Oss.php index 1d2ac468c..d5ac62ba7 100644 --- a/vendor/zoujingli/think-library/src/driver/Oss.php +++ b/vendor/zoujingli/think-library/src/driver/Oss.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -29,7 +30,7 @@ class Oss extends File /** * 检查文件是否已经存在 - * @param string $name + * @param string $name 文件名称 * @return boolean * @throws \OSS\Core\OssException */ @@ -41,7 +42,7 @@ class Oss extends File /** * 根据Key读取文件内容 - * @param string $name + * @param string $name 文件名称 * @return string * @throws \OSS\Core\OssException */ @@ -53,7 +54,7 @@ class Oss extends File /** * 获取文件当前URL地址 - * @param string $name 文件HASH名称 + * @param string $name 文件名称 * @return boolean|string * @throws \OSS\Core\OssException * @throws \think\Exception @@ -75,7 +76,7 @@ class Oss extends File /** * 获取阿里云对象存储URL前缀 - * @param string $name + * @param string $name 文件名称 * @return string * @throws \think\Exception */ @@ -89,14 +90,15 @@ class Oss extends File return "http://{$domain}/{$name}"; case 'auto': return "//{$domain}/{$name}"; + default: + throw new \think\Exception('未设置阿里云文件地址协议'); } - throw new \think\Exception('未设置阿里云文件地址协议'); } /** - * 阿里云OSS - * @param string $name - * @param string $content + * 阿里云OSS保存文件 + * @param string $name 文件名称 + * @param string $content 文件内容 * @return array|null */ public function save($name, $content) @@ -111,6 +113,47 @@ class Oss extends File } } + /** + * 获取文件路径 + * @param string $name 文件名称 + * @return string + */ + public function path($name) + { + return $name; + } + + /** + * 获取文件信息 + * @param string $name 文件名称 + * @return array|null + * @throws \OSS\Core\OssException + * @throws \think\Exception + */ + public function info($name) + { + $bucket = self::$config->get('storage_oss_bucket'); + $result = $this->getOssClient()->getObjectMeta($bucket, $name); + if (empty($result) || !isset($result['content-md5'])) return null; + return ['file' => $name, 'hash' => $result['content-md5'], 'url' => $this->base($name), 'key' => $name]; + } + + /** + * 删除文件 + * @param string $name 文件名称 + * @return boolean + */ + public function remove($name) + { + try { + $bucket = self::$config->get('storage_oss_bucket'); + $this->getOssClient()->deleteObject($bucket, $name); + return true; + } catch (\Exception $e) { + return false; + } + } + /** * 创建OSS空间名称 * @param string $bucket OSS空间名称 @@ -143,48 +186,6 @@ class Oss extends File return pathinfo($result['oss-request-url'], PATHINFO_BASENAME); } - /** - * 获取文件路径 - * @param string $name - * @return string - */ - public function path($name) - { - return $name; - } - - /** - * 获取文件信息 - * @param string $name - * @return array|null - * @throws \OSS\Core\OssException - * @throws \think\Exception - */ - public function info($name) - { - $bucket = self::$config->get('storage_oss_bucket'); - $result = $this->getOssClient()->getObjectMeta($bucket, $name); - if (empty($result) || !isset($result['content-md5'])) return null; - return ['file' => $name, 'hash' => $result['content-md5'], 'url' => $this->base($name), 'key' => $name]; - } - - /** - * 删除文件 - * @param string $name - * @return boolean - * @throws \Exception - */ - public function remove($name) - { - try { - $bucket = self::$config->get('storage_oss_bucket'); - $this->getOssClient()->deleteObject($bucket, $name); - } catch (\Exception $e) { - return false; - } - return true; - } - /** * 获取OssClient对象 * @return OssClient @@ -198,4 +199,4 @@ class Oss extends File return new OssClient($keyid, $secret, $endpoint); } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/driver/Qiniu.php b/vendor/zoujingli/think-library/src/driver/Qiniu.php index 6401381e6..6c0e04ccb 100644 --- a/vendor/zoujingli/think-library/src/driver/Qiniu.php +++ b/vendor/zoujingli/think-library/src/driver/Qiniu.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -40,7 +41,7 @@ class Qiniu extends File /** * 根据Key读取文件内容 - * @param string $name + * @param string $name 文件名称 * @return string * @throws \think\Exception */ @@ -51,8 +52,8 @@ class Qiniu extends File /** * 获取文件当前URL地址 - * @param string $name - * @return boolean|string + * @param string $name 文件名称 + * @return boolean|string|null * @throws \think\Exception */ public function url($name) @@ -66,7 +67,7 @@ class Qiniu extends File * @return string * @throws \think\Exception */ - public function upload($client = true) + public function upload($client = false) { $isHttps = !!self::$config->get('storage_qiniu_is_https'); switch (self::$config->get('storage_qiniu_region')) { @@ -89,7 +90,7 @@ class Qiniu extends File /** * 获取七牛云URL前缀 - * @param string $name + * @param string $name 文件名称 * @return string * @throws \think\Exception */ @@ -103,14 +104,15 @@ class Qiniu extends File return "http://{$domain}/{$name}"; case 'auto': return "//{$domain}/{$name}"; + default: + throw new \think\Exception('未配置七牛云URL前缀'); } - throw new \think\Exception('未设置七牛云文件地址协议'); } /** - * 七牛云存储 - * @param string $name - * @param string $content + * 七牛云存储文件 + * @param string $name 文件名称 + * @param string $content 文件内容 * @return array|null * @throws \think\Exception */ @@ -125,7 +127,7 @@ class Qiniu extends File /** * 获取文件路径 - * @param string $name + * @param string $name 文件名称 * @return string */ public function path($name) @@ -135,7 +137,7 @@ class Qiniu extends File /** * 获取文件信息 - * @param string $name + * @param string $name 文件名称 * @return array|null * @throws \think\Exception */ @@ -150,7 +152,7 @@ class Qiniu extends File /** * 删除文件 - * @param string $name + * @param string $name 文件名称 * @return boolean */ public function remove($name) @@ -160,6 +162,36 @@ class Qiniu extends File return empty($err); } + /** + * 获取空间列表 + * @return string + * @throws \Exception + */ + public function getBucketList() + { + list($list, $err) = (new BucketManager($this->getAuth()))->buckets(true); + if (!empty($err)) throw new \Exception($err); + foreach ($list as &$bucket) { + list($domain, $err) = $this->getDomainList($bucket); + if (empty($err)) { + $bucket = ['bucket' => $bucket, 'domain' => $domain]; + } else { + throw new \Exception($err); + } + } + return $list; + } + + /** + * 获取空间绑定的域名列表 + * @param string $bucket 空间名称 + * @return array + */ + public function getDomainList($bucket) + { + return (new BucketManager($this->getAuth()))->domains($bucket); + } + /** * 获取接口Auth对象 * @return \Qiniu\Auth @@ -172,4 +204,4 @@ class Qiniu extends File ); } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/logic/Delete.php b/vendor/zoujingli/think-library/src/logic/Delete.php index d527aecbd..6ec567d75 100644 --- a/vendor/zoujingli/think-library/src/logic/Delete.php +++ b/vendor/zoujingli/think-library/src/logic/Delete.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -93,4 +94,4 @@ class Delete extends Logic } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/logic/Form.php b/vendor/zoujingli/think-library/src/logic/Form.php index 3c0d1c7e9..2a79ee745 100644 --- a/vendor/zoujingli/think-library/src/logic/Form.php +++ b/vendor/zoujingli/think-library/src/logic/Form.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -111,4 +112,4 @@ class Form extends Logic } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/logic/Input.php b/vendor/zoujingli/think-library/src/logic/Input.php index 749d07a05..bb13cd012 100644 --- a/vendor/zoujingli/think-library/src/logic/Input.php +++ b/vendor/zoujingli/think-library/src/logic/Input.php @@ -3,18 +3,20 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- namespace library\logic; use library\Controller; +use think\Validate; /** * 输入管理器 @@ -84,7 +86,7 @@ class Input extends Logic public function init(Controller $controller) { $this->controller = $controller; - $validate = \think\Validate::make($this->rule, $this->info); + $validate = Validate::make($this->rule, $this->info); if ($validate->check($this->data)) { return $this->data; } else { @@ -92,4 +94,4 @@ class Input extends Logic } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/logic/Logic.php b/vendor/zoujingli/think-library/src/logic/Logic.php index fdb681afd..ffe1e19e3 100644 --- a/vendor/zoujingli/think-library/src/logic/Logic.php +++ b/vendor/zoujingli/think-library/src/logic/Logic.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -53,4 +54,4 @@ abstract class Logic return is_string($dbQuery) ? Db::name($dbQuery) : $dbQuery; } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/logic/Page.php b/vendor/zoujingli/think-library/src/logic/Page.php index 8ac81b943..63c404456 100644 --- a/vendor/zoujingli/think-library/src/logic/Page.php +++ b/vendor/zoujingli/think-library/src/logic/Page.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -49,7 +50,7 @@ class Page extends Logic protected $isDisplay; /** - * ViewList constructor. + * Page constructor. * @param string $dbQuery 数据库查询对象 * @param boolean $isPage 是否启用分页 * @param boolean $isDisplay 是否渲染模板 @@ -68,7 +69,7 @@ class Page extends Logic /** * 逻辑器初始化 * @param Controller $controller - * @return mixed + * @return array * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException @@ -82,7 +83,7 @@ class Page extends Logic if ($this->controller->request->isPost()) $this->_sort(); // 未配置 order 规则时自动按 sort 字段排序 if (!$this->query->getOptions('order') && method_exists($this->query, 'getTableFields')) { - if (in_array('sort', $this->query->getTableFields())) $this->query->order('sort asc'); + if (in_array('sort', $this->query->getTableFields())) $this->query->order('sort desc'); } // 列表分页及结果集处理 if ($this->isPage) { @@ -139,4 +140,4 @@ class Page extends Logic } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/logic/Query.php b/vendor/zoujingli/think-library/src/logic/Query.php index d015475f2..bfb7bf5e3 100644 --- a/vendor/zoujingli/think-library/src/logic/Query.php +++ b/vendor/zoujingli/think-library/src/logic/Query.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -205,7 +206,7 @@ class Query extends Logic list($dk, $qk) = explode($alias, $field); } if (isset($data[$qk]) && $data[$qk] !== '') { - list($begin, $after) = explode($split, $data[$field]); + list($begin, $after) = explode($split, $data[$qk]); if (is_callable($callback)) { $after = call_user_func($callback, $after, 'after'); $begin = call_user_func($callback, $begin, 'begin'); @@ -233,4 +234,4 @@ class Query extends Logic { return (new Page($this->query, $isPage, $isDisplay, $total, $limit))->init($this->controller); } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/logic/Save.php b/vendor/zoujingli/think-library/src/logic/Save.php index b74b46887..36998180c 100644 --- a/vendor/zoujingli/think-library/src/logic/Save.php +++ b/vendor/zoujingli/think-library/src/logic/Save.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -91,10 +92,10 @@ class Save extends Logic } // 回复前端结果 if ($result !== false) { - $this->controller->success('数据记录保存成功!', ''); + $this->controller->success('数据更新成功!', ''); } else { - $this->controller->error('数据保存失败, 请稍候再试!'); + $this->controller->error('数据更新失败, 请稍候再试!'); } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Crypt.php b/vendor/zoujingli/think-library/src/tools/Crypt.php index f3cdd6bde..b414e5e69 100644 --- a/vendor/zoujingli/think-library/src/tools/Crypt.php +++ b/vendor/zoujingli/think-library/src/tools/Crypt.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -62,4 +63,4 @@ class Crypt } } } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Csrf.php b/vendor/zoujingli/think-library/src/tools/Csrf.php index f08862d48..06a00c7e0 100644 --- a/vendor/zoujingli/think-library/src/tools/Csrf.php +++ b/vendor/zoujingli/think-library/src/tools/Csrf.php @@ -3,17 +3,20 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- namespace library\tools; +use think\exception\HttpResponseException; + /** * 表单CSRF表单令牌 * Class Csrf @@ -81,11 +84,11 @@ class Csrf */ public static function fetchTemplate($tpl = '', $vars = [], $node = null) { - throw new \think\exception\HttpResponseException(view($tpl, $vars, 200, function ($html) use ($node) { + throw new HttpResponseException(view($tpl, $vars, 200, function ($html) use ($node) { return preg_replace_callback('/<\/form>/i', function () use ($node) { $csrf = self::buildFormToken($node); return ""; }, $html); })); } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Csv.php b/vendor/zoujingli/think-library/src/tools/Csv.php index fb2deaa0d..9bfb5e403 100644 --- a/vendor/zoujingli/think-library/src/tools/Csv.php +++ b/vendor/zoujingli/think-library/src/tools/Csv.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -64,4 +65,4 @@ class Csv while ($key = array_shift($attr)) $temp = isset($temp[$key]) ? $temp[$key] : $temp; return (is_string($temp) || is_numeric($temp)) ? @iconv('utf-8', 'gbk//TRANSLIT', "{$temp}") : ''; } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Data.php b/vendor/zoujingli/think-library/src/tools/Data.php index 2d2aee8e0..f58420d4b 100644 --- a/vendor/zoujingli/think-library/src/tools/Data.php +++ b/vendor/zoujingli/think-library/src/tools/Data.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -39,9 +40,14 @@ class Data list($table, $value) = [$db->getTable(), isset($data[$key]) ? $data[$key] : null]; $map = isset($where[$key]) ? [] : (is_string($value) ? [[$key, 'in', explode(',', $value)]] : [$key => $value]); if (is_array($info = Db::table($table)->master()->where($where)->where($map)->find()) && !empty($info)) { - return Db::table($table)->strict(false)->where($where)->where($map)->update($data) !== false ? $info[$key] : false; + if (Db::table($table)->strict(false)->where($where)->where($map)->update($data) !== false) { + return isset($info[$key]) ? $info[$key] : true; + } else { + return false; + } + } else { + return Db::table($table)->strict(false)->insertGetId($data); } - return Db::table($table)->strict(false)->insertGetId($data); } /** @@ -184,4 +190,4 @@ class Data while ($size >= 1024 && $pos < 6) if (++$pos) $size /= 1024; return round($size, $dec) . ' ' . $map[$pos]; } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Emoji.php b/vendor/zoujingli/think-library/src/tools/Emoji.php index 678eb9cb8..2139f2425 100644 --- a/vendor/zoujingli/think-library/src/tools/Emoji.php +++ b/vendor/zoujingli/think-library/src/tools/Emoji.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -56,4 +57,4 @@ class Emoji return strlen($match[0]) >= 4 ? '' : $match[0]; }, $content); } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Express.php b/vendor/zoujingli/think-library/src/tools/Express.php index 38b42f429..7b1e38581 100644 --- a/vendor/zoujingli/think-library/src/tools/Express.php +++ b/vendor/zoujingli/think-library/src/tools/Express.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -46,4 +47,4 @@ class Express return ['message' => 'ok', 'com' => $code, 'nu' => $number, 'data' => $list]; } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Http.php b/vendor/zoujingli/think-library/src/tools/Http.php index 4263b582f..ca70ec82a 100644 --- a/vendor/zoujingli/think-library/src/tools/Http.php +++ b/vendor/zoujingli/think-library/src/tools/Http.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -139,4 +140,4 @@ class Http return $userAgents[array_rand($userAgents, 1)]; } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Node.php b/vendor/zoujingli/think-library/src/tools/Node.php index e1c8a514d..20ba15b4e 100644 --- a/vendor/zoujingli/think-library/src/tools/Node.php +++ b/vendor/zoujingli/think-library/src/tools/Node.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -25,10 +26,21 @@ class Node { /** - * 控制器忽略函数 + * 忽略控制名的前缀 * @var array */ - protected static $ignore = ['initialize', 'success', 'error', 'redirect', 'fetch', 'assign', 'callback']; + private static $ignoreController = [ + 'api.', 'wap.', 'web.', + ]; + + /** + * 忽略控制的方法名 + * @var array + */ + private static $ignoreAction = [ + '_', 'redirect', 'assign', 'callback', + 'initialize', 'success', 'error', 'fetch', + ]; /** * 获取标准访问节点 @@ -39,13 +51,9 @@ class Node { if (empty($node)) return self::current(); if (count(explode('/', $node)) === 1) { - $preNode = Request::module() . '/' . Request::controller(); - return self::parseString($preNode) . '/' . strtolower($node); + $node = Request::module() . '/' . Request::controller() . '/' . $node; } - if (count($attr = explode('/', $node)) >= 3) { - $attr[1] = self::parseString($attr[1]); - } - return strtolower(join('/', $attr)); + return self::parseString(trim($node)); } /** @@ -54,34 +62,25 @@ class Node */ public static function current() { - $preNode = Request::module() . '/' . Request::controller(); - return self::parseString($preNode) . '/' . strtolower(Request::action()); + return self::parseString(Request::module() . '/' . Request::controller() . '/' . Request::action()); } /** - * 获取方法节点列表 + * 获取节点列表 * @param string $dir 控制器根路径 * @param array $nodes 额外数据 * @return array * @throws \ReflectionException */ - public static function getMethodTreeNode($dir, $nodes = []) + public static function getTree($dir, $nodes = []) { - foreach (self::scanDir($dir) as $file) { - list($matches, $filename) = [[], str_replace(DIRECTORY_SEPARATOR, '/', $file)]; - if (!preg_match('|/(\w+)/controller/(.+)|', $filename, $matches)) continue; - if (class_exists($classname = env('app_namespace') . str_replace('/', '\\', substr($matches[0], 0, -4)))) { - foreach ((new \ReflectionClass($classname))->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { - list($function, $comment) = [$method->getName(), $method->getDocComment()]; - if (stripos($function, '_') === 0 || in_array($function, self::$ignore)) continue; - $controller = str_replace('/', '.', substr($matches[2], 0, -4)); - if (stripos($controller, 'api.') !== false || stripos($controller, 'wap.') !== false) continue; - $node = self::parseString("{$matches[1]}/{$controller}") . '/' . strtolower($function); - $nodes[$node] = preg_replace('/^\/\*\*\*(.*?)\*.*?$/', '$1', preg_replace("/\s/", '', $comment)); - if (stripos($nodes[$node], '@') !== false) $nodes[$node] = ''; - } - } - } + self::eachController($dir, function (\ReflectionClass $reflection, $prenode) use (&$nodes) { + foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { + $action = strtolower($method->getName()); + foreach (self::$ignoreAction as $ignore) if (stripos($action, $ignore) === 0) continue 2; + $nodes[] = $prenode . $action; + }; + }); return $nodes; } @@ -94,41 +93,51 @@ class Node */ public static function getClassTreeNode($dir, $nodes = []) { - foreach (self::scanDir($dir) as $file) { - list($matches, $filename) = [[], str_replace(DIRECTORY_SEPARATOR, '/', $file)]; - if (!preg_match('|/(\w+)/controller/(.+)|', $filename, $matches)) continue; - if (class_exists($classname = env('app_namespace') . str_replace('/', '\\', substr($matches[0], 0, -4)))) { - $controller = str_replace('/', '.', substr($matches[2], 0, -4)); - if (stripos($controller, 'api.') !== false || stripos($controller, 'wap.') !== false) continue; - $node = self::parseString("{$matches[1]}/{$controller}"); - $comment = (new \ReflectionClass($classname))->getDocComment(); - $nodes[$node] = preg_replace('/^\/\*\*\*(.*?)\*.*?$/', '$1', preg_replace("/\s/", '', $comment)); - if (stripos($nodes[$node], '@') !== false) $nodes[$node] = ''; - } - } + self::eachController($dir, function (\ReflectionClass $reflection, $prenode) use (&$nodes) { + list($node, $comment) = [trim($prenode, '/'), $reflection->getDocComment()]; + $nodes[$node] = preg_replace('/^\/\*\*\*(.*?)\*.*?$/', '$1', preg_replace("/\s/", '', $comment)); + if (stripos($nodes[$node], '@') !== false) $nodes[$node] = ''; + }); return $nodes; } /** - * 获取节点列表 + * 获取方法节点列表 * @param string $dir 控制器根路径 * @param array $nodes 额外数据 * @return array + * @throws \ReflectionException */ - public static function getTree($dir, $nodes = []) + public static function getMethodTreeNode($dir, $nodes = []) { - foreach (self::scanDir($dir) as $file) { - list($matches, $filename) = [[], str_replace(DIRECTORY_SEPARATOR, '/', $file)]; - if (!preg_match('|/(\w+)/controller/(.+)|', $filename, $matches)) continue; - $classname = env('app_namespace') . str_replace('/', '\\', substr($matches[0], 0, -4)); - if (class_exists($classname)) foreach (get_class_methods($classname) as $function) { - if (stripos($function, '_') === 0 || in_array($function, self::$ignore)) continue; - $controller = str_replace('/', '.', substr($matches[2], 0, -4)); - if (stripos($controller, 'api.') !== false || stripos($controller, 'wap.') !== false) continue; - $nodes[] = self::parseString("{$matches[1]}/{$controller}") . '/' . strtolower($function); + self::eachController($dir, function (\ReflectionClass $reflection, $prenode) use (&$nodes) { + foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { + $action = strtolower($method->getName()); + foreach (self::$ignoreAction as $ignore) if (stripos($action, $ignore) === 0) continue 2; + $node = $prenode . $action; + $nodes[$node] = preg_replace('/^\/\*\*\*(.*?)\*.*?$/', '$1', preg_replace("/\s/", '', $method->getDocComment())); + if (stripos($nodes[$node], '@') !== false) $nodes[$node] = ''; + } + }); + return $nodes; + } + + /** + * 控制器扫描回调 + * @param string $dir + * @param callable $callable + * @throws \ReflectionException + */ + public static function eachController($dir, $callable) + { + foreach (Node::scanDir($dir) as $file) { + if (!preg_match("|/(\w+)/controller/(.+)\.php$|", strtr($file, '\\', '/'), $matches)) continue; + list($module, $controller) = [$matches[1], strtr($matches[2], '/', '.')]; + foreach (self::$ignoreController as $ignore) if (stripos($controller, $ignore) === 0) continue 2; + if (class_exists($class = substr(strtr(env('app_namespace') . $matches[0], '/', '\\'), 0, -4))) { + call_user_func($callable, new \ReflectionClass($class), Node::parseString("{$module}/{$controller}/")); } } - return $nodes; } /** @@ -138,13 +147,14 @@ class Node */ public static function parseString($node) { - $nodes = []; - foreach (explode('/', $node) as $str) { + if (count($nodes = explode('/', $node)) > 1) { $dots = []; - foreach (explode('.', $str) as $dot) array_push($dots, strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $dot), "_"))); - $nodes[] = join('.', $dots); + foreach (explode('.', $nodes[1]) as $dot) { + $dots[] = trim(preg_replace("/[A-Z]/", "_\\0", $dot), "_"); + } + $nodes[1] = join('.', $dots); } - return trim(join('/', $nodes), '/'); + return strtolower(join('/', $nodes)); } /** @@ -184,4 +194,4 @@ class Node return $total; } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/think-library/src/tools/Options.php b/vendor/zoujingli/think-library/src/tools/Options.php index edf779a80..f214f24a7 100644 --- a/vendor/zoujingli/think-library/src/tools/Options.php +++ b/vendor/zoujingli/think-library/src/tools/Options.php @@ -3,12 +3,13 @@ // +---------------------------------------------------------------------- // | Library for ThinkAdmin // +---------------------------------------------------------------------- -// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ] +// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ] // +---------------------------------------------------------------------- // | 官方网站: http://library.thinkadmin.top // +---------------------------------------------------------------------- // | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- +// | gitee 仓库地址 :https://gitee.com/zoujingli/ThinkLibrary // | github 仓库地址 :https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- @@ -134,4 +135,4 @@ class Options implements \ArrayAccess { $this->del($offset); } -} \ No newline at end of file +} diff --git a/vendor/zoujingli/weopen-developer/README.md b/vendor/zoujingli/weopen-developer/README.md index 0cfff9b84..894004423 100644 --- a/vendor/zoujingli/weopen-developer/README.md +++ b/vendor/zoujingli/weopen-developer/README.md @@ -124,4 +124,4 @@ Copyright Sponsor -- -![赞助](http://zoujingli.oschina.io/static/pay.png) +![赞助](http://static.thinkadmin.top/pay.png) diff --git a/vendor/zoujingli/weopen-developer/WeMini/User.php b/vendor/zoujingli/weopen-developer/WeMini/User.php index d75208a2a..d3a1f8ffe 100644 --- a/vendor/zoujingli/weopen-developer/WeMini/User.php +++ b/vendor/zoujingli/weopen-developer/WeMini/User.php @@ -76,7 +76,7 @@ class User extends BasicWeChat */ public function get($appid) { - $url = "https://api.weixin.qq.com/cgi-bin/open/unbind?access_token=ACCESS_TOKEN"; + $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]); } diff --git a/vendor/zoujingli/weopen-developer/WeOpen/Login.php b/vendor/zoujingli/weopen-developer/WeOpen/Login.php index 5e6c4609f..2c45101c5 100644 --- a/vendor/zoujingli/weopen-developer/WeOpen/Login.php +++ b/vendor/zoujingli/weopen-developer/WeOpen/Login.php @@ -61,6 +61,7 @@ class Login /** * 第二步:通过code获取access_token * @return mixed + * @throws \WeChat\Exceptions\LocalCacheException */ public function getAccessToken() { @@ -75,6 +76,7 @@ class Login * 刷新AccessToken有效期 * @param string $refreshToken * @return array + * @throws \WeChat\Exceptions\LocalCacheException */ public function refreshToken($refreshToken) { @@ -88,6 +90,7 @@ class Login * @param string $accessToken 调用凭证 * @param string $openid 普通用户的标识,对当前开发者帐号唯一 * @return array + * @throws \WeChat\Exceptions\LocalCacheException */ public function checkAccessToken($accessToken, $openid) { @@ -100,6 +103,7 @@ class Login * @param string $accessToken 调用凭证 * @param string $openid 普通用户的标识,对当前开发者帐号唯一 * @return array + * @throws \WeChat\Exceptions\LocalCacheException */ public function getUserinfo($accessToken, $openid) { diff --git a/vendor/zoujingli/weopen-developer/WeOpen/Service.php b/vendor/zoujingli/weopen-developer/WeOpen/Service.php index 78ef53919..5d8558f5c 100644 --- a/vendor/zoujingli/weopen-developer/WeOpen/Service.php +++ b/vendor/zoujingli/weopen-developer/WeOpen/Service.php @@ -375,6 +375,7 @@ class Service * @param array $data 请求数据 * @param bool $buildToJson * @return array + * @throws \WeChat\Exceptions\LocalCacheException */ protected function httpPostForJson($url, array $data, $buildToJson = true) { @@ -385,6 +386,7 @@ class Service * 以GET获取接口数据并转为数组 * @param string $url 接口地址 * @return array + * @throws \WeChat\Exceptions\LocalCacheException */ protected function httpGetForJson($url) {