|
@@ -9,9 +9,14 @@ |
|
@@ -9,9 +9,14 @@ |
|
9
|
|
9
|
|
|
10
|
namespace App\Console\Commands\Ai;
|
10
|
namespace App\Console\Commands\Ai;
|
|
11
|
|
11
|
|
|
|
|
12
|
+use App\Helper\Arr;
|
|
|
|
13
|
+use App\Models\Com\Notify;
|
|
|
|
14
|
+use App\Models\Devops\ServerConfig;
|
|
|
|
15
|
+use App\Models\Devops\ServersIp;
|
|
12
|
use App\Models\Domain\DomainInfo;
|
16
|
use App\Models\Domain\DomainInfo;
|
|
13
|
use App\Models\Project\AiBlogTask as AiBlogTaskModel;
|
17
|
use App\Models\Project\AiBlogTask as AiBlogTaskModel;
|
|
14
|
use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel;
|
18
|
use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel;
|
|
|
|
19
|
+use App\Models\Project\Project;
|
|
15
|
use App\Services\AiBlogService;
|
20
|
use App\Services\AiBlogService;
|
|
16
|
use App\Services\ProjectServer;
|
21
|
use App\Services\ProjectServer;
|
|
17
|
use Illuminate\Console\Command;
|
22
|
use Illuminate\Console\Command;
|
|
@@ -105,18 +110,53 @@ class AiBlogAuthorId extends Command |
|
@@ -105,18 +110,53 @@ class AiBlogAuthorId extends Command |
|
105
|
* @time :2025/5/26 16:21
|
110
|
* @time :2025/5/26 16:21
|
|
106
|
*/
|
111
|
*/
|
|
107
|
public function sendCPost($project_id){
|
112
|
public function sendCPost($project_id){
|
|
108
|
- $domainModel = new DomainInfo();
|
|
|
|
109
|
- $domain = $domainModel->getProjectIdDomain($project_id);
|
|
|
|
110
|
- $c_url = $domain.'api/update_page/';
|
|
|
|
111
|
- $param = [
|
|
|
|
112
|
- 'project_id' => $project_id,
|
|
|
|
113
|
- 'type' => 1,
|
|
|
|
114
|
- 'route' => 3,
|
|
|
|
115
|
- 'url' => $this->route,
|
|
|
|
116
|
- 'language'=> [],
|
|
|
|
117
|
- 'is_sitemap' => 0
|
|
|
|
118
|
- ];
|
|
|
|
119
|
- $res = http_post($c_url, json_encode($param,true));
|
|
|
|
120
|
- echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
113
|
+ //获取项目所在服务器
|
|
|
|
114
|
+ $project_model = new Project();
|
|
|
|
115
|
+ $project_info = $project_model->read(['id'=>$project_id],['serve_id','is_upgrade', 'main_lang_id']);
|
|
|
|
116
|
+ if(!$project_info){
|
|
|
|
117
|
+ return false;
|
|
|
|
118
|
+ }
|
|
|
|
119
|
+ $serve_ip_model = new ServersIp();
|
|
|
|
120
|
+ $serve_ip_info = $serve_ip_model->read(['id'=>$project_info['serve_id']],['servers_id']);
|
|
|
|
121
|
+ $servers_id = $serve_ip_info ? $serve_ip_info['servers_id'] : 0;
|
|
|
|
122
|
+ if($servers_id == ServerConfig::SELF_SITE_ID){
|
|
|
|
123
|
+ //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库
|
|
|
|
124
|
+ $domain_model = new DomainInfo();
|
|
|
|
125
|
+ $domain_info = $domain_model->read(['project_id'=>$this->user['project_id']],['domain']);
|
|
|
|
126
|
+ if($domain_info){
|
|
|
|
127
|
+ //判断是否已有更新进行中
|
|
|
|
128
|
+ $notify_model = new Notify();
|
|
|
|
129
|
+ $data = [
|
|
|
|
130
|
+ 'project_id' => $project_id,
|
|
|
|
131
|
+ 'type' => 1,
|
|
|
|
132
|
+ 'route' => $this->route,
|
|
|
|
133
|
+ 'server_id' => ServerConfig::SELF_SITE_ID,
|
|
|
|
134
|
+ 'status' => ['!=',Notify::STATUS_FINISH_SITEMAP]
|
|
|
|
135
|
+ ];
|
|
|
|
136
|
+ $notify = $notify_model->read($data,['id']);
|
|
|
|
137
|
+ if(!$notify){
|
|
|
|
138
|
+ $domain = $domain_info['domain'];
|
|
|
|
139
|
+ $data['data'] = Arr::a2s(['domain'=>$domain,'url'=>$this->route,'language'=>[]]);
|
|
|
|
140
|
+ $data['status'] = Notify::STATUS_INIT;
|
|
|
|
141
|
+ $data['is_pull_html_zip'] = Notify::IS_PULL_HTML_ZIP_FALSE;
|
|
|
|
142
|
+ $data['sort'] = 1;
|
|
|
|
143
|
+ $notify_model->add($data);
|
|
|
|
144
|
+ }
|
|
|
|
145
|
+ }
|
|
|
|
146
|
+ }else{
|
|
|
|
147
|
+ $domainModel = new DomainInfo();
|
|
|
|
148
|
+ $domain = $domainModel->getProjectIdDomain($project_id);
|
|
|
|
149
|
+ $c_url = $domain.'api/update_page/';
|
|
|
|
150
|
+ $param = [
|
|
|
|
151
|
+ 'project_id' => $project_id,
|
|
|
|
152
|
+ 'type' => 1,
|
|
|
|
153
|
+ 'route' => 3,
|
|
|
|
154
|
+ 'url' => $this->route,
|
|
|
|
155
|
+ 'language'=> [],
|
|
|
|
156
|
+ 'is_sitemap' => 0
|
|
|
|
157
|
+ ];
|
|
|
|
158
|
+ $res = http_post($c_url, json_encode($param,true));
|
|
|
|
159
|
+ echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
|
|
160
|
+ }
|
|
121
|
}
|
161
|
}
|
|
122
|
} |
162
|
} |