支持括彩云部署

This commit is contained in:
耗子 2025-02-24 19:40:37 +08:00
parent 0877674efb
commit 39dc789ac3
No known key found for this signature in database
GPG Key ID: C964D7226D045DAA
2 changed files with 53 additions and 47 deletions

View File

@ -400,45 +400,6 @@ class DeployHelper
],
],
],
'kuocai' => [
'name' => '括彩云',
'class' => 1,
'icon' => 'kuocai.jpg',
'note' => '填写控制台账号密码',
'inputs' => [
'username' => [
'name' => '账号',
'type' => 'input',
'placeholder' => '控制台账号',
'note' => '填写手机号或邮箱',
'required' => true,
],
'password' => [
'name' => '密码',
'type' => 'input',
'placeholder' => '控制台密码',
'required' => true,
],
'proxy' => [
'name' => '使用代理服务器',
'type' => 'radio',
'options' => [
'0' => '否',
'1' => '是',
],
'value' => '0'
],
],
'taskinputs' => [
'id' => [
'name' => '域名ID',
'type' => 'input',
'placeholder' => '',
'note' => '在控制台->我的域名->配置复制浏览器地址栏显示的域名ID19位数字注意域名是否与证书匹配',
'required' => true,
],
],
],
'aliyun' => [
'name' => '阿里云',
'class' => 2,
@ -1134,6 +1095,45 @@ class DeployHelper
],
],
],
'kuocai' => [
'name' => '括彩云',
'class' => 2,
'icon' => 'kuocai.jpg',
'note' => '填写控制台账号密码',
'inputs' => [
'username' => [
'name' => '账号',
'type' => 'input',
'placeholder' => '控制台账号',
'note' => '填写手机号或邮箱',
'required' => true,
],
'password' => [
'name' => '密码',
'type' => 'input',
'placeholder' => '控制台密码',
'required' => true,
],
'proxy' => [
'name' => '使用代理服务器',
'type' => 'radio',
'options' => [
'0' => '否',
'1' => '是',
],
'value' => '0'
],
],
'taskinputs' => [
'id' => [
'name' => '域名ID',
'type' => 'input',
'placeholder' => '',
'note' => '在控制台->我的域名->配置复制浏览器地址栏显示的域名ID19位数字注意域名是否与证书匹配',
'required' => true,
],
],
],
'allwaf' => [
'name' => 'AllWAF',
'class' => 2,

View File

@ -25,12 +25,11 @@ class kuocai implements DeployInterface
if (empty($this->username) || empty($this->password)) {
throw new Exception('请填写控制台账号和密码');
}
$data = [
$this->request('/login/loginUser', [
'userAccount' => $this->username,
'userPwd' => $this->password,
'remember' => 'true'
];
$this->token = $this->request('/login/loginUser', $data);
]);
}
public function deploy($fullchain, $privatekey, $config, &$info)
@ -39,7 +38,12 @@ class kuocai implements DeployInterface
if (empty($id)) {
throw new Exception('域名ID不能为空');
}
$data = [
$this->token = $this->request('/login/loginUser', [
'userAccount' => $this->username,
'userPwd' => $this->password,
'remember' => 'true'
]);
$this->request('/CdnDomainHttps/httpsConfiguration', [
'doMainId' => $id,
'https' => [
'certificate_name' => uniqid('cert_'),
@ -48,8 +52,7 @@ class kuocai implements DeployInterface
'https_status' => 'on',
'private_key' => $privatekey,
]
];
$this->request('/CdnDomainHttps/httpsConfiguration', $data);
], true);
$this->log("域名ID:{$id}更新成功!");
}
@ -65,15 +68,18 @@ class kuocai implements DeployInterface
}
}
private function request($path, $body = null)
private function request($path, $params = null, $json = false)
{
$url = 'https://kuocai.cn' . $path;
$body = $json ? json_encode($params) : $params;
$headers = [];
if ($json) $headers[] = 'Content-Type: application/json';
$response = curl_client(
$url,
$body,
null,
$this->token ? "kuocai_cdn_token={$this->token}" : null,
null,
$headers,
$this->proxy
);
$result = json_decode($response['body'], true);