From 7264546a3a04c32c97cd5d885b27667c0d16d218 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 26 Jul 2024 11:36:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(BaseLikeController):=20=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BD=AC=E4=B8=BA=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/BaseLikeController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/common/controller/BaseLikeController.php b/app/common/controller/BaseLikeController.php index 13c07d9c..3302bcd0 100644 --- a/app/common/controller/BaseLikeController.php +++ b/app/common/controller/BaseLikeController.php @@ -22,8 +22,11 @@ class BaseLikeController extends BaseController * @author 乔峰 * @date 2021/12/27 14:21 */ - protected function success(string $msg = 'success', array $data = [], int $code = 1, int $show = 0) + protected function success(string $msg = 'success', $data = [], int $code = 1, int $show = 0) { + if(is_object($data)){ + $data = $data->toArray(); + } return JsonService::success($msg, $data, $code, $show); } @@ -36,6 +39,9 @@ class BaseLikeController extends BaseController */ protected function data($data) { + if(is_object($data)){ + $data = $data->toArray(); + } return JsonService::data($data); }