fixCpBookStat.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * zhoulj
  4. * 2018-05-15
  5. */
  6. namespace App\Console\Commands\CP;
  7. use App\Modules\CP\Services\GenerateCpBookStatService;
  8. use Illuminate\Console\Command;
  9. use Log;
  10. class fixCpBookStat extends Command
  11. {
  12. /**
  13. * 执行命令 php artisan cp_generate_cp_book_stat
  14. *
  15. * The name and signature of the console command.
  16. *
  17. * @var string
  18. */
  19. protected $signature = 'cp_fix_cp_book_stat {--date=}';
  20. /**
  21. * The console command description.
  22. *
  23. * @var string
  24. */
  25. protected $description = '每日CP图书订阅数据修复';
  26. /**
  27. * Execute the console command.
  28. *
  29. * @return mixed
  30. */
  31. public function handle()
  32. {
  33. print_r("======每日CP图书订阅数据fix 【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
  34. Log::info("======每日CP图书订阅数据fix【任务执行开始】=====" . date("y-m-d H:i:s" . "\n"));
  35. // 生成每日统计
  36. if($this->option('date')){
  37. $date = $this->option('date');
  38. }else{
  39. $date = date("Y-m-d", strtotime('-1 day'));
  40. }
  41. GenerateCpBookStatService::fixCpBookDailyStat($date);
  42. Log::info("======每日CP图书订阅数据fix【任务执行结束】=====" . $date. "\n");
  43. print_r("======每日CP图书订阅数据fix【任务执行结束】=====" .$date. "\n");
  44. }
  45. }