diff --git a/market/controllers/api/sylive/Statistics.php b/market/controllers/api/sylive/Statistics.php index efa4ab7c..360e0166 100644 --- a/market/controllers/api/sylive/Statistics.php +++ b/market/controllers/api/sylive/Statistics.php @@ -459,19 +459,19 @@ class Statistics extends BaseController if ($sort == 'browse') { $browse = $v['total']; } else { - $where['kpi'] = 'browse'; + $where_sort['kpi'] = 'browse'; $browse = $this->mdSyliveActivityKpidata->count($where_sort); } if ($sort == 'subscribe') { $subscribe = $v['total']; } else { - $where['kpi'] = 'subscribe'; + $where_sort['kpi'] = 'subscribe'; $subscribe = $this->mdSyliveActivityKpidata->count($where_sort); } if ($sort == 'watch') { $watch = $v['total']; } else { - $where['kpi'] = 'watch'; + $where_sort['kpi'] = 'watch'; $watch = $this->mdSyliveActivityKpidata->count($where_sort); } if ($sort == 'order') { @@ -859,19 +859,19 @@ class Statistics extends BaseController if ($sort == 'browse') { $browse = $v['total']; } else { - $where['kpi'] = 'browse'; + $where_sort['kpi'] = 'browse'; $browse = $this->mdSyliveActivityKpidata->count($where_sort); } if ($sort == 'subscribe') { $subscribe = $v['total']; } else { - $where['kpi'] = 'subscribe'; + $where_sort['kpi'] = 'subscribe'; $subscribe = $this->mdSyliveActivityKpidata->count($where_sort); } if ($sort == 'watch') { $watch = $v['total']; } else { - $where['kpi'] = 'watch'; + $where_sort['kpi'] = 'watch'; $watch = $this->mdSyliveActivityKpidata->count($where_sort); } if ($sort == 'order') { @@ -1109,7 +1109,7 @@ class Statistics extends BaseController , 'day' => $v2, 'activityId' => $activityId]); } $legendData[] = $organizationName; - $yAxisSeries[] = ['name' => $organizationName, 'type' => 'line', 'smooth' => true, 'data' => $counts]; + $yAxisSeries[] = ['name' => $organizationName, 'type' => 'line', 'data' => $counts]; } } //折线图数据 @@ -1117,6 +1117,34 @@ class Statistics extends BaseController $this->return_response_list($date); } + public function stacked_order_get() + { + $activityId = intval($this->input_param('activityId')); + $re = $this->mdSyliveActivity->get(['activityId' => $activityId]); + $times = []; + if ($re) { + $timeStart = $re['timeStart']; + $timeEnd = $re['timeEnd']; + if ($timeStart != '0000-00-00 00:00:00' && $timeEnd != '0000-00-00 00:00:00') { + $start_Time = strtotime('2022-11-26 10:00:00'); + $end_Time = strtotime('2022-11-26 17:30:00'); + $add_time = '+1 hour'; + $diff = abs($start_Time - $end_Time); // 获取时间差 + $hour = ceil($diff / 3600); // 获取相差小时数 + $hour <= 6 && $add_time = '+30 minute';//转分钟显示 + while ($start_Time <= $end_Time) { + $start = date('Y-m-d H:i:s', $start_Time); + $name_start = date('d H:i', $start_Time); + $start_Time = strtotime($add_time, $start_Time); + $name_end = date('H:i', $start_Time); + $times[] = ['name' => $name_start . '-' . $name_end, 'start' => $start, 'end' => date('Y-m-d H:i:s', $start_Time)]; + } + } + } + $date['times'] = $times; + $this->return_response_list($date); + } + /** * Notes:查询排名 * Created on: 2022/11/3 19:45