79 lines
1.4 KiB
PHP
79 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace cn\com\maiyoule\mqttclient\response;
|
|
|
|
class BizResponse
|
|
{
|
|
private int $code;
|
|
private string $message;
|
|
private mixed $data;
|
|
|
|
private string $errCode;
|
|
|
|
/**
|
|
* @param int $code
|
|
* @param string $message
|
|
* @param array $data
|
|
* @param string $errCode
|
|
*/
|
|
public function __construct(int $code = -1, string $message = '', mixed $data = [], string $errCode = '')
|
|
{
|
|
$this->code = $code;
|
|
$this->message = $message;
|
|
$this->data = $data;
|
|
$this->errCode = $errCode;
|
|
}
|
|
|
|
public function isSuccess(): bool
|
|
{
|
|
return $this->code == 1;
|
|
}
|
|
|
|
public function getCode(): int
|
|
{
|
|
return $this->code;
|
|
}
|
|
|
|
public function setCode(int $code): void
|
|
{
|
|
$this->code = $code;
|
|
}
|
|
|
|
public function getMessage(): string
|
|
{
|
|
return $this->message;
|
|
}
|
|
|
|
public function setMessage(string $message): void
|
|
{
|
|
$this->message = $message;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getData(): mixed
|
|
{
|
|
return $this->data;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $data
|
|
*/
|
|
public function setData($data): void
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
public function getErrCode(): string
|
|
{
|
|
return $this->errCode;
|
|
}
|
|
|
|
public function setErrCode(string $errCode): void
|
|
{
|
|
$this->errCode = $errCode;
|
|
}
|
|
|
|
|
|
} |