Kernel.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace App\Console;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  5. use Illuminate\Support\Facades\DB;
  6. use Illuminate\Support\Facades\Log;
  7. class Kernel extends ConsoleKernel
  8. {
  9. /**
  10. * The Artisan commands provided by your application.
  11. *
  12. * @var array
  13. */
  14. protected $commands = [
  15. //
  16. ];
  17. /**
  18. * Define the application's command schedule.
  19. *
  20. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  21. * @return void
  22. */
  23. protected function schedule(Schedule $schedule)
  24. {
  25. // $schedule->command('inspire')
  26. // ->hourly();
  27. $schedule->call(function (){
  28. // $monolog = Log::getMonolog();
  29. // $monolog->popHandler();
  30. // Log::useFiles(storage_path('logs/job/error.log'));
  31. // Log::info('test');
  32. $data=DB::table('fail')->where('season','=',20)
  33. ->where('status','=',1)
  34. ->where('type','=',1)
  35. ->select('number','id')
  36. ->get();
  37. foreach ($data as $k=>$v){
  38. $re=DB::table('inte_review')->where('season','=',20)
  39. ->where('number',$v->number)->first();
  40. if (!$re){
  41. DB::table('review_log')->insert(['number'=>$v->number,'inte_id'=>$v->id]);
  42. }
  43. }
  44. })->everyMinute();
  45. }
  46. /**
  47. * Register the commands for the application.
  48. *
  49. * @return void
  50. */
  51. protected function commands()
  52. {
  53. $this->load(__DIR__.'/Commands');
  54. require base_path('routes/console.php');
  55. }
  56. }