作者 赵彬吉

ai blog自动发布

... ... @@ -62,7 +62,7 @@ class AiBlogAutoPublish extends Command
foreach ($projects as $project) {
$this->output("项目{$project->id}开始自动发布");
$next_auto_date = AiBlogTaskModel::where('project_id', $project->id)->whereNotNull('next_auto_date')->orderBy('id', 'desc')->value('next_auto_date');
$next_auto_date = AiBlogTaskModel::where('project_id', $project->id)->where('type', 2)->whereNotNull('next_auto_date')->orderBy('id', 'desc')->value('next_auto_date');
if($next_auto_date && $next_auto_date > date('Y-m-d')){
$this->output("项目{$project->id}未到执行时间" . $next_auto_date);
continue;
... ... @@ -79,7 +79,7 @@ class AiBlogAutoPublish extends Command
if (empty($keywords)) {
$this->output("项目{$project->id}未获取到关键词");
}
$last_task = AiBlogTaskModel::where('project_id', $project->id)->orderBy('id', 'desc')->first();
$last_task = AiBlogTaskModel::where('project_id', $project->id)->where('type', 2)->orderBy('id', 'desc')->first();
//如果没有发布过AI blog任务, 第一次提交3个任务
if (!$last_task) {
for ($i = 0; $i < 3; $i++) {
... ...