market_statistics_1028
This commit is contained in:
@@ -517,92 +517,6 @@ class Activity extends BaseController
|
||||
$this->return_response();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes:获取区域饼状数据
|
||||
* Created on: 2022/10/9 17:21
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function statistics_piechart_get()
|
||||
{
|
||||
$activityId = intval($this->input_param('activityId'));
|
||||
$type = $this->input_param('type');
|
||||
if (!$activityId || !$type) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->load->model('market/Market_sylive_activity_kpidata_model', 'mdSyliveActivityKpidata');
|
||||
$data = [];
|
||||
$res_biz = $this->mdSyliveActivityBiz->select(['activityId' => $activityId, 'status' => 0], 'browse desc', 0, 0, 'distinct(areaId) as areaId');
|
||||
foreach ($res_biz as $k => $v) {
|
||||
$areaId = intval($v['areaId']);
|
||||
$re_area = $this->mdSyliveOrganization->get(['organizationId' => $areaId]);
|
||||
$value = $this->mdSyliveActivityKpidata->count(['area_id' => $areaId, 'a_id' => $activityId, 'kpi' => $type]);
|
||||
$data[] = ['name' => $re_area['organizationName'], 'value' => $value
|
||||
, 'url' => "/sylive/activity/statistics/barchart?activityId={$activityId}&areaId={$areaId}&type={$type}"];
|
||||
}
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取门店柱状数据
|
||||
* Created on: 2022/10/9 17:30
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function statistics_barchart_get()
|
||||
{
|
||||
$activityId = intval($this->input_param('activityId'));
|
||||
$areaId = intval($this->input_param('areaId'));
|
||||
$type = $this->input_param('type');
|
||||
if (!$activityId || !$areaId || !$type) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->load->model('market/Market_sylive_activity_kpidata_model', 'mdSyliveActivityKpidata');
|
||||
$dataTitle = $dataValue = $dataUrl = [];
|
||||
$res_biz = $this->mdSyliveActivityBiz->select(['activityId' => $activityId, 'status' => 0], 'browse desc', 0, 0, 'bizId');
|
||||
foreach ($res_biz as $k => $v) {
|
||||
$bizId = intval($v['bizId']);
|
||||
$re_biz = $this->mdSyliveOrganization->get(['organizationId' => $bizId]);
|
||||
$value = $this->mdSyliveActivityKpidata->count(['area_id' => $areaId, 'biz_id' => $bizId, 'a_id' => $activityId, 'kpi' => $type]);
|
||||
$dataTitle[] = $re_biz['organizationName'];
|
||||
$dataValue[] = $value;
|
||||
$dataUrl[] = "/sylive/activity/statistics/storebarchart?activityId={$activityId}&bizId={$bizId}&type={$type}";
|
||||
}
|
||||
$data['dataTitle'] = $dataTitle;
|
||||
$data['dataValue'] = $dataValue;
|
||||
$data['dataUrl'] = $dataUrl;
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取顾问柱状数据
|
||||
* Created on: 2022/10/10 10:08
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function statistics_storebarchart_get()
|
||||
{
|
||||
$activityId = intval($this->input_param('activityId'));
|
||||
$bizId = intval($this->input_param('bizId'));
|
||||
$type = $this->input_param('type');
|
||||
if (!$activityId || !$bizId || !$type) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$this->load->model('market/Market_sylive_activity_kpidata_model', 'mdSyliveActivityKpidata');
|
||||
$this->load->model('market/Market_sylive_user_model', 'mdSyliveUser');
|
||||
$dataTitle = $dataValue = [];
|
||||
$res_user = $this->mdSyliveActivityKpidata->select(['a_id' => $activityId, 'biz_id' => $bizId], 'id desc', 0, 0, 'distinct(cf_uid) as userId');
|
||||
foreach ($res_user as $k => $v) {
|
||||
$userId = intval($v['userId']);
|
||||
$re_user = $this->mdSyliveUser->get(['userId' => $userId]);
|
||||
if ($re_user) {
|
||||
$dataTitle[] = $re_user['uname'] ? $re_user['uname'] : $re_user['nickname'];
|
||||
$dataValue[] = $this->mdSyliveActivityKpidata->count(['a_id' => $activityId, 'cf_uid' => $userId, 'kpi' => $type]);
|
||||
}
|
||||
}
|
||||
$data['dataTitle'] = $dataTitle;
|
||||
$data['dataValue'] = $dataValue;
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:活动订单列表
|
||||
* Created on: 2022/9/29 9:53
|
||||
|
||||
@@ -204,9 +204,10 @@ class Statistics extends BaseController
|
||||
, ['name' => '观看数(人)', 'value' => $watch, 'url' => ''], ['name' => '订单数(单)', 'value' => $order, 'url' => '']
|
||||
, ['name' => '直播时长(分)', 'value' => $duration, 'url' => ''], ['name' => '观看数(人次)', 'value' => $livePV, 'url' => '']
|
||||
, ['name' => '人均观看(分)', 'value' => $watchDuration, 'url' => ''], ['name' => '人均观看(次)', 'value' => $pvDuration, 'url' => '']];
|
||||
// $activityData2 = [['name' => '浏览人数', 'value' => $browse, 'url' => "{$url}type=browse"], ['name' => '预约人数', 'value' => $subscribe, 'url' => "{$url}type=subscribe"]
|
||||
// , ['name' => '观看人数', 'value' => $watch, 'url' => "{$url}type=watch"], ['name' => '订单数', 'value' => $order, 'url' => "{$url}type=order"]
|
||||
// , ['name' => '直播时长', 'value' => $duration, 'url' => ''], ['name' => '观看次数', 'value' => $livePV, 'url' => ''], ['name' => '人均观看', 'value' => $watchDuration, 'url' => '']];
|
||||
// $activityData2 = [['name' => '浏览数(人)', 'value' => $browse, 'url' => "{$url}kpi=browse"], ['name' => '预约数(人)', 'value' => $subscribe, 'url' => "{$url}kpi=subscribe"]
|
||||
// , ['name' => '观看数(人)', 'value' => $watch, 'url' => "{$url}kpi=watch"], ['name' => '订单数(单)', 'value' => $order, 'url' => "{$url}kpi=order"]
|
||||
// , ['name' => '直播时长(分)', 'value' => $duration, 'url' => ''], ['name' => '观看数(人次)', 'value' => $livePV, 'url' => '']
|
||||
// , ['name' => '人均观看(分)', 'value' => $watchDuration, 'url' => ''], ['name' => '人均观看(次)', 'value' => $pvDuration, 'url' => '']];
|
||||
}
|
||||
$watch_per = number_format_com($watch / $browse * 100, 1, '');
|
||||
$order_per = number_format_com($order / $watch_per * 100, 1, '');
|
||||
@@ -502,12 +503,17 @@ class Statistics extends BaseController
|
||||
$allConsultant = $this->mdSyliveUser->count(["teamId in({$str_allTeamIds})" => null, 'status>=' => 0, 'teamId>' => 0]);
|
||||
}
|
||||
$consultant > $allConsultant && $allConsultant = $consultant;
|
||||
$url = "/sylive/activity/statistics/piechart?activityId={$activityId}&type=1&";
|
||||
$activityData1 = [['name' => '参与团队数', 'value' => count($teamData)]
|
||||
, ['name' => '参与/全部团员数', 'value' => $consultant . '/' . $allConsultant]];
|
||||
$activityData2 = [['name' => '浏览数(人)', 'value' => $browse, 'url' => ''], ['name' => '预约数(人)', 'value' => $subscribe, 'url' => '']
|
||||
, ['name' => '观看数(人)', 'value' => $watch, 'url' => ''], ['name' => '订单数(单)', 'value' => $order, 'url' => '']
|
||||
, ['name' => '直播时长(分)', 'value' => $duration, 'url' => ''], ['name' => '观看数(人次)', 'value' => $livePV, 'url' => '']
|
||||
, ['name' => '人均观看(分)', 'value' => $watchDuration, 'url' => ''], ['name' => '人均观看(次)', 'value' => $pvDuration, 'url' => '']];
|
||||
// $activityData2 = [['name' => '浏览数(人)', 'value' => $browse, 'url' => "{$url}kpi=browse"], ['name' => '预约数(人)', 'value' => $subscribe, 'url' => "{$url}kpi=subscribe"]
|
||||
// , ['name' => '观看数(人)', 'value' => $watch, 'url' => "{$url}kpi=watch"], ['name' => '订单数(单)', 'value' => $order, 'url' => "{$url}kpi=order"]
|
||||
// , ['name' => '直播时长(分)', 'value' => $duration, 'url' => ''], ['name' => '观看数(人次)', 'value' => $livePV, 'url' => '']
|
||||
// , ['name' => '人均观看(分)', 'value' => $watchDuration, 'url' => ''], ['name' => '人均观看(次)', 'value' => $pvDuration, 'url' => '']];
|
||||
}
|
||||
$watch_per = number_format_com($watch / $browse * 100, 1, '');
|
||||
$order_per = number_format_com($order / $watch_per * 100, 1, '');
|
||||
@@ -530,4 +536,112 @@ class Statistics extends BaseController
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取区域饼状数据
|
||||
* Created on: 2022/10/9 17:21
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function piechart_get()
|
||||
{
|
||||
$activityId = intval($this->input_param('activityId'));
|
||||
$type = intval($this->input_param('type'));
|
||||
$kpi = $this->input_param('kpi');
|
||||
if (!$activityId || !$kpi) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$data = [];
|
||||
if ($type == 1) {
|
||||
$res = $this->mdSyliveActivityTeam->select(['activityId' => $activityId, 'status>=' => 0], 'browse desc', 0, 0, 'distinct(teamId1) as areaId');
|
||||
foreach ($res as $k => $v) {
|
||||
$areaId = intval($v['areaId']);
|
||||
$re = $this->mdSyliveTeam->get(['teamId' => $areaId]);
|
||||
$name = $re['teamName'] ? $re['teamName'] : '-';
|
||||
$re_kpi = $this->mdSyliveActivityTeam->sum($kpi, ['teamId1' => $areaId, 'status>=' => 0, 'activityId' => $activityId]);
|
||||
$data[] = ['name' => $name, 'value' => $re_kpi[$kpi] ? $re_kpi[$kpi] : 0
|
||||
, 'url' => "/sylive/activity/statistics/barchart?activityId={$activityId}&areaId={$areaId}&kpi={$kpi}&type={$type}"];
|
||||
}
|
||||
} else {
|
||||
$res = $this->mdSyliveActivityBiz->select(['activityId' => $activityId, 'status>=' => 0], 'browse desc', 0, 0, 'distinct(areaId) as areaId');
|
||||
foreach ($res as $k => $v) {
|
||||
$areaId = intval($v['areaId']);
|
||||
$re = $this->mdSyliveOrganization->get(['organizationId' => $areaId]);
|
||||
$name = $re['organizationName'] ? $re['organizationName'] : '-';
|
||||
$re_kpi = $this->mdSyliveActivityBiz->sum($kpi, ['areaId' => $areaId, 'status>=' => 0, 'activityId' => $activityId]);
|
||||
$data[] = ['name' => $name, 'value' => $re_kpi[$kpi] ? $re_kpi[$kpi] : 0
|
||||
, 'url' => "/sylive/activity/statistics/barchart?activityId={$activityId}&areaId={$areaId}&kpi={$kpi}&type={$type}"];
|
||||
}
|
||||
}
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取门店柱状数据
|
||||
* Created on: 2022/10/9 17:30
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function barchart_get()
|
||||
{
|
||||
$activityId = intval($this->input_param('activityId'));
|
||||
$areaId = intval($this->input_param('areaId'));
|
||||
$type = intval($this->input_param('type'));
|
||||
$kpi = $this->input_param('kpi');
|
||||
if (!$activityId || !$areaId || !$kpi) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$dataTitle = $dataValue = $dataUrl = [];
|
||||
if ($type == 1) {
|
||||
$res = $this->mdSyliveActivityTeam->select(['activityId' => $activityId, 'teamId1' => $areaId, 'status>=' => 0]);
|
||||
foreach ($res as $k => $v) {
|
||||
$bizId = intval($v['teamId2']);
|
||||
$re = $this->mdSyliveTeam->get(['teamId' => $bizId]);
|
||||
$dataTitle[] = $re['teamName'] ? $re['teamName'] : '-';
|
||||
$dataValue[] = $v[$kpi] ? $v[$kpi] : 0;
|
||||
$dataUrl[] = "/sylive/activity/statistics/storebarchart?activityId={$activityId}&bizId={$bizId}&kpi={$kpi}&type={$type}";
|
||||
}
|
||||
} else {
|
||||
$res = $this->mdSyliveActivityBiz->select(['activityId' => $activityId, 'areaId' => $areaId, 'status>=' => 0]);
|
||||
foreach ($res as $k => $v) {
|
||||
$bizId = intval($v['bizId']);
|
||||
$re = $this->mdSyliveOrganization->get(['organizationId' => $bizId]);
|
||||
$dataTitle[] = $re['organizationName'] ? $re['organizationName'] : '-';
|
||||
$dataValue[] = $v[$kpi] ? $v[$kpi] : 0;
|
||||
$dataUrl[] = "/sylive/activity/statistics/storebarchart?activityId={$activityId}&bizId={$bizId}&kpi={$kpi}&type={$type}";
|
||||
}
|
||||
}
|
||||
$data['dataTitle'] = $dataTitle;
|
||||
$data['dataValue'] = $dataValue;
|
||||
$data['dataUrl'] = $dataUrl;
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取顾问柱状数据
|
||||
* Created on: 2022/10/10 10:08
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function storebarchart_get()
|
||||
{
|
||||
$activityId = intval($this->input_param('activityId'));
|
||||
$bizId = intval($this->input_param('bizId'));
|
||||
$type = intval($this->input_param('type'));
|
||||
$kpi = $this->input_param('kpi');
|
||||
if (!$activityId || !$bizId || !$kpi) {
|
||||
$this->return_json('参数错误');
|
||||
}
|
||||
$dataTitle = $dataValue = [];
|
||||
$res_user = $this->mdSyliveActivityKpidata->select(['a_id' => $activityId, 'biz_id' => $bizId, 'type' => $type]
|
||||
, 'id desc', 0, 0, 'distinct(cf_uid) as userId');
|
||||
foreach ($res_user as $k => $v) {
|
||||
$userId = intval($v['userId']);
|
||||
$re_user = $this->mdSyliveUser->get(['userId' => $userId]);
|
||||
if ($re_user) {
|
||||
$dataTitle[] = $re_user['uname'] ? $re_user['uname'] : $re_user['nickname'];
|
||||
$dataValue[] = $this->mdSyliveActivityKpidata->count(['a_id' => $activityId, 'cf_uid' => $userId, 'type' => $type, 'kpi' => $kpi]);
|
||||
}
|
||||
}
|
||||
$data['dataTitle'] = $dataTitle;
|
||||
$data['dataValue'] = $dataValue;
|
||||
$this->return_response($data);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user