SendCommand.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Jobs\BarrageJob;
  4. use App\Jobs\ShopNoticeJob;
  5. use App\Jobs\VerifyImg;
  6. use App\Models\CouponGrantRange;
  7. use App\Models\ErrorRecord;
  8. use App\Models\Express;
  9. use App\Models\Goods;
  10. use App\Models\GoodsSpec;
  11. use App\Models\ImGroup;
  12. use App\Models\ImMyGroup;
  13. use App\Models\Member;
  14. use App\Models\MemberOpenId;
  15. use App\Models\Members;
  16. use App\Models\Menu;
  17. use App\Models\Order;
  18. use App\Models\OrderAccountsSet;
  19. use App\Models\OrderItem;
  20. use App\Models\PayOrder;
  21. use App\Models\RefundOrder;
  22. use App\Models\Region;
  23. use App\Models\SeckillGoods;
  24. use App\Models\Shop;
  25. use App\Models\ShopOrder;
  26. use App\Models\ShopSet;
  27. use App\Models\ShopUser;
  28. use App\Models\Withdraw;
  29. use App\Servers\AlbumServer;
  30. use App\Servers\BarrageServer;
  31. use App\Servers\BroadcastServer;
  32. use App\Servers\CommentServer;
  33. use App\Servers\CommonServer;
  34. use App\Servers\ContractServer;
  35. use App\Servers\Coupon\CouponGrantServer;
  36. use App\Servers\Electricity\JdElectricityServer;
  37. use App\Servers\Electricity\TbElectricityServer;
  38. use App\Servers\ExpressServer;
  39. use App\Servers\GrantPondServer;
  40. use App\Servers\HxServer;
  41. use App\Servers\Icon\BanRPC;
  42. use App\Servers\Icon\TronRPC;
  43. use App\Servers\ImgServer;
  44. use App\Servers\ImServer;
  45. use App\Servers\MemberClanServer;
  46. use App\Servers\MemberServer;
  47. use App\Servers\OrderServer;
  48. use App\Servers\PayServer;
  49. use App\Servers\RedisDataServer;
  50. use App\Servers\RefundOrderServer;
  51. use App\Servers\SeckillServer;
  52. use App\Servers\SensitiveServer;
  53. use App\Servers\ShopFileServer;
  54. use App\Servers\ShopNoticeServer;
  55. use App\Servers\ShopOrderServer;
  56. use App\Servers\ShopServer;
  57. use App\Servers\UsedServer;
  58. use App\Servers\WeixinServer;
  59. use App\Servers\WxTemplateServer;
  60. use App\Servers\ZfbServer;
  61. use Illuminate\Console\Command;
  62. use Illuminate\Support\Facades\DB;
  63. use SimpleSoftwareIO\QrCode\Facades\QrCode;
  64. use SwooleTW\Http\Websocket\Facades\Websocket;
  65. use Topsdk\Topapi\TopApiClient;
  66. class SendCommand extends Command
  67. {
  68. /**
  69. * The name and signature of the console command.
  70. *
  71. * @var string
  72. */
  73. protected $signature = 'broadcast:send';
  74. /**
  75. * The console command description.
  76. *
  77. * @var string
  78. */
  79. protected $description = '广播执行';
  80. /**
  81. * Create a new command instance.
  82. *
  83. * @return void
  84. */
  85. public function __construct()
  86. {
  87. parent::__construct();
  88. }
  89. /**
  90. * Execute the console command.
  91. *
  92. * @return mixed
  93. */
  94. public function handle()
  95. {
  96. while (true) {
  97. $this->info('---------------开始执行了---------------------:'.date('Y-m-d H:i:s'));
  98. $num = BroadcastServer::creatServer()->sendBroadcast();
  99. if ($num <= 0) {
  100. $this->error('---------------执行休眠了---------------------');
  101. sleep(3);
  102. }else{
  103. sleep(1);
  104. }
  105. $this->info('---------------执行完成了---------------------'.date('Y-m-d H:i:s'));
  106. }
  107. }
  108. }