diff --git a/application/admin/view/config.file.html b/application/admin/view/config.file.html index 3d5553d01..5ab92dd70 100644 --- a/application/admin/view/config.file.html +++ b/application/admin/view/config.file.html @@ -7,12 +7,18 @@
@@ -20,6 +26,9 @@ 免费申请10G存储空间, 申请成功后添加公开bucket空间
+
+ 若还没有Ali-OSS存储账号,请点击 创建AliOSS存储空间 +
@@ -30,29 +39,29 @@

七牛云存储空间所在区域,需要严格对应储存所在区域才能上传文件

@@ -63,13 +72,13 @@

七牛云资源访问协议(HTTP 或 HTTPS),HTTPS 需要配置证书才能使用

@@ -117,6 +126,60 @@
+
+ +
+ +

AliOSS资源访问协议(HTTP 或 HTTPS),HTTPS 需要配置证书才能使用

+
+
+ + +
+ +
+ +

填写OSS存储空间名称,如:static

+
+
+ +
+ +
+ +

填写OSS存储外部访问域名,如:static.ctolog.cc

+
+
+ +
+ +
+ +

可以在 阿里云 个人中心 设置并获取到访问密钥

+
+
+ + +
+ +
+ +

可以在 七牛云 个人中心 设置并获取到安全密钥

+
+
+
diff --git a/composer.json b/composer.json index 7b87e5c3c..d79dbe52c 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "topthink/think-captcha": "^1.0", "topthink/think-mongo": "^1.1", "topthink/think-queue": "^1.0", - "endroid/qrcode": "^1.9" + "endroid/qrcode": "^1.9", + "aliyuncs/oss-sdk-php": "^2.2" }, "extra": { "think-path": "thinkphp" diff --git a/extend/service/FileService.php b/extend/service/FileService.php index 3d8922457..bb5d1a428 100644 --- a/extend/service/FileService.php +++ b/extend/service/FileService.php @@ -15,11 +15,13 @@ namespace service; use Exception; -use think\Log; -use think\Config; +use OSS\Core\OssException; +use OSS\OssClient; use Qiniu\Auth; use Qiniu\Storage\BucketManager; use Qiniu\Storage\UploadManager; +use think\Config; +use think\Log; /** * 系统文件服务 @@ -129,6 +131,14 @@ class FileService { return (sysconf('storage_qiniu_is_https') ? 'https' : 'http') . '://' . sysconf('storage_qiniu_domain') . '/'; } + /** + * 获取AliOss URL前缀 + * @return string + */ + public static function getBaseUriOss() { + return (sysconf('storage_oss_is_https') ? 'https' : 'http') . '://' . sysconf('storage_oss_domain') . '/'; + } + /** * 检查文件是否已经存在 * @param string $filename @@ -196,12 +206,8 @@ class FileService { $filepath = ROOT_PATH . 'static/upload/' . $filename; !file_exists(dirname($filepath)) && mkdir(dirname($filepath), '0755', true); if (file_put_contents($filepath, $bodycontent)) { - return [ - 'file' => $filepath, - 'hash' => md5_file($filepath), - 'key' => "upload/{$filename}", - 'url' => pathinfo(request()->baseFile(true), PATHINFO_DIRNAME) . '/upload/' . $filename, - ]; + $url = pathinfo(request()->baseFile(true), PATHINFO_DIRNAME) . '/upload/' . $filename; + return ['file' => $filepath, 'hash' => md5_file($filepath), 'key' => "upload/{$filename}", 'url' => $url]; } } catch (Exception $err) { Log::error('本地文件存储失败, ' . var_export($err, true)); @@ -229,4 +235,21 @@ class FileService { return $result; } + /** + * 阿里云OSS + * @param type $filename + * @param type $bodycontent + * @return type + */ + public static function oss($filename, $bodycontent) { + try { + $ossClient = new OssClient(sysconf('storage_oss_keyid'), sysconf('storage_oss_secret'), self::getBaseUriOss(), true); + $result = $ossClient->putObject(sysconf('storage_oss_bucket'), $filename, $bodycontent); + return ['file' => $filename, 'hash' => $result['content-md5'], 'key' => $filename, 'url' => $result['oss-request-url']]; + } catch (OssException $err) { + Log::error('阿里云OSS文件上传失败, ' . var_export($err, true)); + return null; + } + } + } diff --git a/vendor/autoload.php b/vendor/autoload.php index fbcec486e..5d49adb27 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit5cb6a9364227ba2158c05a13f4655c4b::getLoader(); +return ComposerAutoloaderInitd15b7724a4339f816295e7d8e017c8aa::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index bf1c38b2b..90681700d 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -21,6 +21,66 @@ return array( 'Endroid\\QrCode\\Factory\\QrCodeFactory' => $vendorDir . '/endroid/qrcode/src/Factory/QrCodeFactory.php', 'Endroid\\QrCode\\QrCode' => $vendorDir . '/endroid/qrcode/src/QrCode.php', 'Ip2Region' => $vendorDir . '/zoujingli/ip2region/Ip2Region.php', + 'OSS\\Core\\MimeTypes' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php', + 'OSS\\Core\\OssException' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php', + 'OSS\\Core\\OssUtil' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php', + 'OSS\\Http\\RequestCore' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php', + 'OSS\\Http\\RequestCore_Exception' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore_Exception.php', + 'OSS\\Http\\ResponseCore' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php', + 'OSS\\Model\\BucketInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php', + 'OSS\\Model\\BucketListInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php', + 'OSS\\Model\\CnameConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php', + 'OSS\\Model\\CorsConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php', + 'OSS\\Model\\CorsRule' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php', + 'OSS\\Model\\GetLiveChannelHistory' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php', + 'OSS\\Model\\GetLiveChannelInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php', + 'OSS\\Model\\GetLiveChannelStatus' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php', + 'OSS\\Model\\LifecycleAction' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php', + 'OSS\\Model\\LifecycleConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php', + 'OSS\\Model\\LifecycleRule' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php', + 'OSS\\Model\\ListMultipartUploadInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ListMultipartUploadInfo.php', + 'OSS\\Model\\ListPartsInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ListPartsInfo.php', + 'OSS\\Model\\LiveChannelConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelConfig.php', + 'OSS\\Model\\LiveChannelHistory' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelHistory.php', + 'OSS\\Model\\LiveChannelInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelInfo.php', + 'OSS\\Model\\LiveChannelListInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php', + 'OSS\\Model\\LoggingConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php', + 'OSS\\Model\\ObjectInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php', + 'OSS\\Model\\ObjectListInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php', + 'OSS\\Model\\PartInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php', + 'OSS\\Model\\PrefixInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php', + 'OSS\\Model\\RefererConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php', + 'OSS\\Model\\UploadInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php', + 'OSS\\Model\\WebsiteConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php', + 'OSS\\Model\\XmlConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php', + 'OSS\\OssClient' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/OssClient.php', + 'OSS\\Result\\AclResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php', + 'OSS\\Result\\AppendResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php', + 'OSS\\Result\\BodyResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php', + 'OSS\\Result\\CallbackResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php', + 'OSS\\Result\\CopyObjectResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php', + 'OSS\\Result\\DeleteObjectsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php', + 'OSS\\Result\\ExistResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php', + 'OSS\\Result\\GetCnameResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php', + 'OSS\\Result\\GetCorsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php', + 'OSS\\Result\\GetLifecycleResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php', + 'OSS\\Result\\GetLiveChannelHistoryResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelHistoryResult.php', + 'OSS\\Result\\GetLiveChannelInfoResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelInfoResult.php', + 'OSS\\Result\\GetLiveChannelStatusResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelStatusResult.php', + 'OSS\\Result\\GetLoggingResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php', + 'OSS\\Result\\GetRefererResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php', + 'OSS\\Result\\GetWebsiteResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php', + 'OSS\\Result\\HeaderResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php', + 'OSS\\Result\\InitiateMultipartUploadResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php', + 'OSS\\Result\\ListBucketsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php', + 'OSS\\Result\\ListLiveChannelResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php', + 'OSS\\Result\\ListMultipartUploadResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php', + 'OSS\\Result\\ListObjectsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php', + 'OSS\\Result\\ListPartsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php', + 'OSS\\Result\\PutLiveChannelResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php', + 'OSS\\Result\\PutSetDeleteResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/PutSetDeleteResult.php', + 'OSS\\Result\\Result' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php', + 'OSS\\Result\\UploadPartResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/UploadPartResult.php', 'Qiniu\\Auth' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Auth.php', 'Qiniu\\Config' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Config.php', 'Qiniu\\Etag' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Etag.php', @@ -54,6 +114,7 @@ return array( 'Wechat\\WechatCustom' => $vendorDir . '/zoujingli/wechat-php-sdk/Wechat/WechatCustom.php', 'Wechat\\WechatDevice' => $vendorDir . '/zoujingli/wechat-php-sdk/Wechat/WechatDevice.php', 'Wechat\\WechatExtends' => $vendorDir . '/zoujingli/wechat-php-sdk/Wechat/WechatExtends.php', + 'Wechat\\WechatHardware' => $vendorDir . '/zoujingli/wechat-php-sdk/Wechat/WechatHardware.php', 'Wechat\\WechatMedia' => $vendorDir . '/zoujingli/wechat-php-sdk/Wechat/WechatMedia.php', 'Wechat\\WechatMenu' => $vendorDir . '/zoujingli/wechat-php-sdk/Wechat/WechatMenu.php', 'Wechat\\WechatOauth' => $vendorDir . '/zoujingli/wechat-php-sdk/Wechat/WechatOauth.php', diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 73679c1ad..b0471ab4f 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -14,5 +14,6 @@ return array( 'Wechat\\' => array($vendorDir . '/zoujingli/wechat-php-sdk/Wechat'), 'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'), 'Qiniu\\' => array($vendorDir . '/qiniu/php-sdk/src/Qiniu'), + 'OSS\\' => array($vendorDir . '/aliyuncs/oss-sdk-php/src/OSS'), 'Endroid\\QrCode\\' => array($vendorDir . '/endroid/qrcode/src'), ); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index d39a5d1db..3e1742a80 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit5cb6a9364227ba2158c05a13f4655c4b +class ComposerAutoloaderInitd15b7724a4339f816295e7d8e017c8aa { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit5cb6a9364227ba2158c05a13f4655c4b return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit5cb6a9364227ba2158c05a13f4655c4b', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitd15b7724a4339f816295e7d8e017c8aa', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit5cb6a9364227ba2158c05a13f4655c4b', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitd15b7724a4339f816295e7d8e017c8aa', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitd15b7724a4339f816295e7d8e017c8aa::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit5cb6a9364227ba2158c05a13f4655c4b $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitd15b7724a4339f816295e7d8e017c8aa::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire5cb6a9364227ba2158c05a13f4655c4b($fileIdentifier, $file); + composerRequired15b7724a4339f816295e7d8e017c8aa($fileIdentifier, $file); } return $loader; } } -function composerRequire5cb6a9364227ba2158c05a13f4655c4b($fileIdentifier, $file) +function composerRequired15b7724a4339f816295e7d8e017c8aa($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 a95ba247b..321bf68da 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b +class ComposerStaticInitd15b7724a4339f816295e7d8e017c8aa { public static $files = array ( '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', @@ -34,6 +34,10 @@ class ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b array ( 'Qiniu\\' => 6, ), + 'O' => + array ( + 'OSS\\' => 4, + ), 'E' => array ( 'Endroid\\QrCode\\' => 15, @@ -74,6 +78,10 @@ class ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b array ( 0 => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu', ), + 'OSS\\' => + array ( + 0 => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS', + ), 'Endroid\\QrCode\\' => array ( 0 => __DIR__ . '/..' . '/endroid/qrcode/src', @@ -96,6 +104,66 @@ class ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b 'Endroid\\QrCode\\Factory\\QrCodeFactory' => __DIR__ . '/..' . '/endroid/qrcode/src/Factory/QrCodeFactory.php', 'Endroid\\QrCode\\QrCode' => __DIR__ . '/..' . '/endroid/qrcode/src/QrCode.php', 'Ip2Region' => __DIR__ . '/..' . '/zoujingli/ip2region/Ip2Region.php', + 'OSS\\Core\\MimeTypes' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php', + 'OSS\\Core\\OssException' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php', + 'OSS\\Core\\OssUtil' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php', + 'OSS\\Http\\RequestCore' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php', + 'OSS\\Http\\RequestCore_Exception' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore_Exception.php', + 'OSS\\Http\\ResponseCore' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php', + 'OSS\\Model\\BucketInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php', + 'OSS\\Model\\BucketListInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php', + 'OSS\\Model\\CnameConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php', + 'OSS\\Model\\CorsConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php', + 'OSS\\Model\\CorsRule' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php', + 'OSS\\Model\\GetLiveChannelHistory' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php', + 'OSS\\Model\\GetLiveChannelInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php', + 'OSS\\Model\\GetLiveChannelStatus' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php', + 'OSS\\Model\\LifecycleAction' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php', + 'OSS\\Model\\LifecycleConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php', + 'OSS\\Model\\LifecycleRule' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php', + 'OSS\\Model\\ListMultipartUploadInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ListMultipartUploadInfo.php', + 'OSS\\Model\\ListPartsInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ListPartsInfo.php', + 'OSS\\Model\\LiveChannelConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelConfig.php', + 'OSS\\Model\\LiveChannelHistory' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelHistory.php', + 'OSS\\Model\\LiveChannelInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelInfo.php', + 'OSS\\Model\\LiveChannelListInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php', + 'OSS\\Model\\LoggingConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php', + 'OSS\\Model\\ObjectInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php', + 'OSS\\Model\\ObjectListInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php', + 'OSS\\Model\\PartInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php', + 'OSS\\Model\\PrefixInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php', + 'OSS\\Model\\RefererConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php', + 'OSS\\Model\\UploadInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php', + 'OSS\\Model\\WebsiteConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php', + 'OSS\\Model\\XmlConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php', + 'OSS\\OssClient' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/OssClient.php', + 'OSS\\Result\\AclResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php', + 'OSS\\Result\\AppendResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php', + 'OSS\\Result\\BodyResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php', + 'OSS\\Result\\CallbackResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php', + 'OSS\\Result\\CopyObjectResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php', + 'OSS\\Result\\DeleteObjectsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php', + 'OSS\\Result\\ExistResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php', + 'OSS\\Result\\GetCnameResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php', + 'OSS\\Result\\GetCorsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php', + 'OSS\\Result\\GetLifecycleResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php', + 'OSS\\Result\\GetLiveChannelHistoryResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelHistoryResult.php', + 'OSS\\Result\\GetLiveChannelInfoResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelInfoResult.php', + 'OSS\\Result\\GetLiveChannelStatusResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLiveChannelStatusResult.php', + 'OSS\\Result\\GetLoggingResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php', + 'OSS\\Result\\GetRefererResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php', + 'OSS\\Result\\GetWebsiteResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php', + 'OSS\\Result\\HeaderResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php', + 'OSS\\Result\\InitiateMultipartUploadResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php', + 'OSS\\Result\\ListBucketsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php', + 'OSS\\Result\\ListLiveChannelResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php', + 'OSS\\Result\\ListMultipartUploadResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php', + 'OSS\\Result\\ListObjectsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php', + 'OSS\\Result\\ListPartsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php', + 'OSS\\Result\\PutLiveChannelResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php', + 'OSS\\Result\\PutSetDeleteResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/PutSetDeleteResult.php', + 'OSS\\Result\\Result' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php', + 'OSS\\Result\\UploadPartResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/UploadPartResult.php', 'Qiniu\\Auth' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Auth.php', 'Qiniu\\Config' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Config.php', 'Qiniu\\Etag' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Etag.php', @@ -129,6 +197,7 @@ class ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b 'Wechat\\WechatCustom' => __DIR__ . '/..' . '/zoujingli/wechat-php-sdk/Wechat/WechatCustom.php', 'Wechat\\WechatDevice' => __DIR__ . '/..' . '/zoujingli/wechat-php-sdk/Wechat/WechatDevice.php', 'Wechat\\WechatExtends' => __DIR__ . '/..' . '/zoujingli/wechat-php-sdk/Wechat/WechatExtends.php', + 'Wechat\\WechatHardware' => __DIR__ . '/..' . '/zoujingli/wechat-php-sdk/Wechat/WechatHardware.php', 'Wechat\\WechatMedia' => __DIR__ . '/..' . '/zoujingli/wechat-php-sdk/Wechat/WechatMedia.php', 'Wechat\\WechatMenu' => __DIR__ . '/..' . '/zoujingli/wechat-php-sdk/Wechat/WechatMenu.php', 'Wechat\\WechatOauth' => __DIR__ . '/..' . '/zoujingli/wechat-php-sdk/Wechat/WechatOauth.php', @@ -314,9 +383,9 @@ class ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit5cb6a9364227ba2158c05a13f4655c4b::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitd15b7724a4339f816295e7d8e017c8aa::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitd15b7724a4339f816295e7d8e017c8aa::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitd15b7724a4339f816295e7d8e017c8aa::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 097767a27..d678c7be8 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -49,18 +49,18 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/wechat-php-sdk.git", - "reference": "38f86a42b1c0058d889a0969190540037629606a" + "reference": "caeb3d93a4c7ad78c6aaf7bcdbb0086f0e1f3ae8" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/38f86a42b1c0058d889a0969190540037629606a.zip", - "reference": "38f86a42b1c0058d889a0969190540037629606a", + "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/caeb3d93a4c7ad78c6aaf7bcdbb0086f0e1f3ae8.zip", + "reference": "caeb3d93a4c7ad78c6aaf7bcdbb0086f0e1f3ae8", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2017-04-19 13:34:58", + "time": "2017-05-10 07:41:59", "type": "project", "installation-source": "dist", "autoload": { @@ -496,5 +496,48 @@ "qrcode", "symfony" ] + }, + { + "name": "aliyuncs/oss-sdk-php", + "version": "v2.2.4", + "version_normalized": "2.2.4.0", + "source": { + "type": "git", + "url": "https://github.com/aliyun/aliyun-oss-php-sdk.git", + "reference": "0b9b85b6c5c38cfc4ef3b0205a5a62d1e36acf2e" + }, + "dist": { + "type": "zip", + "url": "https://files.phpcomposer.com/files/aliyun/aliyun-oss-php-sdk/0b9b85b6c5c38cfc4ef3b0205a5a62d1e36acf2e.zip", + "reference": "0b9b85b6c5c38cfc4ef3b0205a5a62d1e36acf2e", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "~1.0" + }, + "time": "2017-04-25 09:15:12", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "OSS\\": "src/OSS" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aliyuncs", + "homepage": "http://www.aliyun.com" + } + ], + "description": "Aliyun OSS SDK for PHP", + "homepage": "http://www.aliyun.com/product/oss/" } ] diff --git a/vendor/zoujingli/wechat-php-sdk/MIT-LICENSE.txt b/vendor/zoujingli/wechat-php-sdk/MIT-LICENSE.txt index d07e2ebab..0624076f0 100644 --- a/vendor/zoujingli/wechat-php-sdk/MIT-LICENSE.txt +++ b/vendor/zoujingli/wechat-php-sdk/MIT-LICENSE.txt @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2009-2015 walkor and contributors (see https://github.com/walkor/workerman/contributors) +Copyright (c) 2014-2017 Anyon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatDevice.php b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatDevice.php index 491ceed91..8126f94f8 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatDevice.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatDevice.php @@ -13,7 +13,7 @@ use Wechat\Lib\Tools; class WechatDevice extends Common { const SHAKEAROUND_DEVICE_APPLYID = '/shakearound/device/applyid?'; //申请设备ID - const SHAKEAROUND_DEVICE_APPLYSTATUS = '/shakearound/device/applystatus?'; //查询设备ID申请审核状态 + const SHAKEAROUND_DEVICE_APPLYSTATUS = '/shakearound/device/applystatus?'; //查询设备ID申请审核状态 const SHAKEAROUND_DEVICE_UPDATE = '/shakearound/device/update?'; //编辑设备信息 const SHAKEAROUND_DEVICE_SEARCH = '/shakearound/device/search?'; //查询设备列表 const SHAKEAROUND_DEVICE_BINDLOCATION = '/shakearound/device/bindlocation?'; //配置设备与门店ID的关系 @@ -49,7 +49,7 @@ class WechatDevice extends Common { } return false; } - + /** * 查询设备ID申请审核状态 * @param int $apply_id @@ -59,7 +59,7 @@ class WechatDevice extends Common { if (!$this->access_token && !$this->getAccessToken()) { return false; } - $data = array("apply_id" => $apply_id); + $data = array("apply_id" => $apply_id); $result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::SHAKEAROUND_DEVICE_APPLYSTATUS . "access_token={$this->access_token}", Tools::json_encode($data)); if ($result) { $json = json_decode($result, true); @@ -154,7 +154,7 @@ class WechatDevice extends Common { } return false; } - + /** * 配置设备与其他公众账号门店的关联关系 * @param type $device_identifier 设备信息 @@ -162,11 +162,11 @@ class WechatDevice extends Common { * @param type $poi_appid 目标微信appid * @return boolean */ - public function bindLocationOtherShakeAroundDevice($device_identifier,$poi_id,$poi_appid) { + public function bindLocationOtherShakeAroundDevice($device_identifier, $poi_id, $poi_appid) { if (!$this->access_token && !$this->getAccessToken()) { return false; } - $data = array('device_identifier' => $device_identifier, 'poi_id' => $poi_id,"type"=>2,"poi_appid"=>$poi_appid); + $data = array('device_identifier' => $device_identifier, 'poi_id' => $poi_id, "type" => 2, "poi_appid" => $poi_appid); $result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::SHAKEAROUND_DEVICE_BINDLOCATION . "access_token={$this->access_token}", Tools::json_encode($data)); if ($result) { $json = json_decode($result, true); diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatMedia.php b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatMedia.php index 5a8613276..3fff1663a 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatMedia.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatMedia.php @@ -82,6 +82,53 @@ class WechatMedia extends Common { return false; } + /** + * 获取临时素材(认证后的订阅号可用) 包含返回的http头信息 + * @param string $media_id 媒体文件id + * @param bool $is_video 是否为视频文件,默认为否 + * @return bool|array + */ + public function getMediaWithHttpInfo($media_id, $is_video = false) { + if (!$this->access_token && !$this->getAccessToken()) { + return false; + } + //原先的上传多媒体文件接口使用 self::UPLOAD_MEDIA_URL 前缀 + //如果要获取的素材是视频文件时,不能使用https协议,必须更换成http协议 + $url_prefix = $is_video ? str_replace('https', 'http', self::API_URL_PREFIX) : self::API_URL_PREFIX; + $url = $url_prefix . self::MEDIA_GET_URL . "access_token={$this->access_token}" . '&media_id=' . $media_id; + $oCurl = curl_init(); + if (stripos($url, "https://") !== FALSE) { + curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE); + curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); + } + curl_setopt($oCurl, CURLOPT_URL, $url); + curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); + $sContent = curl_exec($oCurl); + $aStatus = curl_getinfo($oCurl); + + $result = []; + + if (intval($aStatus["http_code"]) !== 200) { + return false; + } + + if ($sContent) { + if (is_string($sContent)) { + $json = json_decode($sContent, true); + if (isset($json['errcode'])) { + $this->errCode = $json['errcode']; + $this->errMsg = $json['errmsg']; + return $this->checkRetry(__FUNCTION__, func_get_args()); + } + } + $result['content'] = $sContent; + $result['info'] = $aStatus; + return $result; + } + return false; + } + /** * 上传图片,本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。 (认证后的订阅号可用) * 注意:上传大文件时可能需要先调用 set_time_limit(0) 避免超时 diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatPay.php b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatPay.php index 444845682..8be39107e 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatPay.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatPay.php @@ -116,6 +116,33 @@ class WechatPay { return $result; } + /** + * 创建刷卡支付参数包 + * @param string $auth_code 授权Code号 + * @param string $out_trade_no 商户订单号 + * @param int $total_fee 支付费用 + * @param string $body 订单标识 + * @param null $goods_tag 商品标签 + * @return array|bool + */ + public function createMicroPay($auth_code, $out_trade_no, $total_fee, $body, $goods_tag = null) { + $data = array( + "appid" => $this->appid, + "mch_id" => $this->mch_id, + "body" => $body, + "out_trade_no" => $out_trade_no, + "total_fee" => $total_fee, + "auth_code" => $auth_code, + "spbill_create_ip" => Tools::getAddress() + ); + empty($goods_tag) || $data['goods_tag'] = $goods_tag; + $json = Tools::xml2arr($this->postXml($data, self::MCH_BASE_URL . '/pay/micropay')); + if (!empty($json) && false === $this->_parseResult($json)) { + return false; + } + return $json; + } + /** * 支付通知验证处理 * @return bool|array diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php index fa2522ab8..e96120cb0 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php @@ -4,7 +4,6 @@ namespace Wechat; use Wechat\Lib\Common; use Wechat\Lib\Tools; -use Wechat\Loader; /** * 微信前端 JavaScript 签名SDK @@ -113,6 +112,9 @@ class WechatScript extends Common { 'translateVoice', 'getNetworkType', 'openLocation', 'getLocation', 'openProductSpecificView', 'addCard', 'chooseCard', 'openCard', 'startRecord', 'stopRecord', 'onVoiceRecordEnd', 'playVoice', 'pauseVoice', 'stopVoice', 'onVoicePlayEnd', 'uploadVoice', 'downloadVoice', + 'openWXDeviceLib', 'closeWXDeviceLib', 'getWXDeviceInfos', 'sendDataToWXDevice', 'disconnectWXDevice', 'getWXDeviceTicket', 'connectWXDevice', + 'startScanWXDevice', 'stopScanWXDevice', 'onWXDeviceBindStateChange', 'onScanWXDeviceResult', 'onReceiveDataFromWXDevice', + 'onWXDeviceBluetoothStateChange', 'onWXDeviceStateChange' ) ); }