add-sylive-top_view
This commit is contained in:
@@ -17,6 +17,7 @@ class Sylive_entity{
|
||||
$this->ci->load->model('market/market_sylive_activity_biz_model','mdSytActivityBiz');
|
||||
$this->ci->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->ci->load->model('market/market_sylive_organization_model');
|
||||
$this->ci->load->model('live/Live_polyv_viewlog_model', 'mdPolyvViewlog');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,8 +160,6 @@ class Sylive_entity{
|
||||
|
||||
//门店用户排行数据
|
||||
public function top_biz_user($aid,$biz_id,$uid,$type='browse',$page=1,$size=50){
|
||||
$lists = [];
|
||||
$total = 0;
|
||||
$where = [
|
||||
'parentId' => $biz_id
|
||||
];
|
||||
@@ -210,7 +209,77 @@ class Sylive_entity{
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
//用户用户观看次数排行
|
||||
public function top_view_num($channelId,$page=1,$size=10){
|
||||
$where = [
|
||||
'channelId' => $channelId
|
||||
];
|
||||
$total = $this->ci->mdPolyvViewlog->count($where);
|
||||
$lists = [];
|
||||
if($total){
|
||||
$rows = $this->ci->mdPolyvViewlog->select_groupby('param1',$where,'total desc',$page,$size,'param1,count(id) as total');
|
||||
$uids = implode(',',array_unique(array_column($rows,'param1')));
|
||||
$users = [];
|
||||
if($uids){
|
||||
$where = [
|
||||
"unionid in ('$uids')" => null,
|
||||
];
|
||||
$users = $this->ci->user_model->map('unionid','',$where,'','','','userId,uname,nickname,headimg');
|
||||
}
|
||||
foreach ($rows as $item) {
|
||||
$user = $users[$item['uid']] ? $users[$item['uid']][0] : [];
|
||||
$total = $item['total'];
|
||||
$lists[] = [
|
||||
'uid' => $user['userId'],
|
||||
'name' => $user['nickname'] ? $user['nickname'] : '',
|
||||
'headimg' => $user['headimg'] ? $user['headimg'] : self::DEFAULT_HEAD,
|
||||
'total' => $total,
|
||||
'num' => "{$total}次",
|
||||
];
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'total' => $total,
|
||||
'lists' => $lists
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
//用户用户观看时长排行
|
||||
public function top_view_time($channelId,$page=1,$size=10){
|
||||
$where = [
|
||||
'channelId' => $channelId
|
||||
];
|
||||
$total = $this->ci->mdPolyvViewlog->count($where);
|
||||
$lists = [];
|
||||
if($total){
|
||||
$rows = $this->ci->mdPolyvViewlog->select_groupby('param1',$where,'total desc',$page,$size,'param1,,sum(playDuration) as total');
|
||||
$uids = implode(',',array_unique(array_column($rows,'param1')));
|
||||
$users = [];
|
||||
if($uids){
|
||||
$where = [
|
||||
"unionid in ('$uids')" => null,
|
||||
];
|
||||
$users = $this->ci->user_model->map('unionid','',$where,'','','','userId,uname,nickname,headimg');
|
||||
}
|
||||
foreach ($rows as $item) {
|
||||
$user = $users[$item['uid']] ? $users[$item['uid']][0] : [];
|
||||
$total = $item['total'];
|
||||
$lists[] = [
|
||||
'uid' => $user['userId'],
|
||||
'name' => $user['nickname'] ? $user['nickname'] : '',
|
||||
'headimg' => $user['headimg'] ? $user['headimg'] : self::DEFAULT_HEAD,
|
||||
'total' => $total,
|
||||
'num' => "{$total}秒",
|
||||
];
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'total' => $total,
|
||||
'lists' => $lists
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
|
||||
@@ -124,7 +124,14 @@ class Stic extends Admin{
|
||||
['title' => '预约用户', 'num' => "{$subscribe_count}人",'url'=>'/h5/market/sylive/stic/users?type=all&kpi=subscribe&a_id='.$a_id],
|
||||
['title' => '预约率', 'num' => $subscribe_count ? round($subscribe_count/$browse_count*100,2)."%" : 0],
|
||||
];
|
||||
$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;
|
||||
}
|
||||
$browse_lists = $this->sylive_entity->top_lists($a_id,'browse',1,10,$biz_id);
|
||||
$browse = [
|
||||
'title' => '门店<span class="color-00a2ff">浏览</span>排行',
|
||||
@@ -157,6 +164,7 @@ class Stic extends Admin{
|
||||
$this->show_json([],200);
|
||||
}
|
||||
$cell4 = $cell3 = [];
|
||||
$view_num = $view_time = [];
|
||||
if($this->group_id<2){ //所有大区
|
||||
$where = [
|
||||
'a_id' => $a_id,
|
||||
@@ -210,6 +218,18 @@ class Stic extends Admin{
|
||||
$view_count = $this->mdSytActivityKpiData->count($where); //观看数据
|
||||
$where['kpi'] = 'order';
|
||||
$order_count = $this->mdSytActivityKpiData->count($where); //下单数据
|
||||
$view_num_lists = $this->sylive_entity->top_view_num($row['channelId'],1,10);
|
||||
$view_num = [
|
||||
'title' => '客户<span class="color-00a2ff">观看次数</span>排行',
|
||||
'url' => '',
|
||||
'list' => $view_num_lists['lists']
|
||||
];
|
||||
$view_time_lists = $this->sylive_entity->top_view_time($row['channelId'],1,10);
|
||||
$view_time = [
|
||||
'title' => '客户<span class="color-00a2ff">观看时长</span>排行',
|
||||
'url' => '',
|
||||
'list' => $view_time_lists['lists']
|
||||
];
|
||||
}
|
||||
$cell1 = [
|
||||
['title' => '观看用户', 'num' => "{$view_count}人",'url'=>'/h5/market/sylive/stic/users?type=all&kpi=watch&a_id='.$a_id],
|
||||
@@ -225,7 +245,14 @@ class Stic extends Admin{
|
||||
['title' => '人均观看', 'num' => "{$avg_UV_time}秒"],
|
||||
['title' => '观看次数', 'num' => "{$livePV}次"],
|
||||
];
|
||||
$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;
|
||||
}
|
||||
$watch_lists = $this->sylive_entity->top_lists($a_id,'watch',1,10,$biz_id);
|
||||
$view = [
|
||||
'title' => '门店<span class="color-00a2ff">观看</span>排行',
|
||||
@@ -244,7 +271,9 @@ class Stic extends Admin{
|
||||
'cell3' => $cell3,
|
||||
'cell4' => $cell4,
|
||||
'view' => $view,
|
||||
'order' => $order
|
||||
'order' => $order,
|
||||
'view_num' => $view_num,
|
||||
'view_time' => $view_time,
|
||||
];
|
||||
$this->show_json($data,200);
|
||||
}
|
||||
@@ -365,6 +394,17 @@ class Stic extends Admin{
|
||||
'title' => '本店<span class="color-00a2ff">订单</span>排行',
|
||||
'list' => $order_rows['lists']
|
||||
];
|
||||
$view_num_lists = $this->sylive_entity->top_view_num($row['channelId'],1,10);
|
||||
$data['view_num'] = [
|
||||
'title' => '客户<span class="color-00a2ff">观看次数</span>排行',
|
||||
'list' => $view_num_lists['lists']
|
||||
];
|
||||
$view_time_lists = $this->sylive_entity->top_view_time($row['channelId'],1,10);
|
||||
$data['view_time'] = [
|
||||
'title' => '客户<span class="color-00a2ff">观看时长</span>排行',
|
||||
'url' => '',
|
||||
'list' => $view_time_lists['lists']
|
||||
];
|
||||
}
|
||||
$this->show_json($data,200);
|
||||
}
|
||||
|
||||
@@ -168,6 +168,49 @@
|
||||
</div>
|
||||
<div class="pt100 pb100 text-center font-32 color-666" v-else>暂时无数据</div>
|
||||
</div>
|
||||
|
||||
<div class="mt30 bg-f9 inner40 overflowhidden ulib-r20" v-if="live.view_num">
|
||||
<div class="pb20 fn-clear">
|
||||
<b class="fn-fl font-40 text-italic" v-html="live.view_num.title"></b>
|
||||
<a class="mt5 fn-fr font-28" v-if="live.view_num.url" :href="live.view_num.url">查看更多<i class="iconfont icon-gengduo"></i></a>
|
||||
</div>
|
||||
<div v-if="live.view_num.list.length>0">
|
||||
<div class="font-32 color-666" v-for="(item,index) in live.view_num.list">
|
||||
<div class="pt20 pb20 fn-clear">
|
||||
<div class="fn-fl wp70 text-nowrap">
|
||||
<img class="imgsize-42X42 text-middle" v-if="index<3" :src="'https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-ranking-'+(index+1)+'.png'" alt="#" />
|
||||
<span class="inline-block w-50 text-center text-middle" v-else>{{index+1}}</span>
|
||||
<span class="text-middle">{{item.name}}</span>
|
||||
<span class="inline-block pl10 pr10 line-height-15 text-middle bg-fe9538 font-22 color-fff ulib-r750" v-if="item.tip">{{item.tip}}</span>
|
||||
</div>
|
||||
<div class="fn-fr">{{item.num}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt100 pb100 text-center font-32 color-666" v-else>暂时无数据</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt30 bg-f9 inner40 overflowhidden ulib-r20" v-if="live.view_time">
|
||||
<div class="pb20 fn-clear">
|
||||
<b class="fn-fl font-40 text-italic" v-html="live.view_time.title"></b>
|
||||
<a class="mt5 fn-fr font-28" v-if="live.view_time.url" :href="live.view_time.url">查看更多<i class="iconfont icon-gengduo"></i></a>
|
||||
</div>
|
||||
<div v-if="live.view_time.list.length>0">
|
||||
<div class="font-32 color-666" v-for="(item,index) in live.view_time.list">
|
||||
<div class="pt20 pb20 fn-clear">
|
||||
<div class="fn-fl wp70 text-nowrap">
|
||||
<img class="imgsize-42X42 text-middle" v-if="index<3" :src="'https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-ranking-'+(index+1)+'.png'" alt="#" />
|
||||
<span class="inline-block w-50 text-center text-middle" v-else>{{index+1}}</span>
|
||||
<span class="text-middle">{{item.name}}</span>
|
||||
<span class="inline-block pl10 pr10 line-height-15 text-middle bg-fe9538 font-22 color-fff ulib-r750" v-if="item.tip">{{item.tip}}</span>
|
||||
</div>
|
||||
<div class="fn-fr">{{item.num}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt100 pb100 text-center font-32 color-666" v-else>暂时无数据</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end 直播阶段-->
|
||||
</div>
|
||||
@@ -215,6 +258,16 @@
|
||||
title:'',
|
||||
url:'',
|
||||
list:[],
|
||||
},
|
||||
view_num:{
|
||||
title:'',
|
||||
url:'',
|
||||
list:[],
|
||||
},
|
||||
view_time:{
|
||||
title:'',
|
||||
url:'',
|
||||
list:[],
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -78,11 +78,11 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt30 bg-f9 inner40 overflowhidden ulib-r20" v-if="live.view.list.length>0">
|
||||
<div class="mt30 bg-f9 inner40 overflowhidden ulib-r20">
|
||||
<div class="pb20 fn-clear">
|
||||
<b class="fn-fl font-40 text-italic" v-html="live.view.title"></b>
|
||||
</div>
|
||||
<div class="font-32 color-666" v-for="(item,index) in live.view.list">
|
||||
<div class="font-32 color-666" v-for="(item,index) in live.view.list" v-if="live.view.list.length>0">
|
||||
<div class="pt20 pb20 fn-clear">
|
||||
<div class="fn-fl wp70 text-nowrap">
|
||||
<img class="imgsize-42X42 text-middle" v-if="index<3" :src="'https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-ranking-'+(index+1)+'.png'" alt="#" />
|
||||
@@ -95,12 +95,45 @@
|
||||
</div>
|
||||
<div class="pt100 pb100 text-center font-32 color-666" v-else>暂时无数据</div>
|
||||
</div>
|
||||
|
||||
<div class="mt30 bg-f9 inner40 overflowhidden ulib-r20" v-if="live.order.list.length>0">
|
||||
<div class="mt30 bg-f9 inner40 overflowhidden ulib-r20">
|
||||
<div class="pb20 fn-clear">
|
||||
<b class="fn-fl font-40 text-italic" v-html="live.order.title"></b>
|
||||
</div>
|
||||
<div class="font-32 color-666" v-for="(item,index) in live.order.list">
|
||||
<div class="font-32 color-666" v-for="(item,index) in live.order.list" v-if="live.order.list.length>0">
|
||||
<div class="pt20 pb20 fn-clear">
|
||||
<div class="fn-fl wp70 text-nowrap">
|
||||
<img class="imgsize-42X42 text-middle" v-if="index<3" :src="'https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-ranking-'+(index+1)+'.png'" alt="#" />
|
||||
<span class="inline-block w-50 text-center text-middle" v-else>{{index+1}}</span>
|
||||
<span class="text-middle">{{item.name}}</span>
|
||||
<span class="inline-block pl10 pr10 line-height-15 text-middle bg-fe9538 font-22 color-fff ulib-r750" v-if="item.tip">{{item.tip}}</span>
|
||||
</div>
|
||||
<div class="fn-fr">{{item.num}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt100 pb100 text-center font-32 color-666" v-else>暂时无数据</div>
|
||||
</div>
|
||||
<div class="mt30 bg-f9 inner40 overflowhidden ulib-r20" v-if="live.view_num">
|
||||
<div class="pb20 fn-clear">
|
||||
<b class="fn-fl font-40 text-italic" v-html="live.view_num.title"></b>
|
||||
</div>
|
||||
<div class="font-32 color-666" v-for="(item,index) in live.view_num.list" v-if="live.view_num.list.length>0">
|
||||
<div class="pt20 pb20 fn-clear">
|
||||
<div class="fn-fl wp70 text-nowrap">
|
||||
<img class="imgsize-42X42 text-middle" v-if="index<3" :src="'https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-ranking-'+(index+1)+'.png'" alt="#" />
|
||||
<span class="inline-block w-50 text-center text-middle" v-else>{{index+1}}</span>
|
||||
<span class="text-middle">{{item.name}}</span>
|
||||
<span class="inline-block pl10 pr10 line-height-15 text-middle bg-fe9538 font-22 color-fff ulib-r750" v-if="item.tip">{{item.tip}}</span>
|
||||
</div>
|
||||
<div class="fn-fr">{{item.num}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt100 pb100 text-center font-32 color-666" v-else>暂时无数据</div>
|
||||
</div>
|
||||
<div class="mt30 bg-f9 inner40 overflowhidden ulib-r20" v-if="live.view_time">
|
||||
<div class="pb20 fn-clear">
|
||||
<b class="fn-fl font-40 text-italic" v-html="live.view_time.title"></b>
|
||||
</div>
|
||||
<div class="font-32 color-666" v-for="(item,index) in live.view_time.list" v-if="live.view_time.list.length>0">
|
||||
<div class="pt20 pb20 fn-clear">
|
||||
<div class="fn-fl wp70 text-nowrap">
|
||||
<img class="imgsize-42X42 text-middle" v-if="index<3" :src="'https://qs.haodian.cn/web/images/project/H5-ShiYu/icon-ranking-'+(index+1)+'.png'" alt="#" />
|
||||
@@ -177,6 +210,14 @@
|
||||
order:{
|
||||
title:'',
|
||||
list:[],
|
||||
},
|
||||
view_num:{
|
||||
title:'',
|
||||
list:[],
|
||||
},
|
||||
view_time:{
|
||||
title:'',
|
||||
list:[],
|
||||
}
|
||||
},
|
||||
isDataEnd: false,
|
||||
@@ -301,6 +342,8 @@
|
||||
}else{ // 直播
|
||||
that.live.view = res.data.view
|
||||
that.live.order = res.data.order
|
||||
that.live.view_num = res.data.view_num
|
||||
that.live.view_time = res.data.view_time
|
||||
}
|
||||
if (res.data.total == 0) {
|
||||
that.isNoData = true;
|
||||
|
||||
Reference in New Issue
Block a user