From d2e1cc23ef81e71c21374a234f635b0575e11183 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Fri, 20 Jan 2023 00:55:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Application/MqttAuthController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Application/MqttAuthController.php b/app/Http/Controllers/Application/MqttAuthController.php index 4a82857..224f813 100644 --- a/app/Http/Controllers/Application/MqttAuthController.php +++ b/app/Http/Controllers/Application/MqttAuthController.php @@ -14,10 +14,6 @@ public function authentication(Request $request): Response { $client_id = explode('.', $request->input('client_id')); - if (count($client_id) < 2) { - return $this->ignore(); - } - $username = $request->input('username'); $usernames = explode('.', $username); @@ -49,6 +45,12 @@ public function authentication(Request $request): Response } } else { // 如果设置了 device_id,那么就是设备的连接,此时,我们得联系模块,让模块去验证设备。 + + // 设备必须有两段 ID + if (count($client_id) < 2) { + return $this->ignore(); + } + $response = $module->baseRequest('post', 'mqtt/authentication', [ 'client_id' => $client_id[1], 'device_id' => $device_id,