request->get(); $limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT')); $start = $this->request->get('page', 1); $where = []; if (isset($param['report_date']) && !empty($param['report_date'])) { $where = ['report_date', '=', strtotime($param['report_date'])]; } $listObj = (new FinalReportDate()) ->where($where) ->order('report_date', 'DESC') ->paginate(['page' => $start, 'list_rows' => $limit]) ->each(function ($item) { $item['amount_sum'] = FinalReportData::getFrdSumAmount($item['id']); $item['status_str'] = $item['status'] == 1 ? '已结报' : '未结报'; return $item; }) ->toArray(); return $this->buildSuccess([ 'list' => $listObj['data'], 'total' => $listObj['total'] ]); } public function view(): Response { try { $frd_id = $this->request->get('id', ''); if (empty($frd_id)) { throw new \Exception('缺少请求参数'); } $limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT')); $start = $this->request->get('page', 1); $FinalReportData = new FinalReportData(); $data = $FinalReportData->where('frd_id', $frd_id)->paginate(['page' => $start, 'list_rows' => $limit])->toArray(); return $this->buildSuccess([ 'list' => $data['data'], 'total' => $data['total'] ]); } catch (\Exception $e) { return $this->buildFailed(ReturnCode::EMPTY_PARAMS, $e->getMessage()); } } public function report(): Response { try { $param = $this->request->get(); validate()->rule(['frd_id' => 'require|number'])->check($param); $frd_id = $param['frd_id']; $InvoiceIssuanceService = new InvoiceIssuanceService(); $result = $InvoiceIssuanceService->tempFinalReport($frd_id); if ($result !== true) throw new \Exception($result); return $this->buildSuccess(); } catch (\Exception $e) { return $this->buildFailed(ReturnCode::EMPTY_PARAMS, $e->getMessage()); } } }