Commit 0f3414f4 by html5-李恒逸

修改老业主不能报备问题

parent 2cfcee2a
......@@ -16,7 +16,7 @@ class Recommend extends CI_Controller{
parent::__construct();
//加载用户语言
$this->language = $this->input->cookie('lang') ? $this->input->cookie('lang') : $this->config->item('language');
//加载配置文件
$this->config->load('user_config',true);
$this->lang->load('error',$this->language);
......@@ -31,7 +31,7 @@ class Recommend extends CI_Controller{
}
/**
*
*
* 展示页面
* @author wenhuijang
* @version 2014-12-18
......@@ -53,11 +53,11 @@ class Recommend extends CI_Controller{
if($cur_user['check_status']==4){
alert_redirect(site_url('distributor/logindis/logout'),'您的帐号已被后台注销');
}
$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);
$this->data['buildings']=$buildings;
$this->data['distributor_uniqid']=$distributor_entity['uniqid_id'];
$this->data['distributor_name']=$distributor_entity['company_name'];
//加载城市列表,楼盘列表
......@@ -126,8 +126,8 @@ class Recommend extends CI_Controller{
// echo json_encode($result) ;
// return;
// }
//是否为融创客户
$this->load->helper('rpc');
$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{
echo json_encode($result);
return;
}
if($this->get_customer_type($post['customer_phone'][$i]))
{
$result = array('errcode'=>461000, 'errmsg'=> '老业主无法报备进入系统');
echo json_encode($result);
return;
}
// if($this->get_customer_type($post['customer_phone'][$i]))
// {
// $result = array('errcode'=>461000, 'errmsg'=> '老业主无法报备进入系统');
// echo json_encode($result);
// return;
// }
$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.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.manager_id != 0 and CB.recommend_status != 8 and CB.distributor_id = xx
*/
......@@ -178,7 +178,7 @@ class Recommend extends CI_Controller{
$dataLog['is_deleted'] = $cbinfo['is_deleted'];
$dataLog['create_time'] = $cbinfo['create_time'];
$dataLog['action_time'] = time();
$this->customer_building_log->add($dataLog);
$this->customer_building->del(array('id' => $customer_info['id']));
} else if (0 == $customer_info['distribution_status'] && $distributor_entity['id']!=$customer_info['distributor_id']) { //不同分销商,未分配,可报备
......@@ -207,9 +207,9 @@ class Recommend extends CI_Controller{
'update_time' => $time
);
$customer_id = $this->customer->add($customer_data);
}
}
}
if(empty($customer_id) || !is_numeric($customer_id))
{
$result = array('errcode' => 42171, 'errmsg' => $this->lang->line('err_42171'));
......@@ -257,14 +257,14 @@ class Recommend extends CI_Controller{
if ($customer_building_id)
{
$this->update_customer_type($customer_building_id, $post['customer_phone'][$i]);
}
}
}
//分配销售主管或经理楼盘
// $my_manager_id = 0;
// $building_min_num = 0;
// $num = array();
// $new_managers = array();
// $new_managers = array();
// foreach ($building_managers as $k => $manager)
// {
// if(empty($manager['manager_id'])) continue;
......@@ -273,7 +273,7 @@ class Recommend extends CI_Controller{
// $tmp = (int)$this->customer_building->get_count(
// 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;
// //排名格式化(按照销售经理已分配客户量排序)
......@@ -284,7 +284,7 @@ class Recommend extends CI_Controller{
// array_multisort($fenpeied_num, SORT_ASC, $building_managers);
// $my_manager_id = $building_managers[0]['manager_id'];
// //客户楼盘信息
}
......@@ -311,7 +311,7 @@ class Recommend extends CI_Controller{
$my_manager_id = 0;
$building_min_num = 0;
$num = array();
$new_managers = array();
$new_managers = array();
foreach ($building_managers as $k => $manager)
{
$new_managers[$manager['user_id']] = $manager['user_id'];
......@@ -319,7 +319,7 @@ class Recommend extends CI_Controller{
$tmp = (int)$this->customer_building->get_count(
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;
//排名格式化(按照销售经理已分配客户量排序)
......@@ -348,7 +348,7 @@ class Recommend extends CI_Controller{
'update_time' => $time
);
$customer_building_id = $this->customer_building->add($customer_building_data);
$recommend_trace_data = array();
//等待分配
$recommend_trace_data[] = array(
......@@ -370,12 +370,12 @@ class Recommend extends CI_Controller{
{
$old_customer = 0;
$this->load->helper('rpc');
$param = array('body' => array('phone' => $telphone));
$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;
}
......@@ -388,19 +388,19 @@ class Recommend extends CI_Controller{
{
$old_employee = 0;
$this->load->helper('rpc');
$param = array('body' => array('phone' => $telphone));
$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;
}
unset($data);
return $old_employee;
}
/*
* 查找客户是否老业主或者员工
* @param $customer_building_id
......@@ -420,16 +420,16 @@ class Recommend extends CI_Controller{
$customer = $this->get_customer_type($telphone); //老业主
if ($employee && $customer)
if ($employee && $customer)
{
$customer_type = 3; //员工 + 老业主
} else if ($employee && !$customer)
} else if ($employee && !$customer)
{
$customer_type = 2; // 员工
} else if (!$employee && $customer)
} else if (!$employee && $customer)
{
$customer_type = 1; // 老业主
} else
} else
{
$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