<?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($VEnMw, $XoefR, $bhIH0 = array()) { goto RHJxS; Sn0M5: $k0RGX = strtotime($X81Og); goto oVKR7; cONLb: return array('time' => array_keys($WdXin), 'values' => $nuk_j); goto xYi5L; i1gU_: $M_REG = array_values($WdXin); goto H7tLN; IUatq: foreach ($bhIH0 as $XIWRg => $RHpJe) { goto XB8d9; h0c6q: foreach ($Y0YxF as $Nrp0b) { $WdXin[$Nrp0b['_time']][$XIWRg] = $Nrp0b['_cnt']; } goto NyGo3; Y1LAp: $Y0YxF = ModelUtil::model($RHpJe['table'])->where($RHpJe['where'])->where('created_at', '>=', $X81Og)->where('created_at', '<', $cn5do)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('COUNT(1) AS _cnt')))->toArray(); goto h0c6q; XB8d9: if (empty($RHpJe['where'])) { $RHpJe['where'] = array(); } goto Y1LAp; NyGo3: } goto gY8q8; Ps4St: for ($nw42o = $k0RGX; $nw42o < $iCpJV; $nw42o += TimeUtil::PERIOD_DAY) { $Nrp0b = array(); foreach ($bhIH0 as $RHpJe) { $Nrp0b[] = 0; } $WdXin[date('Y-m-d', $nw42o)] = $Nrp0b; } goto IUatq; gY8q8: $nuk_j = array(); goto i1gU_; H7tLN: foreach ($bhIH0 as $XIWRg => $RHpJe) { foreach ($M_REG as $yqHFg) { $nuk_j[$XIWRg][] = $yqHFg[$XIWRg]; } } goto cONLb; BJPOE: $cn5do = $XoefR . ' 23:59:59'; goto Sn0M5; RHJxS: $X81Og = $VEnMw . ' 00:00:00'; goto BJPOE; oVKR7: $iCpJV = strtotime($cn5do); goto nhwPZ; nhwPZ: $WdXin = array(); goto Ps4St; xYi5L: } protected function dsTableSumSeriesDaily($VEnMw, $XoefR, $bhIH0 = array()) { goto wtVNo; MZPop: foreach ($bhIH0 as $XIWRg => $RHpJe) { foreach ($M_REG as $yqHFg) { $nuk_j[$XIWRg][] = $yqHFg[$XIWRg]; } } goto mIU4g; wtVNo: $X81Og = $VEnMw . ' 00:00:00'; goto Yt26e; eR_mf: foreach ($bhIH0 as $XIWRg => $RHpJe) { goto zH1mt; zH1mt: if (empty($RHpJe['where'])) { $RHpJe['where'] = array(); } goto H9Xrj; OGnYI: foreach ($Y0YxF as $Nrp0b) { $WdXin[$Nrp0b['_time']][$XIWRg] = $Nrp0b['_total']; } goto J27mp; H9Xrj: $Y0YxF = ModelUtil::model($RHpJe['table'])->where($RHpJe['where'])->where('created_at', '>=', $X81Og)->where('created_at', '<', $cn5do)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('SUM(' . $RHpJe['field'] . ') AS _total')))->toArray(); goto OGnYI; J27mp: } goto D6Sfw; D6Sfw: $nuk_j = array(); goto zAPYo; Yt26e: $cn5do = $XoefR . ' 23:59:59'; goto thEnD; zAPYo: $M_REG = array_values($WdXin); goto MZPop; ixDsg: $iCpJV = strtotime($cn5do); goto BklM0; Kz0cC: for ($nw42o = $k0RGX; $nw42o < $iCpJV; $nw42o += TimeUtil::PERIOD_DAY) { $Nrp0b = array(); foreach ($bhIH0 as $RHpJe) { $Nrp0b[] = 0; } $WdXin[date('Y-m-d', $nw42o)] = $Nrp0b; } goto eR_mf; thEnD: $k0RGX = strtotime($X81Og); goto ixDsg; mIU4g: return array('time' => array_keys($WdXin), 'values' => $nuk_j); goto fuwSf; BklM0: $WdXin = array(); goto Kz0cC; fuwSf: } }