Commit 970ba304 by HTML5-侯张振
parents 8ae91122 12b426d9
<?php <?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/** /**
*渠道管理 *渠道管理
...@@ -38,14 +38,14 @@ class Channeladmin extends CI_Controller ...@@ -38,14 +38,14 @@ class Channeladmin extends CI_Controller
$con = array(); $con = array();
$where='`role_id` = 12 and'; $where='`role_id` = 12 and';
$name = $this->input->get('manager_name') ? urldecode($this->input->get('manager_name', true)) : ""; $name = $this->input->get('manager_name') ? urldecode($this->input->get('manager_name', true)) : "";
if(!empty($name)) if(!empty($name))
{ {
$where .= " `manager_name` like '%{$name}%' and"; $where .= " `manager_name` like '%{$name}%' and";
} }
$where = rtrim($where, ' and'); $where = rtrim($where, ' and');
$this->data['con_arr'] = $name; $this->data['con_arr'] = $name;
$count = $this->manager->get_count($where); $count = $this->manager->get_count($where);
$this->data['admins'] = array(); $this->data['admins'] = array();
...@@ -55,8 +55,8 @@ class Channeladmin extends CI_Controller ...@@ -55,8 +55,8 @@ class Channeladmin extends CI_Controller
} }
$where1=rtrim($where1,' and'); $where1=rtrim($where1,' and');
//排序 //排序
$orderbySql = 'B.create_time desc'; $orderbySql = 'B.create_time desc';
$page_no = 1; $page_no = 1;
...@@ -73,7 +73,7 @@ class Channeladmin extends CI_Controller ...@@ -73,7 +73,7 @@ class Channeladmin extends CI_Controller
$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));
} }
$this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1; $this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1;
$this->load->view('admin/channel/index',$this->data); $this->load->view('admin/channel/index',$this->data);
} }
//获取权限列表 //获取权限列表
...@@ -89,7 +89,7 @@ class Channeladmin extends CI_Controller ...@@ -89,7 +89,7 @@ class Channeladmin extends CI_Controller
} }
return $return; return $return;
} }
//获取地区数据列表 //获取地区数据列表
public function get_region(){ public function get_region(){
$this->load->model('region_model', 'region'); $this->load->model('region_model', 'region');
...@@ -103,7 +103,7 @@ class Channeladmin extends CI_Controller ...@@ -103,7 +103,7 @@ class Channeladmin extends CI_Controller
} }
return $return; return $return;
} }
//获取楼盘数据列表 //获取楼盘数据列表
public function get_building(){ public function get_building(){
$this->load->model('building_model', 'building'); $this->load->model('building_model', 'building');
...@@ -118,7 +118,7 @@ class Channeladmin extends CI_Controller ...@@ -118,7 +118,7 @@ class Channeladmin extends CI_Controller
return $return; return $return;
} }
/** /**
* *
* 修改渠道所属上级 * 修改渠道所属上级
* @author libin * @author libin
* @version 2016-12-16 * @version 2016-12-16
...@@ -149,7 +149,7 @@ class Channeladmin extends CI_Controller ...@@ -149,7 +149,7 @@ class Channeladmin extends CI_Controller
$data2=array(); $data2=array();
if($manager_pwd!=""){ if($manager_pwd!=""){
$data2['manager_pwd']=md5($manager_pwd); $data2['manager_pwd']=md5($manager_pwd);
$this->manager->update(array('manager_name'=>$channelName),$data2); $this->manager->update(array('manager_name'=>$channelName),$data2);
} }
} }
...@@ -165,7 +165,7 @@ class Channeladmin extends CI_Controller ...@@ -165,7 +165,7 @@ class Channeladmin extends CI_Controller
} else { } else {
$where="E.is_deleted = 0 order by convert(B.manager_name USING gbk) COLLATE gbk_chinese_ci asc"; $where="E.is_deleted = 0 order by convert(B.manager_name USING gbk) COLLATE gbk_chinese_ci asc";
} }
$re=$this->channel->find_channel_name($where); $re=$this->channel->find_channel_name($where);
// $this->db->select('A.id channel_id,B.manager_name channel_name') // $this->db->select('A.id channel_id,B.manager_name channel_name')
// ->from('tb_channel A') // ->from('tb_channel A')
...@@ -178,7 +178,7 @@ class Channeladmin extends CI_Controller ...@@ -178,7 +178,7 @@ class Channeladmin extends CI_Controller
$this->load->view('admin/channel/channelParent',$this->data); $this->load->view('admin/channel/channelParent',$this->data);
} }
/** /**
* *
* 新增渠道管理 * 新增渠道管理
* @author libin * @author libin
* @version 2016-12-15 * @version 2016-12-15
...@@ -190,10 +190,10 @@ class Channeladmin extends CI_Controller ...@@ -190,10 +190,10 @@ class Channeladmin extends CI_Controller
{ {
$this->data['data'] = array(); $this->data['data'] = array();
$this->data['op'] = '添加'; $this->data['op'] = '添加';
//角色类型 //角色类型
$this->data['type'] = $this->get_roles(); $this->data['type'] = $this->get_roles();
//获取地区数据 //获取地区数据
$this->data['region'] = $this->get_region(); $this->data['region'] = $this->get_region();
//获取楼盘数据列表 //获取楼盘数据列表
$this->data['building'] = $this->get_building(); $this->data['building'] = $this->get_building();
...@@ -214,7 +214,7 @@ class Channeladmin extends CI_Controller ...@@ -214,7 +214,7 @@ class Channeladmin extends CI_Controller
if ($this->input->post('building_id')) { if ($this->input->post('building_id')) {
$data['building_id'] = implode(',',$this->input->post('building_id'));//项目 $data['building_id'] = implode(',',$this->input->post('building_id'));//项目
} }
$data['create_time'] = time(); $data['create_time'] = time();
if(empty($data['manager_pwd']) || empty($data['manager_name']) || empty($data['manager_phone'])){ if(empty($data['manager_pwd']) || empty($data['manager_name']) || empty($data['manager_phone'])){
...@@ -226,7 +226,7 @@ class Channeladmin extends CI_Controller ...@@ -226,7 +226,7 @@ class Channeladmin extends CI_Controller
return; return;
} }
$data['manager_pwd'] = md5($data['manager_pwd']); $data['manager_pwd'] = md5($data['manager_pwd']);
$data1=array(); $data1=array();
$data2=array(); $data2=array();
...@@ -257,7 +257,7 @@ class Channeladmin extends CI_Controller ...@@ -257,7 +257,7 @@ class Channeladmin extends CI_Controller
//记录日志 //记录日志
$log = array( $log = array(
'log' => sprintf($this->lang->line('op_insert_succ'), $this->u_name, '管理员email:'.$info['email']) 'log' => sprintf($this->lang->line('op_insert_succ'), $this->u_name, '管理员email:'.$info['email'])
); );
$this->loger->add_op_log('register',$log); $this->loger->add_op_log('register',$log);
alert_redirect(site_url('admin/channeladmin/index')); alert_redirect(site_url('admin/channeladmin/index'));
...@@ -280,7 +280,7 @@ class Channeladmin extends CI_Controller ...@@ -280,7 +280,7 @@ class Channeladmin extends CI_Controller
//记录日志 //记录日志
$log = array( $log = array(
'log' => sprintf($this->lang->line('op_insert_succ'), $this->u_name, '管理员email:'.$info['email']) 'log' => sprintf($this->lang->line('op_insert_succ'), $this->u_name, '管理员email:'.$info['email'])
); );
$this->loger->add_op_log('register',$log); $this->loger->add_op_log('register',$log);
alert_redirect(site_url('admin/channeladmin/index')); alert_redirect(site_url('admin/channeladmin/index'));
...@@ -288,7 +288,7 @@ class Channeladmin extends CI_Controller ...@@ -288,7 +288,7 @@ class Channeladmin extends CI_Controller
//记录日志 //记录日志
$log = array( $log = array(
'log' => sprintf($this->lang->line('op_insert_fail'), $this->u_name, '管理员email:'.$info['email']) 'log' => sprintf($this->lang->line('op_insert_fail'), $this->u_name, '管理员email:'.$info['email'])
); );
$this->loger->add_op_log('register',$log); $this->loger->add_op_log('register',$log);
alert_redirect(site_url('admin/channeladmin/index','添加渠道失败,请重试')); alert_redirect(site_url('admin/channeladmin/index','添加渠道失败,请重试'));
...@@ -296,7 +296,7 @@ class Channeladmin extends CI_Controller ...@@ -296,7 +296,7 @@ class Channeladmin extends CI_Controller
} }
} }
/** /**
* *
* 渠道查看客户 * 渠道查看客户
* @author libin * @author libin
* @version 2016-12-15 * @version 2016-12-15
...@@ -336,27 +336,27 @@ class Channeladmin extends CI_Controller ...@@ -336,27 +336,27 @@ class Channeladmin extends CI_Controller
switch($get['time']) switch($get['time'])
{ {
case "本周": case "本周":
$this_month_start = mktime (0, 0, 0, date ("m"), date ("d") - date ("w") + 1, date ("Y")); $this_month_start = mktime (0, 0, 0, date ("m"), date ("d") - date ("w") + 1, date ("Y"));
$this_month_end = mktime (23, 59, 59, date ("m"), date ("d") - date ("w") + 7, date ("Y")); $this_month_end = mktime (23, 59, 59, date ("m"), date ("d") - date ("w") + 7, date ("Y"));
$where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $get['time']; $this->data['saixuan'] = $get['time'];
break; break;
case "月度": case "月度":
$this_month_start = mktime(0, 0, 0,date("m"),1,date("Y")); //2015-08-01 00:00:00 $this_month_start = mktime(0, 0, 0,date("m"),1,date("Y")); //2015-08-01 00:00:00
$this_month_end = mktime(23,59,59,date("m"),date("t"),date("Y")); //2015-08-31 23:59:59 $this_month_end = mktime(23,59,59,date("m"),date("t"),date("Y")); //2015-08-31 23:59:59
$where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $get['time']; $this->data['saixuan'] = $get['time'];
break; break;
case "季度": case "季度":
$getMonthDays = date("t",mktime(0, 0, 0,date('n')+(date('n')-1)%3,1,date("Y")));//本季度未最后一月天数 $getMonthDays = date("t",mktime(0, 0, 0,date('n')+(date('n')-1)%3,1,date("Y")));//本季度未最后一月天数
$this_j_start = mktime(0, 0, 0,date('n')-(date('n')-1)%3,1,date('Y')); //2015-07-01 00:00:00 $this_j_start = mktime(0, 0, 0,date('n')-(date('n')-1)%3,1,date('Y')); //2015-07-01 00:00:00
$this_j_end = mktime(23,59,59,date('n')+(date('n')-1)%3,$getMonthDays,date('Y')); //2015-09-30 23:59:59 $this_j_end = mktime(23,59,59,date('n')+(date('n')-1)%3,$getMonthDays,date('Y')); //2015-09-30 23:59:59
$where.= ' and A.`create_time` between '.$this_j_start.' and '.$this_j_end; $where.= ' and A.`create_time` between '.$this_j_start.' and '.$this_j_end;
$this->data['saixuan'] = $get['time']; $this->data['saixuan'] = $get['time'];
break; break;
case "年度": case "年度":
$this_month_start = mktime(0, 0, 0,1,1,date('Y')); //2015-01-01 00:00:00 $this_month_start = mktime(0, 0, 0,1,1,date('Y')); //2015-01-01 00:00:00
$this_month_end = mktime(23,59,59,12,30,date('Y')); //2015-12-30 23:59:59 $this_month_end = mktime(23,59,59,12,30,date('Y')); //2015-12-30 23:59:59
$where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $get['time']; $this->data['saixuan'] = $get['time'];
break; break;
...@@ -376,19 +376,19 @@ class Channeladmin extends CI_Controller ...@@ -376,19 +376,19 @@ class Channeladmin extends CI_Controller
$admins = array(); $admins = array();
$admins = $this->channel->get_all_info($where, $page_no, self::PAGE_SIZE); $admins = $this->channel->get_all_info($where, $page_no, self::PAGE_SIZE);
$this->data['customers'] = $admins; $this->data['customers'] = $admins;
//获取分页 //获取分页
$this->data['num_link'] = set_page1( $this->data['num_link'] = set_page1(
$this,site_url('admin/channeladmin/customerSearch?distributor_name='.$get['distributor_name'].'&status='.$get['status'].'&channel_id='.$get['channel_id'].'&building_title='.$get['building_title'].'&time='.$get['time']), $this,site_url('admin/channeladmin/customerSearch?distributor_name='.$get['distributor_name'].'&status='.$get['status'].'&channel_id='.$get['channel_id'].'&building_title='.$get['building_title'].'&time='.$get['time']),
$count,self::PAGE_SIZE,4,'',true, $count,self::PAGE_SIZE,4,'',true,
array('num_links'=>3,'show_total' => false, 'page_query_string' => true)); array('num_links'=>3,'show_total' => false, 'page_query_string' => true));
} }
$this->load->view('admin/channel/customerSearch',$this->data); $this->load->view('admin/channel/customerSearch',$this->data);
} }
/** /**
* *
* 渠道查看客户并导出 * 渠道查看客户并导出
* @author libin * @author libin
* @version 2016-12-15 * @version 2016-12-15
...@@ -427,27 +427,27 @@ class Channeladmin extends CI_Controller ...@@ -427,27 +427,27 @@ class Channeladmin extends CI_Controller
switch($get['time']) switch($get['time'])
{ {
case "本周": case "本周":
$this_month_start = mktime (0, 0, 0, date ("m"), date ("d") - date ("w") + 1, date ("Y")); $this_month_start = mktime (0, 0, 0, date ("m"), date ("d") - date ("w") + 1, date ("Y"));
$this_month_end = mktime (23, 59, 59, date ("m"), date ("d") - date ("w") + 7, date ("Y")); $this_month_end = mktime (23, 59, 59, date ("m"), date ("d") - date ("w") + 7, date ("Y"));
$where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $get['time']; $this->data['saixuan'] = $get['time'];
break; break;
case "月度": case "月度":
$this_month_start = mktime(0, 0, 0,date("m"),1,date("Y")); //2015-08-01 00:00:00 $this_month_start = mktime(0, 0, 0,date("m"),1,date("Y")); //2015-08-01 00:00:00
$this_month_end = mktime(23,59,59,date("m"),date("t"),date("Y")); //2015-08-31 23:59:59 $this_month_end = mktime(23,59,59,date("m"),date("t"),date("Y")); //2015-08-31 23:59:59
$where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $get['time']; $this->data['saixuan'] = $get['time'];
break; break;
case "季度": case "季度":
$getMonthDays = date("t",mktime(0, 0, 0,date('n')+(date('n')-1)%3,1,date("Y")));//本季度未最后一月天数 $getMonthDays = date("t",mktime(0, 0, 0,date('n')+(date('n')-1)%3,1,date("Y")));//本季度未最后一月天数
$this_j_start = mktime(0, 0, 0,date('n')-(date('n')-1)%3,1,date('Y')); //2015-07-01 00:00:00 $this_j_start = mktime(0, 0, 0,date('n')-(date('n')-1)%3,1,date('Y')); //2015-07-01 00:00:00
$this_j_end = mktime(23,59,59,date('n')+(date('n')-1)%3,$getMonthDays,date('Y')); //2015-09-30 23:59:59 $this_j_end = mktime(23,59,59,date('n')+(date('n')-1)%3,$getMonthDays,date('Y')); //2015-09-30 23:59:59
$where.= ' and A.`create_time` between '.$this_j_start.' and '.$this_j_end; $where.= ' and A.`create_time` between '.$this_j_start.' and '.$this_j_end;
$this->data['saixuan'] = $get['time']; $this->data['saixuan'] = $get['time'];
break; break;
case "年度": case "年度":
$this_month_start = mktime(0, 0, 0,1,1,date('Y')); //2015-01-01 00:00:00 $this_month_start = mktime(0, 0, 0,1,1,date('Y')); //2015-01-01 00:00:00
$this_month_end = mktime(23,59,59,12,30,date('Y')); //2015-12-30 23:59:59 $this_month_end = mktime(23,59,59,12,30,date('Y')); //2015-12-30 23:59:59
$where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $get['time']; $this->data['saixuan'] = $get['time'];
break; break;
...@@ -467,21 +467,21 @@ class Channeladmin extends CI_Controller ...@@ -467,21 +467,21 @@ class Channeladmin extends CI_Controller
$admins = array(); $admins = array();
$admins = $this->channel->get_all_info($where, $page_no, self::PAGE_SIZE); $admins = $this->channel->get_all_info($where, $page_no, self::PAGE_SIZE);
$this->data['customers'] = $admins; $this->data['customers'] = $admins;
//获取分页 //获取分页
$this->data['num_link'] = set_page1( $this->data['num_link'] = set_page1(
$this,site_url('admin/channeladmin/customerExport?distributor_name='.$get['distributor_name'].'&status='.$get['status'].'&channel_id='.$get['channel_id'].'&building_title='.$get['building_title'].'&time='.$get['time']), $this,site_url('admin/channeladmin/customerExport?distributor_name='.$get['distributor_name'].'&status='.$get['status'].'&channel_id='.$get['channel_id'].'&building_title='.$get['building_title'].'&time='.$get['time']),
$count,self::PAGE_SIZE,4,'',true, $count,self::PAGE_SIZE,4,'',true,
array('num_links'=>3,'show_total' => false, 'page_query_string' => true)); array('num_links'=>3,'show_total' => false, 'page_query_string' => true));
} }
// var_dump($count); // var_dump($count);
// var_dump($resp) // var_dump($resp)
// die; // die;
$this->load->view('admin/channel/customerExport',$this->data); $this->load->view('admin/channel/customerExport',$this->data);
} }
/** /**
* *
* 导出 * 导出
* @author libin * @author libin
* @version 2016-12-15 * @version 2016-12-15
...@@ -503,7 +503,7 @@ class Channeladmin extends CI_Controller ...@@ -503,7 +503,7 @@ class Channeladmin extends CI_Controller
$_buildingName_where = isset($where['building_title']) && !empty($where['building_title']) ? trim($where['building_title']) : ''; $_buildingName_where = isset($where['building_title']) && !empty($where['building_title']) ? trim($where['building_title']) : '';
$_createTime_where = isset($where['time']) && !empty($where['time']) ? trim($where['time']) : ''; $_createTime_where = isset($where['time']) && !empty($where['time']) ? trim($where['time']) : '';
} }
//获取当前渠道所有下属id //获取当前渠道所有下属id
$username=$this->u_name; $username=$this->u_name;
$res=$this->channel->find_my_channel($username); $res=$this->channel->find_my_channel($username);
...@@ -519,7 +519,7 @@ class Channeladmin extends CI_Controller ...@@ -519,7 +519,7 @@ class Channeladmin extends CI_Controller
$page_size = $count > 1000 ? 1000 : $count; $page_size = $count > 1000 ? 1000 : $count;
//获取所有查询的客户 //获取所有查询的客户
if($count>0) if($count>0)
{ {
// 分销商搜索条件 // 分销商搜索条件
$distributor_name=isset($_distributorName_where) && !empty($_distributorName_where) ? ' and C.company_name like "%'.$_distributorName_where.'%"' : ''; $distributor_name=isset($_distributorName_where) && !empty($_distributorName_where) ? ' and C.company_name like "%'.$_distributorName_where.'%"' : '';
//客户状态条件 //客户状态条件
...@@ -537,27 +537,27 @@ class Channeladmin extends CI_Controller ...@@ -537,27 +537,27 @@ class Channeladmin extends CI_Controller
switch($_createTime_where) switch($_createTime_where)
{ {
case "本周": case "本周":
$this_month_start = mktime (0, 0, 0, date ("m"), date ("d") - date ("w") + 1, date ("Y")); $this_month_start = mktime (0, 0, 0, date ("m"), date ("d") - date ("w") + 1, date ("Y"));
$this_month_end = mktime (23, 59, 59, date ("m"), date ("d") - date ("w") + 7, date ("Y")); $this_month_end = mktime (23, 59, 59, date ("m"), date ("d") - date ("w") + 7, date ("Y"));
$where1.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where1.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $_createTime_where; $this->data['saixuan'] = $_createTime_where;
break; break;
case "月度": case "月度":
$this_month_start = mktime(0, 0, 0,date("m"),1,date("Y")); //2015-08-01 00:00:00 $this_month_start = mktime(0, 0, 0,date("m"),1,date("Y")); //2015-08-01 00:00:00
$this_month_end = mktime(23,59,59,date("m"),date("t"),date("Y")); //2015-08-31 23:59:59 $this_month_end = mktime(23,59,59,date("m"),date("t"),date("Y")); //2015-08-31 23:59:59
$where1.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where1.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $_createTime_where; $this->data['saixuan'] = $_createTime_where;
break; break;
case "季度": case "季度":
$getMonthDays = date("t",mktime(0, 0, 0,date('n')+(date('n')-1)%3,1,date("Y")));//本季度未最后一月天数 $getMonthDays = date("t",mktime(0, 0, 0,date('n')+(date('n')-1)%3,1,date("Y")));//本季度未最后一月天数
$this_j_start = mktime(0, 0, 0,date('n')-(date('n')-1)%3,1,date('Y')); //2015-07-01 00:00:00 $this_j_start = mktime(0, 0, 0,date('n')-(date('n')-1)%3,1,date('Y')); //2015-07-01 00:00:00
$this_j_end = mktime(23,59,59,date('n')+(date('n')-1)%3,$getMonthDays,date('Y')); //2015-09-30 23:59:59 $this_j_end = mktime(23,59,59,date('n')+(date('n')-1)%3,$getMonthDays,date('Y')); //2015-09-30 23:59:59
$where1.= ' and A.`create_time` between '.$this_j_start.' and '.$this_j_end; $where1.= ' and A.`create_time` between '.$this_j_start.' and '.$this_j_end;
$this->data['saixuan'] = $_createTime_where; $this->data['saixuan'] = $_createTime_where;
break; break;
case "年度": case "年度":
$this_month_start = mktime(0, 0, 0,1,1,date('Y')); //2015-01-01 00:00:00 $this_month_start = mktime(0, 0, 0,1,1,date('Y')); //2015-01-01 00:00:00
$this_month_end = mktime(23,59,59,12,30,date('Y')); //2015-12-30 23:59:59 $this_month_end = mktime(23,59,59,12,30,date('Y')); //2015-12-30 23:59:59
$where1.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end; $where1.= ' and A.`create_time` between '.$this_month_start.' and '.$this_month_end;
$this->data['saixuan'] = $_createTime_where; $this->data['saixuan'] = $_createTime_where;
break; break;
...@@ -630,16 +630,16 @@ class Channeladmin extends CI_Controller ...@@ -630,16 +630,16 @@ class Channeladmin extends CI_Controller
$titles = '用户ID,客户姓名,客户电话,类型,报备时间,状态,销售顾问,渠道,分销商,项目,经纪人,备注'; $titles = '用户ID,客户姓名,客户电话,类型,报备时间,状态,销售顾问,渠道,分销商,项目,经纪人,备注';
$titles = iconv('utf-8','gbk',$titles); $titles = iconv('utf-8','gbk',$titles);
$header = iconv('utf-8','gbk',"渠道客户明细"); $header = iconv('utf-8','gbk',"渠道客户明细");
$this->export->export_excel($header . '.xls',$titles,$data); $this->export->export_excel($header . '.xls',$titles,$data);
break; break;
default: default:
echo "no tags, error"; echo "no tags, error";
} }
} }
} }
/** /**
* *
* 删除 * 删除
* @author libin * @author libin
* @version 2016-12-15 * @version 2016-12-15
...@@ -648,8 +648,8 @@ class Channeladmin extends CI_Controller ...@@ -648,8 +648,8 @@ class Channeladmin extends CI_Controller
{ {
$channel_id = $this->input->post('channel_id'); $channel_id = $this->input->post('channel_id');
$parent_id = $this->input->post('parent_id'); $parent_id = $this->input->post('parent_id');
if ($channel_id) if ($channel_id)
{ {
//获取当前渠道所有直属一级下属 //获取当前渠道所有直属一级下属
$this->db->select('A.id') $this->db->select('A.id')
...@@ -688,7 +688,7 @@ class Channeladmin extends CI_Controller ...@@ -688,7 +688,7 @@ class Channeladmin extends CI_Controller
} }
} }
/** /**
* *
* 恢复 * 恢复
* @author libin * @author libin
* @version 2016-12-15 * @version 2016-12-15
...@@ -715,4 +715,4 @@ class Channeladmin extends CI_Controller ...@@ -715,4 +715,4 @@ class Channeladmin extends CI_Controller
} }
} }
} }
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ...@@ -7,7 +7,7 @@ if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Distributionadmin extends CI_Controller class Distributionadmin extends CI_Controller
{ {
const PAGE_SIZE = 20; const PAGE_SIZE = 20;
/** /**
* 构造器 * 构造器
*/ */
...@@ -19,7 +19,7 @@ class Distributionadmin extends CI_Controller ...@@ -19,7 +19,7 @@ class Distributionadmin extends CI_Controller
//语言包 //语言包
$this->lang->load('op_log','chinese'); $this->lang->load('op_log','chinese');
$this->u_name = $this->session->userdata('user_name'); $this->u_name = $this->session->userdata('user_name');
//加载菜单 //加载菜单
$this->load->helper('util'); $this->load->helper('util');
$this->data['menu'] = newgenerate_menu(); $this->data['menu'] = newgenerate_menu();
...@@ -29,7 +29,7 @@ class Distributionadmin extends CI_Controller ...@@ -29,7 +29,7 @@ class Distributionadmin extends CI_Controller
//模型 //模型
$this->load->model('activity_model', 'activity'); $this->load->model('activity_model', 'activity');
//获取城市 //获取城市
//加入城市和楼盘的权限控制 //加入城市和楼盘的权限控制
$u_id = (int)$this->session->userdata('u_id'); $u_id = (int)$this->session->userdata('u_id');
...@@ -43,9 +43,9 @@ class Distributionadmin extends CI_Controller ...@@ -43,9 +43,9 @@ class Distributionadmin extends CI_Controller
} }
/** /**
* *
* 显示分销注册列表 * 显示分销注册列表
* @param string $condition 过滤条件 城市 楼盘名称 姓名 电话 状态 * @param string $condition 过滤条件 城市 楼盘名称 姓名 电话 状态
* @author chenqt * @author chenqt
* @version 2016-10-14 * @version 2016-10-14
*/ */
...@@ -63,15 +63,15 @@ class Distributionadmin extends CI_Controller ...@@ -63,15 +63,15 @@ class Distributionadmin extends CI_Controller
$this->data['condition'] = $condition; $this->data['condition'] = $condition;
$this->data['page_size'] = self::PAGE_SIZE; $this->data['page_size'] = self::PAGE_SIZE;
$this->data['api'] = site_url('admin/salesadmin/page_api'); $this->data['api'] = site_url('admin/salesadmin/page_api');
$this->data['cities'] = $this->cities; $this->data['cities'] = $this->cities;
$this->data['sales_type'] = $this->sales_type; $this->data['sales_type'] = $this->sales_type;
$this->load->view('admin/sales/index',$this->data); $this->load->view('admin/sales/index',$this->data);
} }
/** /**
* *
* 用户列表 ajax分页数据 * 用户列表 ajax分页数据
* @param int $page 要查询的页码 * @param int $page 要查询的页码
* @param string $condition 查询条件 * @param string $condition 查询条件
...@@ -100,7 +100,7 @@ class Distributionadmin extends CI_Controller ...@@ -100,7 +100,7 @@ class Distributionadmin extends CI_Controller
$page_no = 1; $page_no = 1;
} }
$page_data = $this->sales_building->get_sales_building_page($where, $page_no, $page_size); $page_data = $this->sales_building->get_sales_building_page($where, $page_no, $page_size);
//配置信息 //配置信息
foreach($page_data as $key => &$v) foreach($page_data as $key => &$v)
{ {
...@@ -110,11 +110,11 @@ class Distributionadmin extends CI_Controller ...@@ -110,11 +110,11 @@ class Distributionadmin extends CI_Controller
$v['customer_total'] = $this->customer_building->get_count(array('sale_id' => $v['sale_id'], 'building_id' => $v['building_id'], 'is_deleted' => 0)); $v['customer_total'] = $this->customer_building->get_count(array('sale_id' => $v['sale_id'], 'building_id' => $v['building_id'], 'is_deleted' => 0));
$v['deal_total'] = $this->customer_building->get_count(array('sale_id' => $v['sale_id'], 'building_id' => $v['building_id'], 'recommend_status >='=>3, 'is_deleted' => 0)); $v['deal_total'] = $this->customer_building->get_count(array('sale_id' => $v['sale_id'], 'building_id' => $v['building_id'], 'recommend_status >='=>3, 'is_deleted' => 0));
$v['sales_type'] = $this->sales_type[$v['user_type']]; $v['sales_type'] = $this->sales_type[$v['user_type']];
} }
$result = array( $result = array(
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',
'num_start' => ($page_no - 1) * $page_size + 1, 'num_start' => ($page_no - 1) * $page_size + 1,
'data' =>array('total' => $count, 'page_no' => $page_no, 'page_size' => $page_size, 'data' => $page_data) 'data' =>array('total' => $count, 'page_no' => $page_no, 'page_size' => $page_size, 'data' => $page_data)
...@@ -135,7 +135,7 @@ class Distributionadmin extends CI_Controller ...@@ -135,7 +135,7 @@ class Distributionadmin extends CI_Controller
//$where = 'SB.is_deleted = 0 and U.user_type = 3 and '; //$where = 'SB.is_deleted = 0 and U.user_type = 3 and ';
$where = ' U.user_type = 3 and '; $where = ' U.user_type = 3 and ';
//城市编码 //城市编码
if($con_arr[0] != 'NULL' && !empty($con_arr[0])) if($con_arr[0] != 'NULL' && !empty($con_arr[0]))
{ {
...@@ -159,22 +159,22 @@ class Distributionadmin extends CI_Controller ...@@ -159,22 +159,22 @@ class Distributionadmin extends CI_Controller
{ {
$where .= ' U.user_mobile like "%' . $con_arr[3] .'%" and'; $where .= ' U.user_mobile like "%' . $con_arr[3] .'%" and';
} }
//电话号码 //电话号码
if($con_arr[4] != 'NULL' && !empty($con_arr[4])) if($con_arr[4] != 'NULL' && !empty($con_arr[4]))
{ {
$where .= ' U.user_type = ' . $con_arr[4] .' and'; $where .= ' U.user_type = ' . $con_arr[4] .' and';
} }
$user_id = (int)$this->session->userdata('u_id'); $user_id = (int)$this->session->userdata('u_id');
$info_region_id = $this->manager->get(array('id' => $user_id)); $info_region_id = $this->manager->get(array('id' => $user_id));
if(!empty($info_region_id)){ if(!empty($info_region_id)){
$r_id=$info_region_id["region_id"]; $r_id=$info_region_id["region_id"];
$b_id=$info_region_id["building_id"]; $b_id=$info_region_id["building_id"];
$where .= ' B.region_code in('.$r_id.') and B.id in('.$b_id.') and'; $where .= ' B.region_code in('.$r_id.') and B.id in('.$b_id.') and';
} }
$where = trim($where,' and'); $where = trim($where,' and');
return $where; return $where;
...@@ -193,9 +193,7 @@ class Distributionadmin extends CI_Controller ...@@ -193,9 +193,7 @@ class Distributionadmin extends CI_Controller
//$where = 'R.user_id = ' . $user_id; //$where = 'R.user_id = ' . $user_id;
$where = 'B.id in (' . $manager_info['building_id'].')'; $where = 'B.id in (' . $manager_info['building_id'].')';
$con_arr = array(); $con_arr = array();
if ($get) { if ($get) {
$con_arr = array( $con_arr = array(
'company_name' => $get['company_name'] ? : '', 'company_name' => $get['company_name'] ? : '',
'uniqid_id' => $get['uniqid_id'] ? : '' 'uniqid_id' => $get['uniqid_id'] ? : ''
...@@ -205,11 +203,11 @@ class Distributionadmin extends CI_Controller ...@@ -205,11 +203,11 @@ class Distributionadmin extends CI_Controller
$where .= ' and D.company_name like "%' . trim($get['company_name']) . '%"'; $where .= ' and D.company_name like "%' . trim($get['company_name']) . '%"';
} }
if (isset($get['uniqid_id']) && $get['uniqid_id']) { if (isset($get['uniqid_id'])) {
$where .= ' and D.uniqid_id like "%' . trim($get['uniqid_id']) . '%"'; $where .= ' and D.uniqid_id like "%' . trim($get['uniqid_id']) . '%"';
} }
} }
$count = $this->distributor->get_distributor_count_new($where); $count = $this->distributor->get_distributor_count_new($where);
$this->data['admins'] = $this->distributor->get_distributor_new($where, $page_no, self::PAGE_SIZE); $this->data['admins'] = $this->distributor->get_distributor_new($where, $page_no, self::PAGE_SIZE);
...@@ -231,7 +229,7 @@ class Distributionadmin extends CI_Controller ...@@ -231,7 +229,7 @@ class Distributionadmin extends CI_Controller
$data_arr = $con_arr ? '?' . http_build_query($con_arr) : NULL; $data_arr = $con_arr ? '?' . http_build_query($con_arr) : NULL;
$this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1; $this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1;
//获取分页 //获取分页
$this->data['num_link'] = set_page_new($data_arr, $this, site_url('admin/distributionadmin/distributor'), $count, self::PAGE_SIZE,4,'',true); $this->data['num_link'] = set_page_new($data_arr, $this, site_url('admin/distributionadmin/distributor'), $count, self::PAGE_SIZE,4,'',true);
...@@ -257,10 +255,10 @@ class Distributionadmin extends CI_Controller ...@@ -257,10 +255,10 @@ class Distributionadmin extends CI_Controller
{ {
$info = $this->distributor->get(array('company_name' => $value)); $info = $this->distributor->get(array('company_name' => $value));
} }
if ($info) if ($info)
{ {
} else { } else {
$return['errcode'] = '0'; $return['errcode'] = '0';
$return['errmsg'] = ''; $return['errmsg'] = '';
...@@ -284,7 +282,7 @@ class Distributionadmin extends CI_Controller ...@@ -284,7 +282,7 @@ class Distributionadmin extends CI_Controller
//判断是否提交 //判断是否提交
if(empty($_POST)) if(empty($_POST))
{ {
$info = $this->manager->get(array('id' => $uid)); $info = $this->manager->get(array('id' => $uid));
$buildings = array(); $buildings = array();
...@@ -303,9 +301,9 @@ class Distributionadmin extends CI_Controller ...@@ -303,9 +301,9 @@ class Distributionadmin extends CI_Controller
$this->load->model('building_distributor_model', 'relate'); $this->load->model('building_distributor_model', 'relate');
$this->load->model('distributor_model', 'distributor'); $this->load->model('distributor_model', 'distributor');
$this->load->model('channel_distributor_model','channel_distributor'); $this->load->model('channel_distributor_model','channel_distributor');
$post = $this->input->post(); $post = $this->input->post();
//分销商 //分销商
$dataM = $dataD = $dataC = array(); $dataM = $dataD = $dataC = array();
$dataD['company_name'] = trim($post['company_name']); //分销商名称 $dataD['company_name'] = trim($post['company_name']); //分销商名称
...@@ -316,10 +314,10 @@ class Distributionadmin extends CI_Controller ...@@ -316,10 +314,10 @@ class Distributionadmin extends CI_Controller
$dataD['create_time'] = time(); $dataD['create_time'] = time();
$building_ids = $post['building_id']; //楼盘 array $building_ids = $post['building_id']; //楼盘 array
//后台登陆帐号 //后台登陆帐号
$dataM['manager_name'] = $post['manager_name']; //分销商后台管理登陆帐号 $dataM['manager_name'] = $post['manager_name']; //分销商后台管理登陆帐号
$dataM['role_id'] = 11; //角色:分销商 $dataM['role_id'] = 11; //角色:分销商
$dataM['manager_pwd'] = $post['manager_pwd']; $dataM['manager_pwd'] = $post['manager_pwd'];
$dataM['create_time'] = time(); $dataM['create_time'] = time();
...@@ -347,13 +345,13 @@ class Distributionadmin extends CI_Controller ...@@ -347,13 +345,13 @@ class Distributionadmin extends CI_Controller
alert_redirect(site_url('admin/distributionadmin/distributorAdd'), '分销商已存在'); alert_redirect(site_url('admin/distributionadmin/distributorAdd'), '分销商已存在');
return; return;
} }
//校验是否存在该用户 //校验是否存在该用户
$info = array(); $info = array();
$info = $this->manager->get(array('manager_name' => $post['manager_name'])); $info = $this->manager->get(array('manager_name' => $post['manager_name']));
if ($post['op'] == 'add' && !empty($info)) if ($post['op'] == 'add' && !empty($info))
{ {
alert_redirect(site_url('admin/distributionadmin/distributorAdd'), '分销商帐号已存在'); alert_redirect(site_url('admin/distributionadmin/distributorAdd'), '分销商帐号已存在');
return; return;
...@@ -372,10 +370,10 @@ class Distributionadmin extends CI_Controller ...@@ -372,10 +370,10 @@ class Distributionadmin extends CI_Controller
$this->channel_distributor->add($dataC); $this->channel_distributor->add($dataC);
//创建销管与分销商的关联 //创建销管与分销商的关联
if ($distributor_id) if ($distributor_id)
{ {
for ($i=0, $cnt = count($building_ids); $i < $cnt; $i++) for ($i=0, $cnt = count($building_ids); $i < $cnt; $i++)
{ {
$dataR['user_id'] = $uid; $dataR['user_id'] = $uid;
$dataR['distributor_id'] = $distributor_id; $dataR['distributor_id'] = $distributor_id;
$dataR['building_id'] = $building_ids[$i]; $dataR['building_id'] = $building_ids[$i];
...@@ -386,18 +384,18 @@ class Distributionadmin extends CI_Controller ...@@ -386,18 +384,18 @@ class Distributionadmin extends CI_Controller
//记录日志 //记录日志
$log = array( $log = array(
'log' => sprintf($this->lang->line('op_insert_succ'), $this->u_name, '管理员email:') 'log' => sprintf($this->lang->line('op_insert_succ'), $this->u_name, '管理员email:')
); );
$this->loger->add_op_log('register',$log); $this->loger->add_op_log('register',$log);
alert_redirect(site_url('admin/distributionadmin/distributor')); return; alert_redirect(site_url('admin/distributionadmin/distributor')); return;
} }
} }
} }
//记录日志 //记录日志
$log = array( $log = array(
'log' => sprintf($this->lang->line('op_insert_fail'), $this->u_name, '管理员email:') 'log' => sprintf($this->lang->line('op_insert_fail'), $this->u_name, '管理员email:')
); );
$this->loger->add_op_log('register',$log); $this->loger->add_op_log('register',$log);
alert_redirect(site_url('admin/distributionadmin/distributor','添加管理员失败,请重试')); alert_redirect(site_url('admin/distributionadmin/distributor','添加管理员失败,请重试'));
...@@ -430,7 +428,7 @@ class Distributionadmin extends CI_Controller ...@@ -430,7 +428,7 @@ class Distributionadmin extends CI_Controller
$this->load->view('admin/sales/distributorEdit',$this->data); $this->load->view('admin/sales/distributorEdit',$this->data);
return; return;
} }
$post = $this->input->post(); $post = $this->input->post();
//入库 //入库
$dataD = $dataM = array(); //$dataD: distributor表要更新的数据,$dataM:manager表要更新的数据 $dataD = $dataM = array(); //$dataD: distributor表要更新的数据,$dataM:manager表要更新的数据
...@@ -456,22 +454,22 @@ class Distributionadmin extends CI_Controller ...@@ -456,22 +454,22 @@ class Distributionadmin extends CI_Controller
return; return;
} }
if($post['manager_pwd']!=''){ if($post['manager_pwd']!=''){
$dataM['manager_pwd'] = md5($post['manager_pwd']); $dataM['manager_pwd'] = md5($post['manager_pwd']);
} }
//todo 分销商已存在 //todo 分销商已存在
$distributorInfo = $this->distributor->get(array('company_name' => $post['company_name'])); $distributorInfo = $this->distributor->get(array('company_name' => $post['company_name']));
if (!empty($distributorInfo) && $distributorInfo['id'] != $distributor_id) if (!empty($distributorInfo) && $distributorInfo['id'] != $distributor_id)
{ {
alert_redirect(site_url('admin/distributionadmin/distributorEdit/' . $distributor_id), '分销商已存在'); alert_redirect(site_url('admin/distributionadmin/distributorEdit/' . $distributor_id), '分销商已存在');
return; return;
} }
//校验是否存在该用户 //校验是否存在该用户
$info = array(); $info = array();
$info = $this->manager->get(array('manager_name' => $post['manager_name'])); $info = $this->manager->get(array('manager_name' => $post['manager_name']));
if (!empty($info) && $info['id'] != $manager_id) if (!empty($info) && $info['id'] != $manager_id)
{ {
alert_redirect(site_url('admin/distributionadmin/distributorEdit/' . $distributor_id), '分销商帐号已存在'); alert_redirect(site_url('admin/distributionadmin/distributorEdit/' . $distributor_id), '分销商帐号已存在');
return; return;
...@@ -486,19 +484,19 @@ class Distributionadmin extends CI_Controller ...@@ -486,19 +484,19 @@ class Distributionadmin extends CI_Controller
//记录日志 //记录日志
$log = array( $log = array(
'log' => sprintf($this->lang->line('op_insert_succ'), $this->u_name, '管理员email:') 'log' => sprintf($this->lang->line('op_insert_succ'), $this->u_name, '管理员email:')
); );
$this->loger->add_op_log('register',$log); $this->loger->add_op_log('register',$log);
alert_redirect(site_url('admin/distributionadmin/distributor')); alert_redirect(site_url('admin/distributionadmin/distributor'));
return ; return ;
} }
} }
//记录日志 //记录日志
$log = array( $log = array(
'log' => sprintf($this->lang->line('op_insert_fail'), $this->u_name, '管理员email:') 'log' => sprintf($this->lang->line('op_insert_fail'), $this->u_name, '管理员email:')
); );
$this->loger->add_op_log('register',$log); $this->loger->add_op_log('register',$log);
alert_redirect(site_url('admin/distributionadmin/distributor','修改管理员失败,请重试')); alert_redirect(site_url('admin/distributionadmin/distributor','修改管理员失败,请重试'));
...@@ -510,7 +508,7 @@ class Distributionadmin extends CI_Controller ...@@ -510,7 +508,7 @@ class Distributionadmin extends CI_Controller
{ {
$distributor_id = $this->input->post('distributor_id'); $distributor_id = $this->input->post('distributor_id');
$this->load->model('distributor_model', 'distributor'); $this->load->model('distributor_model', 'distributor');
if ($distributor_id) if ($distributor_id)
{ {
$data['is_deleted'] = 1; $data['is_deleted'] = 1;
$data['update_time'] = time(); $data['update_time'] = time();
...@@ -520,7 +518,7 @@ class Distributionadmin extends CI_Controller ...@@ -520,7 +518,7 @@ class Distributionadmin extends CI_Controller
{ {
$dataM['is_deleted'] = 1; $dataM['is_deleted'] = 1;
$dataM['update_time'] = time(); $dataM['update_time'] = time();
if ($this->manager->update(array('id' => $distributor['manager_id']), $dataM)) if ($this->manager->update(array('id' => $distributor['manager_id']), $dataM))
{ {
echo json_encode(array('errcode' => 0, 'errmsg' => '禁用成功')); exit; echo json_encode(array('errcode' => 0, 'errmsg' => '禁用成功')); exit;
} }
...@@ -530,4 +528,4 @@ class Distributionadmin extends CI_Controller ...@@ -530,4 +528,4 @@ class Distributionadmin extends CI_Controller
echo json_encode(array('errcode' => 1, 'errmsg' => '网络错误!')); exit; echo json_encode(array('errcode' => 1, 'errmsg' => '网络错误!')); exit;
} }
} }
} }
\ No newline at end of file
<?php <?php
/** /**
*渠道管理表,管理员所属权限是渠道,及相关操作 *渠道管理表,管理员所属权限是渠道,及相关操作
* *
* @package application/model * @package application/model
* @version 2016-12-15 * @version 2016-12-15
* @author libin * @author libin
...@@ -12,7 +12,7 @@ class Channel_model extends My_Model{ ...@@ -12,7 +12,7 @@ class Channel_model extends My_Model{
* 使用到的表 * 使用到的表
*/ */
public $table = 'tb_channel'; public $table = 'tb_channel';
/** /**
* 构造器 * 构造器
*/ */
...@@ -23,11 +23,11 @@ class Channel_model extends My_Model{ ...@@ -23,11 +23,11 @@ class Channel_model extends My_Model{
$this->db = $this->load->database('default', true); $this->db = $this->load->database('default', true);
} }
/** /**
* *
* 查询所有该渠道下属客户信息 * 查询所有该渠道下属客户信息
* @param int $where * @param int $where
* @return array 包含统计起止时间的数组 * @return array 包含统计起止时间的数组
* @throws Exception * @throws Exception
* @author libin * @author libin
* @version 2016-12-18 * @version 2016-12-18
*/ */
...@@ -35,7 +35,7 @@ class Channel_model extends My_Model{ ...@@ -35,7 +35,7 @@ class Channel_model extends My_Model{
//按首字母排列 //按首字母排列
//$where.=' order by B.create_time desc'; //$where.=' order by B.create_time desc';
$this->db->select('B.id,A.customer_user,A.customer_mobile,A.customer_type,B.create_time,B.recommend_status,H.user_name sale_name,F.manager_name channel_name,C.company_name,I.building_title,J.user_name,B.remark,RR.region_name') $this->db->select('B.id,A.customer_user,A.customer_mobile,A.customer_type,B.sale_id,B.create_time,B.recommend_status,H.user_name sale_name,F.manager_name channel_name,C.company_name,I.building_title,J.user_name,B.remark,RR.region_name')
->from('tb_customer_building B') ->from('tb_customer_building B')
->join('tb_customer A','A.id=B.customer_id') ->join('tb_customer A','A.id=B.customer_id')
...@@ -64,11 +64,11 @@ class Channel_model extends My_Model{ ...@@ -64,11 +64,11 @@ class Channel_model extends My_Model{
} }
/** /**
* *
* 查询所有该渠道下属各个类别客户信息总条数 * 查询所有该渠道下属各个类别客户信息总条数
* @param int $where * @param int $where
* @return array 包含统计起止时间的数组 * @return array 包含统计起止时间的数组
* @throws Exception * @throws Exception
* @author lihengyi * @author lihengyi
* @version 2016-12-23 * @version 2016-12-23
*/ */
...@@ -88,7 +88,7 @@ class Channel_model extends My_Model{ ...@@ -88,7 +88,7 @@ class Channel_model extends My_Model{
->where($where_sql) ->where($where_sql)
->group_by('B.recommend_status') ->group_by('B.recommend_status')
->order_by('B.recommend_status'); ->order_by('B.recommend_status');
$resp=$this->db->get(); $resp=$this->db->get();
//$resp=$resp->result_array(); //$resp=$resp->result_array();
if($resp->num_rows() > 0) if($resp->num_rows() > 0)
...@@ -99,11 +99,11 @@ class Channel_model extends My_Model{ ...@@ -99,11 +99,11 @@ class Channel_model extends My_Model{
} }
/** /**
* *
* 查询所有该渠道下属客户信息总条数 * 查询所有该渠道下属客户信息总条数
* @param int $where * @param int $where
* @return array 包含统计起止时间的数组 * @return array 包含统计起止时间的数组
* @throws Exception * @throws Exception
* @author libin * @author libin
* @version 2016-12-18 * @version 2016-12-18
*/ */
...@@ -122,17 +122,17 @@ class Channel_model extends My_Model{ ...@@ -122,17 +122,17 @@ class Channel_model extends My_Model{
if($where!=''){ if($where!=''){
$this->db->where($where); $this->db->where($where);
} }
$resp=$this->db->get(); $resp=$this->db->get();
$resp=$resp->result_array(); $resp=$resp->result_array();
return $resp[0]['num']; return $resp[0]['num'];
} }
/** /**
* *
* 查询所有该渠道的所有下属渠道id * 查询所有该渠道的所有下属渠道id
* @param int $where * @param int $where
* @return array 包含统计起止时间的数组 * @return array 包含统计起止时间的数组
* @throws Exception * @throws Exception
* @author libin * @author libin
* @version 2016-12-18 * @version 2016-12-18
* *
...@@ -142,7 +142,7 @@ class Channel_model extends My_Model{ ...@@ -142,7 +142,7 @@ class Channel_model extends My_Model{
->from('tb_channel'); ->from('tb_channel');
$query=$this->db->get(); $query=$this->db->get();
$re=$query->result_array(); $re=$query->result_array();
//组建渠道遍历树结构 //组建渠道遍历树结构
$tree=array(); $tree=array();
foreach($re as $k=>$v){ foreach($re as $k=>$v){
...@@ -168,11 +168,11 @@ class Channel_model extends My_Model{ ...@@ -168,11 +168,11 @@ class Channel_model extends My_Model{
return array(); return array();
} }
/** /**
* *
* 查询所有该渠道的渠道id和名称 * 查询所有该渠道的渠道id和名称
* @param int $where * @param int $where
* @return array 包含统计起止时间的数组 * @return array 包含统计起止时间的数组
* @throws Exception * @throws Exception
* @author libin * @author libin
* @version 2016-12-18 * @version 2016-12-18
* *
...@@ -184,7 +184,7 @@ class Channel_model extends My_Model{ ...@@ -184,7 +184,7 @@ class Channel_model extends My_Model{
if($where!=''){ if($where!=''){
$this->db->where($where); $this->db->where($where);
} }
$query=$this->db->get(); $query=$this->db->get();
if($query->num_rows() > 0) if($query->num_rows() > 0)
{ {
...@@ -194,11 +194,11 @@ class Channel_model extends My_Model{ ...@@ -194,11 +194,11 @@ class Channel_model extends My_Model{
} }
/** /**
* *
* 查询所有该渠道的所有下属渠道 * 查询所有该渠道的所有下属渠道
* @param int $where * @param int $where
* @return array 包含统计起止时间的数组 * @return array 包含统计起止时间的数组
* @throws Exception * @throws Exception
* @author libin * @author libin
* @version 2016-12-18 * @version 2016-12-18
*$c必须传空数组 *$c必须传空数组
...@@ -206,19 +206,19 @@ class Channel_model extends My_Model{ ...@@ -206,19 +206,19 @@ class Channel_model extends My_Model{
function findChildren($tree,$c){ function findChildren($tree,$c){
array_push($c,$tree['id']); array_push($c,$tree['id']);
if(isset($tree['children'])){ if(isset($tree['children'])){
foreach($tree['children'] as $k => $v){ foreach($tree['children'] as $k => $v){
$c=$this->findChildren($v,$c); $c=$this->findChildren($v,$c);
} }
} }
return $c; return $c;
} }
/** /**
* *
* 查询所渠道信息分页显示 * 查询所渠道信息分页显示
* @param int $where * @param int $where
* @return array 包含统计起止时间的数组 * @return array 包含统计起止时间的数组
* @throws Exception * @throws Exception
* @author libin * @author libin
* @version 2016-12-18 * @version 2016-12-18
*/ */
...@@ -263,4 +263,4 @@ class Channel_model extends My_Model{ ...@@ -263,4 +263,4 @@ class Channel_model extends My_Model{
} }
return array(); return array();
} }
} }
\ No newline at end of file
...@@ -11,15 +11,15 @@ ...@@ -11,15 +11,15 @@
<meta content="" name="description" /> <meta content="" name="description" />
<meta content="" name="author" /> <meta content="" name="author" />
<meta name="MobileOptimized" content="320"> <meta name="MobileOptimized" content="320">
<!-- BEGIN GLOBAL MANDATORY STYLES --> <!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="<?php echo APPLICATION_PATH ?>/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/> <link href="<?php echo APPLICATION_PATH ?>/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo APPLICATION_PATH ?>/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <link href="<?php echo APPLICATION_PATH ?>/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo APPLICATION_PATH ?>/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/> <link href="<?php echo APPLICATION_PATH ?>/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES --> <!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL STYLES --> <!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="<?php echo APPLICATION_PATH ?>/assets/plugins/select2/select2-metronic.css" /> <link rel="stylesheet" type="text/css" href="<?php echo APPLICATION_PATH ?>/assets/plugins/select2/select2-metronic.css" />
<!-- END PAGE LEVEL SCRIPTS --> <!-- END PAGE LEVEL SCRIPTS -->
<!-- BEGIN THEME STYLES --> <!-- BEGIN THEME STYLES -->
<link href="<?php echo APPLICATION_PATH ?>/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/> <link href="<?php echo APPLICATION_PATH ?>/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo APPLICATION_PATH ?>/assets/css/style.css" rel="stylesheet" type="text/css"/> <link href="<?php echo APPLICATION_PATH ?>/assets/css/style.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo APPLICATION_PATH ?>/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/> <link href="<?php echo APPLICATION_PATH ?>/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
...@@ -66,15 +66,15 @@ ...@@ -66,15 +66,15 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="text" name="captcha" id="captcha" class="input-sm input-small" onkeypress="EnterPress()"> <input type="text" name="captcha" id="captcha" class="input-sm input-small" onkeypress="EnterPress()" onkeydown="EnterPress(event)">
<?php echo isset($image)?$image:'no';?> <?php echo isset($image)?$image:'no';?>
</div> </div>
<div class="form-actions text-center"> <div class="form-actions text-center">
<input type="checkbox" checked="true" name="chkRememberUsername" class="text-left" id="rmbUser">记住用户名 <input type="checkbox" checked="true" name="chkRememberUsername" class="text-left" id="rmbUser">记住用户名
<button type="button" class="btn green pull-center text-right login-btn"> <button type="button" class="btn green pull-center text-right login-btn">
登录 <i class="m-icon-swapright m-icon-white"></i> 登录 <i class="m-icon-swapright m-icon-white"></i>
</button> </button>
</div> </div>
</form> </form>
<!-- END LOGIN FORM --> <!-- END LOGIN FORM -->
...@@ -86,28 +86,28 @@ ...@@ -86,28 +86,28 @@
</div> </div>
<!-- END COPYRIGHT --> <!-- END COPYRIGHT -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) --> <!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS --> <!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="/assets/plugins/respond.min.js"></script> <script src="/assets/plugins/respond.min.js"></script>
<script src="/assets/plugins/excanvas.min.js"></script> <script src="/assets/plugins/excanvas.min.js"></script>
<![endif]--> <![endif]-->
<script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script> <script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script> <script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="<?php echo APPLICATION_PATH ?>/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="<?php echo APPLICATION_PATH ?>/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script> <script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script> <script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
<script src="<?php echo APPLICATION_PATH ?>/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script> <script src="<?php echo APPLICATION_PATH ?>/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>
<!-- END CORE PLUGINS --> <!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS --> <!-- BEGIN PAGE LEVEL PLUGINS -->
<script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script> <script src="<?php echo APPLICATION_PATH ?>/assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo APPLICATION_PATH ?>/assets/plugins/select2/select2.min.js"></script> <script type="text/javascript" src="<?php echo APPLICATION_PATH ?>/assets/plugins/select2/select2.min.js"></script>
<!-- END PAGE LEVEL PLUGINS --> <!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS --> <!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="<?php echo APPLICATION_PATH ?>/assets/js/backend/core/app.js"></script> <script src="<?php echo APPLICATION_PATH ?>/assets/js/backend/core/app.js"></script>
<script src="<?php echo APPLICATION_PATH ?>/assets/js/backend/custom/login.js"></script> <script src="<?php echo APPLICATION_PATH ?>/assets/js/backend/custom/login.js"></script>
<!-- END PAGE LEVEL SCRIPTS --> <!-- END PAGE LEVEL SCRIPTS -->
<script> <script>
jQuery(document).ready(function() { jQuery(document).ready(function() {
App.init(); App.init();
//初始化 //初始化
if ($.cookie("rmbUser")) { if ($.cookie("rmbUser")) {
...@@ -116,11 +116,12 @@ ...@@ -116,11 +116,12 @@
// $("#password").val($.cookie("password")); // $("#password").val($.cookie("password"));
} }
}); });
function EnterPress(){ function EnterPress(e){ //传入 event
if(event.keyCode == 13){ var e = e || window.event;
if(event.keyCode == 13){
$('.login-btn').trigger('click'); $('.login-btn').trigger('click');
} }
} }
$(".login-btn").click(function(){ $(".login-btn").click(function(){
var username = $("#username").val(); var username = $("#username").val();
if(!username) if(!username)
...@@ -189,4 +190,4 @@ ...@@ -189,4 +190,4 @@
<!-- END JAVASCRIPTS --> <!-- END JAVASCRIPTS -->
</body> </body>
<!-- END BODY --> <!-- END BODY -->
</html> </html>
\ No newline at end of file
...@@ -367,8 +367,7 @@ ...@@ -367,8 +367,7 @@
format: 'yyyy-mm-dd', format: 'yyyy-mm-dd',
language: 'cn', language: 'cn',
}); });
var aa = "<?php echo $customer['recommend_status']?>";
console.log(aa);
//分销商筛选 //分销商筛选
$('#parent_name').on('keyup click',function(){ $('#parent_name').on('keyup click',function(){
$('#channel_list').show(); $('#channel_list').show();
......
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