ComposerUpdate

This commit is contained in:
Anyon 2020-07-20 10:36:40 +08:00
parent fd2abc3e25
commit 1df53abef0
8 changed files with 68 additions and 43 deletions

18
composer.lock generated
View File

@ -691,16 +691,16 @@
}, },
{ {
"name": "topthink/think-multi-app", "name": "topthink/think-multi-app",
"version": "v1.0.13", "version": "v1.0.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-multi-app.git", "url": "https://github.com/top-think/think-multi-app.git",
"reference": "21ac02a99bd69e29444963841e09c5d39b2bcecb" "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-multi-app/zipball/21ac02a99bd69e29444963841e09c5d39b2bcecb", "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3",
"reference": "21ac02a99bd69e29444963841e09c5d39b2bcecb", "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -737,7 +737,7 @@
} }
], ],
"description": "thinkphp6 multi app support", "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", "name": "topthink/think-orm",
@ -929,12 +929,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "e60969c7e974c22953bb011a56d1d82e852b09f2" "reference": "84f463dd9e1f30421c430f570c0abde3861c4959"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e60969c7e974c22953bb011a56d1d82e852b09f2", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/84f463dd9e1f30421c430f570c0abde3861c4959",
"reference": "e60969c7e974c22953bb011a56d1d82e852b09f2", "reference": "84f463dd9e1f30421c430f570c0abde3861c4959",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -978,7 +978,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "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", "name": "zoujingli/wechat-developer",

View File

@ -706,17 +706,17 @@
}, },
{ {
"name": "topthink/think-multi-app", "name": "topthink/think-multi-app",
"version": "v1.0.13", "version": "v1.0.14",
"version_normalized": "1.0.13.0", "version_normalized": "1.0.14.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-multi-app.git", "url": "https://github.com/top-think/think-multi-app.git",
"reference": "21ac02a99bd69e29444963841e09c5d39b2bcecb" "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-multi-app/zipball/21ac02a99bd69e29444963841e09c5d39b2bcecb", "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3",
"reference": "21ac02a99bd69e29444963841e09c5d39b2bcecb", "reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -729,7 +729,7 @@
"php": ">=7.1.0", "php": ">=7.1.0",
"topthink/framework": "^6.0.0" "topthink/framework": "^6.0.0"
}, },
"time": "2020-04-24T08:53:21+00:00", "time": "2020-07-12T13:50:37+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {
@ -955,12 +955,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "e60969c7e974c22953bb011a56d1d82e852b09f2" "reference": "84f463dd9e1f30421c430f570c0abde3861c4959"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e60969c7e974c22953bb011a56d1d82e852b09f2", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/84f463dd9e1f30421c430f570c0abde3861c4959",
"reference": "e60969c7e974c22953bb011a56d1d82e852b09f2", "reference": "84f463dd9e1f30421c430f570c0abde3861c4959",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -976,7 +976,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-07-15T08:57:57+00:00", "time": "2020-07-17T08:39:58+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-07-16 10:05:59 // This file is automatically generated at:2020-07-20 10:35:09
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -21,7 +21,6 @@ use think\route\Url as UrlBuild;
*/ */
class Url extends UrlBuild class Url extends UrlBuild
{ {
/** /**
* 直接解析URL地址 * 直接解析URL地址
* @access protected * @access protected
@ -43,34 +42,25 @@ class Url extends UrlBuild
// 解析到控制器 // 解析到控制器
$url = substr($url, 1); $url = substr($url, 1);
} elseif ('' === $url) { } elseif ('' === $url) {
$url = $this->app->http->getName() . '/' . $request->controller() . '/' . $request->action(); $url = $this->getAppName() . '/' . $request->controller() . '/' . $request->action();
} else { } else {
// 解析到 应用/控制器/操作 // 解析到 应用/控制器/操作
$controller = $request->controller(); $controller = $request->controller();
$app = $this->app->http->getName(); $app = $this->getAppName();
$path = explode('/', $url); $path = explode('/', $url);
$action = array_pop($path); $action = array_pop($path);
$controller = empty($path) ? $controller : array_pop($path); $controller = empty($path) ? $controller : array_pop($path);
$app = empty($path) ? $app : array_pop($path); $app = empty($path) ? $app : array_pop($path);
$url = $controller . '/' . $action;
$bind = $this->app->config->get('app.domain_bind', []);
$url = $controller . '/' . $action; if ($key = array_search($this->app->http->getName(), $bind)) {
$bind = $this->app->config->get('app.domain_bind', []);
if ($key = array_search($app, $bind)) {
isset($bind[$_SERVER['SERVER_NAME']]) && $domain = $_SERVER['SERVER_NAME']; isset($bind[$_SERVER['SERVER_NAME']]) && $domain = $_SERVER['SERVER_NAME'];
$domain = is_bool($domain) ? $key : $domain; $domain = is_bool($domain) ? $key : $domain;
} else { } else {
$map = $this->app->config->get('app.app_map', []); $url = $app . '/' . $url;
if ($key = array_search($app, $map)) {
$url = $key . '/' . $url;
} else {
$url = $app . '/' . $url;
}
} }
} }
return $url; return $url;
@ -142,7 +132,8 @@ class Url extends UrlBuild
} }
if (!$this->app->http->isBind()) { if (!$this->app->http->isBind()) {
$url = $this->app->http->getName() . '/' . $url; $app = $this->getAppName();
$url = $app . '/' . $url;
} }
} elseif (!empty($rule) && isset($name)) { } elseif (!empty($rule) && isset($name)) {
throw new \InvalidArgumentException('route name not exists:' . $name); throw new \InvalidArgumentException('route name not exists:' . $name);
@ -222,4 +213,20 @@ class Url extends UrlBuild
return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/'); 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;
}
} }

View File

@ -147,8 +147,8 @@ abstract class Storage
return $file->info($name); return $file->info($name);
} }
} }
return $file->set($name, file_get_contents($url)); return $file->set($name, self::getCurl($url));
} catch (\Exception $e) { } catch (\Exception $exception) {
return ['url' => $url, 'hash' => md5($url), 'key' => $url, 'file' => $url]; 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'; 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 下载名称 * @param string $attname 下载名称

View File

@ -131,7 +131,7 @@ class AliossStorage extends Storage
*/ */
public function get($name, $safe = false) public function get($name, $safe = false)
{ {
return file_get_contents($this->url($name, $safe)); return self::getCurl($this->url($name, $safe));
} }
/** /**

View File

@ -94,7 +94,7 @@ class LocalStorage extends Storage
public function get($name, $safe = false) public function get($name, $safe = false)
{ {
if (!$this->has($name, $safe)) return ''; if (!$this->has($name, $safe)) return '';
return file_get_contents($this->path($name, $safe)); return self::getCurl($this->path($name, $safe));
} }
/** /**

View File

@ -101,7 +101,7 @@ class QiniuStorage extends Storage
{ {
$url = $this->url($name, $safe) . "?e=" . time(); $url = $this->url($name, $safe) . "?e=" . time();
$token = "{$this->accessKey}:{$this->safeBase64(hash_hmac('sha1', $url, $this->secretKey, true))}"; $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}");
} }
/** /**