Commit addba98e by html5-李恒逸

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

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