<?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($X9g7N, $bWtXG, $lev5f = array()) { goto FYTYr; GJ6wv: $OG0F_ = strtotime($J77A0); goto Uxto6; BRzjv: foreach ($lev5f as $C6OV7 => $L83I6) { foreach ($qQ2Ng as $mNouP) { $V5ty1[$C6OV7][] = $mNouP[$C6OV7]; } } goto M_qmv; ApY7Y: for ($fLEeX = $OG0F_; $fLEeX < $SAOgU; $fLEeX += TimeUtil::PERIOD_DAY) { $P1uVJ = array(); foreach ($lev5f as $L83I6) { $P1uVJ[] = 0; } $xBsjt[date('Y-m-d', $fLEeX)] = $P1uVJ; } goto aABsv; M_qmv: return array('time' => array_keys($xBsjt), 'values' => $V5ty1); goto T6DKn; Uxto6: $SAOgU = strtotime($NEtha); goto AqZoO; Ef0sO: $NEtha = $bWtXG . ' 23:59:59'; goto GJ6wv; AqZoO: $xBsjt = array(); goto ApY7Y; qQhYC: $V5ty1 = array(); goto K2rtW; aABsv: foreach ($lev5f as $C6OV7 => $L83I6) { goto l_g46; l_g46: if (empty($L83I6['where'])) { $L83I6['where'] = array(); } goto H530L; H530L: $dTnlu = ModelUtil::model($L83I6['table'])->where('created_at', '>=', $J77A0)->where('created_at', '<', $NEtha)->where($L83I6['where'])->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('COUNT(1) AS _cnt')))->toArray(); goto fnEm1; fnEm1: foreach ($dTnlu as $P1uVJ) { $xBsjt[$P1uVJ['_time']][$C6OV7] = $P1uVJ['_cnt']; } goto lHcrm; lHcrm: } goto qQhYC; K2rtW: $qQ2Ng = array_values($xBsjt); goto BRzjv; FYTYr: $J77A0 = $X9g7N . ' 00:00:00'; goto Ef0sO; T6DKn: } protected function dsTableSumSeriesDaily($X9g7N, $bWtXG, $lev5f = array()) { goto eIyf5; eIyf5: $J77A0 = $X9g7N . ' 00:00:00'; goto CHfjO; pUPGL: $xBsjt = array(); goto Bmk0P; gJErc: foreach ($lev5f as $C6OV7 => $L83I6) { foreach ($qQ2Ng as $mNouP) { $V5ty1[$C6OV7][] = $mNouP[$C6OV7]; } } goto Ko01R; zarRT: $OG0F_ = strtotime($J77A0); goto L5u8y; Gk9Dw: foreach ($lev5f as $C6OV7 => $L83I6) { goto vZ3cp; V7Lmh: $dTnlu = ModelUtil::model($L83I6['table'])->where($L83I6['where'])->where('created_at', '>=', $J77A0)->where('created_at', '<', $NEtha)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('SUM(' . $L83I6['field'] . ') AS _total')))->toArray(); goto m5gtq; vZ3cp: if (empty($L83I6['where'])) { $L83I6['where'] = array(); } goto V7Lmh; m5gtq: foreach ($dTnlu as $P1uVJ) { $xBsjt[$P1uVJ['_time']][$C6OV7] = $P1uVJ['_total']; } goto Pklap; Pklap: } goto ipxPT; ipxPT: $V5ty1 = array(); goto gSPJ7; L5u8y: $SAOgU = strtotime($NEtha); goto pUPGL; CHfjO: $NEtha = $bWtXG . ' 23:59:59'; goto zarRT; Bmk0P: for ($fLEeX = $OG0F_; $fLEeX < $SAOgU; $fLEeX += TimeUtil::PERIOD_DAY) { $P1uVJ = array(); foreach ($lev5f as $L83I6) { $P1uVJ[] = 0; } $xBsjt[date('Y-m-d', $fLEeX)] = $P1uVJ; } goto Gk9Dw; Ko01R: return array('time' => array_keys($xBsjt), 'values' => $V5ty1); goto QbFbS; gSPJ7: $qQ2Ng = array_values($xBsjt); goto gJErc; QbFbS: } }