注销状态
This commit is contained in:
parent
2100f37ffa
commit
8b076e52a9
16
README.md
16
README.md
@ -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();
|
||||
@ -32,4 +36,14 @@ if (!$biz->isSuccess()) {
|
||||
$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())
|
||||
```
|
||||
|
36
src/biz/AppUserLogoutRequest.php
Normal file
36
src/biz/AppUserLogoutRequest.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user