123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Console\Commands\Notices;
- use App\Models\User\UserModel;
- use Illuminate\Console\Command;
- use PocketBE\MsyPush\Jobs\RegistEventJob;
- class PushEventCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'push:event:test';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'push事件测试推送';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $userId = $this->ask('输入用户 uid');
- $eventId = $this->ask('推送事件ID');
- $user = UserModel::find($userId);
- $payload = [
- 'to_user' => $user->getAuth(),
- ];
- dispatch(new RegistEventJob($eventId, $payload))->onQueue("{push}");
- }
- }
|