MaintainTempForceSubscribeUser.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. 维护公众号交互的用户表
  4. */
  5. namespace App\Console\Commands\Tool;
  6. use Log;
  7. use Illuminate\Console\Command;
  8. use App\Modules\OfficialAccount\Models\TempForceSubscribeUsers;
  9. use DB;
  10. class MaintainTempForceSubscribeUser extends Command
  11. {
  12. /**
  13. * 执行命令 MaintainTempForceSubscribeUser
  14. *
  15. * The name and signature of the console command.
  16. *
  17. * @var string
  18. */
  19. protected $signature = 'MaintainTempForceSubscribeUser';
  20. /**
  21. * The console command description.
  22. *
  23. * @var string
  24. */
  25. protected $description = '维护公众号交互的用户表';
  26. /**
  27. * Execute the console command.
  28. *
  29. * @return mixed
  30. */
  31. public function handle()
  32. {
  33. ini_set('memory_limit', '1024M');
  34. print_r('memory_used:'.memory_get_usage()."\n");
  35. print_r("======维护公众号交互的用户表【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
  36. $end_time = date('Y-m-d 00:00:00',strtotime('- 3 day'));
  37. \Log::info('OfficialAccountUserTranser_start:end_time:'.$end_time);
  38. TempForceSubscribeUsers::deleteTempForceSubscribeUsersByTime($end_time);
  39. \Log::info('OfficialAccountUserTranser_end');
  40. print_r("======维护公众号交互的用户表 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
  41. print_r('memory_used:'.memory_get_usage()."\n");
  42. }
  43. }