From 9c65a70991d9da23a547363f0efc55a60db171dd Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Thu, 27 Oct 2022 11:38:44 +0800 Subject: [PATCH] edit-sylive-stic_biz --- home/controllers/h5/market/sylive/Stic.php | 126 +++++++++++---------- home/views/h5/market/sylive/stic/area.php | 4 +- 2 files changed, 70 insertions(+), 60 deletions(-) diff --git a/home/controllers/h5/market/sylive/Stic.php b/home/controllers/h5/market/sylive/Stic.php index e7dfd64e..c69e8d75 100644 --- a/home/controllers/h5/market/sylive/Stic.php +++ b/home/controllers/h5/market/sylive/Stic.php @@ -66,25 +66,44 @@ class Stic extends Admin{ if(!$row && $this->group_id>=3){ $this->show_json([],200); } - $biz = $join = []; + $area_name = ''; + $area = $biz = $join = []; if($this->group_id<2){ //所有大区 $biz_id = $this->input->get('biz_id'); - $sql = "select count(distinct areaId) as total from lc_market_sylive_activity_biz where `activityId`={$a_id}"; - $area_count = $this->mdSytActivityBiz->db->query($sql)->row_array(); - $sql = "select count(distinct bizId) as total from lc_market_sylive_activity_biz where `activityId`={$a_id}"; - $biz_count = $this->mdSytActivityBiz->db->query($sql)->row_array(); - $where = [ - 'status' => 0, - "organizationId in (select organizationId from lc_market_sylive_organization where + if(!$this->group_id) { + $sql = "select count(distinct areaId) as total from lc_market_sylive_activity_biz where `activityId`={$a_id}"; + $area_count = $this->mdSytActivityBiz->db->query($sql)->row_array(); + $sql = "select count(distinct bizId) as total from lc_market_sylive_activity_biz where `activityId`={$a_id}"; + $biz_count = $this->mdSytActivityBiz->db->query($sql)->row_array(); + $where = [ + 'status' => 0, + "organizationId in (select organizationId from lc_market_sylive_organization where parentId in (select bizId from lc_market_sylive_activity_biz where activityId={$a_id} and status=0) )" => null + ]; + $gw_count = $this->user_model->count($where); //顾问 + $join = [ + ['title' => '参与大区', 'num' => "{$area_count['total']}个"], + ['title' => '参与门店', 'num' => "{$biz_count['total']}家"], + ['title' => '参与人数', 'num' => "{$gw_count}人"], + ]; + } + $where = [ + 'type' => 0, + 'a_id' => $a_id, + 'kpi' => 'browse', ]; - $gw_count = $this->user_model->count($where); //顾问 - $join = [ - ['title' => '参与大区', 'num' => "{$area_count['total']}个"], - ['title' => '参与门店', 'num' => "{$biz_count['total']}家"], - ['title' => '参与人数', 'num' => "{$gw_count}人"], + $area_id = $this->sylive_entity->get_area_id($this->session['org_id'],$this->group_id); + $area_id && $where['area_id'] = $area_id; + $a_browse_count = $this->mdSytActivityKpiData->count($where); //浏览数据 + $where['kpi'] = 'subscribe'; + $a_subscribe_count = $this->mdSytActivityKpiData->count($where); //订阅数据 + $area = [ + ['title' => '访问用户', 'num' => "{$a_browse_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=browse&a_id={$a_id}"], + ['title' => '预约用户', 'num' => "{$a_subscribe_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=subscribe&a_id={$a_id}"], + ['title' => '预约率', 'num' => $a_browse_count ? round($a_subscribe_count/$a_browse_count*100,2)."%" : 0], ]; + $area_name = $area_id ? '本域' : '全域'; }else{ //门店 $biz_id = $this->session['org_id']; } @@ -118,21 +137,6 @@ class Stic extends Admin{ ['title' => '预约率', 'num' => $b_browse_count ? round($b_subscribe_count/$b_browse_count*100,2)."%" : 0], ]; } - $where = [ - 'type' => 0, - 'a_id' => $a_id, - 'kpi' => 'browse', - ]; - $area_id = $this->sylive_entity->get_area_id($this->session['org_id'],$this->group_id); - $area_id && $where['area_id'] = $area_id; - $a_browse_count = $this->mdSytActivityKpiData->count($where); //浏览数据 - $where['kpi'] = 'subscribe'; - $a_subscribe_count = $this->mdSytActivityKpiData->count($where); //订阅数据 - $area = [ - ['title' => '访问用户', 'num' => "{$a_browse_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=browse&a_id={$a_id}"], - ['title' => '预约用户', 'num' => "{$a_subscribe_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=subscribe&a_id={$a_id}"], - ['title' => '预约率', 'num' => $a_browse_count ? round($a_subscribe_count/$a_browse_count*100,2)."%" : 0], - ]; $biz_id = $this->sylive_entity->get_biz_id($this->session['org_id'],$this->group_id); $browse_lists = $this->sylive_entity->top_lists($a_id,'browse',1,10,$biz_id); $browse = [ @@ -152,7 +156,8 @@ class Stic extends Admin{ 'area' => $area, 'join' => $join, 'browse' => $browse, - 'book' => $book + 'book' => $book, + 'area_name' => $area_name, ]; $this->show_json($data,200); } @@ -166,25 +171,44 @@ class Stic extends Admin{ if(!$row && $this->group_id>=3){ $this->show_json([],200); } - $biz = $join = $view_num = $view_time = []; + $area_name = ''; + $area = $biz = $join = $view_num = $view_time = []; if($this->group_id<2){ //所有大区 $biz_id = $this->input->get('biz_id'); - $sql = "select count(distinct areaId) as total from lc_market_sylive_activity_biz where `activityId`={$a_id}"; - $area_count = $this->mdSytActivityBiz->db->query($sql)->row_array(); - $sql = "select count(distinct bizId) as total from lc_market_sylive_activity_biz where `activityId`={$a_id}"; - $biz_count = $this->mdSytActivityBiz->db->query($sql)->row_array(); + if(!$this->group_id){ + $sql = "select count(distinct areaId) as total from lc_market_sylive_activity_biz where `activityId`={$a_id}"; + $area_count = $this->mdSytActivityBiz->db->query($sql)->row_array(); + $sql = "select count(distinct bizId) as total from lc_market_sylive_activity_biz where `activityId`={$a_id}"; + $biz_count = $this->mdSytActivityBiz->db->query($sql)->row_array(); + $where = [ + 'status' => 0, + "organizationId in (select organizationId from lc_market_sylive_organization where + parentId in (select bizId from lc_market_sylive_activity_biz where activityId={$a_id} and status=0) + )" => null + ]; + $gw_count = $this->user_model->count($where); //顾问 + $join = [ + ['title' => '参与大区', 'num' => "{$area_count['total']}个"], + ['title' => '参与门店', 'num' => "{$biz_count['total']}家"], + ['title' => '参与人数', 'num' => "{$gw_count}人"], + ]; + } $where = [ - 'status' => 0, - "organizationId in (select organizationId from lc_market_sylive_organization where - parentId in (select bizId from lc_market_sylive_activity_biz where activityId={$a_id} and status=0) - )" => null + 'type' => 0, + 'a_id' => $a_id, + 'kpi' => 'watch', ]; - $gw_count = $this->user_model->count($where); //顾问 - $join = [ - ['title' => '参与大区', 'num' => "{$area_count['total']}个"], - ['title' => '参与门店', 'num' => "{$biz_count['total']}家"], - ['title' => '参与人数', 'num' => "{$gw_count}人"], + $area_id = $this->sylive_entity->get_area_id($this->session['org_id'],$this->group_id); + $area_id && $where['area_id'] = $area_id; + $a_view_count = $this->mdSytActivityKpiData->count($where); //观看数据 + $where['kpi'] = 'order'; + $a_order_count = $this->mdSytActivityKpiData->count($where); //下单数据 + $area = [ + ['title' => '观看用户', 'num' => "{$a_view_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=watch&a_id={$a_id}"], + ['title' => '下单用户', 'num' => "{$a_order_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=order&a_id={$a_id}"], + ['title' => '转化率', 'num' => $a_view_count ? round($a_order_count/$a_view_count*100,2)."%" : 0], ]; + $area_name = $area_id ? '本域' : '全域'; }else{ //门店 $biz_id = $this->session['org_id']; // $view_num_lists = $this->sylive_entity->top_view_num($row['channelId'],1,10); @@ -230,21 +254,6 @@ class Stic extends Admin{ ['title' => '转化率', 'num' => $b_view_count ? round($b_order_count/$b_view_count*100,2)."%" : 0], ]; } - $where = [ - 'type' => 0, - 'a_id' => $a_id, - 'kpi' => 'watch', - ]; - $area_id = $this->sylive_entity->get_area_id($this->session['org_id'],$this->group_id); - $area_id && $where['area_id'] = $area_id; - $a_view_count = $this->mdSytActivityKpiData->count($where); //观看数据 - $where['kpi'] = 'order'; - $a_order_count = $this->mdSytActivityKpiData->count($where); //下单数据 - $area = [ - ['title' => '观看用户', 'num' => "{$a_view_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=watch&a_id={$a_id}"], - ['title' => '下单用户', 'num' => "{$a_order_count}人",'url'=>"/h5/market/sylive/stic/users?type=area&type_id={$area_id}&kpi=order&a_id={$a_id}"], - ['title' => '转化率', 'num' => $a_view_count ? round($a_order_count/$a_view_count*100,2)."%" : 0], - ]; $total_play = $this->mdPolyvSession->sum('totalPlayDuration',['channelId'=>$row['channelId']]); $duration = $this->mdPolyvSession->sum('duration',['channelId'=>$row['channelId']]); $pv = $this->mdPolyvSession->sum('livePV',['channelId'=>$row['channelId']]); @@ -281,6 +290,7 @@ class Stic extends Admin{ 'order' => $order, 'view_num' => $view_num, 'view_time' => $view_time, + 'area_name' => $area_name, ]; $this->show_json($data,200); } diff --git a/home/views/h5/market/sylive/stic/area.php b/home/views/h5/market/sylive/stic/area.php index 593d312c..93e06500 100644 --- a/home/views/h5/market/sylive/stic/area.php +++ b/home/views/h5/market/sylive/stic/area.php @@ -40,7 +40,7 @@
-
全域
+
{{begin.area_name}}
{{item.num}}
@@ -127,7 +127,7 @@
-
全域
+
{{live.area_name}}