From 6b524aefb506135bb034be6932a04184b2e9a9ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=A8=E6=A0=88=E5=B0=8F=E5=AD=A6=E7=94=9F?= <1518079521@qq.com> Date: Sat, 16 Sep 2023 18:42:38 +0800 Subject: [PATCH] update admin --- niucloud/app/dict/menu/admin.php | 15 ++++++++++++++- .../service/core/addon/CoreAddonCloudService.php | 9 ++++++--- .../app/service/core/niucloud/CoreAuthService.php | 5 +++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/niucloud/app/dict/menu/admin.php b/niucloud/app/dict/menu/admin.php index cdd1db70e..e0f86bae3 100644 --- a/niucloud/app/dict/menu/admin.php +++ b/niucloud/app/dict/menu/admin.php @@ -2,8 +2,21 @@ return [ [ - 'menu_name' => '应用中心', + 'menu_name' => '概况', 'menu_key' => 'overview', + 'menu_type' => 1, + 'icon' => 'element-Monitor', + 'api_url' => '', + 'router_path' => 'overview', + 'view_path' => 'index/overview', + 'methods' => '', + 'sort' => 100, + 'status' => 1, + 'is_show' => 0, + ], + [ + 'menu_name' => '应用中心', + 'menu_key' => 'app_center', 'menu_type' => 0, 'icon' => 'iconfont-icona-shouyediannao', 'api_url' => '', diff --git a/niucloud/app/service/core/addon/CoreAddonCloudService.php b/niucloud/app/service/core/addon/CoreAddonCloudService.php index 9c85eaf62..0a6b0f932 100644 --- a/niucloud/app/service/core/addon/CoreAddonCloudService.php +++ b/niucloud/app/service/core/addon/CoreAddonCloudService.php @@ -216,17 +216,20 @@ class CoreAddonCloudService extends CoreCloudBaseService ]; // 获取文件大小 - $response = (new CloudService())->request('HEAD','cloud/build_download?' . http_build_query($query), [ + $response = (new CloudService())->request('HEAD','cloud/download?' . http_build_query($query), [ 'headers' => ['Range' => 'bytes=0-'] ]); $length = $response->getHeader('Content-range'); + $length = (int)explode("/", $length[0])[1]; $temp_dir = runtime_path() . 'backup' . DIRECTORY_SEPARATOR . 'addon_download' . DIRECTORY_SEPARATOR . uniqid() . DIRECTORY_SEPARATOR; + dir_mkdir($temp_dir); + $zip_file = $temp_dir . $addon . '.zip'; - $zip_resource = fopen($zip_file, 'W'); + $zip_resource = fopen($zip_file, 'w'); $response = (new CloudService())->request('GET','cloud/download?' . http_build_query($query), [ - 'headers' => ['Range' => "bytes=0-${$length}"] + 'headers' => ['Range' => "bytes=0-{$length}"] ]); fwrite($zip_resource, $response->getBody()); fclose($zip_resource); diff --git a/niucloud/app/service/core/niucloud/CoreAuthService.php b/niucloud/app/service/core/niucloud/CoreAuthService.php index bd503a7d1..50bd75cd0 100644 --- a/niucloud/app/service/core/niucloud/CoreAuthService.php +++ b/niucloud/app/service/core/niucloud/CoreAuthService.php @@ -32,7 +32,7 @@ class CoreAuthService extends BaseNiucloudClient { $auth_info = $this->httpGet('authinfo', ['code' => $this->code, 'secret' => $this->secret]); if(!empty($auth_info['data'])){ - $auth_info['data']['address_type'] = $this->diffDomain($_SERVER['HTTP_HOST'], $auth_info['data']['site_address']); + $auth_info['data']['address_type'] = $this->diffDomain($auth_info['data']['site_address'], $_SERVER['HTTP_HOST']); } return $auth_info; } @@ -40,9 +40,10 @@ class CoreAuthService extends BaseNiucloudClient public function diffDomain($domain, $child_domain){ $child_domain = str_replace('http://', '', $child_domain); $child_domain = str_replace('https://', '', $child_domain); + if($domain == $child_domain) return true; - if( strstr($child_domain, $domain) === false ) + if(strstr($child_domain, $domain) === false ) return false; return true; }