Commit 0afbdea0 by HTML5-侯张振

修复 7月3号-到7月9号的bug

parent 2c317b46
......@@ -38,6 +38,7 @@ class Channeladmin extends CI_Controller
$con = array();
$where='`role_id` = 12 and';
$name = $this->input->get('manager_name') ? urldecode($this->input->get('manager_name', true)) : "";
$user_data=$this->session->userdata;
if(!empty($name))
{
......@@ -68,6 +69,8 @@ class Channeladmin extends CI_Controller
$page_no = 1;
}
$re=array();
$manager_channel = $this->manager->get(array('id'=>$user_data['u_id']));
$where1 .=' and CA.building_id in ('.$manager_channel['building_id'].')';
$re=$this->channel->get_all_channel($where1,$page_no,self::PAGE_SIZE, $orderbySql);
$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));
......@@ -346,6 +349,9 @@ class Channeladmin extends CI_Controller
//获得所有下属的id和帐户名
$this->data['channelInfo']=$this->channel->find_channel_name($where);
//获取manager_id
$build=$this->manager->get(array('id'=>$this->session->userdata('u_id')));
if($get['distributor_name']!=''){
$where.=' and C.company_name like "%'.$get['distributor_name'].'%"';
......@@ -405,6 +411,7 @@ class Channeladmin extends CI_Controller
$page_no = 1;
}
$admins = array();
$where.=' and B.building_id in ('.$build['building_id'].')';
$admins = $this->channel->get_all_info($where, $page_no, self::PAGE_SIZE);
$this->data['customers'] = $admins;
$this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1;
......@@ -437,7 +444,8 @@ class Channeladmin extends CI_Controller
//获得所有下属的id和帐户名
$this->data['channelInfo']=$this->channel->find_channel_name($where);
//获取manager_id
$build=$this->manager->get(array('id'=>$this->session->userdata('u_id')));
if($get['distributor_name']!=''){
$where.=' and C.company_name like "%'.$get['distributor_name'].'%"';
$this->data['distributor_name']=$get['distributor_name'];
......@@ -496,6 +504,7 @@ class Channeladmin extends CI_Controller
$page_no = 1;
}
$admins = array();
$where.=' and B.building_id in ('.$build['building_id'].')';
$admins = $this->channel->get_all_info($where, $page_no, self::PAGE_SIZE);
$this->data['customers'] = $admins;
$this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1;
......@@ -519,6 +528,8 @@ class Channeladmin extends CI_Controller
*/
function export_actions($where=null){
$where=$this->input->get();
//获取manager_id
$build=$this->manager->get(array('id'=>$this->session->userdata('u_id')));
if(isset($where) && !empty($where))
{
//获取标识
......@@ -595,6 +606,7 @@ class Channeladmin extends CI_Controller
}
}
//获取客户信息
$where1.=' and B.building_id in ('.$build['building_id'].')';
$customers=$this->channel->get_all_info($where1,1,$page_size);
}
//格式数据
......
......@@ -189,7 +189,7 @@ class Distributionadmin extends CI_Controller
$user_id = (int)$this->session->userdata('u_id');
$manager_info = $this->manager->get(array('id' => $user_id));
$user_data=$this->session->userdata;
//$where = 'R.user_id = ' . $user_id;
$where = 'B.id in (' . $manager_info['building_id'].')';
$con_arr = array();
......@@ -209,6 +209,9 @@ class Distributionadmin extends CI_Controller
}
$count = $this->distributor->get_distributor_count_new($where);
if($user_data['role'] == 12){
$where.= ' and A.id ='.$user_data['u_id'];
};
$this->data['admins'] = $this->distributor->get_distributor_new($where, $page_no, self::PAGE_SIZE);
......@@ -232,7 +235,7 @@ class Distributionadmin extends CI_Controller
//获取分页
$this->data['num_link'] = set_page_new($data_arr, $this, site_url('admin/distributionadmin/distributor'), $count, self::PAGE_SIZE,4,'',true);
$user_data=$this->session->userdata;
$this->data['role']=$user_data['role'];
$this->load->view('admin/sales/distributor', $this->data);
}
......@@ -419,8 +422,12 @@ class Distributionadmin extends CI_Controller
$query=$this->db->get();
$channelInfo=$query->result_array();
$build=$this->manager->get(array('id'=>$this->session->userdata('u_id')));
$where='B.id in ('.$build['building_id'].')';
$where.=' and R.distributor_id = ' . $id;
//查找此销管 绑定 此分销商的所有项目,并且不允许修改
$buildings = $this->building_distributor->get_has_building('R.distributor_id = ' . $id);
$buildings = $this->building_distributor->get_has_building($where);
$this->data['buildings'] = $buildings;
$this->data['channelInfo']=$channelInfo;
......
......@@ -483,9 +483,9 @@ class Report extends CI_Controller
// 'rongchuang_id' => $newcustomerId
// );
if($newcustomerId){
$this->customer->add_rongchuang_id($newcustomerInfo['customerId'],$newcustomer);
}
// if($newcustomerId){
// $this->customer->add_rongchuang_id($newcustomerInfo['customerId'],$newcustomer);
// }
}
......
......@@ -73,7 +73,6 @@ class Salesadmin extends CI_Controller
$this->data['condition'] = $condition;
$this->data['page_size'] = self::PAGE_SIZE;
$this->data['api'] = site_url('admin/salesadmin/page_api');
$this->data['cities'] = $this->cities;
$this->data['sales_type'] = $this->sales_type;
$this->load->view('admin/sales/index',$this->data);
......
......@@ -160,7 +160,7 @@ class Index extends CI_Controller{
}
//var_dump($this->session->userdata('u_id'));
$build=$this->manager->get(array('id'=>$this->session->userdata('u_id')));
//var_dump($build['building_id']);
$where.=' and B.building_id in ('.$build['building_id'].')';
if($start_time!=''){
$where.=' and B.create_time >= '.$start_time;
......
......@@ -153,16 +153,18 @@ class Recommend extends CI_Controller{
已过期,所有分销商都可重新报备一次 CB.manager_id != 0 and CB.recommend_status != 8 and CB.distributor_id = xx
*/
$where = "C.customer_mobile = '{$post['customer_phone'][$i]}' AND CB.building_id = {$building_id} AND ((CB.is_valid !=0 and CB.manager_id = 0 and CB.distributor_id = {$distributor_entity['id']}) or (CB.manager_id != 0 and CB.recommend_status != 8) or (CB.is_valid = 0 and CB.distributor_id = {$distributor_entity['id']}) or (CB.manager_id != 0 and CB.recommend_status != 8 and CB.distributor_id = {$distributor_entity['id']}))";
$customer_info = $this->customer_building->exits_customer_building(
//array('C.customer_mobile' => $post['customer_phone'][$i], 'CB.building_id' => $building_id)
$where
);
//var_dump($post);
//如果是已过期,存储历史记录并删除原数据
if(!empty($customer_info))
{
$customer_id = $customer_info['customer_id'];
if ($customer_info['recommend_status'] == 8 || $customer_info['is_valid'] == 0) //已过期 或者报备无效
if ($customer_info['is_expired'] == 1 || $customer_info['is_valid'] == 0) //已过期 或者报备无效
{
$cbinfo = $this->customer_building->get(array('id' => $customer_info['id']));
......@@ -179,6 +181,8 @@ class Recommend extends CI_Controller{
$dataLog['create_time'] = $cbinfo['create_time'];
$dataLog['action_time'] = time();
$customer_user=array('customer_user'=>$post['customer_name'][0]);
$this->customer->updata_customer_user($cbinfo['customer_id'],$customer_user);
$this->customer_building_log->add($dataLog);
$this->customer_building->del(array('id' => $customer_info['id']));
} else if (0 == $customer_info['distribution_status'] && $distributor_entity['id']!=$customer_info['distributor_id']) { //不同分销商,未分配,可报备
......
......@@ -28,7 +28,8 @@ class Rule extends CI_Controller{
alert_redirect(site_url('distributor/logindis'));
}
$distributor_ins=$this->distributor->get(array('uniqid_id'=>$this->uniqid_id));
$buildings=$this->bdrelation->get_all_building(array('D.id'=>$distributor_ins['id'],'R.is_deleted'=>0),1,10);
$buildings=$this->bdrelation->get_all_building(array('D.id'=>$distributor_ins['id'],'R.is_deleted'=>0),1,30);
$prepage_building_id=0;
if(!$building_id_from)
{
......@@ -37,6 +38,7 @@ class Rule extends CI_Controller{
$rules=array();
foreach ($buildings as $i=>$value) {
$temp=$this->rule->get_relate('R.building_id ='.$value['bid'].' and R.is_deleted =0');
if(isset($temp['content'])){
$rules[]=array('bid'=>$temp['building_id'],'title'=>$temp['building_title'],'content'=>unserialize($temp['content']));
}
......@@ -48,6 +50,7 @@ class Rule extends CI_Controller{
$prepage_building_id=0;
}
$this->data['buildings']=$rules;
$this->data['prepage_building_id']=$prepage_building_id;
$this->load->view('distributor/rule',$this->data);
}
......
......@@ -11,7 +11,7 @@ class easApi {
private $dcName = 'T53_7523'; //金蝶分配的数据访问凭证
private $base_url = 'http://192.168.2.48:6888/'; //域名配置
private $base_url = 'http://192.168.2.195:6888/'; //域名配置
public function __construct()
{
......
......@@ -41,10 +41,11 @@ class Channel_model extends My_Model{
->join('tb_customer A','A.id=B.customer_id')
->join('tb_distributor C','B.distributor_id=C.id')
// ->join('tb_channel_distributor D','C.channel=D.channel_id');
->join('tb_customer_sales CS','CS.customer_building_id = B.id','left')
->join('tb_channel E','C.channel_id=E.id')
->join('tb_manager F','E.manager_id=F.id')
->join('tb_sales G','B.sale_id=G.id','left')
->join('tb_user H','G.user_id=H.id','left')
//->join('tb_sales G','CS.sale_id=G.id','left')
->join('tb_user H','CS.sale_id=H.id','left')
->join('tb_building I','B.building_id=I.id','left')
->join('tb_region RR', 'RR.region_code=I.region_code', 'left')
->join('tb_user J','B.user_id=J.id','left');
......@@ -227,6 +228,7 @@ class Channel_model extends My_Model{
->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_building CA','CA.channel_id = B.id','left')
->join('tb_manager C','D.manager_id=C.id','left');
if($where!=''){
$this->db->where($where);
......
......@@ -524,7 +524,7 @@ class Customer_building_model extends MY_Model{
*/
public function exits_customer_building($where = NULL, $getall = false){
$this->db->select('CB.id,CB.recommend_status,CB.customer_id,CB.is_valid,CB.distribution_status,CB.distributor_id')
$this->db->select('CB.id,CB.recommend_status,CB.customer_id,CB.is_valid,CB.distribution_status,CB.distributor_id,CB.is_expired')
->from('tb_customer_building CB')
->join('tb_customer C', 'C.id = CB.customer_id ', 'left');
......
......@@ -338,7 +338,8 @@ class Customer_model extends MY_Model{
$this->db->join('tb_building B', 'B.id = CB.building_id', 'left');
$this->db->join('tb_user UM', 'UM.id = CB.manager_id', 'left');
$this->db->join('tb_user UPP', 'UPP.id = CB.user_id', 'left');
$this->db->join('tb_user US', 'US.id = CB.sale_id', 'left');
$this->db->join('tb_customer_sales CS','CS.customer_building_id = CB.id','left');
$this->db->join('tb_user US', 'US.id = CS.sale_id', 'left');
$this->db->join('tb_distributor D', 'D.id = CB.distributor_id', 'left');
$this->db->join('tb_building_distributor_relate RR', 'RR.distributor_id = D.id', 'left');
$this->db->join('tb_channel TC', 'TC.id = D.channel_id', 'left');
......@@ -958,4 +959,9 @@ class Customer_model extends MY_Model{
}
return 0;
}
public function updata_customer_user($id,$data){
$this->db->where('id', $id);
$this->db->update('tb_customer', $data);
}
}
......@@ -118,4 +118,16 @@ class Manager_model extends MY_Model{
return $return;
}
}
//获取销管所属building_id
public function get_building_id($where){
$this->db->select('M.building_id,M.region_id')
->from('tb_manager M')
->where($where);
$query = $this->db->get();
if($query->num_rows()>0)
{
$return = $query->result_array();
return $return;
}
}
}
\ No newline at end of file
......@@ -165,9 +165,11 @@
<td>
<?php if ($customer['report_status'] == 'PENDING') { ?>
<?php if($customer['expired']==0){?>
<a href="javascript:void(0)" class="agree btn default btn-xs" data-id="<?php echo $customer['id']; ?>"><i class="fa fa-retweet">同意</i></a>
<a href="javascript:void(0)" class="reject btn default red btn-xs" data-id="<?php echo $customer['id']; ?>><i class="fa fa-pencil-square-o">拒绝</i></a>
<?php }?>
<?php } else {
if ($customer['report_status'] == 'SUCCESS') echo '已同意二次报备';
if ($customer['report_status'] == 'REJECT') echo '已拒绝二次报备';
......
......@@ -89,7 +89,6 @@
<div class="col-md-8">
<?php if ($buildings) {
foreach ($buildings as $key => $build) { ?>
<label style="width: 24%;float: left;">
<input type="checkbox" class="building_id" name="building_id[]" value="<?php echo $build['id']; ?>" <?php if($key == 0) { ?> checked="checked" <?php } ?>> <?php echo $build['building_title']; ?>
</label>
......
......@@ -170,9 +170,11 @@
},
dataType:"json",
success:function(res){
if(res.errcode == 0){
$('#add-con').empty();
var _html=null;
console.log(res);
for(var i in res.data.data){
var item = res.data.data[i];
var isdel = "设置离职";
......@@ -201,7 +203,7 @@
res.num_start++;
}
$('#add-con').append(_html);
$(".total").find("span").text(_total);
$(".total").find("span").text(res.data.total);
}
else{
//alert("没有满足条件的数据");
......
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