Jelajahi Sumber

batchService.php报错

LD 5 tahun lalu
induk
melakukan
1cca2dae3f
2 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 2 1
      app/Http/Controllers/TestController.php
  2. 2 1
      app/Services/BatchService.php

+ 2 - 1
app/Http/Controllers/TestController.php

@@ -452,7 +452,8 @@ class TestController extends Controller
     public function ld()
     {
         dd(
-            collect(collect(collect([City::query()->first()])))
+            json_encode(collect(collect(collect([City::query()->first()]))))
+
         );
     }
 

+ 2 - 1
app/Services/BatchService.php

@@ -101,10 +101,11 @@ class BatchService
 //            $ran=$this->stationTaskBatchService->runMany($stationTaskBatches);//执行波次任务
             LogService::log(__METHOD__,'assignTasks','波次任务分配7:'.json_encode($batches));
         }catch(Exception $e){
+            $batchesJson='';
             foreach ($batches as $batch){
+                $batchesJson.=json_encode($batch);
                 Cache::tags(['波次防重叠'.$batch['id']])->flush();
             }
-            $batchesJson = (isEmpty($batches)||!is_array($batches))?'':json_encode($batches);
             throw new ErrorException('注册任务失败: '. $batchesJson . $e->getMessage().$e->getTrace());
         }
     }