说明------------!!! 当使用查询 用到了 paginate 时 返回值会更改不是正常数组形式 但是使用到 两个数组 组合 array_merge 成同一个数组 并分页返回
返回结果-------只需要data中的数据 而不是返回数据的
遇到的问题
1. 当看到数组返回值有 info['data'] 直接打印数据提示没有data
$comment['comment'] = $goodsCommentModel
->with(['user'])
->where($where)
->paginate();
$this->success($comment['comment']['data']);
2.使用数组进行组合 提示错误
$comment['comment'] = $goodsCommentModel
->with(['user'])
->where($where)
->paginate();
$comment['comment']['data'] = array_merge($comment['comment']['data'],$GoodsComment);
解决 -------------- paginate 数据 使用 toArray 就可以打印 出 data数据 最后
$GoodsComment = GoodsCommentModel::where('status',"normal")->select();
$goodsCommentModel = model('app\api\model\wanlshop\GoodsComment')->order('createtime desc');
$comment['comment'] = $goodsCommentModel
->with(['user'])
->where($where)
->paginate();
$comment['comment'] = $comment['comment']->toArray();
$comment['comment']['data'] = array_merge($comment['comment']['data'],$GoodsComment);