update admin

This commit is contained in:
全栈小学生 2023-09-16 18:42:38 +08:00
parent 7a27c663fe
commit 6b524aefb5
3 changed files with 23 additions and 6 deletions

View File

@ -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' => '',

View File

@ -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);

View File

@ -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;
}