Commit 0f3414f4 by html5-李恒逸

修改老业主不能报备问题

parent 2cfcee2a
...@@ -16,7 +16,7 @@ class Recommend extends CI_Controller{ ...@@ -16,7 +16,7 @@ class Recommend extends CI_Controller{
parent::__construct(); parent::__construct();
//加载用户语言 //加载用户语言
$this->language = $this->input->cookie('lang') ? $this->input->cookie('lang') : $this->config->item('language'); $this->language = $this->input->cookie('lang') ? $this->input->cookie('lang') : $this->config->item('language');
//加载配置文件 //加载配置文件
$this->config->load('user_config',true); $this->config->load('user_config',true);
$this->lang->load('error',$this->language); $this->lang->load('error',$this->language);
...@@ -31,7 +31,7 @@ class Recommend extends CI_Controller{ ...@@ -31,7 +31,7 @@ class Recommend extends CI_Controller{
} }
/** /**
* *
* 展示页面 * 展示页面
* @author wenhuijang * @author wenhuijang
* @version 2014-12-18 * @version 2014-12-18
...@@ -53,11 +53,11 @@ class Recommend extends CI_Controller{ ...@@ -53,11 +53,11 @@ class Recommend extends CI_Controller{
if($cur_user['check_status']==4){ if($cur_user['check_status']==4){
alert_redirect(site_url('distributor/logindis/logout'),'您的帐号已被后台注销'); alert_redirect(site_url('distributor/logindis/logout'),'您的帐号已被后台注销');
} }
$distributor_entity=$this->distributor->get(array('uniqid_id'=>$this->uniqid_id)); $distributor_entity=$this->distributor->get(array('uniqid_id'=>$this->uniqid_id));
$buildings=$this->bdrelation->get_all_building(array('D.id'=>$distributor_entity['id'],'R.is_deleted'=>0),1,10); $buildings=$this->bdrelation->get_all_building(array('D.id'=>$distributor_entity['id'],'R.is_deleted'=>0),1,10);
$this->data['buildings']=$buildings; $this->data['buildings']=$buildings;
$this->data['distributor_uniqid']=$distributor_entity['uniqid_id']; $this->data['distributor_uniqid']=$distributor_entity['uniqid_id'];
$this->data['distributor_name']=$distributor_entity['company_name']; $this->data['distributor_name']=$distributor_entity['company_name'];
//加载城市列表,楼盘列表 //加载城市列表,楼盘列表
...@@ -126,8 +126,8 @@ class Recommend extends CI_Controller{ ...@@ -126,8 +126,8 @@ class Recommend extends CI_Controller{
// echo json_encode($result) ; // echo json_encode($result) ;
// return; // return;
// } // }
//是否为融创客户 //是否为融创客户
$this->load->helper('rpc'); $this->load->helper('rpc');
$is_customer = rpc('is_customer', array('body' => array('phone' => $post['customer_phone'][$i],'buildingId'=>$building_code))); $is_customer = rpc('is_customer', array('body' => array('phone' => $post['customer_phone'][$i],'buildingId'=>$building_code)));
...@@ -137,18 +137,18 @@ class Recommend extends CI_Controller{ ...@@ -137,18 +137,18 @@ class Recommend extends CI_Controller{
echo json_encode($result); echo json_encode($result);
return; return;
} }
if($this->get_customer_type($post['customer_phone'][$i])) // if($this->get_customer_type($post['customer_phone'][$i]))
{ // {
$result = array('errcode'=>461000, 'errmsg'=> '老业主无法报备进入系统'); // $result = array('errcode'=>461000, 'errmsg'=> '老业主无法报备进入系统');
echo json_encode($result); // echo json_encode($result);
return; // return;
} // }
$distributor_entity=$this->distributor->get(array('uniqid_id' => $this->uniqid_id)); $distributor_entity=$this->distributor->get(array('uniqid_id' => $this->uniqid_id));
//多个分销商可以报备同一个客户 //多个分销商可以报备同一个客户
/* /*
未确认,所有分销商都可报备一次(未分配) CB.is_valid !=0 and CB.manager_id = 0 and CB.distributor_id = xx 未确认,所有分销商都可报备一次(未分配) CB.is_valid !=0 and CB.manager_id = 0 and CB.distributor_id = xx
已确认,其他分销商都不能报备 CB.manager_id != 0 and CB.recommend_status != 8 已确认,其他分销商都不能报备 CB.manager_id != 0 and CB.recommend_status != 8
无效, 所有分销商都可再报备一次 CB.is_valid = 0 and CB.distributor_id = xx 无效, 所有分销商都可再报备一次 CB.is_valid = 0 and CB.distributor_id = xx
已过期,所有分销商都可重新报备一次 CB.manager_id != 0 and CB.recommend_status != 8 and CB.distributor_id = xx 已过期,所有分销商都可重新报备一次 CB.manager_id != 0 and CB.recommend_status != 8 and CB.distributor_id = xx
*/ */
...@@ -178,7 +178,7 @@ class Recommend extends CI_Controller{ ...@@ -178,7 +178,7 @@ class Recommend extends CI_Controller{
$dataLog['is_deleted'] = $cbinfo['is_deleted']; $dataLog['is_deleted'] = $cbinfo['is_deleted'];
$dataLog['create_time'] = $cbinfo['create_time']; $dataLog['create_time'] = $cbinfo['create_time'];
$dataLog['action_time'] = time(); $dataLog['action_time'] = time();
$this->customer_building_log->add($dataLog); $this->customer_building_log->add($dataLog);
$this->customer_building->del(array('id' => $customer_info['id'])); $this->customer_building->del(array('id' => $customer_info['id']));
} else if (0 == $customer_info['distribution_status'] && $distributor_entity['id']!=$customer_info['distributor_id']) { //不同分销商,未分配,可报备 } else if (0 == $customer_info['distribution_status'] && $distributor_entity['id']!=$customer_info['distributor_id']) { //不同分销商,未分配,可报备
...@@ -207,9 +207,9 @@ class Recommend extends CI_Controller{ ...@@ -207,9 +207,9 @@ class Recommend extends CI_Controller{
'update_time' => $time 'update_time' => $time
); );
$customer_id = $this->customer->add($customer_data); $customer_id = $this->customer->add($customer_data);
} }
} }
if(empty($customer_id) || !is_numeric($customer_id)) if(empty($customer_id) || !is_numeric($customer_id))
{ {
$result = array('errcode' => 42171, 'errmsg' => $this->lang->line('err_42171')); $result = array('errcode' => 42171, 'errmsg' => $this->lang->line('err_42171'));
...@@ -257,14 +257,14 @@ class Recommend extends CI_Controller{ ...@@ -257,14 +257,14 @@ class Recommend extends CI_Controller{
if ($customer_building_id) if ($customer_building_id)
{ {
$this->update_customer_type($customer_building_id, $post['customer_phone'][$i]); $this->update_customer_type($customer_building_id, $post['customer_phone'][$i]);
} }
} }
//分配销售主管或经理楼盘 //分配销售主管或经理楼盘
// $my_manager_id = 0; // $my_manager_id = 0;
// $building_min_num = 0; // $building_min_num = 0;
// $num = array(); // $num = array();
// $new_managers = array(); // $new_managers = array();
// foreach ($building_managers as $k => $manager) // foreach ($building_managers as $k => $manager)
// { // {
// if(empty($manager['manager_id'])) continue; // if(empty($manager['manager_id'])) continue;
...@@ -273,7 +273,7 @@ class Recommend extends CI_Controller{ ...@@ -273,7 +273,7 @@ class Recommend extends CI_Controller{
// $tmp = (int)$this->customer_building->get_count( // $tmp = (int)$this->customer_building->get_count(
// array('building_id' => $building_id, 'manager_id' => $manager['manager_id']) // array('building_id' => $building_id, 'manager_id' => $manager['manager_id'])
// ); // );
// $building_managers[$k]['fenpeied_num'] = $tmp; // $building_managers[$k]['fenpeied_num'] = $tmp;
// } // }
// //var_dump($building_managers);exit; // //var_dump($building_managers);exit;
// //排名格式化(按照销售经理已分配客户量排序) // //排名格式化(按照销售经理已分配客户量排序)
...@@ -284,7 +284,7 @@ class Recommend extends CI_Controller{ ...@@ -284,7 +284,7 @@ class Recommend extends CI_Controller{
// array_multisort($fenpeied_num, SORT_ASC, $building_managers); // array_multisort($fenpeied_num, SORT_ASC, $building_managers);
// $my_manager_id = $building_managers[0]['manager_id']; // $my_manager_id = $building_managers[0]['manager_id'];
// //客户楼盘信息 // //客户楼盘信息
} }
...@@ -311,7 +311,7 @@ class Recommend extends CI_Controller{ ...@@ -311,7 +311,7 @@ class Recommend extends CI_Controller{
$my_manager_id = 0; $my_manager_id = 0;
$building_min_num = 0; $building_min_num = 0;
$num = array(); $num = array();
$new_managers = array(); $new_managers = array();
foreach ($building_managers as $k => $manager) foreach ($building_managers as $k => $manager)
{ {
$new_managers[$manager['user_id']] = $manager['user_id']; $new_managers[$manager['user_id']] = $manager['user_id'];
...@@ -319,7 +319,7 @@ class Recommend extends CI_Controller{ ...@@ -319,7 +319,7 @@ class Recommend extends CI_Controller{
$tmp = (int)$this->customer_building->get_count( $tmp = (int)$this->customer_building->get_count(
array('building_id' => $building_id, 'building_manager_id' => $manager['user_id']) array('building_id' => $building_id, 'building_manager_id' => $manager['user_id'])
); );
$building_managers[$k]['fenpeied_num'] = $tmp; $building_managers[$k]['fenpeied_num'] = $tmp;
} }
//var_dump($building_managers);exit; //var_dump($building_managers);exit;
//排名格式化(按照销售经理已分配客户量排序) //排名格式化(按照销售经理已分配客户量排序)
...@@ -348,7 +348,7 @@ class Recommend extends CI_Controller{ ...@@ -348,7 +348,7 @@ class Recommend extends CI_Controller{
'update_time' => $time 'update_time' => $time
); );
$customer_building_id = $this->customer_building->add($customer_building_data); $customer_building_id = $this->customer_building->add($customer_building_data);
$recommend_trace_data = array(); $recommend_trace_data = array();
//等待分配 //等待分配
$recommend_trace_data[] = array( $recommend_trace_data[] = array(
...@@ -370,12 +370,12 @@ class Recommend extends CI_Controller{ ...@@ -370,12 +370,12 @@ class Recommend extends CI_Controller{
{ {
$old_customer = 0; $old_customer = 0;
$this->load->helper('rpc'); $this->load->helper('rpc');
$param = array('body' => array('phone' => $telphone)); $param = array('body' => array('phone' => $telphone));
$data = rpc('get_owner_by_phone', $param, 'POST'); $data = rpc('get_owner_by_phone', $param, 'POST');
if ($data && isset($data['body']) && count($data['body'])) if ($data && isset($data['body']) && count($data['body']))
{ {
$old_customer = 1; $old_customer = 1;
} }
...@@ -388,19 +388,19 @@ class Recommend extends CI_Controller{ ...@@ -388,19 +388,19 @@ class Recommend extends CI_Controller{
{ {
$old_employee = 0; $old_employee = 0;
$this->load->helper('rpc'); $this->load->helper('rpc');
$param = array('body' => array('phone' => $telphone)); $param = array('body' => array('phone' => $telphone));
$data = rpc('get_staff_by_mobile', $param, 'POST'); $data = rpc('get_staff_by_mobile', $param, 'POST');
if ($data && isset($data['body']) && count($data['body'])) if ($data && isset($data['body']) && count($data['body']))
{ {
$old_employee = 1; $old_employee = 1;
} }
unset($data); unset($data);
return $old_employee; return $old_employee;
} }
/* /*
* 查找客户是否老业主或者员工 * 查找客户是否老业主或者员工
* @param $customer_building_id * @param $customer_building_id
...@@ -420,16 +420,16 @@ class Recommend extends CI_Controller{ ...@@ -420,16 +420,16 @@ class Recommend extends CI_Controller{
$customer = $this->get_customer_type($telphone); //老业主 $customer = $this->get_customer_type($telphone); //老业主
if ($employee && $customer) if ($employee && $customer)
{ {
$customer_type = 3; //员工 + 老业主 $customer_type = 3; //员工 + 老业主
} else if ($employee && !$customer) } else if ($employee && !$customer)
{ {
$customer_type = 2; // 员工 $customer_type = 2; // 员工
} else if (!$employee && $customer) } else if (!$employee && $customer)
{ {
$customer_type = 1; // 老业主 $customer_type = 1; // 老业主
} else } else
{ {
$customer_type = 0; // 新客户 $customer_type = 0; // 新客户
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment