Пример #1
0
 /**
  * Execute the console command.
  *
  * @return bool
  *
  * @dispatches RequestProjectCheckUrl
  */
 public function handle()
 {
     $period = [];
     $minute = intval(date('i'));
     if ($minute === 0) {
         $period = [60, 30, 10, 5];
     } else {
         if ($minute % 30 === 0) {
             $period = [30, 10, 5];
         } elseif ($minute % 10 === 0) {
             $period = [10, 5];
         } elseif ($minute % 5 === 0) {
             $period = [5];
         }
     }
     if (!empty($period)) {
         CheckUrlModel::whereIn('period', $period)->chunk(self::URLS_TO_CHECK, function ($urls) {
             $this->dispatch(new RequestProjectCheckUrl($urls));
         });
     }
     return true;
 }
Пример #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $period = [];
     $minute = intval(date('i'));
     if ($minute === 0) {
         $period = [60, 30, 10, 5];
     } else {
         if ($minute % 30 === 0) {
             $period = [30, 10, 5];
         } elseif ($minute % 10 === 0) {
             $period = [10, 5];
         } elseif ($minute % 5 === 0) {
             $period = [5];
         }
     }
     if (empty($period)) {
         return true;
     }
     $command = $this;
     CheckUrlModel::whereIn('period', $period)->chunk(10, function ($urls) use($command) {
         $command->dispatch(new RequestProjectCheckUrl($urls));
     });
 }