From 3058841746505f9377efb21890bf1b414c805375 Mon Sep 17 00:00:00 2001 From: dengbw Date: Thu, 26 May 2022 17:48:15 +0800 Subject: [PATCH] customers_526 --- api/controllers/plan/Licheb.php | 2 +- api/controllers/plan/Plan.php | 2 +- api/controllers/wxapp/licheb/Customers.php | 33 ++++++++++++++-------- api/controllers/wxapp/licheb/User.php | 24 ++++++++-------- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/api/controllers/plan/Licheb.php b/api/controllers/plan/Licheb.php index 6314a7b5..98e455f4 100644 --- a/api/controllers/plan/Licheb.php +++ b/api/controllers/plan/Licheb.php @@ -215,7 +215,7 @@ class Licheb extends HD_Controller foreach ($res_u as $key => $value) { $id = $value['id']; $biz_id = $value['biz_id']; - $where_v = ['a.biz_id' => $biz_id, 'a.status<>' => 2, 'b.t_day' => $t_day, 'b.sales_id' => $id, 'b.status<>' => 2]; + $where_v = ['a.biz_id' => $biz_id, 'a.status in(0,1)' => null, 'b.t_day' => $t_day, 'b.sales_id' => $id, 'b.status<>' => 2]; $visit_count = $this->mdCustomerVisitData->count_visit($where_v); if ($visit_count) {//发送短信 send_alisms(array('mobile' => $value['mobile'], 'template' => 'SMS_242696263', 'param' => ['count' => $visit_count])); diff --git a/api/controllers/plan/Plan.php b/api/controllers/plan/Plan.php index 5a3a8862..fb17b194 100644 --- a/api/controllers/plan/Plan.php +++ b/api/controllers/plan/Plan.php @@ -33,7 +33,7 @@ class Plan extends CI_Controller //$plan[] = array('url' => base_url(array('plan', 'licheb', 'customer_level')), 'interval' => 1);//更新客户等级 $plan[] = array('url' => base_url(array('plan', 'licheb', 'visit_data')), 'interval' => 3);//更新客户回访记录 $plan[] = array('url' => base_url(array('plan', 'licheb', 'visit_sales')), 'interval' => 3);//客户回访顾问统计 - $plan[] = array('url' => base_url(array('plan', 'licheb', 'visit_sales_sms')), 'interval' => 3);//给销售发送待回访短信 + $plan[] = array('url' => base_url(array('plan', 'licheb', 'visit_sales_sms')), 'interval' => 2);//给销售发送待回访短信 $plan[] = array('url' => base_url(array('plan', 'licheb', 'customer_manager_sms')), 'interval' => 1);//给店长发送待分配短信 $plan[] = array('url' => base_url(array('plan', 'licheb', 'users_log')), 'interval' => 2);//顾问日志 diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 1fed419f..5859a65c 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -125,7 +125,6 @@ class Customers extends Wxapp protected function put_data() { $biz_id = $this->session['new_biz_id'] ? $this->session['new_biz_id'] : intval($this->session['biz_id']); - $id = $this->input_param('cus_id'); $name = $this->input_param('name'); $mobile = $this->input_param('mobile'); @@ -540,6 +539,7 @@ class Customers extends Wxapp $of2_id = intval($this->input_param('of2_id'));//线下来源二级 $s_visit_time = $this->input_param('s_visit_time');//回访开始时间 $e_visit_time = $this->input_param('e_visit_time');//回访结束时间 + $status_tp = intval($this->input_param('status_tp')); //状态类型 !$page && $page = 1; !$size && $size = 10; @@ -588,8 +588,12 @@ class Customers extends Wxapp $where['cont_time!='] = '0000-00-00 00:00:00'; } else { $where['cont_time'] = '0000-00-00 00:00:00'; + $status_tp = 1; } } + if ($status_tp == 1) { + $where['status in(0,1)'] = null; + } $unuse && $where['admin_id'] = 0; $admin_id && $where['admin_id'] = $admin_id; $id && $where['id'] = $id; @@ -606,7 +610,7 @@ class Customers extends Wxapp $lists = []; if ($count) { $fileds = 'id,name,admin_id,mobile,level,car_json,is_top,cf_title,brand_id,s_id,cont_time,c_time,if_defeat - ,of_id,of2_id,unionid,visit_time'; + ,of_id,of2_id,unionid,visit_time,status'; $rows = $this->customers_model->select($where, $orderby, $page, $size, $fileds); //获取管理员 $admin_arr = array_unique(array_column($rows, 'admin_id')); @@ -618,14 +622,14 @@ class Customers extends Wxapp ]; $admins = $this->app_user_model->map('id', '', $where, '', '', '', 'id,uname'); } - $allot = $this->get_allot(); + $status_name = $this->customers_model->get_status(); foreach ($rows as $key => $val) { $other_data = [ '客户来源' => $this->get_cfTitle($val), '建卡时间' => date('Y-m-d', $val['c_time']), ]; - $val['cont_time'] != '0000-00-00 00:00:00' && $other_data['上次联系'] = date('Y-m-d', strtotime($val['cont_time'])); + $val['cont_time'] != '0000-00-00 00:00:00' && $other_data['最近联系'] = date('Y-m-d', strtotime($val['cont_time'])); $val['visit_time'] != '0000-00-00' && $other_data['计划回访时间'] = $val['visit_time']; $other_data['销售顾问'] = isset($admins[$val['admin_id']]) ? $admins[$val['admin_id']][0]['uname'] : ''; $tags = [$val['level'] . '级用户']; @@ -640,6 +644,7 @@ class Customers extends Wxapp $orders_count = $this->mdOrders->count(['status' => 0, 'order_time' => '0000-00-00 00:00:00', 'customer_id' => $val['id']]); $orders_count && $orders_pay = '订单未支付'; } + $tip = $status_name[$val['status']] ? $status_name[$val['status']] : ''; $lists[] = [ 'id' => $val['id'], 'name' => $val['name'], @@ -652,7 +657,8 @@ class Customers extends Wxapp 'orders_pay' => $orders_pay, 'group_id' => $group_id, 'is_weChat' => $val['unionid'] ? true : false, - 'allot' => $allot + 'allot' => $allot, + 'tip' => $tip, ]; } } @@ -718,7 +724,7 @@ class Customers extends Wxapp !$page && $page = 1; !$size && $size = 10; $t_day = date('Y-m-d'); - $where = array('a.biz_id' => $biz_id, 'a.status<>' => 2, 'b.t_day' => $t_day); + $where = array('a.biz_id' => $biz_id, 'a.status in(0,1)' => null, 'b.t_day' => $t_day); $params['level'] && $where['a.level'] = $params['level'];//等级 if ($status == 2) {//已跟进 $where['b.status'] = 2; @@ -729,8 +735,8 @@ class Customers extends Wxapp $count = $this->mdCustomerVisitData->count_visit($where); $lists = []; if ($count) { - $fileds = 'a.id,a.name,a.admin_id,a.mobile,a.level,a.is_top,a.cont_time,a.c_time,a.if_defeat,a.cf_title,a.of_id,a.of2_id - ,a.of2_id'; + $fileds = 'a.id,a.name,a.admin_id,a.mobile,a.level,a.is_top,a.cont_time,a.c_time,a.if_defeat,a.cf_title + ,a.of_id,a.of2_id,a.status'; $rows = $this->mdCustomerVisitData->select_visit($where, 'a.id desc', $page, $size, $fileds); //获取管理员 $admin_arr = array_unique(array_column($rows, 'admin_id')); @@ -739,6 +745,7 @@ class Customers extends Wxapp $admin_ids = implode(',', $admin_arr); $admins = $this->app_user_model->map('id', '', ["id in ({$admin_ids})" => null], '', '', '', 'id,uname'); } + $status_name = $this->customers_model->get_status(); foreach ($rows as $key => $val) { $other_data = [ '客户来源' => $this->get_cfTitle($val), @@ -753,6 +760,7 @@ class Customers extends Wxapp } else if ($val['if_defeat'] == 2) { $defeat = '再战'; } + $tip = $status_name[$val['status']] ? $status_name[$val['status']] : ''; $lists[] = [ 'id' => $val['id'], 'name' => $val['name'], @@ -761,7 +769,8 @@ class Customers extends Wxapp 'is_top' => $val['is_top'], 'other_data' => $other_data, 'tags' => $tags, - 'defeat' => $defeat + 'defeat' => $defeat, + 'tip' => $tip, ]; } } @@ -988,10 +997,10 @@ class Customers extends Wxapp */ private function get_allot() { - $allot = 0; + $allot = 1; $group_id = $this->session['group_id']; - if ($group_id == 2 || $group_id == 3) {//店长和老板可再分配用户 - $allot = 1; + if ($group_id == 1) {//销售不可分配用户 + $allot = 0; } return $allot; } diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php index f305b376..6e7c8e54 100644 --- a/api/controllers/wxapp/licheb/User.php +++ b/api/controllers/wxapp/licheb/User.php @@ -132,7 +132,7 @@ class User extends Wxapp 'biz_id' => $biz_id, 'biz_name' => $biz['biz_name'] ? $biz['biz_name'] : '', 'biz_type' => $biz['type'] ? $biz['type'] : '', - 'show_sa' => $biz_id==70 ? true : false, + 'show_sa' => $biz_id == 70 ? true : false, ); return $data; @@ -229,7 +229,7 @@ class User extends Wxapp $where = [ "cont_time = '0000-00-00 00:00:00'" => null, 'biz_id' => $biz_id, - 'status<>' => 3 + 'status in(0,1)' => null ]; $group_id == 1 && $where['admin_id'] = $uid; $group_id == 4 && $where['brand_id!='] = 3; //渠道经理过滤 @@ -322,8 +322,8 @@ class User extends Wxapp ['title' => '发票开具', 'icon' => 'icon-kaipiao1', 'total' => $kp_total, 'page' => '/pages/order/filterList/index2?type=kp&title=发票开具'], ['title' => '交付确认', 'icon' => 'icon-jiaofu', 'total' => $ck_total, 'page' => '/pages/order/filterList/index2?type=jf&title=交付确认'], ]; - $where_v = ['a.biz_id' => $biz_id, 'a.status<>' => 2, 'b.t_day' => date('Y-m-d')]; - $where_c = ['biz_id' => $biz_id]; + $where_v = ['a.biz_id' => $biz_id, 'a.status in(0,1)' => null, 'b.t_day' => date('Y-m-d')]; + $where_c = ['biz_id' => $biz_id, 'status in(0,1)' => null]; $group_id == 4 && $where_c['brand_id!='] = 3; if ($group_id == 1) { $where_v['b.sales_id'] = $uid; @@ -339,19 +339,19 @@ class User extends Wxapp $b_num_1 = $this->mdCustomerVisitData->count_visit(array_merge($where_v, ['a.level' => 'B', 'b.status<>' => 2])); $b_num_2 = $this->mdCustomerVisitData->count_visit(array_merge($where_v, ['a.level' => 'B', 'b.status' => 2])); $levelSt = [ - ['title' => 'H级客户', 'list' => [['title' => '总数', 'num' => $h_num, 'url' => ''], ['title' => '今日需跟进 >', 'num' => $h_num_1 - , 'url' => '/pages/customer/filterList/index?level=H&status=1&visit=1&title=H级今日需跟进'] + ['title' => 'H级客户', 'list' => [['title' => '总数 >', 'num' => $h_num, 'url' => '/pages/customer/filterList/index?level=H&status_tp=1&title=H级客户'] + , ['title' => '今日需跟进 >', 'num' => $h_num_1, 'url' => '/pages/customer/filterList/index?level=H&status=1&visit=1&title=H级今日需跟进'] , ['title' => '今日已跟进 >', 'num' => $h_num_2, 'url' => '/pages/customer/filterList/index?level=H&status=2&visit=1&title=H级今日已跟进']]], - ['title' => 'A级客户', 'list' => [['title' => '总数', 'num' => $a_num, 'url' => ''], ['title' => '今日需跟进 >', 'num' => $a_num_1 - , 'url' => '/pages/customer/filterList/index?level=A&status=1&visit=1&title=A级今日需跟进'] + ['title' => 'A级客户', 'list' => [['title' => '总数 >', 'num' => $a_num, 'url' => '/pages/customer/filterList/index?level=A&status_tp=1&title=A级客户'] + , ['title' => '今日需跟进 >', 'num' => $a_num_1, 'url' => '/pages/customer/filterList/index?level=A&status=1&visit=1&title=A级今日需跟进'] , ['title' => '今日已跟进 >', 'num' => $a_num_2, 'url' => '/pages/customer/filterList/index?level=A&status=2&visit=1&title=A级今日已跟进']]], - ['title' => 'B级客户', 'list' => [['title' => '总数', 'num' => $b_num, 'url' => ''], ['title' => '今日需跟进 >', 'num' => $b_num_1 - , 'url' => '/pages/customer/filterList/index?level=B&status=1&visit=1&title=B级今日需跟进'] + ['title' => 'B级客户', 'list' => [['title' => '总数 >', 'num' => $b_num, 'url' => '/pages/customer/filterList/index?level=B&status_tp=1&title=B级客户'] + , ['title' => '今日需跟进 >', 'num' => $b_num_1, 'url' => '/pages/customer/filterList/index?level=B&status=1&visit=1&title=B级今日需跟进'] , ['title' => '今日已跟进 >', 'num' => $b_num_2, 'url' => '/pages/customer/filterList/index?level=A&status=2&visit=1&title=A级今日已跟进']]], ]; $data = [ - 'wl_count' => $wl_count, - 'gz_count' => $gz_count, + 'wl_count' => ['title' => '录入未跟进(人)', 'num' => $wl_count, 'url' => '/pages/customer/filterList/index?iscall=0&title=录入未跟进'], + 'gz_count' => ['title' => '特别关注客户(人)', 'num' => $gz_count, 'url' => '/pages/customer/filterList/index?istop=1&title=特别关注客户'], 'sign_count' => $sign_count, 'loan_count' => $loan_count, 'deallist' => $deallist,