Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
3 个修改的文件
包含
9 行增加
和
45 行删除
| @@ -192,22 +192,11 @@ class DomainInfo extends Command | @@ -192,22 +192,11 @@ class DomainInfo extends Command | ||
| 192 | public function updatePrivate($param) | 192 | public function updatePrivate($param) |
| 193 | { | 193 | { |
| 194 | $url = 'https://' . $param['domain'] . '/api/applySsl/'; | 194 | $url = 'https://' . $param['domain'] . '/api/applySsl/'; |
| 195 | - $top_domain = $this->getTopDomain($param['domain']); | ||
| 196 | - if ((empty($extend_config) || empty($extend_config[0]['origin'])) && $param['id'] != 3) { | ||
| 197 | - $extend_config = [ | ||
| 198 | - ['origin' => $top_domain, 'target' => $param['domain']] | ||
| 199 | - ]; | ||
| 200 | - } | ||
| 201 | $param = [ | 195 | $param = [ |
| 202 | - 'project_id' => $param['project_id'], | ||
| 203 | - 'type' => 1, | ||
| 204 | - 'route' => 1, | ||
| 205 | "domain" => $param['domain'], | 196 | "domain" => $param['domain'], |
| 206 | - "rewrite" => $extend_config ?? [], | ||
| 207 | - 'other_domain' => [$top_domain, '*.' . $top_domain], | 197 | + "rewrite" => $param['extend_config'], |
| 198 | + 'other_domain' => $param['other_domain'], | ||
| 208 | 'is_https' => $param['is_https'], | 199 | 'is_https' => $param['is_https'], |
| 209 | - 'private_key' => '', | ||
| 210 | - 'cert' => '' | ||
| 211 | ]; | 200 | ]; |
| 212 | return $this->curlRequest($url, $param); | 201 | return $this->curlRequest($url, $param); |
| 213 | } | 202 | } |
| @@ -250,34 +239,6 @@ class DomainInfo extends Command | @@ -250,34 +239,6 @@ class DomainInfo extends Command | ||
| 250 | return $this->curlRequest($url, $param); | 239 | return $this->curlRequest($url, $param); |
| 251 | } | 240 | } |
| 252 | 241 | ||
| 253 | - public static function getTopDomain($url) | ||
| 254 | - { | ||
| 255 | - $url = strtolower($url); //首先转成小写 | ||
| 256 | - $url = mb_ereg_replace('^( | )+', '', trim($url)); | ||
| 257 | - $url = mb_ereg_replace('( | )+$', '', $url); | ||
| 258 | - if (!preg_match('/^(http:\/\/|https)/', $url)) { | ||
| 259 | - $url = "https://" . $url; | ||
| 260 | - } | ||
| 261 | - $hosts = parse_url($url); | ||
| 262 | - $host = $hosts['host'] ?? ''; | ||
| 263 | - //查看是几级域名 | ||
| 264 | - $data = explode('.', $host); | ||
| 265 | - $n = count($data); | ||
| 266 | - if ($n < 2) { | ||
| 267 | - return $host; | ||
| 268 | - } | ||
| 269 | - //判断是否是双后缀 | ||
| 270 | - $preg = '/[\w].+\.(com|net|org|gov|edu|co|ne)\.[\w]/'; | ||
| 271 | - if (($n > 2) && preg_match($preg, $host)) { | ||
| 272 | - //双后缀取后3位 | ||
| 273 | - $host = $data[$n - 3] . '.' . $data[$n - 2] . '.' . $data[$n - 1]; | ||
| 274 | - } else { | ||
| 275 | - //非双后缀取后两位 | ||
| 276 | - $host = $data[$n - 2] . '.' . $data[$n - 1]; | ||
| 277 | - } | ||
| 278 | - return $host; | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60) | 242 | public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60) |
| 282 | { | 243 | { |
| 283 | $ch = curl_init(); | 244 | $ch = curl_init(); |
| @@ -782,15 +782,18 @@ function check_remote_url_down($url,$project_id,$domain,$is_complete=0){ | @@ -782,15 +782,18 @@ function check_remote_url_down($url,$project_id,$domain,$is_complete=0){ | ||
| 782 | $host_arr = explode('.',$host); | 782 | $host_arr = explode('.',$host); |
| 783 | $path = $arr['path'] ?? ''; | 783 | $path = $arr['path'] ?? ''; |
| 784 | 784 | ||
| 785 | - $url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path; | 785 | + if($path && substr($path,0,1) != '/'){ |
| 786 | + $path = '/'.$path; | ||
| 787 | + } | ||
| 786 | 788 | ||
| 787 | if ( | 789 | if ( |
| 788 | (empty($scheme) || $scheme == 'https' || $scheme == 'http') | 790 | (empty($scheme) || $scheme == 'https' || $scheme == 'http') |
| 789 | && (empty($host) || (strpos($host_arr[0], 'cdn') === false)) | 791 | && (empty($host) || (strpos($host_arr[0], 'cdn') === false)) |
| 790 | && $path | 792 | && $path |
| 791 | - && (substr($path, 0, 1) == '/') | ||
| 792 | && (strpos($path, '.') !== false) | 793 | && (strpos($path, '.') !== false) |
| 793 | ) { | 794 | ) { |
| 795 | + $url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path; | ||
| 796 | + | ||
| 794 | $new_url = CosService::uploadRemote($project_id,'image_product',$url_complete); | 797 | $new_url = CosService::uploadRemote($project_id,'image_product',$url_complete); |
| 795 | if($new_url){ | 798 | if($new_url){ |
| 796 | return $is_complete ? getImageUrl($new_url) : $new_url; | 799 | return $is_complete ? getImageUrl($new_url) : $new_url; |
| @@ -451,7 +451,7 @@ class ImageController extends Controller | @@ -451,7 +451,7 @@ class ImageController extends Controller | ||
| 451 | foreach ($files as $file){ | 451 | foreach ($files as $file){ |
| 452 | if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){ | 452 | if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){ |
| 453 | if ($file->getSize() > $this->cache['image_max'] * 1024) { | 453 | if ($file->getSize() > $this->cache['image_max'] * 1024) { |
| 454 | - $this->response('图片最大为1024K',Code::SYSTEM_ERROR); | 454 | + $this->response('图片最大为'.$this->cache['image_max'],Code::SYSTEM_ERROR); |
| 455 | } | 455 | } |
| 456 | }else{ | 456 | }else{ |
| 457 | if ($file->getSize() > $max) { | 457 | if ($file->getSize() > $max) { |
| @@ -462,7 +462,7 @@ class ImageController extends Controller | @@ -462,7 +462,7 @@ class ImageController extends Controller | ||
| 462 | }else{ | 462 | }else{ |
| 463 | if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){ | 463 | if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){ |
| 464 | if ($files->getSize() > $this->cache['image_max'] * 1024) { | 464 | if ($files->getSize() > $this->cache['image_max'] * 1024) { |
| 465 | - $this->response('图片最大为1024K',Code::SYSTEM_ERROR); | 465 | + $this->response('图片最大为'.$this->cache['image_max'],Code::SYSTEM_ERROR); |
| 466 | } | 466 | } |
| 467 | }else{ | 467 | }else{ |
| 468 | if ($files->getSize() > $max) { | 468 | if ($files->getSize() > $max) { |
-
请 注册 或 登录 后发表评论