作者 lyh

gx

... ... @@ -40,6 +40,10 @@ class DomainInfo extends Command
$map = ['status'=>['!=',2]];
$list = $domainModel->list($map);
foreach ($list as $v){
//域名结束时间<2天时,重新生成
if($v['certificate_end_time'] > date('Y-m-d H:i:s',time()+ 24*3600)){
$this->updatePrivate($v);
}
$ssl = $this->updateDomainSsl($v['domain']);
$time = $this->updateDomain($v['domain']);
$data = [
... ... @@ -48,12 +52,53 @@ class DomainInfo extends Command
'domain_start_time'=>$time['start'],
'domain_end_time'=>$time['end']
];
$domainModel->edit($data,['id'=>$v['id']]);
}
return 1;
}
/**
* @remark :更新正式
* @name :updatePrivate
* @author :lyh
* @method :post
* @time :2023/12/8 16:16
*/
public function updatePrivate($param)
{
$key = $param['private_key'];
$cert = $param['private_cert'];
if (empty($key) || empty($cert)){
$url = 'https://' . $v->domain. '/api/applySsl/';
}else{
$url = 'https://' . $v->domain. '/api/setSsl/';
}
$extend_config = json_decode($v->extend_config, true);
$top_domain = Str::getTopDomain($v->domain);
if ((empty($extend_config) || empty($extend_config[0]['origin'])) && $v->id != 3) {
$extend_config = [
['origin' => $top_domain, 'target' => $v->domain]
];
}
$param = [
'project_id' => $k,
'type' => 1,
'route' => 1,
"domain" =>$v->domain,
"rewrite"=> $extend_config,
'other_domain' => [$top_domain, '*.' . $top_domain],
'private_key' => $key,
'cert' => $cert
];
$result = app(ToolRepository::class)->curlRequest($url, $param);
Log::info('domain id: ' . $v->id . ', domain: ' . $v->domain . ', result: ' . var_export($result, true));
var_dump($result);
}
/**
* @remark :更新域名证书
* @name :updateDomainSsl
* @author :lyh
... ...
... ... @@ -38,6 +38,23 @@ class CustomModuleContentController extends BaseController
}
/**
* @remark :获取所有分类名称
* @name :getAllCategoryName
* @author :lyh
* @method :post
* @time :2023/12/8 15:47
*/
public function getAllCategoryName(){
$categoryModel = new CustomModuleCategory();
$list = $categoryModel->list(['status'=>0],'id',['id','name']);
$data = [];
foreach ($list as $v){
$data[$v['id']] = $v['name'];
}
return $this->success($data);
}
/**
* @remark :添加/编辑内容时获取分类
* @name :getCategoryList
* @author :lyh
... ...
... ... @@ -299,9 +299,9 @@ class CustomModuleCategoryLogic extends BaseLogic
*/
public function delRoute($id)
{
RouteMap::delRoute(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'], $id, $this->user['project_id']);
$info = $this->model->read(['id' => $id], ['id', 'route','module_id']);
RouteMap::delRoute(RouteMap::SOURCE_MODULE_CATE.$info['module_id'], $id, $this->user['project_id']);
//通知
$info = $this->model->read(['id' => $id], ['id', 'route']);
$this->curlDelRoute(['route'=>$info['route']]);
return $this->success();
}
... ...