From 2ebb7eb26243c5e6c9ed476bc59d355473bfdb8c Mon Sep 17 00:00:00 2001 From: qianhy Date: Fri, 24 Feb 2023 18:05:34 +0800 Subject: [PATCH] userslog status: wxqy and wxgr --- admin/controllers/app/licheb/Userslog.php | 33 +++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php index de9c8e55..b41bdea0 100644 --- a/admin/controllers/app/licheb/Userslog.php +++ b/admin/controllers/app/licheb/Userslog.php @@ -18,6 +18,9 @@ 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('receiver/order/receiver_orders_v2_model', 'orders_model'); + $this->load->model('receiver/order/receiver_order_deliverys_model', 'order_deliverys_model'); + $this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model'); $this->load->model('app/app_lichene_qy_log_model', 'mdWechatqyLog'); $this->load->model("biz/biz_model", 'mdBiz'); $this->load->model('area_model', 'mdArea'); @@ -63,7 +66,8 @@ class Userslog extends HD_Controller !$params['biz_id'] && $params['biz_id'] = ''; !$params['city_id'] && $params['city_id'] = ''; !$params['county_id'] && $params['county_id'] = ''; - $lists = $where_c = $where_dt = $where = []; + $lists = $where_c = $where_dt = $where = $where_order = $where_order_del = $where_gr = []; + $where_gr['type'] = 10; $same_day = 0; if ($params['time']) { $time = explode(' ~ ', $params['time']); @@ -72,15 +76,20 @@ class Userslog extends HD_Controller $where["log_date>="] = $time[0]; $where_c["c_time>="] = strtotime("{$time[0]} 00:00:00"); $where_dt["dt_time>="] = "{$time[0]} 00:00:00"; + $where_order_del["c_time>="] = strtotime("{$time[0]} 00:00:00"); + $where_gr["c_time>="] = strtotime("{$time[0]} 00:00:00"); } if ($time[1]) { $where["log_date<="] = $time[1]; $where_c["c_time<="] = strtotime("{$time[1]} 23:59:59"); $where_dt["dt_time<="] = "{$time[1]} 23:59:59"; + $where_order_del["c_time<="] = strtotime("{$time[1]} 23:59:59"); + $where_gr["c_time<="] = strtotime("{$time[1]} 23:59:59"); } } else { $where_c["c_time>="] = strtotime("2022-04-15 00:00:00"); $where_dt["dt_time>="] = "2022-04-15 00:00:00"; + $where_order_del["c_time>="] = strtotime("2022-04-15 00:00:00"); } $where_qy = $where_c;//企微数 $where_qy['change_type'] = 'add_external_contact'; @@ -103,6 +112,8 @@ class Userslog extends HD_Controller $where_c["biz_id in ({$str_ids})"] = null; $where_dt["biz_id in ({$str_ids})"] = null; } + $where_order["biz_id in ({$str_ids})"] = null; + $where_gr["customer_id in (select id from lc_receiver_customers where biz_id in ({$str_ids}))"] = null; } else { $where['biz_id'] = -2; $where_user = "biz_id = -2"; @@ -110,6 +121,8 @@ class Userslog extends HD_Controller $where_c['biz_id'] = -2; $where_dt['biz_id'] = -2; } + $where_order['biz_id'] = -2; + $where_gr['type'] = -2; } } $total = $this->mdBizsLog->count($where); @@ -227,9 +240,25 @@ 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' => '个']; + $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' => '人']; + #$menus[] = ['title' => "企微数", 'value' => $qy_adds, 'tag' => '人']; + $qy_dts = $this->mdCustomers->count(array_merge($where_dt, ['wxqy' => 1])); + $this->order_deliverys_model->get(array_merge($where_order_del, ['status in (1, 2)'=> null]), 'o_id'); + $del_sql = $this->order_deliverys_model->db->last_query(); + $this->orders_model->get(array_merge($where_order, ["id in ($del_sql)" => null]), 'customer_id'); + $order_sql = $this->orders_model->db->last_query(); + $qy_deliverys = $this->mdCustomers->count(array_merge($where_order, ['wxqy' => 1, "id in ($order_sql)" => null])); + $qy_info = "
进店数:{$qy_dts}
交付数:{$qy_deliverys}"; + $menus[] = ['title' => "企微数", 'note' => $qy_adds ? "新增数:{$qy_adds}{$qy_info}" : '0人']; + + $gr_adds = $this->customer_oplogs_model->count($where_gr); + $gr_dts = $this->mdCustomers->count(array_merge($where_dt, ['wxgr' => 1])); + $gr_deliverys = $this->mdCustomers->count(array_merge($where_order, ['wxgr' => 1, "id in ($order_sql)" => null])); + $gr_info = "
进店数:{$gr_dts}
交付数:{$gr_deliverys}"; + $menus[] = ['title' => "个微数", 'note' => $gr_adds ? "新增数:{$gr_adds}{$gr_info}" : '0人']; + $sum = $this->mdUsersLog->sum('reassigns', $where); $menus[] = ['title' => "改派数", 'value' => intval($sum['reassigns']), 'tag' => '个']; $sum = $this->mdUsersLog->sum('receives', $where);