From 5d180b26beb46fb6cfc7d914219f0b0bc5b28e49 Mon Sep 17 00:00:00 2001 From: dengbw Date: Fri, 19 Aug 2022 15:35:45 +0800 Subject: [PATCH] userslog_819 --- admin/controllers/app/licheb/Userslog.php | 61 +++++++++++------------ admin/controllers/stats/Order.php | 6 ++- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php index 73125bdd..e2b5b24a 100644 --- a/admin/controllers/app/licheb/Userslog.php +++ b/admin/controllers/app/licheb/Userslog.php @@ -18,6 +18,7 @@ class Userslog extends HD_Controller $this->load->model('app/licheb/app_licheb_bizs_log_model', 'mdBizsLog'); $this->load->model('receiver/receiver_customers_visit_sales_model', 'mdCustomerVisitSales'); $this->load->model('receiver/receiver_customers_model', 'mdCustomers'); + $this->load->model('app/app_lichene_qy_log_model', 'mdWechatqyLog'); $this->load->model("biz/biz_model", 'mdBiz'); $this->load->model('area_model', 'mdArea'); } @@ -58,6 +59,10 @@ class Userslog extends HD_Controller private function dataBizSelect($params) { + !$params['type'] && $params['type'] = ''; + !$params['biz_id'] && $params['biz_id'] = ''; + !$params['city_id'] && $params['city_id'] = ''; + !$params['county_id'] && $params['county_id'] = ''; $lists = $where = $where_c = $where_dt = []; $same_day = 0; if ($params['time']) { @@ -77,16 +82,32 @@ class Userslog extends HD_Controller $where_c["c_time>="] = strtotime("2022-04-15 00:00:00"); $where_dt["dt_time>="] = "2022-04-15 00:00:00"; } - //门店搜索 - if (!$same_day && ($params['type'] || $params['biz_id'] || $params['city_id'] || $params['county_id'])) { + $where_qy = $where_c;//企微数 + $where_qy['change_type'] = 'add_external_contact'; + $where_user = $str_ids = ''; + $res_biz = []; + if ($params['type'] || $params['biz_id'] || $params['city_id'] || $params['county_id']) { $where_cdt['status'] = 1; - $params['type'] && $where_cdt['type'] = $params['type']; - $params['biz_id'] && $where_cdt['id'] = $params['biz_id']; - $params['city_id'] && $where_cdt['city_id'] = $params['city_id']; - $params['county_id'] && $where_cdt['county_id'] = $params['county_id']; + if ($params['biz_id']) { + $where_cdt['id'] = $params['biz_id']; + } else { + $params['type'] && $where_cdt['type'] = $params['type']; + $params['city_id'] && $where_cdt['city_id'] = $params['city_id']; + $params['county_id'] && $where_cdt['county_id'] = $params['county_id']; + } $res_biz = $this->mdBiz->select($where_cdt, 'id desc', 0, 0, 'id'); if ($res_biz) { $str_ids = implode(',', array_column($res_biz, 'id')); + $where["biz_id in ({$str_ids})"] = null; + $where_user = "biz_id in ({$str_ids})"; + } else { + $where['biz_id'] = -2; + $where_user = "biz_id = -2"; + } + } + //门店搜索 + if (!$same_day) {//不是搜索本日 + if ($res_biz) { $where_c["biz_id in ({$str_ids})"] = null; $where_dt["biz_id in ({$str_ids})"] = null; } else { @@ -94,29 +115,6 @@ class Userslog extends HD_Controller $where_dt['biz_id'] = -2; } } - if ($params['type']) { - $where["type"] = $params['type']; - } else { - $params['type'] = ''; - } - if ($params['biz_id']) { - $where['biz_id'] = $params['biz_id']; - } else if ($params['city_id']) { - $where_biz['status'] = 1; - $params['city_id'] && $where_biz['city_id'] = $params['city_id']; - $params['county_id'] && $where_biz['county_id'] = $params['county_id']; - $res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id'); - if ($res_biz) { - $str_ids = implode(',', array_column($res_biz, 'id')); - $where["biz_id in ({$str_ids})"] = null; - } else { - $where['biz_id'] = -2; - } - } else { - $params['city_id'] = ''; - $params['county_id'] = ''; - $params['biz_id'] = ''; - } $total = $this->mdBizsLog->count($where); $offlineSources = $this->mdCustomers->offlineSources(); if ($total) { @@ -232,8 +230,9 @@ class Userslog extends HD_Controller $menus[] = ['title' => "战败数", 'value' => intval($sum['defeats']), 'tag' => '个']; $sum = $this->mdUsersLog->sum('bills', $where); $menus[] = ['title' => "开票数", 'value' => intval($sum['bills']), 'tag' => '个']; - $sum = $this->mdUsersLog->sum('qy_adds', $where); - $menus[] = ['title' => "企微数", 'value' => intval($sum['qy_adds']), 'tag' => '人']; + $where_user && $where_qy["userid in(select userid from lc_app_licheb_users where $where_user)"] = null; + $qy_adds = $this->mdWechatqyLog->count($where_qy); + $menus[] = ['title' => "企微数", 'value' => $qy_adds, 'tag' => '人']; $sum = $this->mdUsersLog->sum('reassigns', $where); $menus[] = ['title' => "改派数", 'value' => intval($sum['reassigns']), 'tag' => '个']; $sum = $this->mdUsersLog->sum('receives', $where); diff --git a/admin/controllers/stats/Order.php b/admin/controllers/stats/Order.php index f0c4c905..9e542303 100644 --- a/admin/controllers/stats/Order.php +++ b/admin/controllers/stats/Order.php @@ -11,6 +11,7 @@ class order extends HD_Controller $this->load->model('receiver/order/receiver_orders_v2_model', 'mdOrders'); $this->load->model('receiver/receiver_customers_model', 'mdCustomers'); $this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog'); + $this->load->model('biz/biz_model', 'mdBiz'); } //首页信息 @@ -26,7 +27,6 @@ class order extends HD_Controller */ public function get_hozonauto() { - $this->load->model('biz/biz_model', 'mdBiz'); $brand_id = 4;//品牌id $params = $this->input->get(); !$params['type'] && $params['type'] = 1; @@ -369,6 +369,10 @@ class order extends HD_Controller return $this->show_view('stats/order/dfmc', true); } + private function dataSelect($params) + { + } + /** * Notes:计算出两个日期之间的月份 * Created on: 2022/8/9 14:38