GameCoun.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Jobs;
  3. use App\Http\logic\api\ExtensionLogic;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Queue\SerializesModels;
  6. use Illuminate\Queue\InteractsWithQueue;
  7. use Illuminate\Contracts\Queue\ShouldQueue;
  8. use Illuminate\Foundation\Bus\Dispatchable;
  9. use Illuminate\Support\Facades\Log;
  10. use Illuminate\Support\Facades\Redis;
  11. class GameCoun implements ShouldQueue
  12. {
  13. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  14. // 1005=>TP、2030=>Rummy、2050=>Rummy两人、2060=>TPJoker玩法、2061=>TPAK玩法、2070=>Rummy10Card、2090=>Rummy两人十张
  15. // 2010=>百人TP、 2012=>百人AB 暂时忽略
  16. protected $GameIDs = [1005, 2030, 2050, 2060, 2061, 2070, 2090];
  17. /**
  18. * Create a new job instance.
  19. *
  20. * @return void
  21. */
  22. public function __construct()
  23. {
  24. //
  25. }
  26. /**
  27. * 任务尝试次数
  28. *
  29. * @var int
  30. */
  31. public $tries = 5;
  32. /**
  33. * Execute the job.
  34. *
  35. * @return void
  36. */
  37. public function handle()
  38. {
  39. // Log::info('进来了');
  40. // $logic = new ExtensionLogic();
  41. // $redis = Redis::connection('test');
  42. // // 出栈
  43. // while (true) {
  44. // $brPop = $redis->brPop('gameCount', 0);
  45. //
  46. // $ret = $brPop[1] ?? 0;
  47. // if (!empty($ret)) {
  48. // $ret = explode(',', $ret);
  49. // if (in_array($ret[1], $this->GameIDs)) {
  50. // $UserID = $ret[0];
  51. // $logic->invitation($UserID, 2);
  52. // }
  53. // }
  54. // }
  55. }
  56. }