改进 踢出处理
This commit is contained in:
parent
58a363bd41
commit
06c9c176e0
@ -48,24 +48,28 @@ public function destroy(Request $request, $client_id = null): JsonResponse
|
||||
|
||||
$module_name = explode('.', $client['username'])[0];
|
||||
|
||||
if ($request->user('module')->id === $module_name) {
|
||||
$emqx->kickClient($client_id);
|
||||
|
||||
return $this->deleted();
|
||||
} else {
|
||||
if ($request->user('module')->id !== $module_name) {
|
||||
return $this->failed('client not found');
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->filled('name')) {
|
||||
$username = $request->input('name');
|
||||
$username = $request->user('module')->id . '.' . $username;
|
||||
|
||||
$this->dispatch(new EMQXKickClientJob(null, $username, false));
|
||||
$emqx->kickClient($client_id);
|
||||
|
||||
return $this->deleted();
|
||||
}
|
||||
|
||||
return $this->failed('missing client_id or username');
|
||||
if ($request->filled('name')) {
|
||||
$name = $request->input('name');
|
||||
$module_name = explode('.', $name)[0];
|
||||
|
||||
if ($request->user('module')->id !== $module_name) {
|
||||
return $this->failed('client not found');
|
||||
}
|
||||
|
||||
$this->dispatch(new EMQXKickClientJob(null, $name, false));
|
||||
|
||||
return $this->deleted();
|
||||
}
|
||||
|
||||
return $this->failed('missing client_id or name');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user