作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

... ... @@ -26,7 +26,7 @@ class UpgradeProjectCount extends Command
*
* @var string
*/
protected $signature = 'upgrade_month_count';
protected $signature = 'upgrade_month_count {project_id}';
/**
* The console command description.
... ... @@ -36,13 +36,12 @@ class UpgradeProjectCount extends Command
protected $description = '升级项目统计';
public function handle(){
$project_id = 769;
$project_id = $this->argument('project_id');
$oldModel = new UpdateOldInfo();
$info = $oldModel->read(['project_id'=>$project_id]);
$url = $info['old_domain_online'];
ProjectServer::useProject($project_id);
$this->count($project_id,$url);
DB::disconnect('custom_mysql');
}
... ...
... ... @@ -55,7 +55,7 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>645]);
$list = $projectModel->list(['id'=>264]);
$data = [];
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
... ...
... ... @@ -189,6 +189,48 @@ class DomainInfoLogic extends BaseLogic
}
/**
* 编辑amp网站证书
* @param $initDomain
* @param $domain
* @return array
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2024/02/22 14:58
*/
public function setAmpDomainSsl($initDomain,$domain)
{
if($this->param['amp_type'] == 2){
if(empty($this->param['amp_key'])){
$this->fail('AMP站点证书KEY值不能为空');
}
if(empty($this->param['amp_cert'])){
$this->fail('AMP站点证书cert值不能为空');
}
}
$api_url = 'http://'.$initDomain.'/api/createSiteAmp';
$api_param = [
'domain' => $domain,
'private_key' => $this->param['amp_key']??'',
'cert' => $this->param['amp_cert']??''
];
try {
$rs = HttpUtils::get($api_url, $api_param);
$rs = json_decode($rs, true);
if(isset($rs['status']) && $rs['status'] == 200){
return $this->success();
}else{
$this->fail($rs['message']??'');
}
} catch (\Exception | GuzzleException $e) {
errorLog('创建AMP站点', $api_param, $e);
$this->fail('编辑AMP站点证书失败');
}
return $this->success();
}
/**
* @remark :保存证书相关配置
* @name :sslSave
* @author :lyh
... ... @@ -229,10 +271,20 @@ class DomainInfoLogic extends BaseLogic
'type'=>$this->param['type'],
'private_key' => $this->param['key'] ?? '',
'private_cert' => $this->param['cert'] ?? '',
'amp_status' => $this->param['amp_status'] ?? 0,
'amp_type' => $this->param['amp_type'] ?? 0,
'amp_private_key' => $this->param['amp_key'] ?? '',
'amp_private_cert' => $this->param['amp_cert'] ?? '',
];
$this->model->edit($data,['id'=>$this->param['id']]);
//生成证书
$this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? []);
//amp站点生成证书
if($data['amp_status']){
$this->setAmpDomainSsl($server_info['init_domain'],$info['domain']);
}
return $this->success();
}
... ...
... ... @@ -57,9 +57,12 @@ class CopyProjectJob implements ShouldQueue
$data = $data->getAttributes();
$type = $data['type'];
$data['type'] = 0;
$data['old_project_id'] = $this->param['project_id'];
$data['title'] = $data['title'].'-copy';
unset($data['id']);
$project_id = $projectModel->insertGetId($data);
$hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890');
$projectModel->edit(['from_order_id'=>$hashids->encode($project_id)],['id'=>$project_id]);
//复制部署表
$buildModel = new DeployBuild();
$buildData = $buildModel::where('project_id', $this->param['project_id'])->first();
... ...