|
...
|
...
|
@@ -104,21 +104,12 @@ class BaseController extends Controller |
|
|
|
*/
|
|
|
|
public function response($msg = null,string $code = Code::SUCCESS,$data = [],$result_code = 200,$type = 'application/json'): JsonResponse
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
$code = Code::fromValue($code);
|
|
|
|
$result = [
|
|
|
|
'msg' => $msg == ' ' ? $code->description : $msg,
|
|
|
|
'code' => $code->value,
|
|
|
|
'data' => $this->_extents($data),
|
|
|
|
];
|
|
|
|
}catch (\Throwable $e){
|
|
|
|
$result = [
|
|
|
|
'msg' => $msg,
|
|
|
|
'code' => $code,
|
|
|
|
'data' => $this->_extents($data),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
$code = Code::fromValue($code);
|
|
|
|
$result = [
|
|
|
|
'msg' => $msg == ' ' ? $code->description : $msg,
|
|
|
|
'code' => $code->value,
|
|
|
|
'data' => $this->_extents($data),
|
|
|
|
];
|
|
|
|
$this->header['Content-Type'] = $type;
|
|
|
|
$this->header['token'] = $this->token;
|
|
|
|
$response = response($result,$result_code,$this->header);;
|
...
|
...
|
|