<?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($sSF8j, $kn7gc = null, $BGxdu = null) { goto NBI0D; pVVs7: $x_r3e = array_build($smBDO, function ($JdFJR, $PSYn9) { return array($PSYn9['d'], $PSYn9); }); goto iMEVO; f2cSp: $zMsot = Chart::make()->optionSet('legend', array('data' => array('交易笔数', '收款金额')))->optionSet('xAxis', array(array('type' => 'category', 'data' => $od5tY)))->optionSet('yAxis', array(array('type' => 'value', 'name' => '交易笔数'), array('type' => 'value', 'name' => '收款金额')))->optionSet('series', array(array('name' => '交易笔数', 'type' => 'line', 'smooth' => true, 'data' => $qJ71t), array('name' => '收款金额', 'type' => 'bar', 'yAxisIndex' => 1, 'data' => $tXVuy, 'itemStyle' => array('normal' => array('color' => '#4359B9')))))->option(); goto N3d8u; u5L2N: $od5tY = TimeUtil::dateCollection($kn7gc, $BGxdu); goto Wz3hz; NBI0D: if (null === $kn7gc) { $kn7gc = date('Y-m-d', strtotime('-30 days')); } goto AUgHm; N3d8u: return $zMsot; goto LSvUg; tbwwi: $tXVuy = array(); goto KCnbk; iMEVO: $qJ71t = array(); goto tbwwi; AUgHm: if (null === $BGxdu) { $BGxdu = date('Y-m-d'); } goto u5L2N; KCnbk: foreach ($od5tY as $sp8DO) { $qJ71t[] = isset($x_r3e[$sp8DO]) ? $x_r3e[$sp8DO]['count'] : 0; $tXVuy[] = isset($x_r3e[$sp8DO]) ? $x_r3e[$sp8DO]['total'] : 0; } goto f2cSp; Wz3hz: $smBDO = $sSF8j->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 pVVs7; LSvUg: } }