loadMissing('stationTaskBatch'); if($batch['stationTaskBatch'])return null; return Cache::remember('stationRuleBatch_batchType_'.$batchType.'_ownerId_'.$ownerId, config('cache.expirations.rarelyChange'),function()use($batch){ $builder= StationRuleBatch::query()->with('stationType') ->where('owner_id',$batch['owner_id']); if($batch['type'] && $batch['type']!='无'){ $builder=$builder->where('batch_type',$batch['type']); } return $builder->first(); }); } function getStationType_toBeTask(Batch $batch): ?StationType{ $stationRuleBatch=$this->getByBatch($batch); if(!$stationRuleBatch)return null; return $stationRuleBatch['stationType']; } /** * @param Collection $batches * @return Collection Batches */ function getBatches_shouldProcess(Collection $batches): Collection { $batches_toProcess=collect(); foreach ($batches as $batch){ $stationRuleBatch=$this->getByBatch($batch); if($stationRuleBatch) $batches_toProcess->push($batch); } return $batches_toProcess; } }