feat(BaseLikeController): 对象数据转为数组
This commit is contained in:
parent
4e67edcc77
commit
7264546a3a
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user