<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\PayCenter\Util; use Illuminate\Support\Facades\DB; use ModStart\Core\Util\TimeUtil; use ModStart\Widget\Chart\Chart; class ReportUtil { public static function option($jyBel, $exxst = null, $Fezgp = null) { goto Rcfkf; PIZ9q: $zZR5n = TimeUtil::dateCollection($exxst, $Fezgp); goto GpN0n; Rcfkf: if (null === $exxst) { $exxst = date('Y-m-d', strtotime('-30 days')); } goto pnq0V; Rrimz: foreach ($zZR5n as $rzfez) { $vHbdj[] = isset($A0ZuD[$rzfez]) ? $A0ZuD[$rzfez]['count'] : 0; $xSftV[] = isset($A0ZuD[$rzfez]) ? $A0ZuD[$rzfez]['total'] : 0; } goto bXtn2; bXtn2: $BtwZr = Chart::make()->optionSet('legend', array('data' => array('交易笔数', '收款金额')))->optionSet('xAxis', array(array('type' => 'category', 'data' => $zZR5n)))->optionSet('yAxis', array(array('type' => 'value', 'name' => '交易笔数'), array('type' => 'value', 'name' => '收款金额')))->optionSet('series', array(array('name' => '交易笔数', 'type' => 'line', 'smooth' => true, 'data' => $vHbdj), array('name' => '收款金额', 'type' => 'bar', 'yAxisIndex' => 1, 'data' => $xSftV, 'itemStyle' => array('normal' => array('color' => '#4359B9')))))->option(); goto t_wJ9; xn_y2: $xSftV = array(); goto Rrimz; t_wJ9: return $BtwZr; goto MlBbp; Kswx3: $A0ZuD = array_build($avcnU, function ($KAKiA, $Iim2u) { return array($Iim2u['d'], $Iim2u); }); goto e80Zg; pnq0V: if (null === $Fezgp) { $Fezgp = date('Y-m-d'); } goto PIZ9q; GpN0n: $avcnU = $jyBel->groupBy('d')->orderBy('d', 'DESC')->get(array(DB::raw('Date(created_at) as d'), DB::raw('COUNT(*) as count'), DB::raw('SUM(feeTotal) as total')))->toArray(); goto Kswx3; e80Zg: $vHbdj = array(); goto xn_y2; MlBbp: } }