This commit is contained in:
小鱼开发
2024-07-12 22:25:43 +08:00
parent 560be99d95
commit b3d73847ed
@@ -196,12 +196,12 @@ class GroupsStatistics extends BaseController
$where_sort['kpi'] = 'beforeOrder';
$beforeOrderTotal = $this->mdSyliveActivityKpidata->count($where_sort);
}
if ($sort == 'watch') {
$watch = $v['total'];
} else {
$where_sort['kpi'] = 'watch';
$watch = $this->mdSyliveActivityKpidata->count($where_sort);
}
// if ($sort == 'watch') {
// $watch = $v['total'];
// } else {
// $where_sort['kpi'] = 'watch';
// $watch = $this->mdSyliveActivityKpidata->count($where_sort);
// }
if ($sort == 'order') {
$orderTotal = $v['total'];
} else {
@@ -213,21 +213,21 @@ class GroupsStatistics extends BaseController
$orderTotal = $this->mdSyliveActivityKpidata->count($where_sort);
}
$livePV = $watchDuration = 0;
if ($channelId) {
$livePV = $this->mdSyliveViewlog->count([$levelId => $groupsId, 'activityId' => $activityId
, 'createTime>=' => $createTimeStart, 'createTime<=' => $createTimeEnd]);
$re_sum = $this->mdSyliveViewlog->sum('playDuration', [$levelId => $groupsId, 'activityId' => $activityId
, 'createTime>=' => $createTimeStart, 'createTime<=' => $createTimeEnd]);
if ($re_sum['playDuration']) {
$playDuration = ceil($re_sum['playDuration'] / 60);
$watchDuration = round($playDuration / $livePV);
}
}
// $livePV = $watchDuration = 0;
// if ($channelId) {
// $livePV = $this->mdSyliveViewlog->count([$levelId => $groupsId, 'activityId' => $activityId
// , 'createTime>=' => $createTimeStart, 'createTime<=' => $createTimeEnd]);
// $re_sum = $this->mdSyliveViewlog->sum('playDuration', [$levelId => $groupsId, 'activityId' => $activityId
// , 'createTime>=' => $createTimeStart, 'createTime<=' => $createTimeEnd]);
// if ($re_sum['playDuration']) {
// $playDuration = ceil($re_sum['playDuration'] / 60);
// $watchDuration = round($playDuration / $livePV);
// }
// }
$biz = $this->getBiz($groupsId);
$list[] = [
'groupsName' => $groupsName, 'biz' => $biz, 'browse' => $browse, 'subscribe' => $subscribe
, 'beforeOrder' => $beforeOrderTotal, 'watch' => $watch, 'order' => $orderTotal, 'livePV' => $livePV, 'watchDuration' => $watchDuration];
, 'beforeOrder' => $beforeOrderTotal, 'order' => $orderTotal];
}
}
} else {
@@ -249,7 +249,7 @@ class GroupsStatistics extends BaseController
$sort_order = 'beforeOrderTotal ' . $order;
}
$res = $this->mdSyliveGroups->select($where, "{$sort_order},groupsId desc", $page, $limit,
'groupsId,groupsName,browse,subscribe,watch,beforeOrderTotal,orderTotal');
'groupsId,groupsName,browse,subscribe,beforeOrderTotal,orderTotal');
}
foreach ($res as $v) {
@@ -260,21 +260,21 @@ class GroupsStatistics extends BaseController
$v['browse'] = intval($re_gro['browse']);
$v['subscribe'] = intval($re_gro['subscribe']);
$v['beforeOrderTotal'] = intval($re_gro['beforeOrderTotal']);
$v['watch'] = intval($re_gro['watch']);
//$v['watch'] = intval($re_gro['watch']);
} else {
$groupsId = intval($v['groupsId']);
$groupsName = $v['groupsName'] ? $v['groupsName'] : '-';
}
$livePV = $watchDuration = 0;
if ($channelId) {
$livePV = $this->mdSyliveViewlog->count([$levelId => $groupsId, 'activityId' => $activityId]);
$re_sum = $this->mdSyliveViewlog->sum('playDuration', [$levelId => $groupsId, 'activityId' => $activityId]);
if ($re_sum['playDuration']) {
$playDuration = ceil($re_sum['playDuration'] / 60);
$watchDuration = round($playDuration / $livePV);
}
}
// $livePV = $watchDuration = 0;
// if ($channelId) {
// $livePV = $this->mdSyliveViewlog->count([$levelId => $groupsId, 'activityId' => $activityId]);
// $re_sum = $this->mdSyliveViewlog->sum('playDuration', [$levelId => $groupsId, 'activityId' => $activityId]);
// if ($re_sum['playDuration']) {
// $playDuration = ceil($re_sum['playDuration'] / 60);
// $watchDuration = round($playDuration / $livePV);
// }
// }
if ($sort != 'order' && $itemId) {//有商品id,区分订单
$order = $this->mdSyliveActivityKpidata->count(['itemId>' => 0, $levelId => $groupsId, 'itemId' => $itemId, 'activityId' => $activityId]);
} else {
@@ -283,7 +283,7 @@ class GroupsStatistics extends BaseController
$biz = $this->getBiz($groupsId);
$list[] = [
'groupsName' => $groupsName, 'biz' => $biz, 'browse' => $v['browse'], 'subscribe' => $v['subscribe']
, 'beforeOrder' => $v['beforeOrderTotal'], 'watch' => $v['watch'], 'order' => $order, 'livePV' => $livePV, 'watchDuration' => $watchDuration];
, 'beforeOrder' => $v['beforeOrderTotal'], 'order' => $order];
}
}
}