diff --git a/common/libraries/market/Sylive_entity.php b/common/libraries/market/Sylive_entity.php index 52613b82..27e1a3aa 100644 --- a/common/libraries/market/Sylive_entity.php +++ b/common/libraries/market/Sylive_entity.php @@ -156,6 +156,60 @@ class Sylive_entity{ return $data; } + //门店用户排行数据 + public function top_biz_user($aid,$biz_id,$uid,$type='browse',$page=1,$size=50){ + $lists = []; + $total = 0; + $where = [ + 'parentId' => $biz_id + ]; + $orgs = $this->ci->market_sylive_organization_model->select($where,'',0,0,'organizationId'); + $org_ids = 0; + if($orgs){ + $org_arr_ids = array_column($orgs,'organizationId'); + $org_arr_ids[] = $biz_id; + $org_ids = implode($org_arr_ids,','); + } + $where = [ + "organizationId in ({$org_ids})" => null + ]; + $total = $this->ci->user_model->count($where); + $lists = []; + if($total){ + $rows = $this->ci->user_model->select($where,'userId desc',$page,$size,'userId,uname,nickname,headimg'); + $where = [ + 'a_id' => $aid, + 'kpi' => $type, + 'biz_id' => $biz_id + ]; + $t_rows = $this->ci->mdSytActivityKpiData->select_groupby('cf_uid',$where,'total desc',$page,$size,'cf_uid,count(id) as total'); + $map = []; + if($t_rows){ + foreach($t_rows as $item) { + $map[$item['cf_uid']] = null !== $item['total'] ? $item['total'] : $item; + } + } + foreach ($rows as $item) { + $total = $map[$item['userId']] ? $map[$item['userId']] : '0'; + $lists[] = [ + 'uid' => $item['userId'], + 'name' => $item['uname'] ? $item['uname'] : $item['nickname'], + 'total' => $total, + 'num' => "{$total}人", + 'tip' => $uid == $item['userId'] ? '本人' : '', + ]; + } + $edit = array_column($lists,'total'); + array_multisort($edit,SORT_DESC,$lists); + } + $data = [ + 'total' => $total, + 'lists' => $lists + ]; + return $data; + } + + public function __get($name) { if ('_model' === substr($name, -6)) { diff --git a/home/controllers/h5/market/sylive/Stic.php b/home/controllers/h5/market/sylive/Stic.php index c86a3e4a..d6b3a6f0 100644 --- a/home/controllers/h5/market/sylive/Stic.php +++ b/home/controllers/h5/market/sylive/Stic.php @@ -262,7 +262,14 @@ class Stic extends Admin{ $page = $params['page'] ? intval($params['page']) : 1; $info = $this->myencryption->base64url_decode($params['skey']); $a_id = intval($info['a_id']);//活动id - $biz_id = $this->group_id==3 ? $this->session['org_id'] : 0; + if($this->group_id==3){ + $org_row = $this->market_sylive_organization_model->get(['organizationId'=>$this->session['org_id']],'parentId'); + $biz_id = $org_row['parentId'] ? $org_row['parentId'] : 0; + }elseif($this->group_id==2){ + $biz_id = $this->session['org_id']; + }else{ + $biz_id = 0; + } $type = $params['type'] ? $params['type'] : 'browse'; $data = $this->sylive_entity->top_lists($a_id,$type,$page,10,$biz_id); $data['title'] = $title_arr[$type]; @@ -328,6 +335,37 @@ class Stic extends Admin{ 'lists' => $lists, 'total' => $total ]; + if($this->group_id==3){ + $org_row = $this->market_sylive_organization_model->get(['organizationId'=>$this->session['org_id']],'parentId'); + $biz_id = $org_row['parentId'] ? $org_row['parentId'] : 0; + }elseif($this->group_id==2){ + $biz_id = $this->session['org_id']; + }else{ + $biz_id = 0; + } + if($type==1){ + $b_rows = $this->sylive_entity->top_biz_user($a_id,$biz_id,$this->uid,'browse'); + $data['browse'] = [ + 'title' => '本店浏览排行', + 'list' => $b_rows['lists'] + ]; + $sub_rows = $this->sylive_entity->top_biz_user($a_id,$biz_id,$this->uid,'subscribe'); + $data['book'] = [ + 'title' => '本店预约排行', + 'list' => $sub_rows['lists'] + ]; + }else{ + $view_rows = $this->sylive_entity->top_biz_user($a_id,$biz_id,$this->uid,'watch'); + $data['view'] = [ + 'title' => '本店观看排行', + 'list' => $view_rows['lists'] + ]; + $order_rows = $this->sylive_entity->top_biz_user($a_id,$biz_id,$this->uid,'order'); + $data['order'] = [ + 'title' => '本店订单排行', + 'list' => $order_rows['lists'] + ]; + } $this->show_json($data,200); } diff --git a/home/views/h5/market/sylive/act/ucenter.php b/home/views/h5/market/sylive/act/ucenter.php index 294d89de..3c1bb5d8 100644 --- a/home/views/h5/market/sylive/act/ucenter.php +++ b/home/views/h5/market/sylive/act/ucenter.php @@ -16,7 +16,7 @@
{{info.title}} - 专属客服 + 专属顾问
{{info.slogan}}
diff --git a/home/views/h5/market/sylive/stic/index.php b/home/views/h5/market/sylive/stic/index.php index 5a65dc99..04ace813 100644 --- a/home/views/h5/market/sylive/stic/index.php +++ b/home/views/h5/market/sylive/stic/index.php @@ -28,6 +28,42 @@ + +
+
+ +
+
+
+
+ # + {{index+1}} + {{item.name}} + {{item.tip}} +
+
{{item.num}}
+
+
+
+ +
+
+ +
+
+
+
+ # + {{index+1}} + {{item.name}} + {{item.tip}} +
+
{{item.num}}
+
+
+
暂时无数据
+
+ @@ -42,6 +78,41 @@ +
+
+ +
+
+
+
+ # + {{index+1}} + {{item.name}} + {{item.tip}} +
+
{{item.num}}
+
+
+
暂时无数据
+
+ +
+
+ +
+
+
+
+ # + {{index+1}} + {{item.name}} + {{item.tip}} +
+
{{item.num}}
+
+
+
暂时无数据
+
@@ -88,9 +159,25 @@ loading: false, begin:{ cell1:, + browse:{ + title:'', + list:[], + }, + book:{ + title:'', + list:[], + } }, live:{ cell1:, + view:{ + title:'', + list:[], + }, + order:{ + title:'', + list:[], + } }, isDataEnd: false, isNoData: false, @@ -180,9 +267,6 @@ if (!that.loading) { that.getDynamicList() that.loading = false; - that.begin = { - cell1:, - } } }, @@ -192,9 +276,6 @@ if (!that.loading) { that.getDynamicList() that.loading = false; - that.live = { - cell1:, - } } }, @@ -214,12 +295,18 @@ that.page = that.page + 1; that.dynamic.title = '实时动态'; that.dynamic.list = that.dynamic.list.concat(res.data.lists); + if(that.tabid==1){ //预热 + that.begin.browse = res.data.browse + that.begin.book = res.data.book + }else{ // 直播 + that.live.view = res.data.view + that.live.order = res.data.order + } if (res.data.total == 0) { that.isNoData = true; } else if (that.dynamic.list.length == res.data.total) { that.isDataEnd = true; } - console.dir(that.begin) },'json'); } },