diff --git a/composer.lock b/composer.lock index 29da0c8c0..3d9b720da 100644 --- a/composer.lock +++ b/composer.lock @@ -691,16 +691,16 @@ }, { "name": "topthink/think-multi-app", - "version": "v1.0.13", + "version": "v1.0.14", "source": { "type": "git", "url": "https://github.com/top-think/think-multi-app.git", - "reference": "21ac02a99bd69e29444963841e09c5d39b2bcecb" + "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/21ac02a99bd69e29444963841e09c5d39b2bcecb", - "reference": "21ac02a99bd69e29444963841e09c5d39b2bcecb", + "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3", + "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3", "shasum": "", "mirrors": [ { @@ -737,7 +737,7 @@ } ], "description": "thinkphp6 multi app support", - "time": "2020-04-24T08:53:21+00:00" + "time": "2020-07-12T13:50:37+00:00" }, { "name": "topthink/think-orm", @@ -929,12 +929,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "e60969c7e974c22953bb011a56d1d82e852b09f2" + "reference": "84f463dd9e1f30421c430f570c0abde3861c4959" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e60969c7e974c22953bb011a56d1d82e852b09f2", - "reference": "e60969c7e974c22953bb011a56d1d82e852b09f2", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/84f463dd9e1f30421c430f570c0abde3861c4959", + "reference": "84f463dd9e1f30421c430f570c0abde3861c4959", "shasum": "", "mirrors": [ { @@ -978,7 +978,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://framework.thinkadmin.top", - "time": "2020-07-15T08:57:57+00:00" + "time": "2020-07-17T08:39:58+00:00" }, { "name": "zoujingli/wechat-developer", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 6d3d128f5..99f477594 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -706,17 +706,17 @@ }, { "name": "topthink/think-multi-app", - "version": "v1.0.13", - "version_normalized": "1.0.13.0", + "version": "v1.0.14", + "version_normalized": "1.0.14.0", "source": { "type": "git", "url": "https://github.com/top-think/think-multi-app.git", - "reference": "21ac02a99bd69e29444963841e09c5d39b2bcecb" + "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/21ac02a99bd69e29444963841e09c5d39b2bcecb", - "reference": "21ac02a99bd69e29444963841e09c5d39b2bcecb", + "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3", + "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3", "shasum": "", "mirrors": [ { @@ -729,7 +729,7 @@ "php": ">=7.1.0", "topthink/framework": "^6.0.0" }, - "time": "2020-04-24T08:53:21+00:00", + "time": "2020-07-12T13:50:37+00:00", "type": "library", "extra": { "think": { @@ -955,12 +955,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "e60969c7e974c22953bb011a56d1d82e852b09f2" + "reference": "84f463dd9e1f30421c430f570c0abde3861c4959" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e60969c7e974c22953bb011a56d1d82e852b09f2", - "reference": "e60969c7e974c22953bb011a56d1d82e852b09f2", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/84f463dd9e1f30421c430f570c0abde3861c4959", + "reference": "84f463dd9e1f30421c430f570c0abde3861c4959", "shasum": "", "mirrors": [ { @@ -976,7 +976,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2020-07-15T08:57:57+00:00", + "time": "2020-07-17T08:39:58+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index 6f6934bb3..033ac22f9 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/topthink/think-multi-app/src/Url.php b/vendor/topthink/think-multi-app/src/Url.php index 792267286..7bd6057f9 100644 --- a/vendor/topthink/think-multi-app/src/Url.php +++ b/vendor/topthink/think-multi-app/src/Url.php @@ -21,7 +21,6 @@ use think\route\Url as UrlBuild; */ class Url extends UrlBuild { - /** * 直接解析URL地址 * @access protected @@ -43,34 +42,25 @@ class Url extends UrlBuild // 解析到控制器 $url = substr($url, 1); } elseif ('' === $url) { - $url = $this->app->http->getName() . '/' . $request->controller() . '/' . $request->action(); + $url = $this->getAppName() . '/' . $request->controller() . '/' . $request->action(); } else { // 解析到 应用/控制器/操作 $controller = $request->controller(); - $app = $this->app->http->getName(); - + $app = $this->getAppName(); $path = explode('/', $url); $action = array_pop($path); $controller = empty($path) ? $controller : array_pop($path); $app = empty($path) ? $app : array_pop($path); + $url = $controller . '/' . $action; + $bind = $this->app->config->get('app.domain_bind', []); - $url = $controller . '/' . $action; - - $bind = $this->app->config->get('app.domain_bind', []); - - if ($key = array_search($app, $bind)) { + if ($key = array_search($this->app->http->getName(), $bind)) { isset($bind[$_SERVER['SERVER_NAME']]) && $domain = $_SERVER['SERVER_NAME']; + $domain = is_bool($domain) ? $key : $domain; } else { - $map = $this->app->config->get('app.app_map', []); - - if ($key = array_search($app, $map)) { - $url = $key . '/' . $url; - } else { - $url = $app . '/' . $url; - } + $url = $app . '/' . $url; } - } return $url; @@ -142,7 +132,8 @@ class Url extends UrlBuild } if (!$this->app->http->isBind()) { - $url = $this->app->http->getName() . '/' . $url; + $app = $this->getAppName(); + $url = $app . '/' . $url; } } elseif (!empty($rule) && isset($name)) { throw new \InvalidArgumentException('route name not exists:' . $name); @@ -222,4 +213,20 @@ class Url extends UrlBuild return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/'); } + /** + * 获取URL的应用名 + * @access protected + * @return string + */ + protected function getAppName() + { + $app = $this->app->http->getName(); + $map = $this->app->config->get('app.app_map', []); + + if ($key = array_search($app, $map)) { + $app = $key; + } + + return $app; + } } diff --git a/vendor/zoujingli/think-library/src/Storage.php b/vendor/zoujingli/think-library/src/Storage.php index 795914e72..1e2e00efc 100644 --- a/vendor/zoujingli/think-library/src/Storage.php +++ b/vendor/zoujingli/think-library/src/Storage.php @@ -147,8 +147,8 @@ abstract class Storage return $file->info($name); } } - return $file->set($name, file_get_contents($url)); - } catch (\Exception $e) { + return $file->set($name, self::getCurl($url)); + } catch (\Exception $exception) { return ['url' => $url, 'hash' => md5($url), 'key' => $url, 'file' => $url]; } } @@ -179,6 +179,24 @@ abstract class Storage return $mimes = include __DIR__ . '/storage/bin/mimes.php'; } + /** + * 使用CURL读取网络资源 + * @param string $url + * @return string + */ + public static function getCurl($url) + { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + list($content) = [curl_exec($ch), curl_close($ch)]; + return $content; + } + /** * 获取下载链接后缀 * @param string $attname 下载名称 diff --git a/vendor/zoujingli/think-library/src/storage/AliossStorage.php b/vendor/zoujingli/think-library/src/storage/AliossStorage.php index b1bf88a76..7b8b3c2a2 100644 --- a/vendor/zoujingli/think-library/src/storage/AliossStorage.php +++ b/vendor/zoujingli/think-library/src/storage/AliossStorage.php @@ -131,7 +131,7 @@ class AliossStorage extends Storage */ public function get($name, $safe = false) { - return file_get_contents($this->url($name, $safe)); + return self::getCurl($this->url($name, $safe)); } /** diff --git a/vendor/zoujingli/think-library/src/storage/LocalStorage.php b/vendor/zoujingli/think-library/src/storage/LocalStorage.php index 3e50357fe..658e18f7e 100644 --- a/vendor/zoujingli/think-library/src/storage/LocalStorage.php +++ b/vendor/zoujingli/think-library/src/storage/LocalStorage.php @@ -94,7 +94,7 @@ class LocalStorage extends Storage public function get($name, $safe = false) { if (!$this->has($name, $safe)) return ''; - return file_get_contents($this->path($name, $safe)); + return self::getCurl($this->path($name, $safe)); } /** diff --git a/vendor/zoujingli/think-library/src/storage/QiniuStorage.php b/vendor/zoujingli/think-library/src/storage/QiniuStorage.php index 5a05c6dd0..23b7ff69f 100644 --- a/vendor/zoujingli/think-library/src/storage/QiniuStorage.php +++ b/vendor/zoujingli/think-library/src/storage/QiniuStorage.php @@ -101,7 +101,7 @@ class QiniuStorage extends Storage { $url = $this->url($name, $safe) . "?e=" . time(); $token = "{$this->accessKey}:{$this->safeBase64(hash_hmac('sha1', $url, $this->secretKey, true))}"; - return file_get_contents("{$url}&token={$token}"); + return self::getCurl("{$url}&token={$token}"); } /**