<?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($mTKI1, $ineBL, $Jwra6 = array()) { goto yne24; Ej2hv: $kK9aH = array_values($KpD1x); goto rGNbc; KTsaq: return array('time' => array_keys($KpD1x), 'values' => $ozH9e); goto Aq1bF; yne24: $uo6AD = $mTKI1 . ' 00:00:00'; goto f639m; CYtMN: foreach ($Jwra6 as $vTPD6 => $tuIjr) { goto byfqk; byfqk: if (empty($tuIjr['where'])) { $tuIjr['where'] = array(); } goto Qoswa; FlRkU: foreach ($EdQjV as $El_MH) { $KpD1x[$El_MH['_time']][$vTPD6] = $El_MH['_cnt']; } goto EZ2Oc; Qoswa: $EdQjV = ModelUtil::model($tuIjr['table'])->where($tuIjr['where'])->where('created_at', '>=', $uo6AD)->where('created_at', '<', $JVUPP)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('COUNT(1) AS _cnt')))->toArray(); goto FlRkU; EZ2Oc: } goto z16sP; IMxKP: $Pfgjd = strtotime($uo6AD); goto z6zkq; f639m: $JVUPP = $ineBL . ' 23:59:59'; goto IMxKP; rGNbc: foreach ($Jwra6 as $vTPD6 => $tuIjr) { foreach ($kK9aH as $xroky) { $ozH9e[$vTPD6][] = $xroky[$vTPD6]; } } goto KTsaq; z16sP: $ozH9e = array(); goto Ej2hv; z6zkq: $m8O6r = strtotime($JVUPP); goto sQzc4; sQzc4: $KpD1x = array(); goto ZAyAE; ZAyAE: for ($vPRxo = $Pfgjd; $vPRxo < $m8O6r; $vPRxo += TimeUtil::PERIOD_DAY) { $El_MH = array(); foreach ($Jwra6 as $tuIjr) { $El_MH[] = 0; } $KpD1x[date('Y-m-d', $vPRxo)] = $El_MH; } goto CYtMN; Aq1bF: } protected function dsTableSumSeriesDaily($mTKI1, $ineBL, $Jwra6 = array()) { goto v324Q; xAGOk: foreach ($Jwra6 as $vTPD6 => $tuIjr) { foreach ($kK9aH as $xroky) { $ozH9e[$vTPD6][] = $xroky[$vTPD6]; } } goto l57sC; wP_As: $KpD1x = array(); goto OQrr6; wKHRX: $m8O6r = strtotime($JVUPP); goto wP_As; l57sC: return array('time' => array_keys($KpD1x), 'values' => $ozH9e); goto q15eI; nwI1y: $ozH9e = array(); goto dn8Gj; v324Q: $uo6AD = $mTKI1 . ' 00:00:00'; goto RzSVs; ktv1N: foreach ($Jwra6 as $vTPD6 => $tuIjr) { goto m5e5o; y_m2T: $EdQjV = ModelUtil::model($tuIjr['table'])->where($tuIjr['where'])->where('created_at', '>=', $uo6AD)->where('created_at', '<', $JVUPP)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('SUM(' . $tuIjr['field'] . ') AS _total')))->toArray(); goto HVfMq; HVfMq: foreach ($EdQjV as $El_MH) { $KpD1x[$El_MH['_time']][$vTPD6] = $El_MH['_total']; } goto ya30a; m5e5o: if (empty($tuIjr['where'])) { $tuIjr['where'] = array(); } goto y_m2T; ya30a: } goto nwI1y; dn8Gj: $kK9aH = array_values($KpD1x); goto xAGOk; RzSVs: $JVUPP = $ineBL . ' 23:59:59'; goto GbMdu; GbMdu: $Pfgjd = strtotime($uo6AD); goto wKHRX; OQrr6: for ($vPRxo = $Pfgjd; $vPRxo < $m8O6r; $vPRxo += TimeUtil::PERIOD_DAY) { $El_MH = array(); foreach ($Jwra6 as $tuIjr) { $El_MH[] = 0; } $KpD1x[date('Y-m-d', $vPRxo)] = $El_MH; } goto ktv1N; q15eI: } }