|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Logic\Aside\Project;
|
|
|
|
|
|
|
|
|
|
|
|
use App\Http\Logic\Aside\BaseLogic;
|
|
|
|
use App\Models\Project\DomainInfo;
|
|
|
|
use App\Models\Project\Payment;
|
|
|
|
use MongoDB\Client;
|
|
|
|
|
|
|
|
class DomainInfoLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->model = new DomainInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDomainInfo($project_id)
|
|
|
|
{
|
|
|
|
$project = app(ProjectLogic::class)->getInfo($project_id);
|
|
|
|
$domain = $project['deploy_optimize']['domain'] ?? '';
|
|
|
|
$info = $this->model->where('project_id', $project_id)->first();
|
|
|
|
//不存在或时间过期了 重新获取信息
|
|
|
|
$expiration_date = $info['domain_info']['expiration_date'] ?? '';
|
|
|
|
$end_time = $info['ssl']['end_time'] ?? '';
|
|
|
|
if(!$info || $expiration_date < date("Y-m-d") || $end_time < date('Y-m-d')){
|
|
|
|
try {
|
|
|
|
$mongo = new Client("mongodb://root:globalso8837840@23.228.125.2:27017");
|
|
|
|
$db = $mongo->globalso_monitor;
|
|
|
|
$collection = $db->project_v1;
|
|
|
|
$project_zk = $collection->findOne(['main_url' => $domain]);
|
|
|
|
$info['domain'] = $domain;
|
|
|
|
$info['domain_info'] = (array) $project_zk['domain_info'] ?? [];
|
|
|
|
$info['ssl'] = (array) $project_zk['ssl'] ?? [];
|
|
|
|
parent::save($info);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $info;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|