market_statistics_1122
This commit is contained in:
@@ -140,16 +140,11 @@ class Statistics extends BaseController
|
||||
public function page_area_get()
|
||||
{
|
||||
$activityId = intval($this->input_param('activityId'));
|
||||
$page = $this->input_param('page');
|
||||
$limit = $this->input_param('limit');
|
||||
$sort = $this->input_param('sort');
|
||||
$order = $this->input_param('order');
|
||||
$day = $this->input_param('day');//日期
|
||||
$itemId = intval($this->input_param('itemId'));//商品
|
||||
!$page && $page = 1;
|
||||
!$limit && $limit = 100;
|
||||
$list = $legendData = $yAxisSeries = [];
|
||||
$xAxisData = ['参与门店数', '参与顾问数', '全部顾问数', '浏览数', '预约数', '观看数', '订单数', '观看数', '人均观看'];
|
||||
$list = [];
|
||||
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
|
||||
if ($re) {
|
||||
$type = 0;
|
||||
@@ -201,9 +196,6 @@ class Statistics extends BaseController
|
||||
$consultant > $allConsultant && $allConsultant = $consultant;
|
||||
$biz = count($v['biz']);
|
||||
$organizationName = $re_area['organizationName'] ? $re_area['organizationName'] : '-';
|
||||
$legendData[] = $organizationName;
|
||||
$yAxisSeries[] = ['name' => $organizationName, 'type' => 'line'
|
||||
, 'data' => [$biz, $consultant, $allConsultant, $browse, $subscribe, $watch, $orderTotal, $livePV, $watchDuration]];
|
||||
$list[] = ['areaName' => $organizationName, 'biz' => $biz, 'consultant' => $consultant, 'allConsultant' => $allConsultant
|
||||
, 'browse' => $browse, 'subscribe' => $subscribe, 'watch' => $watch, 'order' => $orderTotal
|
||||
, 'livePV' => $livePV, 'watchDuration' => $watchDuration];
|
||||
@@ -247,9 +239,6 @@ class Statistics extends BaseController
|
||||
$subscribe = intval($subscribe['subscribe']);
|
||||
$watch = intval($watch['watch']);
|
||||
$organizationName = $re_area['organizationName'] ? $re_area['organizationName'] : '-';
|
||||
$legendData[] = $organizationName;
|
||||
$yAxisSeries[] = ['name' => $organizationName, 'type' => 'line'
|
||||
, 'data' => [$biz, $consultant, $allConsultant, $browse, $subscribe, $watch, $orderTotal, $livePV, $watchDuration]];
|
||||
$list[] = ['areaName' => $organizationName, 'biz' => $biz, 'consultant' => $consultant, 'allConsultant' => $allConsultant
|
||||
, 'browse' => $browse, 'subscribe' => $subscribe, 'watch' => $watch, 'order' => $orderTotal
|
||||
, 'livePV' => $livePV, 'watchDuration' => $watchDuration];
|
||||
@@ -261,10 +250,7 @@ class Statistics extends BaseController
|
||||
$sortKey = array_column($list, $sort);
|
||||
array_multisort($sortKey, $order, $list);
|
||||
$count = count($list);
|
||||
//$list = array_splice($list, 0, $limit);
|
||||
//折线图数据
|
||||
$chart = ['legendData' => $legendData, 'xAxisData' => $xAxisData, 'yAxisSeries' => $yAxisSeries];
|
||||
$date = ['list' => $list, 'count' => $count, 'chart' => $chart];
|
||||
$date = ['list' => $list, 'count' => $count];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
@@ -758,7 +744,7 @@ class Statistics extends BaseController
|
||||
}
|
||||
}
|
||||
$list[] = [
|
||||
'bizName' => $bizName, 'consultant' => $consultant . '/' . $allConsultant, 'browse' => $browse, 'subscribe' => $subscribe
|
||||
'bizName' => $bizName, 'consultant' => $consultant, 'allConsultant' => $allConsultant, 'browse' => $browse, 'subscribe' => $subscribe
|
||||
, 'watch' => $watch, 'order' => $orderTotal, 'livePV' => $livePV, 'watchDuration' => $watchDuration];
|
||||
}
|
||||
}
|
||||
@@ -813,7 +799,7 @@ class Statistics extends BaseController
|
||||
$v['watch'] = intval($re['watch']);
|
||||
}
|
||||
$list[] = [
|
||||
'bizName' => $bizName, 'consultant' => $consultant . '/' . $allConsultant, 'browse' => $v['browse'], 'subscribe' => $v['subscribe']
|
||||
'bizName' => $bizName, 'consultant' => $consultant, 'allConsultant' => $allConsultant, 'browse' => $v['browse'], 'subscribe' => $v['subscribe']
|
||||
, 'watch' => $v['watch'], 'order' => $order, 'livePV' => $livePV, 'watchDuration' => $watchDuration];
|
||||
}
|
||||
}
|
||||
@@ -1092,6 +1078,45 @@ class Statistics extends BaseController
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取区域折线图数据
|
||||
* Created on: 2022/11/22 9:39
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function stacked_area_get()
|
||||
{
|
||||
$activityId = intval($this->input_param('activityId'));
|
||||
$kpi = $this->input_param('kpi');
|
||||
$legendData = $yAxisSeries = $xAxisData = [];
|
||||
$re = $this->mdSyliveActivity->get(['activityId' => $activityId]);
|
||||
!$kpi && $kpi = 'subscribe';
|
||||
if ($re && $re['timeEnd'] != '0000-00-00 00:00:00') {
|
||||
$type = 0;
|
||||
$timeEnd = date("Y-m-d", strtotime($re['timeEnd']));
|
||||
for ($i = 6; $i >= 0; $i--) {
|
||||
$day = date("Y-m-d", strtotime("$timeEnd -{$i} day"));
|
||||
$xAxisData[] = $day;
|
||||
}
|
||||
$res = $this->mdSyliveActivityBiz->select_groupby('areaId', ['activityId' => $activityId, 'status>=' => 0
|
||||
, 'areaId>' => 0], "$kpi desc", 0, 0, 'areaId');
|
||||
foreach ($res as $v) {
|
||||
$areaId = intval($v['areaId']);
|
||||
$re_area = $this->mdSyliveOrganization->get(['organizationId' => $areaId]);
|
||||
$organizationName = $re_area['organizationName'] ? $re_area['organizationName'] : '-';
|
||||
$counts = [];
|
||||
foreach ($xAxisData as $v2) {
|
||||
$counts[] = $this->mdSyliveActivityKpidata->count(['kpi' => $kpi, 'areaId' => $areaId, 'type' => $type
|
||||
, 'day' => $v2, 'activityId' => $activityId]);
|
||||
}
|
||||
$legendData[] = $organizationName;
|
||||
$yAxisSeries[] = ['name' => $organizationName, 'type' => 'line', 'smooth' => true, 'data' => $counts];
|
||||
}
|
||||
}
|
||||
//折线图数据
|
||||
$date = ['legendData' => $legendData, 'xAxisData' => $xAxisData, 'yAxisSeries' => $yAxisSeries];
|
||||
$this->return_response_list($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:查询排名
|
||||
* Created on: 2022/11/3 19:45
|
||||
|
||||
Reference in New Issue
Block a user