<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Widget\Traits; use Illuminate\Support\Facades\DB; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Util\TimeUtil; trait DSTrait { protected function dsTableCountSeriesDaily($GJZpW, $g106V, $Ctrg1 = array()) { goto LwXjJ; icYPY: $kmF9t = array_values($E2cwY); goto r2R1I; Qf7NC: $jzuii = $g106V . ' 23:59:59'; goto G5aaX; ehKkw: $wb2YF = array(); goto icYPY; RyCaj: $E2cwY = array(); goto poYwk; G5aaX: $wJfuo = strtotime($S1plg); goto t6d_6; r2R1I: foreach ($Ctrg1 as $EqYVi => $CLtei) { foreach ($kmF9t as $YvQNA) { $wb2YF[$EqYVi][] = $YvQNA[$EqYVi]; } } goto yX3hD; fwGMy: foreach ($Ctrg1 as $EqYVi => $CLtei) { goto ojENd; ojENd: if (empty($CLtei['where'])) { $CLtei['where'] = array(); } goto VdhWp; xvrCp: foreach ($zvN10 as $Esk0p) { $E2cwY[$Esk0p['_time']][$EqYVi] = $Esk0p['_cnt']; } goto l6wyH; VdhWp: $zvN10 = ModelUtil::model($CLtei['table'])->where('created_at', '>=', $S1plg)->where('created_at', '<', $jzuii)->where($CLtei['where'])->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('COUNT(1) AS _cnt')))->toArray(); goto xvrCp; l6wyH: } goto ehKkw; LwXjJ: $S1plg = $GJZpW . ' 00:00:00'; goto Qf7NC; yX3hD: return array('time' => array_keys($E2cwY), 'values' => $wb2YF); goto RuXcb; poYwk: for ($f3YYx = $wJfuo; $f3YYx < $gYlze; $f3YYx += TimeUtil::PERIOD_DAY) { $Esk0p = array(); foreach ($Ctrg1 as $CLtei) { $Esk0p[] = 0; } $E2cwY[date('Y-m-d', $f3YYx)] = $Esk0p; } goto fwGMy; t6d_6: $gYlze = strtotime($jzuii); goto RyCaj; RuXcb: } protected function dsTableSumSeriesDaily($GJZpW, $g106V, $Ctrg1 = array()) { goto aRkXM; xOzO0: $wb2YF = array(); goto GeA6Z; Vat9U: foreach ($Ctrg1 as $EqYVi => $CLtei) { foreach ($kmF9t as $YvQNA) { $wb2YF[$EqYVi][] = $YvQNA[$EqYVi]; } } goto pTtXt; BN6SN: $gYlze = strtotime($jzuii); goto NkTG2; NkTG2: $E2cwY = array(); goto XBxaG; e5upY: $jzuii = $g106V . ' 23:59:59'; goto JEYHj; pTtXt: return array('time' => array_keys($E2cwY), 'values' => $wb2YF); goto TKJRV; XBxaG: for ($f3YYx = $wJfuo; $f3YYx < $gYlze; $f3YYx += TimeUtil::PERIOD_DAY) { $Esk0p = array(); foreach ($Ctrg1 as $CLtei) { $Esk0p[] = 0; } $E2cwY[date('Y-m-d', $f3YYx)] = $Esk0p; } goto dC7W2; dC7W2: foreach ($Ctrg1 as $EqYVi => $CLtei) { goto MTrGe; MTrGe: if (empty($CLtei['where'])) { $CLtei['where'] = array(); } goto l02qe; ueG6F: foreach ($zvN10 as $Esk0p) { $E2cwY[$Esk0p['_time']][$EqYVi] = $Esk0p['_total']; } goto jZG_P; l02qe: $zvN10 = ModelUtil::model($CLtei['table'])->where($CLtei['where'])->where('created_at', '>=', $S1plg)->where('created_at', '<', $jzuii)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('SUM(' . $CLtei['field'] . ') AS _total')))->toArray(); goto ueG6F; jZG_P: } goto xOzO0; GeA6Z: $kmF9t = array_values($E2cwY); goto Vat9U; JEYHj: $wJfuo = strtotime($S1plg); goto BN6SN; aRkXM: $S1plg = $GJZpW . ' 00:00:00'; goto e5upY; TKJRV: } }