作者 zhl

u cache

... ... @@ -302,11 +302,11 @@ public function setEvent($id, $status, $note = '')
if ($status == BtEvents::STATUS_ERROR && $times < BtEvents::MAX_TRIES_TIMES) {
$status = BtEvents::STATUS_INIT;
// 第一次执行失败以后, 5分钟后再执行一次; 第二次执行失败以后, 10分钟后再执行一次 0->5->15
// 第一次执行失败以后, 15分钟后再执行一次; 第二次执行失败以后, 15分钟后再执行一次 0->15->30
if ($times == 1)
$event->start_at = date('Y-m-d H:i:s', time() + 300);
$event->start_at = date('Y-m-d H:i:s', time() + 900);
if ($times == 2)
$event->start_at = date('Y-m-d H:i:s', time() + 600);
$event->start_at = date('Y-m-d H:i:s', time() + 900);
}
$event->status = $status;
$event->times = $times;
... ...
... ... @@ -51,7 +51,7 @@ public function deleteSite(Request $request)
try {
// $this->validate();
$domain = $request->input('domain');
if (empty($domain) || filter_var($domain, FILTER_VALIDATE_URL))
if (empty($domain) || FALSE == filter_var($domain, FILTER_VALIDATE_URL))
return $this->error('请提交有效domain信息');
$result = app(BtRepository::class)->deleteBtSite($domain);
... ...
... ... @@ -10,6 +10,7 @@
use App\Models\BtSites;
use App\Repositories\Bt\Bt;
use Illuminate\Filesystem\Cache;
/**
* Class BtRepository
... ... @@ -177,10 +178,16 @@ public function applySsl($host)
return true;
}
if (Cache::get('apply_ssl_' . $host))
return false;
$domain = array_column($domain_list, 'name');
$result = $bt->ApplyCert(json_encode($domain), $site->site_id);
if (empty($result) || empty($result['cert']))
if (empty($result) || empty($result['cert'])) {
// 创建失败 host冻结15分钟
Cache::put('apply_ssl_' . $host, 1, 890);
return false;
}
$bt->SetSSL('1', $host, $result['private_key'], $result['cert']);
// 开启强制https
... ...