<?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($nktn1, $R96Y0, $ARPC2 = array()) { goto Fvnq5; k5Ce6: for ($Ku2V9 = $sOQj0; $Ku2V9 < $rarSr; $Ku2V9 += TimeUtil::PERIOD_DAY) { $yFnpO = array(); foreach ($ARPC2 as $j2S1b) { $yFnpO[] = 0; } $wzfN_[date('Y-m-d', $Ku2V9)] = $yFnpO; } goto Mi71b; Mdhn0: $sOQj0 = strtotime($MWKUg); goto eXha1; fvA8O: $fIAhI = array(); goto fb0SU; xUXhv: foreach ($ARPC2 as $dtpXv => $j2S1b) { foreach ($JBmEs as $xR8iA) { $fIAhI[$dtpXv][] = $xR8iA[$dtpXv]; } } goto xoE7l; fb0SU: $JBmEs = array_values($wzfN_); goto xUXhv; Mi71b: foreach ($ARPC2 as $dtpXv => $j2S1b) { goto GlPHm; vhnIW: foreach ($Sj05q as $yFnpO) { $wzfN_[$yFnpO['_time']][$dtpXv] = $yFnpO['_cnt']; } goto Uujeh; eyTwW: $Sj05q = ModelUtil::model($j2S1b['table'])->where($j2S1b['where'])->where('created_at', '>=', $MWKUg)->where('created_at', '<', $IF3JO)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('COUNT(1) AS _cnt')))->toArray(); goto vhnIW; GlPHm: if (empty($j2S1b['where'])) { $j2S1b['where'] = array(); } goto eyTwW; Uujeh: } goto fvA8O; Fvnq5: $MWKUg = $nktn1 . ' 00:00:00'; goto i37Ow; xoE7l: return array('time' => array_keys($wzfN_), 'values' => $fIAhI); goto snCd3; i37Ow: $IF3JO = $R96Y0 . ' 23:59:59'; goto Mdhn0; eXha1: $rarSr = strtotime($IF3JO); goto jcX74; jcX74: $wzfN_ = array(); goto k5Ce6; snCd3: } protected function dsTableSumSeriesDaily($nktn1, $R96Y0, $ARPC2 = array()) { goto DuuGa; eGphM: $IF3JO = $R96Y0 . ' 23:59:59'; goto dyCU7; njimy: $rarSr = strtotime($IF3JO); goto nSlQO; AsRsv: return array('time' => array_keys($wzfN_), 'values' => $fIAhI); goto gR6gj; rHjaB: foreach ($ARPC2 as $dtpXv => $j2S1b) { goto ppTRr; IAHAu: foreach ($Sj05q as $yFnpO) { $wzfN_[$yFnpO['_time']][$dtpXv] = $yFnpO['_total']; } goto xQ_hU; ppTRr: if (empty($j2S1b['where'])) { $j2S1b['where'] = array(); } goto rb6UH; rb6UH: $Sj05q = ModelUtil::model($j2S1b['table'])->where($j2S1b['where'])->where('created_at', '>=', $MWKUg)->where('created_at', '<', $IF3JO)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('SUM(' . $j2S1b['field'] . ') AS _total')))->toArray(); goto IAHAu; xQ_hU: } goto ivWuq; qRNeL: foreach ($ARPC2 as $dtpXv => $j2S1b) { foreach ($JBmEs as $xR8iA) { $fIAhI[$dtpXv][] = $xR8iA[$dtpXv]; } } goto AsRsv; P3rUe: $JBmEs = array_values($wzfN_); goto qRNeL; DuuGa: $MWKUg = $nktn1 . ' 00:00:00'; goto eGphM; dyCU7: $sOQj0 = strtotime($MWKUg); goto njimy; ivWuq: $fIAhI = array(); goto P3rUe; nSlQO: $wzfN_ = array(); goto nl31f; nl31f: for ($Ku2V9 = $sOQj0; $Ku2V9 < $rarSr; $Ku2V9 += TimeUtil::PERIOD_DAY) { $yFnpO = array(); foreach ($ARPC2 as $j2S1b) { $yFnpO[] = 0; } $wzfN_[date('Y-m-d', $Ku2V9)] = $yFnpO; } goto rHjaB; gR6gj: } }