request->get(); $limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT')); $start = $this->request->get('page', 1); $where = []; if (isset($param['pucode']) && !empty($param['pucode'])) { $wechat_user_ids = WechatPucode::where('pucode', 'like', "%{$param['pucode']}%")->column('wechat_user_id'); $where[] = ['wechat_user_id', 'in', $wechat_user_ids]; } $InvoiceHead = new InvoiceHeadModel(); $listObj = $InvoiceHead->where($where) ->order('create_time', 'DESC') ->paginate(['page' => $start, 'list_rows' => $limit]) ->each(function ($item, $key) use ($InvoiceHead) { $item['type'] = InvoiceHeadModel::$typeArr[$item['type']]; $WechatUser = WechatUserModel::where('id', $item['wechat_user_id'])->find(); if ($WechatUser) { $item['wechat_user_name'] = $WechatUser['nickname']; $item['headimgurl'] = $WechatUser['headimgurl']; } $item['pucode'] = WechatPucode::where('wechat_user_id', $item['wechat_user_id'])->value('pucode'); unset($item['wechat_user_id']); })->toArray(); $listInfo = $listObj['data']; return $this->buildSuccess([ 'list' => $listInfo, 'count' => $listObj['total'] ]); } }