UpdateSeoTdkCrontab.php
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
namespace App\Console\Commands\Tdk;
use App\Models\Project\Project;
use App\Models\Project\ProjectKeywordAiTask;
use App\Models\Project\ProjectUpdateTdk;
use Illuminate\Console\Command;
/**
* 初始化项目
* Class InitProject
* @package App\Console\Commands
* @author zbj
* @date 2023/10/8
*/
class UpdateSeoTdkCrontab extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update_seo_tdk_crontab';
/**
* The console command description.
*
* @var string
*/
protected $description = '一键生成tdk';
/**
* @return bool
*/
public function handle()
{
$project_ids = Project::where('type', Project::TYPE_TWO)->where('site_status',0)->where('extend_type',0)->where('delete_status',0)->where('uptime', '<=', date('Y-m-d H:i:s'))->pluck('id')->toArray();
foreach ($project_ids as $project_id){
try {
ProjectUpdateTdk::add_task($project_id);
}catch (\Exception $e){
dump($e->getMessage());
}
}
$project_ids = Project::where('type', Project::TYPE_TWO)->where('site_status',0)->where('extend_type',0)->where('delete_status',0)->where('tag_page_version', '>' ,1)->where('uptime', '<=', date('Y-m-d H:i:s'))->pluck('id')->toArray();
foreach ($project_ids as $project_id){
try {
ProjectKeywordAiTask::add_task($project_id);
}catch (\Exception $e){
dump($e->getMessage());
}
}
}
}