TestCommand.php 885 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Console\Commands\User;
  3. use App\Services\Notice\UserNoticeService;
  4. use Illuminate\Console\Command;
  5. use Illuminate\Support\Facades\DB;
  6. use Illuminate\Support\Facades\Redis;
  7. class TestCommand extends Command
  8. {
  9. protected $signature = "user:test";
  10. protected $description = "心动考验|发放内测资格";
  11. public function handle()
  12. {
  13. $istested = Redis::smembers("fpdx_supervip_test");
  14. $hide = implode(",", $istested);
  15. $time = mktime(18, 0, 0) - 86400;
  16. $users = DB::table("kdgx_fpdx_invitation_card")
  17. ->select("uid")
  18. ->where("created_at", ">", $time)
  19. ->whereNotIn("uid", $hide)
  20. ->distinct()
  21. ->count('uid');
  22. $noticeService = new UserNoticeService();
  23. foreach ($users as $user) {
  24. $noticeService->test($user->uid);
  25. }
  26. }
  27. }