Loading composer.json +12 −12 Original line number Original line Diff line number Diff line Loading @@ -15,21 +15,21 @@ "ext-gd": "*", "ext-gd": "*", "ext-curl": "*", "ext-curl": "*", "ext-mbstring": "*", "ext-mbstring": "*", "hyperf/cache": "~2.1.0", "hyperf/cache": "~2.1.0|~2.2.0", "hyperf/framework": "~2.1.0", "hyperf/framework": "~2.1.0|~2.2.0", "hyperf/db-connection": "~2.1.0", "hyperf/db-connection": "~2.1.0|~2.2.0", "hyperf/validation": "~2.1.0", "hyperf/validation": "~2.1.0|~2.2.0", "hyperf/command": "~2.1.0", "hyperf/command": "~2.1.0|~2.2.0", "hyperf/redis": "~2.1.0", "hyperf/redis": "~2.1.0|~2.2.0", "hyperf/guzzle": "~2.1.0", "hyperf/guzzle": "~2.1.0|~2.2.0", "hyperf/config": "~2.1.0", "hyperf/config": "~2.1.0|~2.2.0", "hyperf/logger": "~2.1.0", "hyperf/logger": "~2.1.0|~2.2.0", "hyperf/service-governance": "~2.1.0", "hyperf/service-governance": "~2.1.0|~2.2.0", "fzaninotto/faker": "^1.9", "fzaninotto/faker": "^1.9", "phpoffice/phpspreadsheet": "^1.18", "phpoffice/phpspreadsheet": "^1.18", "dimsav/unix-zipper": "1.*", "dimsav/unix-zipper": "1.*", "hyperf/amqp": "~2.1.0", "hyperf/amqp": "~2.1.0|~2.2.0", "hyperf/paginator": "~2.1.0" "hyperf/paginator": "~2.1.0|~2.2.0" }, }, "autoload": { "autoload": { "psr-4": { "psr-4": { Loading src/Listener/RegisterServiceListener.php +19 −1 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ class RegisterServiceListener extends BaseRegisterServiceListener */ */ $host = isset($server['local_ip']) ? $server['local_ip'] : $server['host']; $host = isset($server['local_ip']) ? $server['local_ip'] : $server['host']; if (in_array($host, ['0.0.0.0', 'localhost'])) { if (in_array($host, ['0.0.0.0', 'localhost'])) { $host = $this->getInternalIp(); $host = $this->getRealInternalIp(); } } if (!filter_var($host, FILTER_VALIDATE_IP)) { if (!filter_var($host, FILTER_VALIDATE_IP)) { throw new \InvalidArgumentException(sprintf('Invalid host %s', $host)); throw new \InvalidArgumentException(sprintf('Invalid host %s', $host)); Loading @@ -45,4 +45,22 @@ class RegisterServiceListener extends BaseRegisterServiceListener return $result; return $result; } } protected function getRealInternalIp() { if (method_exists(self::class, 'getInternalIp')) { return $this->getInternalIp(); } $ips = swoole_get_local_ip(); if (is_array($ips) && ! empty($ips)) { return current($ips); } /** @var mixed|string $ip */ $ip = gethostbyname(gethostname()); if (is_string($ip)) { return $ip; } throw new \RuntimeException('Can not get the internal IP.'); } } } No newline at end of file src/Tools/Drawer.php +2 −1 Original line number Original line Diff line number Diff line Loading @@ -132,8 +132,9 @@ class Drawer { { $originUrl = $url; $originUrl = $url; //如果shopify 去掉版本号 //如果shopify 去掉版本号 if (strpos($url, 'shopify') !== false) { if (strpos($url, 'shopify') !== false && strpos($url, '?v=') !== false) { $url = substr($url, 0, strpos($url, '?v=')); $url = substr($url, 0, strpos($url, '?v=')); var_dump($url); } } $savePath = $this->rootPath . '/download/images/' . ($path ? $path . '/' : $this->savePath); $savePath = $this->rootPath . '/download/images/' . ($path ? $path . '/' : $this->savePath); create_file_dir($savePath); create_file_dir($savePath); Loading Loading
composer.json +12 −12 Original line number Original line Diff line number Diff line Loading @@ -15,21 +15,21 @@ "ext-gd": "*", "ext-gd": "*", "ext-curl": "*", "ext-curl": "*", "ext-mbstring": "*", "ext-mbstring": "*", "hyperf/cache": "~2.1.0", "hyperf/cache": "~2.1.0|~2.2.0", "hyperf/framework": "~2.1.0", "hyperf/framework": "~2.1.0|~2.2.0", "hyperf/db-connection": "~2.1.0", "hyperf/db-connection": "~2.1.0|~2.2.0", "hyperf/validation": "~2.1.0", "hyperf/validation": "~2.1.0|~2.2.0", "hyperf/command": "~2.1.0", "hyperf/command": "~2.1.0|~2.2.0", "hyperf/redis": "~2.1.0", "hyperf/redis": "~2.1.0|~2.2.0", "hyperf/guzzle": "~2.1.0", "hyperf/guzzle": "~2.1.0|~2.2.0", "hyperf/config": "~2.1.0", "hyperf/config": "~2.1.0|~2.2.0", "hyperf/logger": "~2.1.0", "hyperf/logger": "~2.1.0|~2.2.0", "hyperf/service-governance": "~2.1.0", "hyperf/service-governance": "~2.1.0|~2.2.0", "fzaninotto/faker": "^1.9", "fzaninotto/faker": "^1.9", "phpoffice/phpspreadsheet": "^1.18", "phpoffice/phpspreadsheet": "^1.18", "dimsav/unix-zipper": "1.*", "dimsav/unix-zipper": "1.*", "hyperf/amqp": "~2.1.0", "hyperf/amqp": "~2.1.0|~2.2.0", "hyperf/paginator": "~2.1.0" "hyperf/paginator": "~2.1.0|~2.2.0" }, }, "autoload": { "autoload": { "psr-4": { "psr-4": { Loading
src/Listener/RegisterServiceListener.php +19 −1 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,7 @@ class RegisterServiceListener extends BaseRegisterServiceListener */ */ $host = isset($server['local_ip']) ? $server['local_ip'] : $server['host']; $host = isset($server['local_ip']) ? $server['local_ip'] : $server['host']; if (in_array($host, ['0.0.0.0', 'localhost'])) { if (in_array($host, ['0.0.0.0', 'localhost'])) { $host = $this->getInternalIp(); $host = $this->getRealInternalIp(); } } if (!filter_var($host, FILTER_VALIDATE_IP)) { if (!filter_var($host, FILTER_VALIDATE_IP)) { throw new \InvalidArgumentException(sprintf('Invalid host %s', $host)); throw new \InvalidArgumentException(sprintf('Invalid host %s', $host)); Loading @@ -45,4 +45,22 @@ class RegisterServiceListener extends BaseRegisterServiceListener return $result; return $result; } } protected function getRealInternalIp() { if (method_exists(self::class, 'getInternalIp')) { return $this->getInternalIp(); } $ips = swoole_get_local_ip(); if (is_array($ips) && ! empty($ips)) { return current($ips); } /** @var mixed|string $ip */ $ip = gethostbyname(gethostname()); if (is_string($ip)) { return $ip; } throw new \RuntimeException('Can not get the internal IP.'); } } } No newline at end of file
src/Tools/Drawer.php +2 −1 Original line number Original line Diff line number Diff line Loading @@ -132,8 +132,9 @@ class Drawer { { $originUrl = $url; $originUrl = $url; //如果shopify 去掉版本号 //如果shopify 去掉版本号 if (strpos($url, 'shopify') !== false) { if (strpos($url, 'shopify') !== false && strpos($url, '?v=') !== false) { $url = substr($url, 0, strpos($url, '?v=')); $url = substr($url, 0, strpos($url, '?v=')); var_dump($url); } } $savePath = $this->rootPath . '/download/images/' . ($path ? $path . '/' : $this->savePath); $savePath = $this->rootPath . '/download/images/' . ($path ? $path . '/' : $this->savePath); create_file_dir($savePath); create_file_dir($savePath); Loading