client_id = $client_id; $this->username = $username; $this->like_username = $like_username; } /** * Execute the job. * * @return void */ public function handle(): void { $emqx = new EmqxSupport(); if ($this->client_id) { $emqx->api()->delete('/clients/' . $this->client_id); } if ($this->username) { $query = 'username'; if ($this->like_username) { $query = 'like_username'; } try { $clients = $emqx->clients([$query => $this->username]); } catch (EmqxSupportException $e) { Log::error('emqx connect failed.', [$e]); return; } if ($clients) { if (count($clients['data']) > 0) { foreach ($clients['data'] as $client) { dispatch(new self($client['clientid'], null)); } dispatch(new self(null, $this->username, $this->like_username)); } } } } }