diff --git a/home/controllers/h5/market/sylive/Biz.php b/home/controllers/h5/market/sylive/Biz.php index 5bf5ee40..e781641b 100644 --- a/home/controllers/h5/market/sylive/Biz.php +++ b/home/controllers/h5/market/sylive/Biz.php @@ -280,8 +280,8 @@ class Biz extends Admin { $way = $pay['way'] ? intval($pay['way']) : 1; //1厂商支付 2 经销商支付 $skey = $this->myencryption->base64url_encode("a_id=" . $val['activityId']); $pay_status = 1; - $url = '/h5/market/sylive/act?skey='.$skey; - $stat_url = "/h5/market/sylive/stic?skey={$skey}&biz_id={$biz_id}"; + $url = "/h5/market/sylive/act?skey={$skey}&biz_id={$biz_id}&area_id={$area_id}"; + $stat_url = "/h5/market/sylive/stic?skey={$skey}&biz_id={$biz_id}&area_id={$area_id}"; if($way==2 && in_array($this->group_id,[2,3])){ $where = [ 'activityId' => $val['activityId'], diff --git a/home/controllers/h5/market/sylive/Stic.php b/home/controllers/h5/market/sylive/Stic.php index c69e8d75..7f1b6e5f 100644 --- a/home/controllers/h5/market/sylive/Stic.php +++ b/home/controllers/h5/market/sylive/Stic.php @@ -51,8 +51,19 @@ class Stic extends Admin{ $this->data['info'] = $info; $this->show_view('h5/market/sylive/stic/index'); }else{ //门店和大区 - $biz_id = $this->input->get('biz_id'); - $info['biz_id'] = $biz_id ? $biz_id : 0; + $params = $this->input->get(); + $info['biz_id'] = $params['biz_id'] ? $params['biz_id'] : 0; + $info['area_id'] = $params['area_id'] ? $params['area_id'] : 0; + $h_title = ''; + if($info['area_id']){ + $a_row = $this->market_sylive_organization_model->get(['organizationId'=>$info['area_id']],'organizationName'); + $h_title .= $a_row['organizationName']." "; + } + if($info['biz_id']){ + $b_row = $this->market_sylive_organization_model->get(['organizationId'=>$info['biz_id']],'organizationName'); + $h_title .= $b_row['organizationName']; + } + $this->data['h_title'] = $h_title; $this->data['info'] = $info; $this->show_view('h5/market/sylive/stic/area'); } @@ -67,9 +78,10 @@ class Stic extends Admin{ $this->show_json([],200); } $area_name = ''; - $area = $biz = $join = []; + $all = $area = $biz = $join = []; if($this->group_id<2){ //所有大区 $biz_id = $this->input->get('biz_id'); + $area_id = $this->input->get('area_id'); 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(); @@ -87,23 +99,38 @@ class Stic extends Admin{ ['title' => '参与门店', 'num' => "{$biz_count['total']}家"], ['title' => '参与人数', 'num' => "{$gw_count}人"], ]; + $where = [ + 'type' => 0, + 'a_id' => $a_id, + 'kpi' => 'browse', + ]; + $all_browse_count = $this->mdSytActivityKpiData->count($where); //浏览数据 + $where['kpi'] = 'subscribe'; + $all_subscribe_count = $this->mdSytActivityKpiData->count($where); //订阅数据 + $all = [ + ['title' => '访问用户', 'num' => "{$all_browse_count}人",'url'=>"/h5/market/sylive/stic/users?type=all&kpi=browse&a_id={$a_id}"], + ['title' => '预约用户', 'num' => "{$all_subscribe_count}人",'url'=>"/h5/market/sylive/stic/users?type=all&kpi=subscribe&a_id={$a_id}"], + ['title' => '预约率', 'num' => $all_browse_count ? round($all_subscribe_count/$all_browse_count*100,2)."%" : 0], + ]; + }else{ + $area_id = $this->session['org_id']; + } + if($area_id){ + $where = [ + 'type' => 0, + 'a_id' => $a_id, + 'kpi' => 'browse', + ]; + $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], + ]; } - $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], - ]; - $area_name = $area_id ? '本域' : '全域'; }else{ //门店 $biz_id = $this->session['org_id']; } @@ -154,6 +181,7 @@ class Stic extends Admin{ 'mine' => $mine, 'biz' => $biz, 'area' => $area, + 'all' => $all, 'join' => $join, 'browse' => $browse, 'book' => $book, @@ -172,9 +200,10 @@ class Stic extends Admin{ $this->show_json([],200); } $area_name = ''; - $area = $biz = $join = $view_num = $view_time = []; + $all = $area = $biz = $join = $view_num = $view_time = []; if($this->group_id<2){ //所有大区 $biz_id = $this->input->get('biz_id'); + $area_id = $this->input->get('area_id'); 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(); @@ -192,23 +221,38 @@ class Stic extends Admin{ ['title' => '参与门店', 'num' => "{$biz_count['total']}家"], ['title' => '参与人数', 'num' => "{$gw_count}人"], ]; + $where = [ + 'type' => 0, + 'a_id' => $a_id, + 'kpi' => 'watch', + ]; + $all_view_count = $this->mdSytActivityKpiData->count($where); //观看数据 + $where['kpi'] = 'order'; + $all_order_count = $this->mdSytActivityKpiData->count($where); //下单数据 + $all = [ + ['title' => '观看用户', 'num' => "{$all_view_count}人",'url'=>'/h5/market/sylive/stic/users?type=all&kpi=watch&a_id='.$a_id], + ['title' => '下单用户', 'num' => "{$all_order_count}人",'url'=>'/h5/market/sylive/stic/users?type=all&kpi=order&a_id='.$a_id], + ['title' => '转化率', 'num' => $all_view_count ? round($all_order_count/$all_view_count*100,2)."%" : 0], + ]; + }else{ + $area_id = $this->session['org_id']; + } + if($area_id){ + $where = [ + 'type' => 0, + 'a_id' => $a_id, + 'kpi' => 'watch', + ]; + $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], + ]; } - $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], - ]; - $area_name = $area_id ? '本域' : '全域'; }else{ //门店 $biz_id = $this->session['org_id']; // $view_num_lists = $this->sylive_entity->top_view_num($row['channelId'],1,10); @@ -284,6 +328,7 @@ class Stic extends Admin{ 'mine' => $mine, 'biz' => $biz, 'area' => $area, + 'all' => $all, 'l_time' => $l_time, 'join' => $join, 'view' => $view, @@ -450,8 +495,10 @@ class Stic extends Admin{ 'a_id' => $params['a_id'], 'kpi' => $params['kpi'], ]; - if($params['type']=='area'){ - $params['type_id'] && $where['area_id'] = $params['type_id']; + if($params['type']=='all'){ + + }elseif($params['type']=='area'){ + $where['area_id'] = $params['type_id']; }elseif($params['type']=='biz'){ $where['biz_id'] = $params['type_id']; }else{ diff --git a/home/views/h5/market/sylive/biz/index.php b/home/views/h5/market/sylive/biz/index.php index 2c9ea8c0..07d40650 100644 --- a/home/views/h5/market/sylive/biz/index.php +++ b/home/views/h5/market/sylive/biz/index.php @@ -97,7 +97,7 @@ that.loading = true; //请求接口 //请求接口 - $.get('/h5/market/sylive/biz/act_list',{'biz_id':=$biz_id ? $biz_id : 0?>,'page':that.page},function (result) { + $.get('/h5/market/sylive/biz/act_list',{'biz_id':=$biz_id ? $biz_id : 0?>,'area_id':=$area_id ? $area_id : 0?>,'page':that.page},function (result) { that.loading = false; that.page = that.page + 1; that.list = that.list.concat(result.data.list); diff --git a/home/views/h5/market/sylive/stic/area.php b/home/views/h5/market/sylive/stic/area.php index 93e06500..59c691c4 100644 --- a/home/views/h5/market/sylive/stic/area.php +++ b/home/views/h5/market/sylive/stic/area.php @@ -3,6 +3,11 @@