<?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($K0yTv, $kJ2hw, $kKV1v = array()) { goto AoER4; mJ7rm: $PdJXU = strtotime($Hp8gT); goto qqSEt; eVJi8: $H6_y1 = array_values($Idkbx); goto R7RD1; yx0oq: return array('time' => array_keys($Idkbx), 'values' => $HM8PZ); goto dZn4e; WuOJv: $HM8PZ = array(); goto eVJi8; r11jP: for ($T_NF7 = $PliFt; $T_NF7 < $PdJXU; $T_NF7 += TimeUtil::PERIOD_DAY) { $ZpLX1 = array(); foreach ($kKV1v as $Tl7fK) { $ZpLX1[] = 0; } $Idkbx[date('Y-m-d', $T_NF7)] = $ZpLX1; } goto czznK; qqSEt: $Idkbx = array(); goto r11jP; AoER4: $wcTnb = $K0yTv . ' 00:00:00'; goto oVK1s; czznK: foreach ($kKV1v as $ouMWs => $Tl7fK) { goto aeJMc; aeJMc: if (empty($Tl7fK['where'])) { $Tl7fK['where'] = array(); } goto JVBCu; ziRyi: foreach ($SjN8A as $ZpLX1) { $Idkbx[$ZpLX1['_time']][$ouMWs] = $ZpLX1['_cnt']; } goto NRj3U; JVBCu: $SjN8A = ModelUtil::model($Tl7fK['table'])->where($Tl7fK['where'])->where('created_at', '>=', $wcTnb)->where('created_at', '<', $Hp8gT)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('COUNT(1) AS _cnt')))->toArray(); goto ziRyi; NRj3U: } goto WuOJv; u7_6z: $PliFt = strtotime($wcTnb); goto mJ7rm; oVK1s: $Hp8gT = $kJ2hw . ' 23:59:59'; goto u7_6z; R7RD1: foreach ($kKV1v as $ouMWs => $Tl7fK) { foreach ($H6_y1 as $Zgh08) { $HM8PZ[$ouMWs][] = $Zgh08[$ouMWs]; } } goto yx0oq; dZn4e: } protected function dsTableSumSeriesDaily($K0yTv, $kJ2hw, $kKV1v = array()) { goto VscQ6; VscQ6: $wcTnb = $K0yTv . ' 00:00:00'; goto ICGeS; QiHtZ: foreach ($kKV1v as $ouMWs => $Tl7fK) { goto hVR2J; c35v3: foreach ($SjN8A as $ZpLX1) { $Idkbx[$ZpLX1['_time']][$ouMWs] = $ZpLX1['_total']; } goto UA7q1; s3yRI: $SjN8A = ModelUtil::model($Tl7fK['table'])->where($Tl7fK['where'])->where('created_at', '>=', $wcTnb)->where('created_at', '<', $Hp8gT)->groupBy('_time')->get(array(DB::raw('DATE_FORMAT(created_at, \'%Y-%m-%d\') _time'), DB::raw('SUM(' . $Tl7fK['field'] . ') AS _total')))->toArray(); goto c35v3; hVR2J: if (empty($Tl7fK['where'])) { $Tl7fK['where'] = array(); } goto s3yRI; UA7q1: } goto lW6EJ; sX56B: $H6_y1 = array_values($Idkbx); goto D54dY; ICGeS: $Hp8gT = $kJ2hw . ' 23:59:59'; goto DdU8m; lWSVb: $PdJXU = strtotime($Hp8gT); goto nVGj7; jylHF: for ($T_NF7 = $PliFt; $T_NF7 < $PdJXU; $T_NF7 += TimeUtil::PERIOD_DAY) { $ZpLX1 = array(); foreach ($kKV1v as $Tl7fK) { $ZpLX1[] = 0; } $Idkbx[date('Y-m-d', $T_NF7)] = $ZpLX1; } goto QiHtZ; DdU8m: $PliFt = strtotime($wcTnb); goto lWSVb; nVGj7: $Idkbx = array(); goto jylHF; D54dY: foreach ($kKV1v as $ouMWs => $Tl7fK) { foreach ($H6_y1 as $Zgh08) { $HM8PZ[$ouMWs][] = $Zgh08[$ouMWs]; } } goto p3kzR; lW6EJ: $HM8PZ = array(); goto sX56B; p3kzR: return array('time' => array_keys($Idkbx), 'values' => $HM8PZ); goto r4OVo; r4OVo: } }