Ken 3 дней назад
Родитель
Сommit
99369d7544
1 измененных файлов с 10 добавлено и 5 удалено
  1. 10 5
      app/Jobs/FiveSecondTaskJob.php

+ 10 - 5
app/Jobs/FiveSecondTaskJob.php

@@ -4,7 +4,9 @@
 namespace App\Jobs;
 
 use App\Services\BetService;
+use App\Services\LogService;
 use App\Services\PcIssueService;
+use Exception;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldBeUnique;
 use Illuminate\Contracts\Queue\ShouldQueue;
@@ -47,7 +49,7 @@ class FiveSecondTaskJob implements ShouldQueue
     public function handle()
     {
         try {
-            Log::error('🚀 开始执行15秒任务: ' . now());
+//            Log::error('🚀 开始执行15秒任务: ' . now());
             //自定义开奖
             PcIssueService::index();
 
@@ -66,11 +68,14 @@ class FiveSecondTaskJob implements ShouldQueue
             // 重要:使用类名而不是 self(),避免递归
             FiveSecondTaskJob::dispatch()->delay(now()->addSeconds(15));
 
-            Log::error('📅 下一个15秒任务已安排');
-
-        } catch (\Exception $e) {
-            Log::error('❌ 15秒任务执行异常: ' . $e->getMessage());
+//            Log::error('📅 下一个15秒任务已安排');
 
+        } catch (Exception $e) {
+            try {
+                throw new Exception('❌ 15秒任务执行异常: ' . $e->getMessage());
+            }catch (Exception $e) {
+               LogService::error($e);
+            }
             // 异常后15秒重试
             FiveSecondTaskJob::dispatch()->delay(now()->addSeconds(15));
         }