diff --git a/library/think/Response.php b/library/think/Response.php index 4f8eb0f5..9507b698 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -180,25 +180,6 @@ class Response return $this; } - /** - * 返回封装后的API数据到客户端 - * @access public - * @param mixed $data 要返回的数据 - * @param integer $code 返回的code - * @param string $msg 提示信息 - * @return mixed - */ - public function result($data, $code = 0, $msg = '') - { - $result = [ - 'code' => $code, - 'msg' => $msg, - 'time' => $_SERVER['REQUEST_TIME'], - 'data' => $data, - ]; - return $this->data($result); - } - /** * 设置响应头 * @access public diff --git a/library/traits/controller/Jump.php b/library/traits/controller/Jump.php index 27b55c5d..40f3dacd 100644 --- a/library/traits/controller/Jump.php +++ b/library/traits/controller/Jump.php @@ -99,7 +99,14 @@ trait Jump */ protected function result($data, $code = 0, $msg = '', $type = '') { - return Response::create([], $type)->result($data, $code, $msg); + $result = [ + 'code' => $code, + 'msg' => $msg, + 'time' => $_SERVER['REQUEST_TIME'], + 'data' => $data, + ]; + $type = $type ?: $this->getResponseType(); + return Response::create([], $type)->data($data); } /**