<?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($JCIt8, $HBrrp, $l8Ger = array()) { goto n6nh7; WQn4c: foreach ($l8Ger as $xlsSz => $k1GDE) { goto u61Jp; u61Jp: if (empty($k1GDE['where'])) { $k1GDE['where'] = array(); } goto K0tu2; K0tu2: $zonFp = ModelUtil::model($k1GDE['table'])->where('created_at', '>=', $qUxIC)->where('created_at', '<', $BPAc0)->where($k1GDE['where'])->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('COUNT(1) AS _cnt')))->toArray(); goto qfpp0; qfpp0: foreach ($zonFp as $OV1o4) { $uZul3[$OV1o4['_time']][$xlsSz] = $OV1o4['_cnt']; } goto o9BHc; o9BHc: } goto LcBEf; n6nh7: $qUxIC = $JCIt8 . ' 00:00:00'; goto LRIHO; PVnb1: $X2G8M = strtotime($qUxIC); goto wWKAL; LRIHO: $BPAc0 = $HBrrp . ' 23:59:59'; goto PVnb1; ZxF0O: for ($HjXRV = $X2G8M; $HjXRV < $nR73L; $HjXRV += TimeUtil::PERIOD_DAY) { $OV1o4 = array(); foreach ($l8Ger as $k1GDE) { $OV1o4[] = 0; } $uZul3[date('Y-m-d', $HjXRV)] = $OV1o4; } goto WQn4c; wWKAL: $nR73L = strtotime($BPAc0); goto zpdSP; LcBEf: $FKs0n = array(); goto s30P5; zpdSP: $uZul3 = array(); goto ZxF0O; ui0Ul: return array('time' => array_keys($uZul3), 'values' => $FKs0n); goto esm2F; s30P5: $wBuPD = array_values($uZul3); goto XyTqU; XyTqU: foreach ($l8Ger as $xlsSz => $k1GDE) { foreach ($wBuPD as $TEhly) { $FKs0n[$xlsSz][] = $TEhly[$xlsSz]; } } goto ui0Ul; esm2F: } protected function dsTableSumSeriesDaily($JCIt8, $HBrrp, $l8Ger = array()) { goto cKdy0; o94Ny: return array('time' => array_keys($uZul3), 'values' => $FKs0n); goto yjx3C; DtmCf: $wBuPD = array_values($uZul3); goto OhJSE; yPVrF: $BPAc0 = $HBrrp . ' 23:59:59'; goto ygG1B; RdAop: foreach ($l8Ger as $xlsSz => $k1GDE) { goto ICeKm; VIFGz: $zonFp = ModelUtil::model($k1GDE['table'])->where($k1GDE['where'])->where('created_at', '>=', $qUxIC)->where('created_at', '<', $BPAc0)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('SUM(' . $k1GDE['field'] . ') AS _total')))->toArray(); goto FwmNd; FwmNd: foreach ($zonFp as $OV1o4) { $uZul3[$OV1o4['_time']][$xlsSz] = $OV1o4['_total']; } goto tC0Za; ICeKm: if (empty($k1GDE['where'])) { $k1GDE['where'] = array(); } goto VIFGz; tC0Za: } goto P4zU0; ygG1B: $X2G8M = strtotime($qUxIC); goto G7PrN; cKdy0: $qUxIC = $JCIt8 . ' 00:00:00'; goto yPVrF; P4zU0: $FKs0n = array(); goto DtmCf; OhJSE: foreach ($l8Ger as $xlsSz => $k1GDE) { foreach ($wBuPD as $TEhly) { $FKs0n[$xlsSz][] = $TEhly[$xlsSz]; } } goto o94Ny; Xuhhn: for ($HjXRV = $X2G8M; $HjXRV < $nR73L; $HjXRV += TimeUtil::PERIOD_DAY) { $OV1o4 = array(); foreach ($l8Ger as $k1GDE) { $OV1o4[] = 0; } $uZul3[date('Y-m-d', $HjXRV)] = $OV1o4; } goto RdAop; wSEI3: $uZul3 = array(); goto Xuhhn; G7PrN: $nR73L = strtotime($BPAc0); goto wSEI3; yjx3C: } }