diff --git a/admin/controllers/app/licheb/Userslog.php b/admin/controllers/app/licheb/Userslog.php
index fe9da23c..deeaef82 100644
--- a/admin/controllers/app/licheb/Userslog.php
+++ b/admin/controllers/app/licheb/Userslog.php
@@ -122,6 +122,25 @@ class Userslog extends HD_Controller
$lists[] = $temp;
}
}
+ if ($params['size'] != 10000) {
+ $sum = $this->mdUsersLog->sum('customers', $where);
+ $menus[] = ['title' => "客户数", 'value' => $sum['customers'], 'tag' => '人'];
+ $sum = $this->mdUsersLog->sum('a_num', $where);
+ $menus[] = ['title' => "进店数", 'value' => $sum['a_num'], 'tag' => '人'];
+ $sum = $this->mdUsersLog->sum('follows', $where);
+ $menus[] = ['title' => "跟进数", 'value' => $sum['follows'], 'tag' => '个'];
+ $sum = $this->mdUsersLog->sum('orders', $where);
+ $menus[] = ['title' => "订单数", 'value' => $sum['orders'], 'tag' => '个'];
+ $sum = $this->mdUsersLog->sum('defeats', $where);
+ $menus[] = ['title' => "战败数", 'value' => $sum['defeats'], 'tag' => '个'];
+ $sum = $this->mdUsersLog->sum('bills', $where);
+ $menus[] = ['title' => "开票数", 'value' => $sum['bills'], 'tag' => '个'];
+ $sum = $this->mdUsersLog->sum('qy_adds', $where);
+ $menus[] = ['title' => "新增企微", 'value' => $sum['qy_adds'], 'tag' => '人'];
+ $sum = $this->mdUsersLog->sum('qy_dels', $where);
+ $menus[] = ['title' => "删除企微", 'value' => $sum['qy_dels'], 'tag' => '人'];
+ $data['menus'] = $menus;
+ }
$data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
$data['lists'] = $lists;
$data['params'] = $params;
@@ -164,7 +183,7 @@ 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;
}
diff --git a/admin/views/app/licheb/userslog/lists.php b/admin/views/app/licheb/userslog/lists.php
index ba29e71f..9e037944 100644
--- a/admin/views/app/licheb/userslog/lists.php
+++ b/admin/views/app/licheb/userslog/lists.php
@@ -1,3 +1,12 @@
+
+
+ foreach ($menus as $key => $value) { ?>
+
+ = $value['title'] ?> = $value['value'] ?>= $value['tag'] ?>
+ |
+ } ?>
+
+
+
共有= $pager['totle'] ?>条数据
@@ -272,3 +282,13 @@
});
});
+
diff --git a/api/controllers/plan/Licheb.php b/api/controllers/plan/Licheb.php
index 364ede56..32a91961 100644
--- a/api/controllers/plan/Licheb.php
+++ b/api/controllers/plan/Licheb.php
@@ -90,7 +90,7 @@ class Licheb extends HD_Controller
$bills = $this->mdOrdersV2->count(['sale_id' => $sale_id, 'biz_id' => $biz_id, 'status>=' => 0,
'bill_time>=' => "{$log_date} 00:00:00", 'bill_time<=' => "{$log_date} 23:59:59"]
);
- $qy_adds = $qy_dels = 0;
+ $qy_adds = $qy_dels = $customers = 0;
if ($value['userid']) {
$qy_adds = $this->mdWechatqyLog->count(['userid' => $value['userid'], 'change_type' => 'add_external_contact'
, 'c_time>=' => $s_time, 'c_time<=' => $e_time]);
@@ -105,6 +105,7 @@ class Licheb extends HD_Controller
$customer_num1 = $this->mdCustomers->count(['of_id' => $key1, 'admin_id' => $sale_id
, 'status>=' => 0, 'c_time>=' => $s_time, 'c_time<=' => $e_time]);
if ($customer_num1) {//一级
+ $customers += $customer_num1;
$add_item["customer_{$key1}"] = $customer_num1;
$list = '';
foreach ($value1['list'] as $key2 => $value2) {
@@ -118,6 +119,7 @@ class Licheb extends HD_Controller
}
}
$customer_json && $add_item['customer_json'] = json_encode($customer_json, JSON_UNESCAPED_UNICODE);
+ $add_item['customers'] = $customers;
$add_id = $this->mdUsersLog->add($add_item);
$add_id && $log[] = array('id' => $sale_id, 'addDate' => $add_item);
}
diff --git a/api/controllers/plan/Temp.php b/api/controllers/plan/Temp.php
index 3589a653..c8ec84f1 100644
--- a/api/controllers/plan/Temp.php
+++ b/api/controllers/plan/Temp.php
@@ -16,6 +16,47 @@ class Temp extends HD_Controller
$this->log_file = 'temp.log';
}
+ /**
+ * Notes:更新顾问客户数
+ * Created on: 2022/3/09 11:58
+ * Created by: dengbw
+ * https://liche-api-dev.xiaoyu.com/plan/temp/receiver_users_log
+ * https://api.liche.cn/plan/temp/receiver_users_log
+ */
+ public function receiver_users_log()
+ {
+ $this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog');
+ $param = $this->input->get();
+ $param['page'] = intval($param['page']);
+ $param['size'] = intval($param['size']);
+ !$param['size'] && $param['size'] = 200;
+ !$param['page'] && $param['page'] = 1;
+ $counts = intval($param['counts']);
+ ob_start(); //打开缓冲区
+ $where = ["id>" => 0];
+ $res = $this->mdUsersLog->select($where, 'id ASC', $param['page'], $param['size'], 'id,customer_1,customer_2,customer_3
+ ,customer_4,customer_5');
+ if (!$res) {
+ echo '
本次更新顾问客户数完成了:';
+ echo '
成功更新 ' . $counts . ' 条';
+ echo '
点击将再次更新顾问客户数>>>';
+ exit;
+ }
+ $log = array();
+ foreach ($res as $key => $value) {
+ $customers = $value['customer_1'] + $value['customer_2'] + $value['customer_3'] + $value['customer_4'] + $value['customer_5'];
+ $this->mdUsersLog->update(['customers' => $customers], ['id' => $value['id']]);
+ $log[] = ['id' => $value['id'], 'customers' => $customers];
+ $counts++;
+ }
+ echo '
成功更新:';
+ $log && print_r($log);
+ echo '
数据库获取:';
+ echo json_encode($res, JSON_UNESCAPED_UNICODE);
+ header('refresh:3;url=/plan/temp/receiver_users_log?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
+ ob_end_flush();//输出全部内容到浏览器
+ }
+
/**
* Notes:更新战败客户信息
* Created on: 2022/3/09 11:58