userslog_419

This commit is contained in:
dengbw
2022-04-19 10:45:23 +08:00
parent 026f10911a
commit ce91711da8
+25 -18
View File
@@ -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'));