ClearLimit.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Models\UserVipLimit;
  4. use Illuminate\Console\Command;
  5. use Illuminate\Support\Facades\Log;
  6. class ClearLimit extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'chenglu:clear_limit';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = '每天凌晨清空用户限制数据';
  20. /**
  21. * Create a new command instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. }
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return int
  33. */
  34. public function handle()
  35. {
  36. /*
  37. * 每天初始化用户限制数据
  38. * */
  39. Log::info("清空用户限制数据准备执行,执行时间:".date('Y-m-d H:i:s'));
  40. UserVipLimit::query()->update(['weixin'=>0,'user'=>0,'dynamic'=>0,'user_detail'=>0,'user_info'=>0]);
  41. Log::info("用户限制数据已清空,执行时间:".date('Y-m-d H:i:s'));
  42. }
  43. }