diff --git a/market/controllers/api/sylive/Activity.php b/market/controllers/api/sylive/Activity.php index 61ff2b18..aab2249e 100644 --- a/market/controllers/api/sylive/Activity.php +++ b/market/controllers/api/sylive/Activity.php @@ -486,9 +486,10 @@ class Activity extends BaseController } $activityData1 = [['name' => '参与区域数', 'value' => count($areaData)], ['name' => '参与门店数', 'value' => count($bizData)] , ['name' => '参与顾问数', 'value' => count($res_user)]]; - $activityData2 = [['name' => '浏览人数', 'value' => $browse, 'url' => '/system/user'], ['name' => '预约人数', 'value' => $subscribe, 'url' => '/system/user'] - , ['name' => '观看人数', 'value' => $watch, 'url' => '/system/user'], ['name' => '订单数', 'value' => $order, 'url' => '/system/user'], ['name' => '直播时长', 'value' => $duration, 'url' => '/system/user'] - , ['name' => '观看次数', 'value' => $livePV, 'url' => '/system/user'], ['name' => '人均观看', 'value' => $watchDuration, 'url' => '/system/user']]; + $url = '/sylive/activity/statistics/piechart?'; + $activityData2 = [['name' => '浏览人数', 'value' => $browse, 'url' => "{$url}activityId=$activityId&type=browse"], ['name' => '预约人数', 'value' => $subscribe, 'url' => "{$url}activityId=$activityId&type=subscribe"] + , ['name' => '观看人数', 'value' => $watch, 'url' => "{$url}activityId=$activityId&type=watch"], ['name' => '订单数', 'value' => $order, 'url' => "{$url}activityId=$activityId&type=order"] + , ['name' => '直播时长', 'value' => $duration, 'url' => ''], ['name' => '观看次数', 'value' => $livePV, 'url' => ''], ['name' => '人均观看', 'value' => $watchDuration, 'url' => '']]; } $watch_per = number_format_com($watch / $browse * 100, 1, ''); $order_per = number_format_com($order / $browse * 100, 1, ''); @@ -508,6 +509,59 @@ class Activity extends BaseController $this->return_response($data); } + /** + * 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 = []; + $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; + } + $data['dataTitle'] = $dataTitle; + $data['dataValue'] = $dataValue; + $this->return_response($data); + } + /** * Notes:活动订单列表 * Created on: 2022/9/29 9:53 @@ -584,4 +638,4 @@ class Activity extends BaseController return $title; } -} \ No newline at end of file +}