Commit addba98e by html5-李恒逸

更改:分销商绑定时,过滤掉已经绑定的楼盘

parent 3e01f604
...@@ -1064,7 +1064,7 @@ class Report extends CI_Controller ...@@ -1064,7 +1064,7 @@ class Report extends CI_Controller
$where .= ' and b.id in(' . $info['building_id'] . ')'; //echo $where;die; $where .= ' and b.id in(' . $info['building_id'] . ')'; //echo $where;die;
$all_result = $this->relate->get_unbind_list(trim($where)); //查询所有的笛卡尔积(项目*分销商) $all_result = $this->relate->get_unbind_list(trim($where)); //查询所有的笛卡尔积(项目*分销商)
$has_result = $this->relate->get_bind_list($uid); //查询已经绑定此销管的分销商 $has_result = $this->relate->get_bind_list($info['building_id']); //查询已经绑定此销管的分销商
if ($all_result) { if ($all_result) {
foreach ($all_result as $key => $all) { foreach ($all_result as $key => $all) {
......
<?php <?php
/** /**
* 分销商与销管关系模型 * 分销商与销管关系模型
* *
* @package application/model * @package application/model
* @version 2012-10-31 * @version 2012-10-31
* @author wenhuijang * @author wenhuijang
...@@ -11,18 +11,18 @@ class Building_distributor_model extends MY_Model{ ...@@ -11,18 +11,18 @@ class Building_distributor_model extends MY_Model{
//定义用到的数据库表 //定义用到的数据库表
public $table='tb_building_distributor_relate'; public $table='tb_building_distributor_relate';
public function __construct(){ public function __construct(){
parent::__construct(); parent::__construct();
$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 wenhuijang * @author wenhuijang
* @version 2014-09-09 * @version 2014-09-09
*/ */
...@@ -34,7 +34,7 @@ class Building_distributor_model extends MY_Model{ ...@@ -34,7 +34,7 @@ class Building_distributor_model extends MY_Model{
->join('tb_manager M', 'M.id = R.user_id') ->join('tb_manager M', 'M.id = R.user_id')
->join('tb_building B', 'B.id = R.building_id'); ->join('tb_building B', 'B.id = R.building_id');
if(!empty($where)) if(!empty($where))
{ {
$this->db->where($where); $this->db->where($where);
...@@ -91,11 +91,11 @@ class Building_distributor_model extends MY_Model{ ...@@ -91,11 +91,11 @@ class Building_distributor_model extends MY_Model{
} }
/** /**
* *
* 查询所有楼盘数据 * 查询所有楼盘数据
* @param int $where * @param int $where
* @return array 包含统计起止时间的数组 * @return array 包含统计起止时间的数组
* @throws Exception * @throws Exception
* @author wenhuijang * @author wenhuijang
* @version 2014-09-09 * @version 2014-09-09
*/ */
...@@ -106,7 +106,7 @@ class Building_distributor_model extends MY_Model{ ...@@ -106,7 +106,7 @@ class Building_distributor_model extends MY_Model{
->join('tb_distributor D', 'D.id = R.distributor_id') ->join('tb_distributor D', 'D.id = R.distributor_id')
->join('tb_building B', 'B.id = R.building_id') ->join('tb_building B', 'B.id = R.building_id')
->join('tb_region RE','RE.region_code=B.region_code'); ->join('tb_region RE','RE.region_code=B.region_code');
if(!empty($where)) if(!empty($where))
{ {
...@@ -116,7 +116,7 @@ class Building_distributor_model extends MY_Model{ ...@@ -116,7 +116,7 @@ class Building_distributor_model extends MY_Model{
$this->db->order_by('R.id','desc'); $this->db->order_by('R.id','desc');
$query = $this->db->get(null, $page_size, ($page-1) * $page_size); $query = $this->db->get(null, $page_size, ($page-1) * $page_size);
if($query->num_rows() > 0) if($query->num_rows() > 0)
{ {
$return = $query->result_array(); $return = $query->result_array();
...@@ -174,9 +174,9 @@ class Building_distributor_model extends MY_Model{ ...@@ -174,9 +174,9 @@ class Building_distributor_model extends MY_Model{
} }
//查询已经绑定此销管的分销商 //查询已经绑定此销管的分销商
public function get_bind_list($manager_id = '') public function get_bind_list($building_id = '')
{ {
$query = $this->db->query('SELECT distributor_id,building_id from tb_building_distributor_relate WHERE user_id =' . $manager_id); $query = $this->db->query('SELECT distributor_id,building_id from tb_building_distributor_relate WHERE building_id in (' . $building_id.')');
if($query->num_rows() > 0) if($query->num_rows() > 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