From c2a4dd1bddc85abde793647028ded3b70b37521e Mon Sep 17 00:00:00 2001 From: dengbw Date: Mon, 18 Apr 2022 13:51:34 +0800 Subject: [PATCH] userslog_418 --- admin/controllers/app/licheb/Main.php | 9 + admin/controllers/app/licheb/Userslog.php | 128 +++++++++++ admin/controllers/app/licheb/Usersog.php | 153 ------------- admin/views/app/licheb/userslog/lists.php | 249 ++++++++++++++++++++++ api/controllers/wxapp/liche/Auto.php | 7 + 5 files changed, 393 insertions(+), 153 deletions(-) create mode 100644 admin/controllers/app/licheb/Userslog.php delete mode 100644 admin/controllers/app/licheb/Usersog.php create mode 100644 admin/views/app/licheb/userslog/lists.php diff --git a/admin/controllers/app/licheb/Main.php b/admin/controllers/app/licheb/Main.php index 65e3b085..d56cfd6c 100644 --- a/admin/controllers/app/licheb/Main.php +++ b/admin/controllers/app/licheb/Main.php @@ -20,6 +20,7 @@ class Main extends HD_Controller $this->load->model('app/material/Material_biz_model', 'mdMaterialBiz'); $this->load->model('topics/topics_model', 'mdTopics'); $this->load->model('live/Live_polyv_session_model', 'mdPolyvSession'); + $this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog'); } public function index() @@ -89,6 +90,14 @@ class Main extends HD_Controller array('name' => '查看详情', 'url' => '/live/polyv'), ), ); +// $value = $this->mdUsersLog->count(); +// $list[] = array( +// 'title' => '顾问日志', +// 'value' => $value, +// 'btns' => array( +// array('name' => '查看详情', 'url' => 'app/licheb/userslog'), +// ), +// ); $conditions[] = array('icon' => 'am-icon-user', 'list' => $list); /*小程序设置 end*/ diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php new file mode 100644 index 00000000..4500ac00 --- /dev/null +++ b/admin/controllers/app/licheb/Userslog.php @@ -0,0 +1,128 @@ +load->model('app/licheb/app_licheb_users_model', 'mdUsers'); + $this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog'); + $this->load->model('receiver/receiver_customers_model', 'mdCustomers'); + $this->load->model("biz/biz_model", 'mdBiz'); + $this->load->model('area_model', 'mdArea'); + } + + public function index() + { + return $this->lists(); + } + + public function lists() + { + $params = $this->input->get(); + $params['page'] = $params['page'] ? intval($params['page']) : 1; + $params['size'] = $params['size'] ? intval($params['size']) : 20; + $lists = $where = []; + if ($params['uname']) { + $where["sale_id in(select id from lc_app_licheb_users where uname like '%{$params['uname']}%')"] = null; + } + 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'] = ''; + } + if ($params['time']) { + $time = explode(' ~ ', $params['time']); + $time[0] && $where["log_date>="] = $time[0]; + $time[1] && $where["log_date<="] = $time[1]; + } + $total = $this->mdUsersLog->count($where); + if ($total) { + $res = $this->mdUsersLog->select($where, "id desc", $params['page'], $params['size']); + $sale_ids = $biz_ids = []; + foreach ($res as $v) { + $v['sale_id'] && !in_array($v['sale_id'], $sale_ids) && $sale_ids[] = $v['sale_id']; + $v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_id']; + } + $map_sale = $map_biz = $map_city = []; + if ($sale_ids) { + $str_ids = implode(',', $sale_ids); + $map_sale = $this->mdUsers->map('id', 'uname', ["id in ({$str_ids})" => null]); + } + if ($biz_ids) { + $str_ids = implode(',', $biz_ids); + $map_biz = $this->mdBiz->map('id', 'biz_name,type', ["id in ({$str_ids})" => null]); + } + $offlineSources = $this->mdCustomers->offlineSources(); + $typeAry = $this->mdBiz->type_ary(); + foreach ($res as $v) { + $uname = $biz_name = $biz_type = $city_name = ''; + $map_sale[$v['sale_id']] && $uname = $map_sale[$v['sale_id']]; + $map_biz[$v['biz_id']]['biz_name'] && $biz_name = $map_biz[$v['biz_id']]['biz_name']; + $map_biz[$v['biz_id']]['type'] && $biz_type = $typeAry[$map_biz[$v['biz_id']]['type']]; + if ($v['city_id']) { + $re_area = $this->mdArea->get(array('city_id' => $v['city_id'])); + $re_area['city_name'] && $city_name = $re_area['city_name']; + } + $customers = 0; + foreach ($offlineSources as $key1 => $value1) { + $customers += intval($v['customer_' . $key1]); + } + $lists[] = ['uname' => $uname, 'biz_type' => $biz_type, 'biz_name' => $biz_name, 'city_name' => $city_name + , 'a_num' => $v['a_num'], 'orders' => $v['orders'], 'bills' => $v['bills'], 'follows' => $v['follows'] + , 'customers' => $customers, 'log_date' => $v['log_date']]; + } + } + $this->data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total); + $this->data['lists'] = $lists; + $this->data['params'] = $params; + $this->data['_title'] = "顾问日志"; + $this->show_view('app/licheb/userslog/lists', true); + } + + + public function get() + { + } + + public function add() + { + } + + public function edit() + { + } + + public function del() + { + } + + + public function batch() + { + } + + public function export() + { + } +} \ No newline at end of file diff --git a/admin/controllers/app/licheb/Usersog.php b/admin/controllers/app/licheb/Usersog.php deleted file mode 100644 index db1be405..00000000 --- a/admin/controllers/app/licheb/Usersog.php +++ /dev/null @@ -1,153 +0,0 @@ -load->model('items/items_stock_log_model', 'mdStockLog'); - $this->load->model('items/items_model', 'mdItems'); - $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); - $this->load->model('auto/auto_series_model', 'mdAutoSeries'); - $this->load->model("biz/biz_model", 'mdBiz'); - $this->load->model('area_model', 'mdArea'); - } - - public function index() - { - return $this->lists(); - } - - public function lists() - { - $params = $this->input->get(); - $params['page'] = $params['page'] ? intval($params['page']) : 1; - $params['size'] = $params['size'] ? intval($params['size']) : 20; - $lists = $where = []; - $params['days_sort'] = $params['days_sort'] ? $params['days_sort'] : ''; - if ($params['days_sort']) { - $order = $params['days_sort'] == 1 ? 'stay_days desc,id desc' : 'stay_days asc,id desc'; - } else { - $order = "id desc"; - } - if ($params['brand_id']) { - $where['brand_id'] = $params['brand_id']; - } - if ($params['s_id']) { - $where['s_id'] = $params['s_id']; - } - if ($params['vin']) { - $where["item_id in(select id from lc_items where vin like '%{$params['vin']}%')"] = null; - } - 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'] = ''; - } - if ($params['time']) { - $time = explode(' ~ ', $params['time']); - $time[0] && $where["log_date>="] = $time[0]; - $time[1] && $where["log_date<="] = $time[1]; - } - $autoList[1] = $this->mdAutoBrand->select(array('status' => 1), "id desc", 0, 0, 'id,name'); - if ($params['brand_id']) { - $autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name'); - } - $total = $this->mdStockLog->count($where); - if ($total) { - $res = $this->mdStockLog->select($where, $order, $params['page'], $params['size']); - $brand_ids = $s_ids = $biz_ids = $item_ids = array(); - foreach ($res as $v) { - $v['brand_id'] && !in_array($v['brand_id'], $brand_ids) && $brand_ids[] = $v['brand_id']; - $v['s_id'] && !in_array($v['s_id'], $s_ids) && $s_ids[] = $v['s_id']; - $v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_id']; - $v['item_id'] && !in_array($v['item_id'], $item_ids) && $item_ids[] = $v['item_id']; - } - $map_brand = $map_sery = $map_biz = $map_item = array(); - if ($brand_ids) { - $str_ids = implode(',', $brand_ids); - $map_brand = $this->mdAutoBrand->map('id', 'name', ["id in ({$str_ids})" => null]); - } - if ($s_ids) { - $str_ids = implode(',', $s_ids); - $map_sery = $this->mdAutoSeries->map('id', 'name', ["id in ({$str_ids})" => null]); - } - if ($biz_ids) { - $str_ids = implode(',', $biz_ids); - $map_biz = $this->mdBiz->map('id', 'biz_name', ["id in ({$str_ids})" => null]); - } - if ($item_ids) { - $str_ids = implode(',', $item_ids); - $map_item = $this->mdItems->map('id', 'vin', ["id in ({$str_ids})" => null]); - } - foreach ($res as $v) { - $address = $map_biz[$v['biz_id']]; - $re_biz = $this->mdBiz->get(array('id' => $v['biz_id'])); - if ($re_biz['county_id']) { - $re_area = $this->mdArea->get(array('county_id' => $re_biz['county_id'])); - $re_area && $address = "{$re_area['city_name']} {$re_area['county_name']} {$address}"; - } else if ($re_biz['city_id']) { - $re_area = $this->mdArea->get(array('city_id' => $re_biz['city_id'])); - $re_area && $address = "{$re_area['city_name']} {$address}"; - } - $title = "{$map_brand[$v['brand_id']]}-{$map_sery[$v['s_id']]}"; - $vin = $map_item[$v['item_id']]; - $in_time = !$v['in_time'] || '0000-00-00 00:00:00' == $v['in_time'] ? '' : substr($v['in_time'], 0, 10); - $lists[] = ['item_id' => $v['item_id'], 'title' => $title, 'vin' => $vin, 'in_time' => $in_time, 'address' => $address - , 'log_date' => $v['log_date'], 'stay_days' => $v['stay_days']]; - } - } - $this->data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total); - $this->data['lists'] = $lists; - $this->data['autoList'] = $autoList; - $this->data['params'] = $params; - $this->data['_title'] = "库存车辆日志"; - $this->show_view('items/stock/lists', true); - } - - - public function get() - { - } - - public function add() - { - } - - public function edit() - { - } - - public function del() - { - } - - - public function batch() - { - } - - public function export() - { - } -} \ No newline at end of file diff --git a/admin/views/app/licheb/userslog/lists.php b/admin/views/app/licheb/userslog/lists.php new file mode 100644 index 00000000..835c0537 --- /dev/null +++ b/admin/views/app/licheb/userslog/lists.php @@ -0,0 +1,249 @@ +
+ +
+
共有条数据
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
顾问名字门店类型城市到店数订单数开票数跟进数客户数日志日期
+
+
+
+
+
+ +
+
+
+ diff --git a/api/controllers/wxapp/liche/Auto.php b/api/controllers/wxapp/liche/Auto.php index a1ca6f33..673a68c5 100644 --- a/api/controllers/wxapp/liche/Auto.php +++ b/api/controllers/wxapp/liche/Auto.php @@ -27,6 +27,7 @@ class Auto extends Wxapp protected function get_introduce() { $this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce'); + $this->load->model("biz/biz_model", 'mdBiz'); $id = intval($this->input_param('id')); $biz_id = intval($this->input_param('biz_id')); $re = $this->mdAutoIntroduce->get(array('id' => $id, 'status' => 1)); @@ -40,9 +41,15 @@ class Auto extends Wxapp $this->addTag(['c_id' => $re_cus['id'], 'brand_id' => $re['brand_id']]); } } + $biz_name = ''; + if ($biz_id) { + $re_biz = $this->mdBiz->get(array('id' => $biz_id, 'status' => 1)); + $re_biz['biz_name'] && $biz_name = $re_biz['biz_name']; + } $sign_up = $this->session['mobile'] ? 0 : 1; $data = array( 'title' => '车型介绍', + 'biz_name' => $biz_name, "video" => $re['video'] ? build_qiniu_image_url($re['video'], 0, 0, 'video') : '', 'content' => $re['content'], 'sign_up' => $sign_up,