update
This commit is contained in:
@ -10,6 +10,7 @@ class RpcResponse
|
||||
public array $meta = [];
|
||||
public string $title = '';
|
||||
public array $pageModule = [];
|
||||
public array $extra = [];
|
||||
|
||||
|
||||
public function setData(array $data)
|
||||
@ -18,6 +19,12 @@ class RpcResponse
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setExtra($extraKey = '', $value = '')
|
||||
{
|
||||
$this->extra[$extraKey] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setCode(int $code)
|
||||
{
|
||||
$this->code = $code;
|
||||
@ -32,10 +39,17 @@ class RpcResponse
|
||||
|
||||
public function send()
|
||||
{
|
||||
return [
|
||||
$resp = [
|
||||
'code' => $this->code,
|
||||
'msg' => $this->msg,
|
||||
'data' => $this->data,
|
||||
];
|
||||
|
||||
if ($this->extra) {
|
||||
foreach ($this->extra as $key => $item) {
|
||||
$resp[$key] = $item;
|
||||
}
|
||||
}
|
||||
return $resp;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user