From aa0a9050b6456b88d9ad2749a1fc313da984d2a9 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Wed, 26 Oct 2022 16:02:30 +0800 Subject: [PATCH] edit-sylive-static --- api/controllers/plan/Plan.php | 1 + api/controllers/plan/Syt.php | 22 +++++++------ common/libraries/market/Sylive_entity.php | 36 +++++++++------------ home/controllers/h5/market/sylive/Act.php | 2 +- home/controllers/h5/market/sylive/Biz.php | 5 ++- home/controllers/h5/market/sylive/Stic.php | 15 +++++---- home/controllers/h5/market/sylive/Team.php | 5 ++- home/controllers/h5/market/sylive/Tstic.php | 2 +- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/api/controllers/plan/Plan.php b/api/controllers/plan/Plan.php index 7a57ad32..52e21b29 100644 --- a/api/controllers/plan/Plan.php +++ b/api/controllers/plan/Plan.php @@ -54,6 +54,7 @@ class Plan extends CI_Controller $plan[] = array('url' => base_url(array('plan', 'syt', 'subscribemsg')), 'interval' => 1); //私域通模板消息 $plan[] = array('url' => base_url(array('plan', 'syt', 'syn_polyv')), 'interval' => 60); //私域通直播间数据同步 $plan[] = array('url' => base_url(array('plan', 'syt', 'out_time')), 'interval' => 1); //订单过期 + $plan[] = array('url' => base_url(array('plan', 'syt', 'union_user')), 'interval' => 1); //直播数据关联用户 $this->plan = $plan; } diff --git a/api/controllers/plan/Syt.php b/api/controllers/plan/Syt.php index ff72c262..b4dbf1f6 100644 --- a/api/controllers/plan/Syt.php +++ b/api/controllers/plan/Syt.php @@ -262,18 +262,18 @@ class Syt extends CI_Controller $this->load->model('market/market_sylive_activity_user_model', 'act_user_model'); $this->load->model('market/market_sylive_viewlog_model'); $size = 30; - $t1 = 'lc_market_sylive_viewlog'; - $t2 = 'lc_live_polyv_viewlog'; - $t3 = 'lc_market_sylive_activity'; + $t1 = 'lc_live_polyv_viewlog'; + $t2 = 'lc_market_sylive_activity'; + $t3 = 'lc_market_sylive_viewlog'; $where = [ - "$t2.id>" => 0, - "$t2.id is null" => null + "$t2.activityId>" => 0, + "$t3.id is null" => null ]; - $fileds = "{$t2}.*,{$t3}.activityId"; - $rows = $this->db->select($fileds)->from("$t3") - ->join("$t2", "{$t2}.channelId={$t3}.activityId", 'left') - ->join("$t1", "{$t1}.vlog_id={$t2}.id", 'left') - ->where($where)->order_by("{$t2}.id asc")->limit($size, 0) + $fileds = "{$t1}.*,{$t2}.activityId"; + $rows = $this->db->select($fileds)->from("$t1") + ->join("$t2", "{$t2}.channelId={$t1}.channelId", 'left') + ->join("$t3", "{$t3}.vlog_id={$t1}.id", 'left') + ->where($where)->order_by("{$t1}.id asc")->limit($size, 0) ->get()->result_array(); if (!$rows) { echo "不存在直播日志数据"; @@ -298,12 +298,14 @@ class Syt extends CI_Controller $team_lists = $this->sylive_entity->get_team_lists($p_user['teamId']); $area_id = $team_lists[0]['teamId']; //大团长id $biz_id = $team_lists[1]['teamId']; //团长id + $addData['cf_uid'] = $p_user['userId']; } if($p_user['organizationId']){ $addData['type'] = 0; $team_lists = $this->sylive_entity->get_level_lists($p_user['organizationId']); $area_id = $team_lists[0]['teamId']; //大团长id $biz_id = $team_lists[1]['teamId']; //团长id + $addData['cf_uid'] = $p_user['userId']; } $area_id && $addData['area_id'] = $area_id; $biz_id && $addData['biz_id'] = $biz_id; diff --git a/common/libraries/market/Sylive_entity.php b/common/libraries/market/Sylive_entity.php index 0218f2bd..8494605c 100644 --- a/common/libraries/market/Sylive_entity.php +++ b/common/libraries/market/Sylive_entity.php @@ -5,6 +5,7 @@ class Sylive_entity{ const DEFAULT_HEAD = 'https://qs.haodian.cn/web/images/project/H5-ShiYu/default-head.png'; //默认头像 + const DF_IMG = 'https://qs.haodian.cn/web/images/project/H5-ShiYu/goodslogo.jpg'; //东风图标 private $ci; private $map_kpi_biz = [ 'browse' => 'browse', 'subscribe' => 'subscribe', 'order' => 'orderTotal','watch' => 'watch' @@ -225,19 +226,16 @@ class Sylive_entity{ //门店用户排行数据 public function top_biz_user($aid,$biz_id,$uid,$type='browse',$page=1,$size=50){ + if(!$biz_id){ + return ['total' => 0, 'lists' => []]; + } $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,','); - } - if(!$org_ids){ - return ['total' => 0, 'lists' => []]; - } + $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 ]; @@ -445,19 +443,16 @@ class Sylive_entity{ //团队用户排行数据 public function top_team_user($aid,$teamId,$uid,$type='browse',$page=1,$size=50){ + if(!$teamId){ + return ['total' => 0, 'lists' => []]; + } $where = [ 'parentId' => $teamId ]; $orgs = $this->ci->market_sylive_team_model->select($where,'',0,0,'teamId'); - $org_ids = 0; - if($orgs){ - $org_arr_ids = array_column($orgs,'teamId'); - $org_arr_ids[] = $teamId; - $org_ids = implode($org_arr_ids,','); - } - if(!$org_ids){ - return ['total' => 0, 'lists' => []]; - } + $orgs && $org_arr_ids = array_column($orgs,'teamId'); + $org_arr_ids[] = $teamId; + $org_ids = implode($org_arr_ids,','); $where = [ "teamId>" => 0, "teamId in ({$org_ids})" => null @@ -481,10 +476,11 @@ class Sylive_entity{ } foreach ($rows as $item) { $total = $map[$item['userId']] ? $map[$item['userId']] : '0'; + $name = $item['uname'] ? $item['uname'] : $item['nickname']; $lists[] = [ 'uid' => $item['userId'], - 'name' => $item['uname'] ? $item['uname'] : $item['nickname'], - 'headimg' => $item['headimg'] ? $item['headimg'] : self::DEFAULT_HEAD, + 'name' => name_asterisk($name), + 'headimg' => self::DF_IMG, 'total' => $total, 'num' => "{$total}人", 'tip' => $uid == $item['userId'] ? '本人' : '', diff --git a/home/controllers/h5/market/sylive/Act.php b/home/controllers/h5/market/sylive/Act.php index 95228b65..19929240 100644 --- a/home/controllers/h5/market/sylive/Act.php +++ b/home/controllers/h5/market/sylive/Act.php @@ -258,7 +258,7 @@ class Act extends Wx { ]; } } - $user = $this->user_model->get(['userId'=>$this->uid],'uname,nickname'); + $user = $this->user_model->get(['userId'=>$this->uid],'uname,nickname,organizationId'); if($user['organizationId']){ if($this->group_id==3){ $where = [ diff --git a/home/controllers/h5/market/sylive/Biz.php b/home/controllers/h5/market/sylive/Biz.php index 5427c531..62114b74 100644 --- a/home/controllers/h5/market/sylive/Biz.php +++ b/home/controllers/h5/market/sylive/Biz.php @@ -5,7 +5,6 @@ require_once 'Common.php'; class Biz extends Admin { private $group_id; - private $liche_img = 'https://qs.haodian.cn/web/images/project/H5-ShiYu/goodslogo.jpg'; public function __construct(){ parent::__construct(); @@ -34,7 +33,7 @@ class Biz extends Admin { $this->data['biz_id'] = $biz_id; $this->data['group_id'] = $this->group_id; $row = $this->market_sylive_organization_model->get(['organizationId'=>$biz_id]); - $this->data['headimg'] = $this->liche_img; + $this->data['headimg'] = Sylive_entity::DF_IMG; $this->data['biz_name'] = $row['organizationName']; //微信分享 $wx_info = $this->share_info(); @@ -83,7 +82,7 @@ class Biz extends Admin { $user = $this->user_model->get(['userId'=>$this->uid]); $data = [ 'nickname' => $user['nickname'], - 'headimg' => $this->liche_img + 'headimg' => Sylive_entity::DF_IMG ]; if($this->group_id==1 || $area_id){ //所有店铺 !$area_id && $area_id = $this->session['org_id']; diff --git a/home/controllers/h5/market/sylive/Stic.php b/home/controllers/h5/market/sylive/Stic.php index 064d42e0..aef1f8a6 100644 --- a/home/controllers/h5/market/sylive/Stic.php +++ b/home/controllers/h5/market/sylive/Stic.php @@ -242,13 +242,17 @@ class Stic extends Admin{ ['title' => '下单用户', 'num' => "{$order_count}人",'url'=>'/h5/market/sylive/stic/users?type=all&kpi=order&a_id='.$a_id], ['title' => '转化率', 'num' => $view_count ? round($order_count/$view_count*100,2)."%" : 0], ]; - $poly_row = $this->mdPolyvSession->get(['channelId'=>$row['channelId']]); - $duration = $poly_row['duration'] ? intval($poly_row['duration']/60) : "0"; - $livePV = $poly_row['livePV'] ? $poly_row['livePV'] : 0; - $avg_UV_time = $poly_row['liveUV'] ? intval($poly_row['totalPlayDuration']/$poly_row['liveUV']) : 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']]); + $uv = $this->mdPolyvSession->sum('liveUV',['channelId'=>$row['channelId']]); + $duration = $duration['duration'] ? intval($duration['duration']/60) : "0"; + $livePV = $pv['livePV'] ? $pv['livePV'] : 0; + $avg_UV_time = $uv['liveUV'] ? intval($total_play['totalPlayDuration']/$uv['liveUV']) : 0; + $avg_UV_time = intval($avg_UV_time/60); $cell2 = [ ['title' => '直播时长', 'num' => "{$duration}分钟"], - ['title' => '人均观看', 'num' => "{$avg_UV_time}秒"], + ['title' => '人均观看', 'num' => "{$avg_UV_time}分钟"], ['title' => '观看次数', 'num' => "{$livePV}次"], ]; if($this->group_id==3){ @@ -509,7 +513,6 @@ class Stic extends Admin{ public function gw_lists(){ $params = $this->input->get(); - $res = $this->sylive_entity->top_biz_user($params['a_id'],$this->session['org_id'],$this->uid,$params['kpi']); $lists = []; if($res['lists']){ diff --git a/home/controllers/h5/market/sylive/Team.php b/home/controllers/h5/market/sylive/Team.php index 63325e67..1b1fbc7b 100644 --- a/home/controllers/h5/market/sylive/Team.php +++ b/home/controllers/h5/market/sylive/Team.php @@ -5,7 +5,6 @@ require_once 'Common.php'; class Team extends Admin{ private $teamLevel; - private $liche_img = 'https://qs.haodian.cn/web/images/project/H5-ShiYu/goodslogo.jpg'; public function __construct(){ parent::__construct(); @@ -22,7 +21,7 @@ class Team extends Admin{ } $row = $this->market_sylive_team_model->get(['teamId'=>$this->session['teamId']]); $info['nickname'] = $row['teamName']; - $info['headimg'] = $this->liche_img; + $info['headimg'] = Sylive_entity::DF_IMG; $info['tab'] = [ ['id'=>1,'title'=>'团队'], ['id'=>2,'title'=>'活动'], @@ -44,7 +43,7 @@ class Team extends Admin{ $team_id = $this->input->get('team_id'); } $row = $this->market_sylive_team_model->get(['teamId'=>$team_id]); - $this->data['headimg'] = $this->liche_img; + $this->data['headimg'] = Sylive_entity::DF_IMG; $this->data['biz_name'] = $row['teamName']; $this->data['team_id'] = $this->input->get('team_id'); $this->data['teamLevel'] = $this->teamLevel; diff --git a/home/controllers/h5/market/sylive/Tstic.php b/home/controllers/h5/market/sylive/Tstic.php index 2aa4c43e..6b2600fe 100644 --- a/home/controllers/h5/market/sylive/Tstic.php +++ b/home/controllers/h5/market/sylive/Tstic.php @@ -460,7 +460,7 @@ class Tstic extends Admin{ $cf_uname = ''; if($this->teamLevel==1){ //团长 $cf_user = $users[$item['cf_uid']] ? $users[$item['cf_uid']][0] : []; - $cf_uname = $cf_user['uname'] ? "({$cf_user['uname']})" : ""; + $cf_user['uname'] && '('.name_asterisk($cf_user['uname']).')'; } $lists[] = [ 'nickname' => $nickname,