作者 lyh

gx

@@ -7,13 +7,16 @@ use App\Helper\Common; @@ -7,13 +7,16 @@ use App\Helper\Common;
7 use App\Helper\Gpt; 7 use App\Helper\Gpt;
8 use App\Helper\Translate; 8 use App\Helper\Translate;
9 use App\Models\Ai\AiCommand; 9 use App\Models\Ai\AiCommand;
  10 +use App\Models\Domain\DomainInfo;
10 use App\Models\Mail\Mail; 11 use App\Models\Mail\Mail;
  12 +use App\Models\Project\DeployBuild;
11 use App\Models\Project\DeployOptimize; 13 use App\Models\Project\DeployOptimize;
12 use App\Models\Project\ProjectUpdateTdk; 14 use App\Models\Project\ProjectUpdateTdk;
13 use App\Models\User\User; 15 use App\Models\User\User;
14 use App\Models\WebSetting\WebLanguage; 16 use App\Models\WebSetting\WebLanguage;
15 use App\Services\ProjectServer; 17 use App\Services\ProjectServer;
16 use Illuminate\Console\Command; 18 use Illuminate\Console\Command;
  19 +use Illuminate\Http\Request;
17 use Illuminate\Support\Facades\Cache; 20 use Illuminate\Support\Facades\Cache;
18 use Illuminate\Support\Facades\DB; 21 use Illuminate\Support\Facades\DB;
19 use Illuminate\Support\Facades\Redis; 22 use Illuminate\Support\Facades\Redis;
@@ -150,6 +153,7 @@ class UpdateSeoTdk extends Command @@ -150,6 +153,7 @@ class UpdateSeoTdk extends Command
150 $this->project = ProjectServer::useProject($project_id); 153 $this->project = ProjectServer::useProject($project_id);
151 $this->seo_tdk($project_id, $task->id); 154 $this->seo_tdk($project_id, $task->id);
152 //TODO::通知C端更新所有界面 155 //TODO::通知C端更新所有界面
  156 + $this->sendNotify($project_id);
153 DB::disconnect('custom_mysql'); 157 DB::disconnect('custom_mysql');
154 }catch (\Exception $e){ 158 }catch (\Exception $e){
155 echo date('Y-m-d H:i:s') . 'line: '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL; 159 echo date('Y-m-d H:i:s') . 'line: '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
@@ -159,7 +163,30 @@ class UpdateSeoTdk extends Command @@ -159,7 +163,30 @@ class UpdateSeoTdk extends Command
159 echo date('Y-m-d H:i:s') . ' end project_id: ' . $project_id . PHP_EOL; 163 echo date('Y-m-d H:i:s') . ' end project_id: ' . $project_id . PHP_EOL;
160 } 164 }
161 } 165 }
162 - 166 + public function sendNotify($project_id)
  167 + {
  168 + //获取当前项目的域名
  169 + $domainModel = new DomainInfo();
  170 + $domainInfo = $domainModel->read(['project_id'=>$project_id]);
  171 + if($domainInfo === false){
  172 + //获取测试域名
  173 + $deployBuildModel = new DeployBuild();
  174 + $buildInfo = $deployBuildModel->read(['project_id'=>$project_id]);
  175 + $this->param['domain'] = $buildInfo['test_domain'];
  176 + }else{
  177 + $this->param['domain'] = 'https://'.$domainInfo['domain'].'/';
  178 + }
  179 + $url = $this->param['domain'].'api/update_page/';
  180 + $param = [
  181 + 'project_id' => $project_id,
  182 + 'type' => 1,
  183 + 'route' => 1,
  184 + 'url' => [],
  185 + 'language'=> [],
  186 + ];
  187 + http_post($url, json_encode($param));
  188 + $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!');
  189 + }
163 public function seo_tdk($project_id, $task_id) 190 public function seo_tdk($project_id, $task_id)
164 { 191 {
165 192