| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- class Sdzxlist extends Start_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('session');
- $this->load->_model('Model_sdzxlist','sdzxlist');
- }
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg,$arg_array)
- {
- if($arg == 'index'){
- $this->_index();
- }else{
- exit('No direct script access allowed');
- }
- }
- private function _index(){
- if($this->input->method() == 'post'){
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $sqr = $this->input->post('sqr',true);
- $sqr = trim($sqr);
- $shop_id = $this->input->post('shop_id',true);
- $plat_id = $this->input->post('plat_id',true);
- $shop_ids = $this->input->post('shop_ids',true);
- $ktime = $this->input->post('ktime',true);
- $jtime = $this->input->post('jtime',true);
- $ktime = strtotime($ktime);
- $jtime = strtotime($jtime);
- $where = "add_time >= ".$ktime." and add_time < ".$jtime." ";
- if(!empty($sqr)){
- $where .= " and sqr = ".$sqr." ";
- }
- if(!empty($shop_id)){
- $where .= " and shop_id = ".$shop_id." ";
- }else{
- $where .= " and shop_id in (".$shop_ids.") ";
- }
- if(!empty($plat_id)){
- $where .= " and plat_id = ".$plat_id." ";
- }
- //数据排序
- $order_str = "id desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //$list = $this->bhsq->find_all($where,"id,shop_id,plat_id,title,sku,sqr,sq_num,sq_status,add_time,update_time",$order_str,$start,$perpage);
- $list = [];
- if(empty($list)){
- $rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([]));
- echo json_encode($rows);exit;
- }
- $shop_list = $this->shop->find_all("1=1","id,shopname");
- $shop_list = array_column($shop_list,'shopname','id');
- $plat_list = $this->typeclass->find_all("classid = 32","id,title");
- $plat_list = array_column($plat_list,'title','id');
- $status_list = $this->bhsq->getSqStatus();
- foreach($list as $k=>$v){
-
- $list[$k]['update_time'] = "";
- }
- $total = $this->bhsq->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
- echo json_encode($rows);exit;
- }else{
- $this->_Template('sdzxlist_index',$this->data);
- }
- }
- }
|