From a680e7d035bf0a1df8c5507e05f9ff262a62e66f Mon Sep 17 00:00:00 2001 From: dengbw Date: Tue, 19 Apr 2022 15:39:29 +0800 Subject: [PATCH] transfer_419_3 --- admin/controllers/app/licheb/Userslog.php | 9 ++++++++- api/controllers/wxapp/licheb/Customers.php | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php index 2fc38a4a..770f7a83 100644 --- a/admin/controllers/app/licheb/Userslog.php +++ b/admin/controllers/app/licheb/Userslog.php @@ -97,10 +97,14 @@ class Userslog extends HD_Controller $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']]; + $customer_json = $v['customer_json'] ? json_decode($v['customer_json'], true) : []; foreach ($offlineSources as $key1 => $value1) { $nums = intval($v['customer_' . $key1]); if ($params['size'] == 10000) {//导出使用 $temp['customer_' . $key1] = $nums; + foreach ($value1['list'] as $key2 => $value2) { + $temp['customer_' . $key2] = intval($customer_json[$key1]['list'][$key2]['num']); + } } if ($nums) { $customers += $nums; @@ -160,7 +164,10 @@ class Userslog extends HD_Controller } $indexs = ['biz_name' => '门店', 'uname' => '顾问', 'customers' => '客户数']; foreach ($offlineSources as $key1 => $value1) { - $indexs['customer_' . $key1] = $value1['name']; + $indexs['customer_' . $key1] = '【'.$value1['name'].'】'; + foreach ($value1['list'] as $key2 => $value2) { + $indexs['customer_' . $key2] = $value2; + } } $indexs['a_num'] = '进店数'; $indexs['follows'] = '跟进数'; diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index c7ee9ec1..95fcdcdf 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -372,8 +372,21 @@ class Customers extends Wxapp } } strlen($is_top) && $up_data['is_top'] = $is_top; - $t_num && $up_data['t_num = t_num+1'] = null; + if ($a_num || $t_num) { + $day = date('Y-m-d'); + if ($a_num) {//判断今日是否到店 + $re = $this->customer_oplogs_model->get(['customer_id' => $id, 'type' => 4, + 'c_time >=' => strtotime($day . ' 00:00:00'), 'c_time <=' => strtotime($day . ' 23:59:59')]); + $re && $a_num = 0; + } + if ($t_num) {//判断今日是否试驾 + $re = $this->customer_oplogs_model->get(['customer_id' => $id, 'type' => 5, + 'c_time >=' => strtotime($day . ' 00:00:00'), 'c_time <=' => strtotime($day . ' 23:59:59')]); + $re && $t_num = 0; + } + } $a_num && $up_data['a_num = a_num+1'] = null; + $t_num && $up_data['t_num = t_num+1'] = null; $result = true; if ($up_data) { $a_log = '';//到店