默认的db类的查询最后会得到bootstrap的数据,但是我们只想要array的数据怎么办,用一个$data = $data->toArray()的函数就可以了
/**
* @ApiTitle (获取协会会员)
* @ApiSummary (获取协会会员)
* @ApiMethod (POST)
* @ApiRoute (/api/xhmh/get_xhhy)
* @ApiParams (name="page", type="integer", required=true, description="页数从第一页开始")
* @ApiParams (name="groupid", type="integer", required=true, description="会员等级id 6=普通 7=理事 8=常务理事 9=副会长")
*
*
**/
public function get_xhhy()
{
$groupid = $this->request->post("groupid");
$page= $this->request->post("page");
$data = Db::table('fa_auth_group_access')->where('group_id',$groupid)->paginate(10);
$data = $data->toArray();
if ($data) {
Log::info($data);
$this->success('已查询', $data);
} else {
$this->error('查询失败');
}
}
下图是没有用 toArray函数得到的数据
下图是用 toArray函数得到的数据