| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 | <?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");		$this->load->_model("Model_fullorder","fullorder");		$this->load->_model("Model_fullordersmt","fullordersmt");		$this->load->_model("Model_fullordertt","fullordertt");		$this->load->_model("Model_fullorderamz","fullorderamz");		$this->load->_model("Model_express","express");		$this->load->model("Model_warehouse","warehouse");	}	//定义方法的调用规则 获取URI第二段值    public function _remap($arg,$arg_array)    {		if($arg == 'outtime')//添加        {             $this->_outtime();        }		else if($arg == 'shanchu')//删除        {             $this->_shanchu($arg_array);	        }		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);			$plat = $this->input->post('plat',true);			$number = $this->input->post('number',true);			$shop = $this->input->post('shop',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "plat = '".$plat."' and 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'";            }			if($shop){				$where  .= " and shop = '$shop'";			}            //数据排序            $order_str = "id desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            $info_list = $this->fullordererrors->find_all($where,'*',$order_str,$start,$perpage);			 //格式化数据			$warehouse_list = $this->warehouse->find_all();			$warehouse_list = array_column($warehouse_list,'title','id');			$express_list = $this->express->find_all();			$express_list = array_column($express_list,'servicename','id');			$shop_list = $this->shop->find_all();			$shop_list = array_column($shop_list,'shopname','id');			$final_data = [];            foreach ($info_list as $key=>$value) 		    {				$tmp_data = [];				$plat = $value['plat'];				$ud = $this->$plat->get_number($value['number']);				$tmp_data['id'] = $value['id'];				$tmp_data['shop'] = isset($shop_list[$value['shop']])?$shop_list[$value['shop']]:'';				$tmp_data['warehouse'] = isset($warehouse_list[$ud['type']])?$warehouse_list[$ud['type']]:'无';				if($plat == 'fullordertt'){					$tmp_data['orderinfo'] = "<h9 class='window' data-h='/fullordertt/readonly/".$ud['id']."' data-t='订单号:".$ud['orderinfo']."'><p>".$ud['orderinfo']."</p></h9>";				}elseif($plat == 'fullordersmt'){					$tmp_data['orderinfo'] = "<h9 class='window' data-h='/fullordersmt/readonly/".$ud['id']."' data-t='订单号:".$ud['orderinfo']."'><p>".$ud['orderinfo']."</p></h9>";				}elseif($plat == 'fullorderamz'){					$tmp_data['orderinfo'] = "<h9 class='window' data-h='/fullorderamz/readonly/".$ud['id']."' data-t='订单号:".$ud['orderinfo']."'><p>".$ud['orderinfo']."</p></h9>";				}else{					$tmp_data['orderinfo'] = "<h9 class='window' data-h='/fullorder/readonly/".$ud['id']."' data-t='订单号:".$ud['orderinfo']."'><p>".$ud['orderinfo']."</p></h9>";				}								$tmp_data['number'] = $value['number'];				$tmp_data['express'] = isset($express_list[$ud['express']])?$express_list[$ud['express']]:'无';			    				$tmp_data['error_time'] = date("Y-m-d H:i:s",$value['error_time']);				$tmp_data['operation'] = "<p class='ckn' onclick='shanchu(".$value['id'].")'><b style='padding: 5px;font-size: 100%;'>删除</b></p>";				$final_data[] = $tmp_data;								// $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'=>($final_data));		    echo json_encode($rows);exit;		}		$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));		$this->data['wlshop'] = $wlshop;		$this->data['plat'] = $this->input->get('plat');		$this->_Template('fullordererror_errshow',$this->data);	}	public function _shanchu($arg_array){		$id = $arg_array[0];		$this->fullordererrors->remove($id);		exit(json_encode(array('success'=>true,'msg'=>'删除成功')));		}}
 |