Commit 726c86c0 by HTML5-侯张振

修复 渠道展示重复bug

parent 4d416e7b
...@@ -70,8 +70,11 @@ class Channeladmin extends CI_Controller ...@@ -70,8 +70,11 @@ class Channeladmin extends CI_Controller
} }
$re=array(); $re=array();
$manager_channel = $this->manager->get(array('id'=>$user_data['u_id'])); $manager_channel = $this->manager->get(array('id'=>$user_data['u_id']));
$where1 .=' and CA.building_id in ('.$manager_channel['building_id'].')'; $where1 .=' and CA.building_id in ('.$manager_channel['building_id'].')';
$re=$this->channel->get_all_channel($where1,$page_no,self::PAGE_SIZE, $orderbySql); $re=$this->channel->get_all_channel($where1,$page_no,self::PAGE_SIZE, $orderbySql);
var_dump($where1);
$this->data['admins']=$re; $this->data['admins']=$re;
$this->data['num_link'] = set_page1($this, site_url('admin/channeladmin/index?manager_id='.$name), $count, self::PAGE_SIZE,4,'',true,array('num_links'=>3,'show_total' => false, 'page_query_string' => true)); $this->data['num_link'] = set_page1($this, site_url('admin/channeladmin/index?manager_id='.$name), $count, self::PAGE_SIZE,4,'',true,array('num_links'=>3,'show_total' => false, 'page_query_string' => true));
} }
......
...@@ -1040,7 +1040,7 @@ class Report extends CI_Controller ...@@ -1040,7 +1040,7 @@ class Report extends CI_Controller
$this->data['buildings'] = $protection_arr; $this->data['buildings'] = $protection_arr;
$data_arr = '?building_title=' . $building; $data_arr = '?company_name=' . $building;
$this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1; $this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1;
//获取分页 //获取分页
......
...@@ -187,18 +187,20 @@ class Recommend extends CI_Controller{ ...@@ -187,18 +187,20 @@ class Recommend extends CI_Controller{
$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']) { //不同分销商,未分配,可报备
//todo //todo
} else { } else {
$result = array('errcode' => 42178, 'errmsg' => $this->lang->line('err_42178')); //重复提交 $result = array('errcode' => 42178, 'errmsg' => $this->lang->line('err_42178')); //重复提交
echo json_encode($result); echo json_encode($result);
return; return;
} }
} else { } else{
//查找客户 //查找客户
$customerInfo = $this->customer->exits_customer_by_mobile($post['customer_phone'][$i]); $customerInfo = $this->customer->exits_customer_by_mobile($post['customer_phone'][$i]);
if ($customerInfo) { if ($customerInfo) {
$customer_id = $customerInfo['id']; $customer_id = $customerInfo['id'];
} else { } else{
//客户信息 //客户信息
$customer_data = array( $customer_data = array(
'user_id' => $this->user_id, 'user_id' => $this->user_id,
...@@ -226,7 +228,11 @@ class Recommend extends CI_Controller{ ...@@ -226,7 +228,11 @@ class Recommend extends CI_Controller{
if(!empty($buildingmanager)) if(!empty($buildingmanager))
{ {
$return = $this->building_manager(array('building_id' => $building_id, 'customer_id' => $customer_id, 'distributor_id' => $distributor_entity['id']),$i,$post); $return = $this->building_manager(array('building_id' => $building_id, 'customer_id' => $customer_id, 'distributor_id' => $distributor_entity['id']),$i,$post);
} else { }else if(!empty($customerInfo)&&$customer_info['is_expired']!= 1&&$customer_info['is_valid']!='0'&&$building!=$customer_info['building_id']){
$result = array('errcode' => 42178, 'errmsg' => $this->lang->line('err_42178')); //重复提交
echo json_encode($result);
return;
}else{
$customer_building_data = array( $customer_building_data = array(
'user_id' => $this->user_id, 'user_id' => $this->user_id,
'customer_id' => $customer_id, 'customer_id' => $customer_id,
......
...@@ -224,12 +224,12 @@ class Channel_model extends My_Model{ ...@@ -224,12 +224,12 @@ class Channel_model extends My_Model{
* @version 2016-12-18 * @version 2016-12-18
*/ */
public function get_all_channel($where='',$page_no = 1,$page_size = 20, $order_by = ''){ public function get_all_channel($where='',$page_no = 1,$page_size = 20, $order_by = ''){
$this->db->select('A.manager_name,B.id channel_id,B.parent_id,C.manager_name parent_name,B.is_deleted,B.create_time') $this->db->select('A.manager_name,B.id channel_id,B.parent_id,A.manager_name parent_name,B.is_deleted,B.create_time')
->from('tb_channel B') ->from('tb_channel B')
->join('tb_manager A','B.manager_id=A.id','left') //->join('tb_channel D','B.parent_id=D.id','left')
->join('tb_channel D','B.parent_id=D.id','left')
->join('tb_channel_building CA','CA.channel_id = B.id','left') ->join('tb_channel_building CA','CA.channel_id = B.id','left')
->join('tb_manager C','D.manager_id=C.id','left'); ->join('tb_manager A','B.manager_id=A.id','left')
->join('tb_manager C','B.manager_id=C.id','left');
if($where!=''){ if($where!=''){
$this->db->where($where); $this->db->where($where);
} }
...@@ -241,7 +241,18 @@ class Channel_model extends My_Model{ ...@@ -241,7 +241,18 @@ class Channel_model extends My_Model{
$query = $this->db->get(null,$page_size,$offset); $query = $this->db->get(null,$page_size,$offset);
if($query->num_rows() > 0) if($query->num_rows() > 0)
{ {
return $query->result_array(); $qery = $query->result_array();
$rAr=array();
for($i=0;$i<count($qery);$i++)
{
if(!isset($rAr[$qery[$i]['manager_name']]))
{
$rAr[$qery[$i]['manager_name']]=$qery[$i];
}
}
$qery=array_values($rAr);
return $qery;
//return $query->result_array();
} }
return array(); return array();
......
...@@ -167,15 +167,21 @@ jQuery(document).ready(function() { ...@@ -167,15 +167,21 @@ jQuery(document).ready(function() {
$('#checked_list').html(html); $('#checked_list').html(html);
}); });
//全选
$(".form-body").on('click','#all',function(){ $(".form-body").on('click','#all',function(){
console.log(12211);
if(this.checked){ if(this.checked){
console.log(3);
$(".checked_list").parent().addClass('checked'); $(".checked_list").parent().addClass('checked');
}else{ }else{
$(".checked_list").parent().removeClass('checked'); $(".checked_list").parent().removeClass('checked');
} }
}); });
$(".checked_list").on('click',function(){
if($(".checked_list").parent().attr('class')==''){
$("#all").parent().removeClass('checked');
}
});
}); });
</script> </script>
</body> </body>
......
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