|
...
|
...
|
@@ -9,9 +9,14 @@ |
|
|
|
|
|
|
|
namespace App\Console\Commands\Ai;
|
|
|
|
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Models\Com\Notify;
|
|
|
|
use App\Models\Devops\ServerConfig;
|
|
|
|
use App\Models\Devops\ServersIp;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\Project\AiBlogTask as AiBlogTaskModel;
|
|
|
|
use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Services\AiBlogService;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
...
|
...
|
@@ -105,6 +110,40 @@ class AiBlogAuthorId extends Command |
|
|
|
* @time :2025/5/26 16:21
|
|
|
|
*/
|
|
|
|
public function sendCPost($project_id){
|
|
|
|
//获取项目所在服务器
|
|
|
|
$project_model = new Project();
|
|
|
|
$project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']);
|
|
|
|
if(!$project_info){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$serve_ip_model = new ServersIp();
|
|
|
|
$serve_ip_info = $serve_ip_model->read(['id'=>$project_info['serve_id']],['servers_id']);
|
|
|
|
$servers_id = $serve_ip_info ? $serve_ip_info['servers_id'] : 0;
|
|
|
|
if($servers_id == ServerConfig::SELF_SITE_ID){
|
|
|
|
//自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库
|
|
|
|
$domain_model = new DomainInfo();
|
|
|
|
$domain_info = $domain_model->read(['project_id'=>$this->user['project_id']],['domain']);
|
|
|
|
if($domain_info){
|
|
|
|
//判断是否已有更新进行中
|
|
|
|
$notify_model = new Notify();
|
|
|
|
$data = [
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'type' => 1,
|
|
|
|
'route' => $this->route,
|
|
|
|
'server_id' => ServerConfig::SELF_SITE_ID,
|
|
|
|
'status' => ['!=',Notify::STATUS_FINISH_SITEMAP]
|
|
|
|
];
|
|
|
|
$notify = $notify_model->read($data,['id']);
|
|
|
|
if(!$notify){
|
|
|
|
$domain = $domain_info['domain'];
|
|
|
|
$data['data'] = Arr::a2s(['domain'=>$domain,'url'=>$this->route,'language'=>[]]);
|
|
|
|
$data['status'] = Notify::STATUS_INIT;
|
|
|
|
$data['is_pull_html_zip'] = Notify::IS_PULL_HTML_ZIP_FALSE;
|
|
|
|
$data['sort'] = 1;
|
|
|
|
$notify_model->add($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$domainModel = new DomainInfo();
|
|
|
|
$domain = $domainModel->getProjectIdDomain($project_id);
|
|
|
|
$c_url = $domain.'api/update_page/';
|
|
...
|
...
|
@@ -119,4 +158,5 @@ class AiBlogAuthorId extends Command |
|
|
|
$res = http_post($c_url, json_encode($param,true));
|
|
|
|
echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|