From 832137b310fae17257d81512345814b06bc71dec Mon Sep 17 00:00:00 2001 From: dengbw Date: Sat, 8 Oct 2022 21:06:48 +0800 Subject: [PATCH] sylive_1008 --- market/controllers/api/sylive/Activity.php | 63 ++++++++++++++-------- market/controllers/api/sylive/User.php | 16 ++++++ 2 files changed, 57 insertions(+), 22 deletions(-) diff --git a/market/controllers/api/sylive/Activity.php b/market/controllers/api/sylive/Activity.php index e001e3b4..ad8e59d2 100644 --- a/market/controllers/api/sylive/Activity.php +++ b/market/controllers/api/sylive/Activity.php @@ -360,7 +360,8 @@ class Activity extends BaseController $this->load->model('live/Live_polyv_session_model', 'mdPolyvSession'); $this->load->model('live/Live_polyv_viewlog_model', 'mdPolyvViewlog'); $title = ''; - $activityData = $areaData = $bizData = $consultantData = $areaAry = []; + $activityData1 = $activityData2 = $areaData = $bizData = $consultantData = $areaAry = $funnel = []; + $browse = $subscribe = $watch = $order = 0; $re = $this->mdSyliveActivity->get(['activityId' => $activityId]); if ($re) { $title = $re['title']; @@ -481,13 +482,20 @@ class Activity extends BaseController $watchDuration = round($duration / $livePV); } } - $activityData = [['name' => '参与区域数', 'value' => count($areaData)], ['name' => '参与门店数', 'value' => count($bizData)] - , ['name' => '参与顾问数', 'value' => count($res_user)], ['name' => '浏览人数', 'value' => $browse], ['name' => '预约人数', 'value' => $subscribe] + $activityData1 = [['name' => '参与区域数', 'value' => count($areaData)], ['name' => '参与门店数', 'value' => count($bizData)] + , ['name' => '参与顾问数', 'value' => count($res_user)]]; + $activityData2 = [['name' => '浏览人数', 'value' => $browse], ['name' => '预约人数', 'value' => $subscribe] , ['name' => '观看人数', 'value' => $watch], ['name' => '订单数', 'value' => $order], ['name' => '直播时长', 'value' => $duration] , ['name' => '观看次数', 'value' => $livePV], ['name' => '人均观看', 'value' => $watchDuration]]; } - $data = ['activityId' => $activityId, 'title' => $title, 'activityData' => $activityData, 'areaData' => $areaData - , 'bizData' => $bizData, 'consultantData' => $consultantData]; + $funnel = ['title' => '活动漏斗' + , 'expected_data' => [['name' => '浏览人数', 'value' => 100], ['name' => '预约人数', 'value' => $subscribe > $watch ? 75 : 50] + , ['name' => '观看人数', 'value' => $watch > $subscribe ? 75 : 50], ['name' => '订单数', 'value' => 25]] + , 'actual_data' => [['name' => '浏览人数', 'value' => $browse], ['name' => '预约人数', 'value' => $subscribe] + , ['name' => '观看人数', 'value' => $watch], ['name' => '订单数', 'value' => $order]] + ]; + $data = ['activityId' => $activityId, 'title' => $title, 'activityData1' => $activityData1, 'activityData2' => $activityData2, 'areaData' => $areaData + , 'bizData' => $bizData, 'consultantAry' => $consultantData, 'funnel' => $funnel]; $this->return_response($data); } @@ -501,14 +509,14 @@ class Activity extends BaseController { $this->load->model('market/Market_sylive_order_model', 'mdSyliveOrder'); $this->load->model('market/Market_sylive_user_model', 'mdSyliveUser'); + $this->load->model('market/Market_sylive_activity_kpidata_model', 'mdSyliveActivityKpidata'); $activityId = intval($this->input_param('activityId')); $page = $this->input_param('page'); $limit = $this->input_param('limit'); $item_title = $this->input_param('item_title'); + $uname = $this->input_param('uname'); $mobile = $this->input_param('mobile'); - $name = $this->input_param('name'); $status = $this->input_param('status'); - $sid = $this->input_param('sid'); $sort = $this->input_param('sort'); $order = $this->input_param('order'); !$page && $page = 1; @@ -528,26 +536,15 @@ class Activity extends BaseController $where['status'] = $status; $activityId && $where['item_id'] = $activityId; $item_title && $where['item_title'] = $item_title; - $sid && $where['sid'] = $sid; - $str_user_ids = 0; - if ($name || $mobile) { - $where_user['status>='] = 0; - $name && $where_user["(uname LIKE '%{$name}%' OR mobile LIKE '%{$name}%')"] = null; - $mobile && $where_user['mobile'] = $mobile; - $res_user = $this->mdSyliveUser->select($where_user, 'userId desc', 0, 0, 'userId'); - $res_user && $str_user_ids = implode(',', array_unique(array_column($res_user, 'userId'))); - $where["u_id in($str_user_ids)"] = null; - } + $uname && $where['uname'] = $uname; + $mobile && $where['mobile'] = $mobile; $count = $this->mdSyliveOrder->count($where); if ($count) { $res = $this->mdSyliveOrder->select($where, $sort_order, $page, $limit); - $str_user_ids = implode(',', array_unique(array_column($res, 'uid'))); - $map_users = $this->mdSyliveUser->map('userId', 'uname,nickname,mobile', ["userId in({$str_user_ids})" => null]); foreach ($res as $v) { - $name = $map_users[$v['uid']]['uname'] ? $map_users[$v['uid']]['uname'] : $map_users[$v['uid']]['nickname']; - $mobile = $map_users[$v['uid']]['mobile']; + $consultant = $this->consultantGet(['a_id' => $v['item_id'], 'uid' => $v['uid']]); $list[] = [ - 'id' => $v['id'], 'sid' => $v['sid'], 'name' => $name, 'mobile' => $mobile, 'item_title' => $v['item_title'] + 'id' => $v['id'], 'consultant' => $consultant, 'uname' => $v['uname'], 'mobile' => $v['mobile'], 'item_title' => $v['item_title'] , 'total_price' => $v['total_price'], 'pay_time' => $v['pay_time'] != '0000-00-00 00:00:00' ? $v['pay_time'] : '' , 'statusName' => $this->mdSyliveOrder->statusAry($v['status']), 'createTime' => $v['createTime']]; } @@ -556,4 +553,26 @@ class Activity extends BaseController $this->return_response_list($date); } + /** + * Notes:获取顾问信息 + * Created on: 2022/10/8 11:29 + * Created by: dengbw + * @param $params + * @return string + */ + public function consultantGet($params) + { + $title = ''; + $re = $this->mdSyliveActivityKpidata->get(['a_id' => $params['a_id'], 'uid' => $params['uid'], 'kpi' => 'order']); + if ($re['cf_uid']) { + $re_user = $this->mdSyliveUser->get(['userId' => $re['cf_uid']]); + $res_orga = $this->mdSyliveOrganization->get(["organizationId" => $re['area_id']]); + $res_orgb = $this->mdSyliveOrganization->get(["organizationId" => $re['biz_id']]); + $res_orga && $title = $res_orga['organizationName']; + $res_orgb && $title = $title ? $title . '-' . $res_orgb['organizationName'] : $res_orgb['organizationName']; + $re_user && $title = $title ? $title . '-' . $re_user['uname'] : $re_user['uname']; + } + return $title; + } + } \ No newline at end of file diff --git a/market/controllers/api/sylive/User.php b/market/controllers/api/sylive/User.php index 34029449..68e80856 100644 --- a/market/controllers/api/sylive/User.php +++ b/market/controllers/api/sylive/User.php @@ -130,6 +130,22 @@ class User extends BaseController $this->return_response(); } + /** + * Notes:修改状态 + * Created on: 2022/9/21 16:10 + * Created by: dengbw + */ + public function status_put() + { + $userId = $this->input_param('userId'); + $status = $this->input_param('status'); + if (!$userId) { + $this->return_json('参数错误'); + } + $this->mdSyliveUser->update(['status' => $status], ['userId' => $userId]); + $this->return_response(); + } + /** * Notes:删除用户 * Created on: 2022/9/21 16:10