has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : ''; $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : ''; $end_time = self::getMaxDay($end_time); $payments = PaymentStatisticService::getGroupByDayDataStatistic($start_time, $end_time); return response()->pagination(new PaymentStatisticTransformer(), $payments); } /** * @apiVersion 1.0.0 * @apiDescription 每天对账统计导出 * @api {GET} paymentStaticDayExport 每天对账统计导出 * @apiGroup Finance * @apiName paymentStaticDayExport * @apiParam {String} [start_time] 开始时间(可不传) * @apiParam {String} [end_time] 结束时间(可不传) */ function get_list_day_export(Request $request) { $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : ''; $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : ''; $end_time = self::getMaxDay($end_time); $payments = PaymentStatisticService::getGroupByDayDataStatistic($start_time, $end_time, true); header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:attachment;filename=" . "对账统计" . date("YmdHis") . ".csv"); echo iconv("UTF-8","GBK","\"操作日期\",\"打款成功金额\",\"打款成功笔数\",\"对私成功金额\",\"对私成功笔数\",\"对公成功金额\",\"对公成功笔数\",\"审核不通过金额\",\"审核不通过笔数\",\"打款失败金额\",\"打款失败笔数\",\"扣税金额\"\r\n"); if($payments) { foreach($payments as $item) { echo("\"" . iconv("UTF-8","GBK",date('Y-m-d H:i:s',strtotime($item->created_at))) . "\","); echo("\"" . $item->amount . "\","); echo("\"" . $item->amount_num . "\","); echo("\"" . $item->amount_person . "\","); echo("\"" . $item->amount_person_num . "\","); echo("\"" . $item->amount_company . "\","); echo("\"" . $item->amount_company_num . "\","); echo("\"" . $item->amount_audit_fail . "\","); echo("\"" . ($item->amount_audit_fail_num) . "\","); echo("\"" . $item->amount_fail . "\","); echo("\"" . $item->amount_fail_num . "\","); echo("\"" . $item->tallage . "\"\r\n"); } } exit(); } }