lh 3 settimane fa
parent
commit
898749f22c
1 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. 11 0
      app/Console/Commands/SyncTaskCenterCommand.php

+ 11 - 0
app/Console/Commands/SyncTaskCenterCommand.php

@@ -5,6 +5,7 @@ namespace App\Console\Commands;
 use App\Models\MpTaskCenter;
 use App\Models\MpTaskCenter;
 use App\Services\TaskCenterService;
 use App\Services\TaskCenterService;
 use Illuminate\Console\Command;
 use Illuminate\Console\Command;
+use Illuminate\Support\Facades\DB;
 
 
 class SyncTaskCenterCommand extends Command
 class SyncTaskCenterCommand extends Command
 {
 {
@@ -30,6 +31,16 @@ class SyncTaskCenterCommand extends Command
      */
      */
     public function handle(TaskCenterService $taskCenterService)
     public function handle(TaskCenterService $taskCenterService)
     {
     {
+        // 将剧本资产生成任务表的超时任务设置为失败
+        DB::table('mp_script_generate_tasks')
+        ->where('status', 'processing')
+        ->where('started_at', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))
+        ->update([
+            'status'        => 'failed',
+            'error_message' => '任务超时',
+            'updated_at'    => date('Y-m-d H:i:s')
+        ]);
+
         dLog('command')->info('开始同步任务中心状态...');
         dLog('command')->info('开始同步任务中心状态...');
 
 
         try {
         try {