123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- class Fullordererror extends Start_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('session');
- $this->load->_model('Model_message','message');
- $this->load->_model('Model_shop','shop');
- $this->load->_model("Model_fullordererrors","fullordererrors");
- }
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg,$arg_array)
- {
- if($arg == 'outtime')//添加
- {
- $this->_outtime();
- }
- else
- {
- $this->_index();
- }
- }
- public function _index(){
- }
- public function _outtime(){
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";
- $user = explode('|',trim($user['shop'],'|'));
- foreach ($user as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- }
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $number = $this->input->post('number',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = "error_type = 1 and (".rtrim($fgshop,'or').")";
-
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($timetk && $timetj)
- {
- $timetj = $timetj+24*3600;
- $where .= " and dtime > '$timetk' and dtime < '$timetj'";
- }
- //数据排序
- $order_str = "id desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- $info_list = $this->fullordererrors->find_all($where,'id,shop,number,error_time',$order_str,$start,$perpage);
- //格式化数据
- foreach ($info_list as $key=>$value)
- {
- //$ud = $this->fullorder->read($value['id']);
- $shop = $this->shop->read($value['shop']);
- $info_list[$key]['shop'] = $shop['shopname'];
- // $info_list[$key]['orderinfo'] = "<h9 class='window' data-h='/fullorder/edit/".$value['id']."' data-t='订单号:".$value['orderinfo']."'>".$value['orderinfo']."<p>";
- // $warehouse = $this->warehouse->read($value['type']);
- // $warehousetitle = $warehouse['title'];
- // if($value['type'] != 1){$warehousetitle = "<font style='color:#f64b4b'>".$warehouse['title']."</font>";}
- // $info_list[$key]['type'] = $warehousetitle;
- // if($value['express'] != 0)
- // {
- // $express = $this->express->read($value['express']);
- // $expressservicename = $express['servicename'];
- // if($value['express'] != 1){$expressservicename = "<font style='color:#f64b4b'>".$express['servicename']."</font>";}
- // $info_list[$key]['express'] = $expressservicename;
- // }
- // else
- // {
- // $info_list[$key]['express'] = "无";
- // }
- // $x = "";
- // if($ud['review'] >4 && $ud['print'] == 1)
- // {
- // $x = "<p class='ckn'><b class='fojzof' data-type='8' data-id='".$value['id']."'>允许打印</b></p>";
- // }
- // else
- // {
- // $x = "<p class='ckn'><b class='fojzof' data-type='9' data-id='".$value['id']."'>关闭</b></p>";
- // }
- // $info_list[$key]['operation'] = $x;
- }
- $total = $this->fullordererrors->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $this->data['wlshop'] = $wlshop;
- $this->_Template('fullordererror_errshow',$this->data);
- }
- }
|