Commit 6ae9f605 by HTML5-侯张振

渠道展示更改

parent 5e1661f5
...@@ -294,7 +294,7 @@ class Index extends CI_Controller{ ...@@ -294,7 +294,7 @@ class Index extends CI_Controller{
$where=array( $where=array(
'CB.id'=>$cb_id 'CB.id'=>$cb_id
); );
$query=$this->customer_building->get_custormer_list_byStatus($where,1,1); $query=$this->customer_building->get_custormer_channellist_byStatus($where,1,1);
if($query[0]['sale_id']!=0){ if($query[0]['sale_id']!=0){
$sales=$this->user->get(array('id'=>$query[0]['sale_id'])); $sales=$this->user->get(array('id'=>$query[0]['sale_id']));
$this->data['sales_name']=$sales['true_name']; $this->data['sales_name']=$sales['true_name'];
......
...@@ -41,6 +41,7 @@ class Customer extends CI_Controller { ...@@ -41,6 +41,7 @@ class Customer extends CI_Controller {
} }
$distributor_ins=$this->distributor->get(array('uniqid_id'=>$this->uniqid_id)); $distributor_ins=$this->distributor->get(array('uniqid_id'=>$this->uniqid_id));
if($status==99){ //获取所有状态的客户 if($status==99){ //获取所有状态的客户
$where=array('D.id'=>$distributor_ins['id'],'U.id'=>$this->user_id); $where=array('D.id'=>$distributor_ins['id'],'U.id'=>$this->user_id);
}else if($status==9){ }else if($status==9){
...@@ -53,9 +54,9 @@ class Customer extends CI_Controller { ...@@ -53,9 +54,9 @@ class Customer extends CI_Controller {
'U.id'=>$this->user_id 'U.id'=>$this->user_id
); );
} }
$lists=$this->customer_building->get_custormer_list_byStatus($where,1,6); $lists=$this->customer_building->get_custormer_list_byStatus($where,1,6);
if (count($lists)) { if (count($lists)) {
foreach ($lists as $key => &$val) { foreach ($lists as $key => &$val) {
$val['tips'] = $this->can_report($val['cbid']); $val['tips'] = $this->can_report($val['cbid']);
......
...@@ -548,12 +548,11 @@ class Customer_building_model extends MY_Model{ ...@@ -548,12 +548,11 @@ class Customer_building_model extends MY_Model{
*获取某种状态下的客户里报表。分销商用 *获取某种状态下的客户里报表。分销商用
*/ */
public function get_custormer_list_byStatus($where=NULL, $page = 1, $page_size = 0){ public function get_custormer_list_byStatus($where=NULL, $page = 1, $page_size = 0){
$this->db->select('CB.id cbid,CB.create_time,CS.sale_id,C.customer_user,C.customer_mobile,U.user_name,B.building_title,D.id idd,D.company_name,M.manager_name,R.region_name,U.user_mobile user_mobile,CB.recommend_status') $this->db->select('CB.id cbid,CB.create_time,CB.sale_id,C.customer_user,C.customer_mobile,U.user_name,B.building_title,D.id idd,D.company_name,M.manager_name,R.region_name,CB.recommend_status')
->from('tb_customer_building CB') ->from('tb_customer_building CB')
->join('tb_customer C','C.id=CB.customer_id','left') ->join('tb_customer C','C.id=CB.customer_id','left')
->join('tb_building B','B.id=CB.building_id','left') ->join('tb_building B','B.id=CB.building_id','left')
->join('tb_customer_sales CS','CS.customer_building_id = CB.id') ->join('tb_user U','U.id=CB.user_id','left')
->join('tb_user U','U.id=CS.sale_id','left')
->join('tb_distributor D','D.id=CB.distributor_id') ->join('tb_distributor D','D.id=CB.distributor_id')
->join('tb_channel CH','CH.id=D.channel_id') ->join('tb_channel CH','CH.id=D.channel_id')
->join('tb_manager M','M.id=CH.manager_id') ->join('tb_manager M','M.id=CH.manager_id')
...@@ -571,7 +570,31 @@ class Customer_building_model extends MY_Model{ ...@@ -571,7 +570,31 @@ class Customer_building_model extends MY_Model{
} }
return $query->result_array(); return $query->result_array();
} }
//渠道用状态
public function get_custormer_channellist_byStatus($where=NULL, $page = 1, $page_size = 0){
$this->db->select('CB.id cbid,CB.create_time,CS.sale_id,C.customer_user,C.customer_mobile,U.user_name,B.building_title,D.id idd,D.company_name,M.manager_name,R.region_name,CB.recommend_status')
->from('tb_customer_building CB')
->join('tb_customer C','C.id=CB.customer_id','left')
->join('tb_building B','B.id=CB.building_id','left')
->join('tb_customer_sales CS','CS.customer_building_id = CB.id','left')
->join('tb_user U','U.id=CS.sale_id','left')
->join('tb_distributor D','D.id=CB.distributor_id')
->join('tb_channel CH','CH.id=D.channel_id')
->join('tb_manager M','M.id=CH.manager_id')
->join('tb_region R','R.region_code=B.region_code');
if(!empty($where)){
$this->db->where($where);
}
$this->db->order_by('CB.create_time desc');
if (!$page)
{
$query = $this->db->get();
} else {
$query = $this->db->get(null, $page_size, ($page-1) * $page_size);
}
return $query->result_array();
}
//首页小红点 //首页小红点
public function get_count_by_where($where = '') public function get_count_by_where($where = '')
{ {
......
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