注销状态

This commit is contained in:
X14XA\shengli 2025-05-11 17:43:19 +08:00
parent 2100f37ffa
commit 8b076e52a9
2 changed files with 51 additions and 1 deletions

View File

@ -1,9 +1,11 @@
### 安装
```shell
composer require maiyoule/mqttclient_author
```
### 配置
```php
$manager = new MQTTManager();
//设置APPID
@ -14,6 +16,8 @@ $manager->setPrivateKey('');
### 使用
#### 创建
```php
//创建MQTT用户
$request = new AppUserCreateRequest();
@ -33,3 +37,13 @@ $data = $biz->getData();
//....
print_r($data);
```
#### 注销登录
```php
$request=new \cn\com\maiyoule\mqttclient\biz\AppUserLogoutRequest();
$request->setUsername('xxxxx');
$biz=$manager->exec($request);
echo sprintf('注销结果:%b',$biz->isSuccess())
```

View File

@ -0,0 +1,36 @@
<?php
namespace cn\com\maiyoule\mqttclient\biz;
use cn\com\maiyoule\mqttclient\IRequest;
class AppUserLogoutRequest extends IRequest
{
public function path(): string
{
return 'mqtt/user/kick';
}
public function body(): array
{
return [
'username' => $this->getUsername()
];
}
private string $username;
public function getUsername(): string
{
return $this->username;
}
public function setUsername(string $username): void
{
$this->username = $username;
}
}