...
|
...
|
@@ -166,6 +166,84 @@ public function deleteSiteEvent($id, $param) |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 创建ssl证书
|
|
|
* @param $id
|
|
|
* @param $param
|
|
|
* @return bool
|
|
|
*/
|
|
|
public function createSiteSsl($id, $param)
|
|
|
{
|
|
|
if (empty($param) || FALSE == is_array($param))
|
|
|
return false;
|
|
|
$callback = $param['callback'] ?? '';
|
|
|
$host = $param['host'] ?? '';
|
|
|
if (empty($host)) {
|
|
|
if (FALSE == empty($callback) && filter_var($callback, FILTER_VALIDATE_URL)) {
|
|
|
$param['result_status'] = 400;
|
|
|
$param['result_message'] = 'host信息错误';
|
|
|
BtEvents::createBtEvent(BtEvents::TYPE_EVENT_CALLBACK, json_encode($param));
|
|
|
}
|
|
|
return $this->setEvent($id, BtEvents::STATUS_FINISH, 'host信息错误');
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
$flag = app(BtRepository::class)->applySsl($host);
|
|
|
$status = $flag ? BtEvents::STATUS_FINISH : BtEvents::STATUS_ERROR;
|
|
|
$note = $flag ? '' : '删除站点失败';
|
|
|
} catch (\Exception $e) {
|
|
|
$status = BtEvents::STATUS_ERROR;
|
|
|
$note = $e->getMessage();
|
|
|
}
|
|
|
|
|
|
if (FALSE == empty($callback) && filter_var($callback, FILTER_VALIDATE_URL)) {
|
|
|
$param['result_status'] = $status == BtEvents::STATUS_FINISH ? 200 : 400;
|
|
|
$param['result_message'] = $note;
|
|
|
BtEvents::createBtEvent(BtEvents::TYPE_EVENT_CALLBACK, json_encode($param));
|
|
|
}
|
|
|
|
|
|
return $this->setEvent($id, $status, $note);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 续签证书
|
|
|
* @param $id
|
|
|
* @param $param
|
|
|
* @return bool
|
|
|
*/
|
|
|
public function renewalSiteSsl($id, $param)
|
|
|
{
|
|
|
if (empty($param) || FALSE == is_array($param))
|
|
|
return false;
|
|
|
$callback = $param['callback'] ?? '';
|
|
|
$host = $param['host'] ?? '';
|
|
|
if (empty($host)) {
|
|
|
if (FALSE == empty($callback) && filter_var($callback, FILTER_VALIDATE_URL)) {
|
|
|
$param['result_status'] = 400;
|
|
|
$param['result_message'] = 'host信息错误';
|
|
|
BtEvents::createBtEvent(BtEvents::TYPE_EVENT_CALLBACK, json_encode($param));
|
|
|
}
|
|
|
return $this->setEvent($id, BtEvents::STATUS_FINISH, 'host信息错误');
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
$flag = app(BtRepository::class)->renewalSsl($host);
|
|
|
$status = $flag ? BtEvents::STATUS_FINISH : BtEvents::STATUS_ERROR;
|
|
|
$note = $flag ? '' : '删除站点失败';
|
|
|
} catch (\Exception $e) {
|
|
|
$status = BtEvents::STATUS_ERROR;
|
|
|
$note = $e->getMessage();
|
|
|
}
|
|
|
|
|
|
if (FALSE == empty($callback) && filter_var($callback, FILTER_VALIDATE_URL)) {
|
|
|
$param['result_status'] = $status == BtEvents::STATUS_FINISH ? 200 : 400;
|
|
|
$param['result_message'] = $note;
|
|
|
BtEvents::createBtEvent(BtEvents::TYPE_EVENT_CALLBACK, json_encode($param));
|
|
|
}
|
|
|
|
|
|
return $this->setEvent($id, $status, $note);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 回调信息
|
|
|
* @param $id
|
|
|
* @param $param
|
...
|
...
|
|