Commit b8831c35 by HTML5-侯张振

修改 修改定时任务保护期设置

parent 421a9a3d
...@@ -214,7 +214,7 @@ class Distributionadmin extends CI_Controller ...@@ -214,7 +214,7 @@ class Distributionadmin extends CI_Controller
}; };
$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);
/*$this->data['count'] = $count; /*$this->data['count'] = $count;
$this->db->select('A.manager_name channel,M.manager_name,D.id distributor_id,D.uniqid_id,D.company_name,D.manager_id ,D.remark,D.create_time') $this->db->select('A.manager_name channel,M.manager_name,D.id distributor_id,D.uniqid_id,D.company_name,D.manager_id ,D.remark,D.create_time')
->from('tb_distributor D') ->from('tb_distributor D')
......
...@@ -970,7 +970,7 @@ class Report extends CI_Controller ...@@ -970,7 +970,7 @@ class Report extends CI_Controller
$this->data['buildings'] = $this->building->get_building_page($where, $page_no, self::PAGE_SIZE); $this->data['buildings'] = $this->building->get_building_page($where, $page_no, self::PAGE_SIZE);
$data_arr = '?building_title=' . $building; $data_arr = '?building_title=' . $building;
$this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1; $this->data['num_start'] = ($page_no - 1) * self::PAGE_SIZE + 1;
//获取分页 //获取分页
...@@ -982,31 +982,68 @@ class Report extends CI_Controller ...@@ -982,31 +982,68 @@ class Report extends CI_Controller
public function protection($page_no = 1){ public function protection($page_no = 1){
$get = $this->input->get(); $get = $this->input->get();
$this->load->model('distributor_model', 'distributor');
$this->load->model('building_distributor_model','relate');
$uid = $this->session->userdata['u_id']; $uid = $this->session->userdata['u_id'];
$info = $this->manager->get(array('id' => $uid)); $info = $this->manager->get(array('id' => $uid));
$this->data['building_title'] = $building = $get['building_title']; $this->data['building_title'] = $building = $get['building_title'];
$where = "B.building_title like '%$building%'"; $where1 = "B.building_title like '%$building%'";
if ($info['building_id']) { if ($info['building_id']) {
$where .= " and B.id in(" . $info['building_id'] . ")"; $where1 .= " and B.id in(" . $info['building_id'] . ")";
} }
//
$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();
if ($get) {
$con_arr = array(
'company_name' => $get['building_title'] ? : ''
);
if (isset($get['building_title']) && $get['building_title']) {
$where .= ' and D.company_name like "%' . trim($get['building_title']) . '%"';
}
$count = $this->building->get_building_count($where); // if (isset($get['uniqid_id'])) {
// $where .= ' and D.uniqid_id like "%' . trim($get['uniqid_id']) . '%"';
// }
}
$count = $this->distributor->get_distributor_count_new($where);
if($user_data['role'] == 12){
$where.= ' and A.id ='.$user_data['u_id'];
};
$admins = $this->distributor->get_distributor_new($where, $page_no, self::PAGE_SIZE);
$der = explode(',',$info['building_id']);
$protection_arr = array();
foreach($admins as $admin){
$data_arrid = $this->relate->protection_list(array('distributor_id'=>$admin['distributor_id']));
foreach($data_arrid as $k=>$id){
if(in_array($data_arrid[$k]['building_id'],$der)){
$protection_arr[] = $data_arrid[$k];
}
}
}
$this->data['count'] = $count; $this->data['count'] = $count;
$this->data['buildings'] = $this->building->get_building_page($where, $page_no, self::PAGE_SIZE); $this->data['buildings'] = $protection_arr;
$data_arr = '?building_title=' . $building; $data_arr = '?building_title=' . $building;
$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/report/circulation'), $count,self::PAGE_SIZE, 4, '', true); $this->data['num_link'] = set_page_new($data_arr, $this, site_url('admin/report/protection'), $count,self::PAGE_SIZE, 4, '', true);
$this->load->view('admin/report/protection',$this->data); $this->load->view('admin/report/protection',$this->data);
......
...@@ -83,7 +83,7 @@ class Distributor extends CI_Controller{ ...@@ -83,7 +83,7 @@ class Distributor extends CI_Controller{
//超出保护期 + 未认购 则删除 //超出保护期 + 未认购 则删除
//$where = 'is_deleted = 0 and building_id = ' . $build['id'] . ' and recommend_status in (0,1,2,3) and create_time<' . (time() - $valid_day*24*3600); //$where = 'is_deleted = 0 and building_id = ' . $build['id'] . ' and recommend_status in (0,1,2,3) and create_time<' . (time() - $valid_day*24*3600);
$where = "is_deleted = 0 and building_id = {$build['id']} and recommend_status in (0,1,2) and ((report_status != 'SUCCESS' and create_time < {$endTime}) OR (report_status = 'SUCCESS' and create_time < {$endTime2}) )"; $where = "is_deleted = 0 and distributor_id = {$build['distributor_id']} and recommend_status in (0,1,2) and ((report_status != 'SUCCESS' and create_time < {$endTime}) OR (report_status = 'SUCCESS' and create_time < {$endTime2}) )";
$customers = $this->customer_building->get_all_customer($where); $customers = $this->customer_building->get_all_customer($where);
if ($customers) if ($customers)
......
...@@ -70,7 +70,7 @@ class Building_distributor_model extends MY_Model{ ...@@ -70,7 +70,7 @@ class Building_distributor_model extends MY_Model{
//根据条件分组查询楼盘 //根据条件分组查询楼盘
public function get_has_building($where = '') public function get_has_building($where = '')
{ {
$this->db->select('B.id,B.building_title,B.valid_day') $this->db->select('B.id,B.building_title,R.set_protection valid_day,R.distributor_id distributor_id')
->from('tb_building_distributor_relate R') ->from('tb_building_distributor_relate R')
->join('tb_building B', 'B.id=R.building_id', 'left'); ->join('tb_building B', 'B.id=R.building_id', 'left');
...@@ -203,4 +203,21 @@ class Building_distributor_model extends MY_Model{ ...@@ -203,4 +203,21 @@ class Building_distributor_model extends MY_Model{
} }
return array(); return array();
} }
//获取保护期查看列表
public function protection_list($where){
$this->db->select('set_protection, B.building_title building_title, D.company_name company_name, BD.building_id building_id');
$this->db->from('tb_building_distributor_relate BD');
$this->db->join('tb_building B','B.id = BD.building_id','left');
$this->db->join('tb_distributor D','D.id = BD.distributor_id','left');
if(!empty($where))
{
$this->db->where($where);
}
$query = $this->db->get();
if($query->num_rows() > 0)
{
return $query->result_array();
}
return false;
}
} }
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
<div class="portlet-body clearfix"> <div class="portlet-body clearfix">
<div class="form-body" style="padding:0"> <div class="form-body" style="padding:0">
<div style="margin-bottom: 20px;background: #F9FCEF;padding: 10px 0;border: 1px solid #ccc;" class="text-center"> <div style="margin-bottom: 20px;background: #F9FCEF;padding: 10px 0;border: 1px solid #ccc;" class="text-center">
<form action="<?php echo site_url('admin/report/circulation');?>" name='form' method="get"> <form action="<?php echo site_url('admin/report/protection');?>" name='form' method="get">
项目名称: 分销商名称:
<input type="text" class="form-control input-inline input-small" name="building_title" id="building_title" value="<?php echo $building_title;?>"> <input type="text" class="form-control input-inline input-small" name="building_title" id="building_title" value="<?php echo $building_title;?>">
<button type="submit" class="btn blue" id="search">搜索</button> <button type="submit" class="btn blue" id="search">搜索</button>
...@@ -53,11 +53,11 @@ ...@@ -53,11 +53,11 @@
<table class="table table-striped table-bordered table-hover" id="sample_1"> <table class="table table-striped table-bordered table-hover" id="sample_1">
<thead> <thead>
<tr> <tr>
<th>序号</th> <th>序号</th>
<th>项目名称</th> <th>项目名称</th>
<th>默认保护期(天)</th> <th>分销商名称</th>
<th>当前保护期(天)</th> <th>当前保护期(天)</th>
<th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody id="add-con"> <tbody id="add-con">
...@@ -67,11 +67,10 @@ ...@@ -67,11 +67,10 @@
<tr> <tr>
<td><?php echo $num_start++; ?></td> <td><?php echo $num_start++; ?></td>
<td><?php echo $building['building_title'];?></td> <td><?php echo $building['building_title'];?></td>
<td>7</td> <td><?php echo $building['company_name'];?></td>
<td><?php echo $building['valid_day'] ? $building['valid_day'] : 7;?></td> <td><?php echo $building['set_protection'] ? $building['set_protection'] : 7;?></td>
<td><a href="<?php echo site_url('admin/report/updateDay/' . $building['id']) ?>">编辑</a></td>
</tr> </tr>
<?php <?php
endforeach; endforeach;
......
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