12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace App\Console\Commands;
- use App\Jobs\SendMessageFive;
- use App\Jobs\SendMessageFour;
- use App\Jobs\SendMessageOne;
- use App\Jobs\SendMessageSeven;
- use App\Jobs\SendMessageSix;
- use App\Jobs\SendMessageThree;
- use App\Jobs\SendMessageTwo;
- use App\Models\Basic;
- use App\Models\Enroll;
- use Carbon\Carbon;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\Log;
- class SendMessageCourseCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'SendMess';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'Command description';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $tem='xZRPVJAb0lahLAJhWuOAknw7N3yk-CXKn88QjMaHQ_8';
- $basic=Basic::whereIn('keys',['season','round_start_time','round_end_time'])->select('value','keys')->get();
- foreach ($basic as $k=>$v){
- $re[$v['keys']]=$v['value'];
- }
- $now=Carbon::now()->timestamp;
- if ($now>=$re['round_start_time']&&$now<=$re['round_end_time']){
- $data=Enroll::where('season',$re['season'])->where('status',0)->with(['user:id,phone'])->select('uid')->get()->toArray();
- for ($i=0;$i<1000;$i++){
- if (isset($data[$i])){
- dispatch(new SendMessageOne($data[$i]));
- }
- if (isset($data[$i+1000])){
- dispatch(new SendMessageTwo($data[$i+1000]));
- }
- if (isset($data[$i+2000])){
- dispatch(new SendMessageThree($data[$i+2000]));
- }
- if (isset($data[$i+3000])){
- dispatch(new SendMessageFour($data[$i+3000]));
- }
- if (isset($data[$i+4000])){
- dispatch(new SendMessageFive($data[$i+4000]));
- }
- if (isset($data[$i+5000])){
- dispatch(new SendMessageSix($data[$i+5000]));
- }
- if (isset($data[$i+6000])){
- dispatch(new SendMessageSeven($data[$i+6000]));
- }
- }
- // Log::error($data[0]);
- }
- }
- }
|