From eded3ce46554663e13faa3aff2522541bbe83806 Mon Sep 17 00:00:00 2001 From: dengbw Date: Wed, 12 Oct 2022 17:42:43 +0800 Subject: [PATCH] user_10112_4 --- api/controllers/plan/Licheb.php | 8 ++++---- api/controllers/wxapp/licheb/User.php | 8 ++++---- market/controllers/api/sylive/Activity.php | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api/controllers/plan/Licheb.php b/api/controllers/plan/Licheb.php index a4c66414..0aa882d2 100644 --- a/api/controllers/plan/Licheb.php +++ b/api/controllers/plan/Licheb.php @@ -157,11 +157,11 @@ class Licheb extends HD_Controller if ($value['userid']) { $qy_where = ['userid' => $value['userid'], 'c_time>=' => $s_time, 'c_time<=' => $e_time]; if ($type == 5) {//异业店 - $qy_adds = $this->mdDifferentQyLog->count(array_merge($qy_where, ['change_type' => 'add_external_contact'])); - $qy_dels = $this->mdDifferentQyLog->count(array_merge($qy_where, ["change_type in('del_external_contact','del_follow_user')" => null])); + $qy_adds = $this->mdDifferentQyLog->count(array_merge($qy_where, ['change_type' => 'add_external_contact']), 'distinct(external_userid)'); + $qy_dels = $this->mdDifferentQyLog->count(array_merge($qy_where, ["change_type in('del_external_contact','del_follow_user')" => null]), 'distinct(external_userid)'); } else { - $qy_adds = $this->mdWechatqyLog->count(array_merge($qy_where, ['change_type' => 'add_external_contact'])); - $qy_dels = $this->mdWechatqyLog->count(array_merge($qy_where, ["change_type in('del_external_contact','del_follow_user')" => null])); + $qy_adds = $this->mdWechatqyLog->count(array_merge($qy_where, ['change_type' => 'add_external_contact']), 'distinct(external_userid)'); + $qy_dels = $this->mdWechatqyLog->count(array_merge($qy_where, ["change_type in('del_external_contact','del_follow_user')" => null]), 'distinct(external_userid)'); } } //改派数 diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php index 7ca914e3..159aa8a4 100644 --- a/api/controllers/wxapp/licheb/User.php +++ b/api/controllers/wxapp/licheb/User.php @@ -373,12 +373,12 @@ class User extends Wxapp $re_biz = $this->biz_model->get(['id' => $biz_id]); if ($re_biz['type'] == 5) {//异业店 $this->load->model('app/app_different_qy_log_model', 'mdDifferentQyLog'); - $today_qy = $this->mdDifferentQyLog->count($where_today_qy); - $month_qy = $this->mdDifferentQyLog->count($where_month_qy); + $today_qy = $this->mdDifferentQyLog->count($where_today_qy, 'distinct(external_userid)'); + $month_qy = $this->mdDifferentQyLog->count($where_month_qy, 'distinct(external_userid)'); } else { $this->load->model('app/app_lichene_qy_log_model', 'mdWechatqyLog'); - $today_qy = $this->mdWechatqyLog->count($where_today_qy); - $month_qy = $this->mdWechatqyLog->count($where_month_qy); + $today_qy = $this->mdWechatqyLog->count($where_today_qy, 'distinct(external_userid)'); + $month_qy = $this->mdWechatqyLog->count($where_month_qy, 'distinct(external_userid)'); } } $where_today_dd[$where_customer_id] = null; diff --git a/market/controllers/api/sylive/Activity.php b/market/controllers/api/sylive/Activity.php index 82d67bf4..19d7622f 100644 --- a/market/controllers/api/sylive/Activity.php +++ b/market/controllers/api/sylive/Activity.php @@ -507,7 +507,7 @@ class Activity extends BaseController // , ['name' => '直播时长', 'value' => $duration, 'url' => ''], ['name' => '观看次数', 'value' => $livePV, 'url' => ''], ['name' => '人均观看', 'value' => $watchDuration, 'url' => '']]; } $watch_per = number_format_com($watch / $browse * 100, 1, ''); - $order_per = number_format_com($order / $browse * 100, 1, ''); + $order_per = number_format_com($order / $watch_per * 100, 1, ''); $browse_expected_data = [['name' => "浏览人数(100%)", 'value' => 100], ['name' => "观看人数({$watch_per}%)", 'value' => 66.7], ['name' => "订单数({$order_per}%)", 'value' => 33.3]]; $browse_actual_data = [['name' => '浏览人数', 'value' => $browse], ['name' => '观看人数', 'value' => $watch], ['name' => '订单数', 'value' => $order]]; $funnel_browse = ['title' => '浏览转化漏斗', 'expected_data' => $browse_expected_data, 'actual_data' => $browse_actual_data]; @@ -516,8 +516,8 @@ class Activity extends BaseController $watch_subscribe = $this->mdSyliveActivityKpidata->count(['a_id' => $activityId, 'kpi' => 'watch', $id_in => null]); $order_subscribe = $this->mdSyliveActivityKpidata->count(['a_id' => $activityId, 'kpi' => 'order', $id_in => null]); $subscribe_per = number_format_com($subscribe / $browse * 100, 1, ''); - $watch_subscribe_per = number_format_com($watch_subscribe / $browse * 100, 1, ''); - $order_subscribe_per = number_format_com($order_subscribe / $browse * 100, 1, ''); + $watch_subscribe_per = number_format_com($watch_subscribe / $subscribe * 100, 1, ''); + $order_subscribe_per = number_format_com($order_subscribe / $watch_subscribe * 100, 1, ''); $subscribe_expected_data = [['name' => "浏览人数100%", 'value' => 100], ['name' => "预约人数({$subscribe_per}%)", 'value' => 75] , ['name' => "观看人数({$watch_subscribe_per}%)", 'value' => 50], ['name' => "订单数({$order_subscribe_per}%)", 'value' => 25]]; $subscribe_actual_data = [['name' => '浏览人数', 'value' => $browse], ['name' => '预约人数', 'value' => $subscribe]