From ce91711da80d268a4bc04b9d92d54de8e1aa90aa Mon Sep 17 00:00:00 2001 From: dengbw Date: Tue, 19 Apr 2022 10:45:23 +0800 Subject: [PATCH] userslog_419 --- admin/controllers/app/licheb/Userslog.php | 43 +++++++++++++---------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php index d56c988d..2fc38a4a 100644 --- a/admin/controllers/app/licheb/Userslog.php +++ b/admin/controllers/app/licheb/Userslog.php @@ -94,21 +94,28 @@ class Userslog extends HD_Controller $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']]; + $temp = ['uname' => $uname, 'biz_type' => $biz_type, 'biz_name' => $biz_name, 'defeats' => $v['defeats'] + , 'a_num' => $v['a_num'], 'orders' => $v['orders'], 'bills' => $v['bills'], 'follows' => $v['follows'] + , 'log_date' => $v['log_date']]; foreach ($offlineSources as $key1 => $value1) { $nums = intval($v['customer_' . $key1]); + if ($params['size'] == 10000) {//导出使用 + $temp['customer_' . $key1] = $nums; + } if ($nums) { $customers += $nums; - if ($customers_info) { - $customers_info = $customers_info . '+' . $value1['name'] . '(' . $nums . ')'; - } else { - $customers_info = $value1['name'] . '(' . $nums . ')'; + if ($params['size'] != 10000) { + if ($customers_info) { + $customers_info = $customers_info . '+' . $value1['name'] . '(' . $nums . ')'; + } else { + $customers_info = $value1['name'] . '(' . $nums . ')'; + } } } } $customers_info && $customers = $customers . '=' . $customers_info; - $lists[] = ['uname' => $uname, 'biz_type' => $biz_type, 'biz_name' => $biz_name, 'defeats' => $v['defeats'] - , 'a_num' => $v['a_num'], 'orders' => $v['orders'], 'bills' => $v['bills'], 'follows' => $v['follows'] - , 'customers' => $customers, 'log_date' => $v['log_date']]; + $temp['customers'] = $customers; + $lists[] = $temp; } } $data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total); @@ -147,20 +154,20 @@ class Userslog extends HD_Controller $data = $indexs = array(); $res = $this->dataSelect($params); $fileName = $res['_title']; + $offlineSources = $this->mdCustomers->offlineSources(); foreach ($res['lists'] as $key => $value) { $data[] = $value; } - $indexs = [ - 'biz_name' => '门店', - 'uname' => '顾问', - 'customers' => '客户数', - 'a_num' => '进店数', - 'follows' => '跟进数', - "orders" => "订单数", - "defeats" => "战败数", - "bills" => "开票数", - "log_date" => "日期", - ]; + $indexs = ['biz_name' => '门店', 'uname' => '顾问', 'customers' => '客户数']; + foreach ($offlineSources as $key1 => $value1) { + $indexs['customer_' . $key1] = $value1['name']; + } + $indexs['a_num'] = '进店数'; + $indexs['follows'] = '跟进数'; + $indexs['orders'] = '订单数'; + $indexs['defeats'] = '战败数'; + $indexs['bills'] = '开票数'; + $indexs['log_date'] = '日期'; array_unshift($data, $indexs); $this->load->library('excel'); $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));