From fa9235562a3edbd61c76dbf3deec61aa591aec20 Mon Sep 17 00:00:00 2001 From: net909 Date: Mon, 23 Dec 2024 22:31:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=8E=E4=B8=BA=E4=BA=91?= =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Auth.php | 4 ++-- app/lib/DeployHelper.php | 5 +++-- app/lib/client/HuaweiCloud.php | 2 +- app/lib/deploy/tencent.php | 7 ++++++- app/lib/dns/huawei.php | 2 ++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/controller/Auth.php b/app/controller/Auth.php index 7d7891e..0f0d81f 100644 --- a/app/controller/Auth.php +++ b/app/controller/Auth.php @@ -38,7 +38,7 @@ class Auth extends BaseController $user = Db::name('user')->where('username', $username)->find(); if ($user && password_verify($password, $user['password'])) { if ($user['status'] == 0) return json(['code' => -1, 'msg' => '此用户已被封禁', 'vcode' => 1]); - if ($user['totp_open'] == 1 && !empty($user['totp_secret'])) { + if (isset($user['totp_open']) && $user['totp_open'] == 1 && !empty($user['totp_secret'])) { session('pre_login_user', $user['id']); if (file_exists($login_limit_file)) { unlink($login_limit_file); @@ -53,7 +53,7 @@ class Auth extends BaseController } else { if ($user) { Db::name('log')->insert(['uid' => $user['id'], 'action' => '登录失败', 'data' => 'IP:' . $this->clientip, 'addtime' => date("Y-m-d H:i:s")]); - if ($user['totp_open'] == 1 && !empty($user['totp_secret'])) $login_limit_count = 10; + if (isset($user['totp_open']) && $user['totp_open'] == 1 && !empty($user['totp_secret'])) $login_limit_count = 10; } if (!file_exists($login_limit_file)) { $login_limit = ['count' => 0, 'time' => 0]; diff --git a/app/lib/DeployHelper.php b/app/lib/DeployHelper.php index 050cd8f..72e4cd2 100644 --- a/app/lib/DeployHelper.php +++ b/app/lib/DeployHelper.php @@ -600,6 +600,7 @@ class DeployHelper 'type' => 'input', 'placeholder' => '', 'show' => 'product!=\'clb\'&&product!=\'tke\'', + 'note' => 'CDN、EO、WAF多个域名可用,隔开,其他只能填写1个域名', 'required' => true, ], ], @@ -813,7 +814,7 @@ class DeployHelper 'domain' => [ 'name' => '绑定的域名', 'type' => 'input', - 'placeholder' => '多个域名可使用英文逗号分隔', + 'placeholder' => '多个域名可使用,分隔', 'required' => true, ], ], @@ -1266,7 +1267,7 @@ class DeployHelper ]; public static $class_config = [ - 1 => '自建面板', + 1 => '自建系统', 2 => '云服务商', 3 => '服务器', ]; diff --git a/app/lib/client/HuaweiCloud.php b/app/lib/client/HuaweiCloud.php index e5942b3..c9db988 100644 --- a/app/lib/client/HuaweiCloud.php +++ b/app/lib/client/HuaweiCloud.php @@ -150,6 +150,7 @@ class HuaweiCloud curl_close($ch); throw new Exception('Curl error: ' . curl_error($ch)); } + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $arr = json_decode($response, true); @@ -164,7 +165,6 @@ class HuaweiCloud return $arr; } } else { - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode >= 200 && $httpCode < 300) { return null; } else { diff --git a/app/lib/deploy/tencent.php b/app/lib/deploy/tencent.php index 6f2b5c8..9e6e561 100644 --- a/app/lib/deploy/tencent.php +++ b/app/lib/deploy/tencent.php @@ -104,9 +104,14 @@ class tencent implements DeployInterface private function deploy_common($product, $cert_id, $instance_id) { + if (in_array($product, ['cdn', 'waf', 'teo', 'ddos', 'live', 'vod']) && strpos($instance_id, ',') !== false) { + $instance_ids = explode(',', $instance_id); + } else { + $instance_ids = [$instance_id]; + } $param = [ 'CertificateId' => $cert_id, - 'InstanceIdList' => [$instance_id], + 'InstanceIdList' => $instance_ids, 'ResourceType' => $product, ]; $data = $this->client->request('DeployCertificateInstance', $param); diff --git a/app/lib/dns/huawei.php b/app/lib/dns/huawei.php index 2bd4bd9..b4ffe0f 100644 --- a/app/lib/dns/huawei.php +++ b/app/lib/dns/huawei.php @@ -78,6 +78,7 @@ class huawei implements DnsInterface foreach ($data['recordsets'] as $row) { if ($row['name'] == $row['zone_name']) $row['name'] = '@'; if ($row['type'] == 'MX') list($row['mx'], $row['records']) = explode(' ', $row['records'][0]); + if ($row['type'] == 'TXT') $row['records'] = array_map(function($v){return trim($v, '"');}, $row['records']); $list[] = [ 'RecordId' => $row['id'], 'Domain' => rtrim($row['zone_name'], '.'), @@ -111,6 +112,7 @@ class huawei implements DnsInterface if ($data) { if ($data['name'] == $data['zone_name']) $data['name'] = '@'; if ($data['type'] == 'MX') list($data['mx'], $data['records']) = explode(' ', $data['records'][0]); + if ($data['type'] == 'TXT') $data['records'] = array_map(function($v){return trim($v, '"');}, $data['records']); return [ 'RecordId' => $data['id'], 'Domain' => rtrim($data['zone_name'], '.'),