<?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($GcZ1R, $uqLdQ, $P4hFJ = array()) { goto bIWYG; NOKWC: $W9j8i = strtotime($yE4DO); goto G0ywB; nmdY1: for ($KpVmd = $W9j8i; $KpVmd < $f8DbJ; $KpVmd += TimeUtil::PERIOD_DAY) { $Xvngd = array(); foreach ($P4hFJ as $Fn99E) { $Xvngd[] = 0; } $aGNE3[date('Y-m-d', $KpVmd)] = $Xvngd; } goto f04U2; bIWYG: $yE4DO = $GcZ1R . ' 00:00:00'; goto tHVYu; G0ywB: $f8DbJ = strtotime($ZIlJo); goto nQX3d; G2O21: return array('time' => array_keys($aGNE3), 'values' => $v37OZ); goto O7WMq; wXSTp: foreach ($P4hFJ as $K_IJ6 => $Fn99E) { foreach ($JgIJJ as $yPU82) { $v37OZ[$K_IJ6][] = $yPU82[$K_IJ6]; } } goto G2O21; bGkhI: $v37OZ = array(); goto cZRRq; nQX3d: $aGNE3 = array(); goto nmdY1; tHVYu: $ZIlJo = $uqLdQ . ' 23:59:59'; goto NOKWC; f04U2: foreach ($P4hFJ as $K_IJ6 => $Fn99E) { goto bgIKD; bgIKD: if (empty($Fn99E['where'])) { $Fn99E['where'] = array(); } goto j1K0H; AtUXY: foreach ($CnWtd as $Xvngd) { $aGNE3[$Xvngd['_time']][$K_IJ6] = $Xvngd['_cnt']; } goto Otdnk; j1K0H: $CnWtd = ModelUtil::model($Fn99E['table'])->where($Fn99E['where'])->where('created_at', '>=', $yE4DO)->where('created_at', '<', $ZIlJo)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('COUNT(1) AS _cnt')))->toArray(); goto AtUXY; Otdnk: } goto bGkhI; cZRRq: $JgIJJ = array_values($aGNE3); goto wXSTp; O7WMq: } protected function dsTableSumSeriesDaily($GcZ1R, $uqLdQ, $P4hFJ = array()) { goto ur8GE; mdA2P: for ($KpVmd = $W9j8i; $KpVmd < $f8DbJ; $KpVmd += TimeUtil::PERIOD_DAY) { $Xvngd = array(); foreach ($P4hFJ as $Fn99E) { $Xvngd[] = 0; } $aGNE3[date('Y-m-d', $KpVmd)] = $Xvngd; } goto i7Wod; AwtZ6: return array('time' => array_keys($aGNE3), 'values' => $v37OZ); goto UTrUI; kKrAA: $f8DbJ = strtotime($ZIlJo); goto xhJnt; g8UkA: $ZIlJo = $uqLdQ . ' 23:59:59'; goto h5bXn; q_rWs: $v37OZ = array(); goto TukwE; XGs5p: foreach ($P4hFJ as $K_IJ6 => $Fn99E) { foreach ($JgIJJ as $yPU82) { $v37OZ[$K_IJ6][] = $yPU82[$K_IJ6]; } } goto AwtZ6; xhJnt: $aGNE3 = array(); goto mdA2P; i7Wod: foreach ($P4hFJ as $K_IJ6 => $Fn99E) { goto mQXiC; b2JPG: $CnWtd = ModelUtil::model($Fn99E['table'])->where($Fn99E['where'])->where('created_at', '>=', $yE4DO)->where('created_at', '<', $ZIlJo)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('SUM(' . $Fn99E['field'] . ') AS _total')))->toArray(); goto oIeSY; oIeSY: foreach ($CnWtd as $Xvngd) { $aGNE3[$Xvngd['_time']][$K_IJ6] = $Xvngd['_total']; } goto irfO_; mQXiC: if (empty($Fn99E['where'])) { $Fn99E['where'] = array(); } goto b2JPG; irfO_: } goto q_rWs; TukwE: $JgIJJ = array_values($aGNE3); goto XGs5p; ur8GE: $yE4DO = $GcZ1R . ' 00:00:00'; goto g8UkA; h5bXn: $W9j8i = strtotime($yE4DO); goto kKrAA; UTrUI: } }