| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818 | <?php defined('BASEPATH') OR exit('No direct script access allowed');header("Access-Control-Allow-Origin: *");class Apt extends Start_Controller {	public function __construct(){		parent::__construct();		$this->load->library('session');		$this->load->_model('Model_whlabel','whlabel');		$this->load->_model('Model_warehouse','warehouse');		$this->load->_model('Model_productprice','productprice');		$this->load->_model('Model_excel','excel');		$this->load->_model('Model_fullorder','fullorder');		$this->load->_model('Model_fullordertt','fullordertt');		$this->load->_model('Model_express','express');		$this->load->_model('Model_shop','shop');		$this->load->_model('Model_typeclass','typeclass');		$this->load->_model('Model_country','country');		$this->load->_model('Model_warehouse','warehouse');		$this->load->_model('Model_kdniao','kdniao');		$this->load->_model('Model_notice','notice');		$this->load->_model('Model_dhl','dhl');		$this->load->_model('Model_shop','shop');		$this->load->_model('Model_user','user');	}	//定义方法的调用规则 获取URI第二段值    public function _remap($arg,$arg_array)    {		if($arg == 'fout')//出库页        {             $this->_fout();        }		else if($arg == 'printing')//打印操作        {             $this->_printing();        }		else if($arg == 'print')//打印操作        {             $this->_print();        }		else if($arg == 'fhd')//发货单        {             $this->_fhd($arg_array);        }		else if($arg == 'fhddata')//发货单        {             $this->_fhddata();        }		else if($arg == 'fpdata')//发货单        {             $this->_fpdata();        }		else if($arg == 'shop')//发货单        {             $this->_shop();        }		else if($arg == 'express')//发货单        {             $this->_express();        }		else if($arg == 'retreat')//发货单        {             $this->_retreat();        }		else if($arg == 'excel')//发货单        {             $this->_excel();        }		else		{			 $this->_index();		}    }	//管理	public function _index()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['userid']))		{			$userid = $this->input->post('userid',true);			$userpass = $this->input->post('userpass',true);			$password = sha1($userpass);			$user = $this->user->get_uid($userid);			if($user)			{				if($user['type'] == 2)				{					echo json_encode(array('msg'=>"账户已停用",'success'=>false));exit;				}				if($user['userpass'] == $password)				{                    $this->user->get_land($user);  //更新登录数据					echo json_encode(array('url'=>'?id='.$user['api'],'success'=>true));exit;				}				else				{					echo json_encode(array('msg'=>"用户或密码不正确",'success'=>false));exit;				}			}			else			{				echo json_encode(array('msg'=>"用户不正确",'success'=>false));exit;			}		}	}	//出库	public function _fout()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['order']))  		{			$time = time();			$order = $this->input->post('order',true);			$y = $this->fullorder->get_waybill($order);			if(!$y)			{				$y = $this->fullorder->get_number($order);				if(!$y)				{					 echo json_encode(array('msg'=>'无此数据','success'=>false));exit;				}			}			if($y['libraryconfirm'] == 1)			{				echo json_encode(array('msg'=>$y['librarynot'],'success'=>false));exit;			}			if($y['library'] == 2)			{				echo json_encode(array('msg'=>'此数据 '.date('Y-m-d H:i:s',$y['librarytime']).' 已操作','success'=>false));exit;			}			if($this->fullorder->save(array('library'=>2,'librarytime'=>$time),$y['id']))        	{         		echo json_encode(array('success'=>true));exit;       	 	}       		else        	{           		echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));exit;        	}		}		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$shop = $this->input->post('shop',true);			$source = $this->input->post('source',true);			$orderinfo = $this->input->post('orderinfo',true);			$number = $this->input->post('number',true);			$library = $this->input->post('library',true);			$waybill = $this->input->post('waybill',true);			$express = $this->input->post('express',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "library!=3 and libraryconfirm=2 and mergeid = 0 and print = 3";			if($timetk && $timetj && $library == 2)            {                $where  .= " and librarytime > '$timetk' and librarytime < '$timetj'";            }			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($library)            {                $where  .= " and library = '$library'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($express)            {				$where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }            //数据排序            $order_str = "librarytime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				if($value['waybill'] == 0)				{					$info_list[$key]['waybill'] = "";				}				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				$warehouse = $this->warehouse->read($value['type']);				$info_list[$key]['type'] = $warehouse['title'];				if($value['print'] == 1)				{					$info_list[$key]['print'] = '不可打印';				}				else if($value['print'] == 2)				{					$info_list[$key]['print'] = '未打印';				}				else if($value['print'] == 3)				{					$info_list[$key]['print'] = '已打印';				}				if($value['library'] == 1)				{					$info_list[$key]['library'] = '<em class="c">未出库</em>';				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = '<em class="c">已出库</em>';				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = '<em class="c">已退库</em>';				}				if($value['librarytime'] == '0')				{					$info_list[$key]['librarytime'] = '<em class="t"></em>';				}				else				{					$info_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';				}            }		    $total = $this->fullorder->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;		}		$this->data['express'] = $this->express->find_all();		$this->_Template('whlabel_fout',$this->data);	}	//退库	public function _retreat()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['order']))  		{			$time = time();			$order = $this->input->post('order',true);			$y = $this->fullorder->get_waybill($order);			if(!$y)			{				$y = $this->fullorder->get_number($order);				if(!$y)				{					 echo json_encode(array('msg'=>'无此数据','success'=>false));exit;				}			}			if($y['library'] == 3)			{				echo json_encode(array('msg'=>'此数据 '.date('Y-m-d H:i:s',$y['retreattime']).' 已操作','success'=>false));exit;			}			if($y['library'] == 1)			{				echo json_encode(array('msg'=>'此数据未出库','success'=>false));exit;			}			if($this->fullorder->save(array('library'=>3,'retreattime'=>$time),$y['id']))        	{         		echo json_encode(array('success'=>true));exit;       	 	}       		else        	{           		echo json_encode(array('msg'=>'退库失败,请重试','success'=>false));exit;        	}		}		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$shop = $this->input->post('shop',true);			$source = $this->input->post('source',true);			$orderinfo = $this->input->post('orderinfo',true);			$number = $this->input->post('number',true);			$waybill = $this->input->post('waybill',true);			$express = $this->input->post('express',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "library=3 and gtime > 20190127";			if($timetk && $timetj)            {                $where  .= " and retreattime > '$timetk' and retreattime < '$timetj'";            }			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($express)            {				$where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }            //数据排序            $order_str = "retreattime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,state,retreattime',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				if($value['waybill'] == 0)				{					$info_list[$key]['waybill'] = "";				}				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				$warehouse = $this->warehouse->read($value['type']);				$info_list[$key]['type'] = $warehouse['title'];				$typeclass = $this->typeclass->read($value['state']);				$info_list[$key]['state'] = $typeclass['spare'];				if($value['print'] == 1)				{					$info_list[$key]['print'] = '不可打印';				}				else if($value['print'] == 2)				{					$info_list[$key]['print'] = '未打印';				}				else if($value['print'] == 3)				{					$info_list[$key]['print'] = '已打印';				}				if($value['retreattime'] == '0')				{					$info_list[$key]['retreattime'] = '<em class="t"></em>';				}				else				{					$info_list[$key]['retreattime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['retreattime']).'</em>';				}				            }		    $total = $this->fullorder->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;		}		$this->data['express'] = $this->express->find_all();		$this->_Template('whlabel_fout',$this->data);	}	//打印页面	public function _print()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['page']))  		{		    $page = $this->input->post('page',true);		    $perpage = $this->input->post('perpage',true);			$timetk = $this->input->post('timetk',true);			$timetj = $this->input->post('timetj',true);			$shop = $this->input->post('shop',true);			$print = $this->input->post('print',true);			$express = $this->input->post('express',true);			$waybill = $this->input->post('waybill',true);			$printtype = $this->input->post('printtype',true);			$orderinfo = $this->input->post('orderinfo',true);			$number = $this->input->post('number',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "type = 1 and express != 0 and printtype > 0 and printtype < 3 and print != 1 and review > 4";			if($timetk && $timetj && $print == 3)            {                $where  .= " and printtime > '$timetk' and printtime < '$timetj'";            }			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($print)            {				if($print == 2)				{                    $where  .= " and state = 207 and print = '$print'";				}				else				{					$where  .= " and print = '$print'";				}            }			if($express)            {				$where  .= " and express = '$express'";            }			if($printtype)            {                $where  .= " and printtype = '$printtype'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }            //数据排序            $order_str = "id desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime',$order_str,$start,$perpage);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				$express = $this->express->read($value['express']);				if($express)				{				    $info_list[$key]['express'] = $express['servicename'];				}				else				{					$info_list[$key]['express'] = '未选择';				}				if($value['printtime'] != 0)				{				    $info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);				}				else				{					$info_list[$key]['printtime'] = '无';				}				if($value['print'] == 1)				{					$info_list[$key]['print'] = "禁止打印";				}				else if($value['print'] == 2)				{					$info_list[$key]['print'] = "未打印";				}				else if($value['print'] == 3)				{					$info_list[$key]['print'] = "已打印";				}				if($value['printtype'] == 1)				{					$info_list[$key]['printtype'] = "运单";				}				else if($value['printtype'] == 2)				{					$info_list[$key]['printtype'] = "发货单";				}				else if($value['printtype'] == 0)				{					$info_list[$key]['printtype'] = "未选择";				}            }		    $total = $this->fullorder->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;		}		$this->_Template('whlabel_print',$this->data);	}	//打印	public function _printing()	{		$post = $this->input->post(NULL, TRUE);		$dhlover = 1;		if(isset($post['s']))  		{			$v = $this->input->post('s');			$va = explode(',',rtrim($v,','));			$n = $this->input->post('n');            $fullorder = $this->fullorder->read($va[$n]);			$exp = $this->express->read($fullorder['express']);//获取快递信息			if($fullorder['printtype'] == 1)			{				//获取所用相关信息				$warehouse = $this->warehouse->read($fullorder['type']);				$al = $this->country->read($warehouse['country']);				foreach ($warehouse as $kk=>$vv)		        {				    $warehouse['al'] = $al['lb'];				}				$fullorder['baddress'] = explode(',',$fullorder['baddress']);				$fullorder['baddress'] = array_reverse($fullorder['baddress']);				$country = $this->country->get_al($fullorder['baddress'][1]);				$fullorder['baddress'][1] = $country['ename'];				$fcountry = $this->country->read($warehouse['country']);				$warehouse['country'] = $fcountry['ename'];				$fullorder['warehouse'] = $warehouse;				$fullorder['al'] = $country['lb'];//收货加改联邦名 此项过完春节口可以去掉,之前订单同步没添加此项				$fullorder['country'] = $country['ename'];				//获取完毕				if($exp['servicecode'] == "DHLGF")//如果打印过那么重新获取运单				{				   	$barcode = $this->dhl->get_data($fullorder);//获取DHL快递信息					if(isset($barcode['AirwayBillNumber']))					{						$Hwaybill = $barcode['AirwayBillNumber'];						$Hfp = $this->_pdf($barcode['LabelImage']['MultiLabels']['MultiLabel']['DocImageVal'],'f'.$Hwaybill);					    $Hyd = $this->_pdf($barcode['LabelImage']['OutputImage'],'y'.$Hwaybill);					}					else if(isset($barcode['Response']['Status']['Condition']['ConditionData']))					{						$dhlover = $barcode['Response']['Status']['Condition']['ConditionData'];					}					else if(isset($barcode['Response']['Status']['Condition'][0]['ConditionData']))					{						$dhlover = $barcode['Response']['Status']['Condition'][0]['ConditionData'];					}else{$dhlover = "错误!";}				}				if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))				{					if($this->fullorder->save(array('waybill'=>$Hwaybill,'fp'=>$Hfp,'yd'=>$Hyd,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>time(),'printnumber'=>$fullorder['printnumber']+1,'print'=>3),$va[$n]))				    {						$rows = array('type'=>1,'t'=>11000,'n'=>$n-1,'data'=>$v,'rows'=>array('1'=>$Hfp,'0'=>$Hyd,'2'=>$va[$n]));					}				}			}			else if($fullorder['printtype'] == 2)			{				if($this->fullorder->save(array('libraryconfirm'=>2,'librarynot'=>'','printtime'=>time(),'printnumber'=>$fullorder['printnumber']+1,'print'=>3),$va[$n]))				{					$country = $this->country->read($fullorder['country']);					$rows = array('type'=>2,'fhd'=>$va[$n],'t'=>3000,'n'=>$n-1,'data'=>$v);				}			}			if(isset($rows))			{				echo json_encode(array('rows'=>($rows),'success'=>true));exit;			}			else			{				if($dhlover != 1)				{					echo json_encode(array('msg'=>"订单号:".$fullorder['orderinfo']." - ".$dhlover,'success'=>false));exit;				}				else				{				    echo json_encode(array('msg'=>"订单号:".$fullorder['orderinfo']."打印类型错误!请跳过!",'success'=>false));exit;				}			}		}	}	public function _excel()	{		if(isset($_GET['fexcel']))  		{			$dowid = $this->input->get('a');			$wid = "";			if($dowid != "")			{				$id_arr =  explode(',',rtrim($dowid,','));				foreach ($id_arr as $v) 		        {					$wid  .= " id = 0 or";                    $wid  .= " id = '$v' or";                }				$wid = " and".rtrim($wid,'or');			}		    $t = $this->input->get('t',true);			$timetk = $this->input->get('timetk',true);			$timetj = $this->input->get('timetj',true);			$shop = $this->input->get('shop',true);			$source = $this->input->get('source',true);			$orderinfo = $this->input->get('orderinfo',true);			$number = $this->input->get('number',true);			$library = $this->input->get('library',true);			$waybill = $this->input->get('waybill',true);			$express = $this->input->get('express',true);			$timetk = strtotime($timetk);			$timetj = strtotime($timetj);			$where = "library!=3 and libraryconfirm=2 and mergeid = 0 and print = 3";			if($timetk && $timetj && $library == 2)            {                $where  .= " and librarytime > '$timetk' and librarytime < '$timetj'";            }			if($shop)            {                $where  .= " and shop = '$shop'";            }			if($number)            {                $where  .= " and number = '$number'";            }			if($library)            {                $where  .= " and library = '$library'";            }			if($waybill)            {                $where  .= " and waybill = '$waybill'";            }			if($express)            {				$where  .= " and express = '$express'";            }			if($orderinfo)            {                $where  .= " and orderinfo = '$orderinfo'";            }            //数据排序            $order_str = "librarytime desc";            if(empty($page))		    {                $start = 0;		    	$perpage = 1;            }		    else		    {                $start = ($page - 1)*$perpage;            }            //取得信息列表            $info_list = $this->fullorder->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,library,librarytime',$order_str);			 //格式化数据            foreach ($info_list as $key=>$value) 		    {				$shop = $this->shop->read($value['shop']);				$info_list[$key]['shop'] = $shop['shopname'];				if($value['waybill'] == 0)				{					$info_list[$key]['waybill'] = "";				}				$express = $this->express->read($value['express']);				$info_list[$key]['express'] = $express['servicename'];				$warehouse = $this->warehouse->read($value['type']);				$info_list[$key]['type'] = $warehouse['title'];				if($value['print'] == 1)				{					$info_list[$key]['print'] = '不可打印';				}				else if($value['print'] == 2)				{					$info_list[$key]['print'] = '未打印';				}				else if($value['print'] == 3)				{					$info_list[$key]['print'] = '已打印';				}				if($value['library'] == 1)				{					$info_list[$key]['library'] = '<em class="c">未出库</em>';				}				else if($value['library'] == 2)				{					$info_list[$key]['library'] = '<em class="c">已出库</em>';				}				else if($value['library'] == 3)				{					$info_list[$key]['library'] = '<em class="c">已退库</em>';				}				if($value['librarytime'] == '0')				{					$info_list[$key]['librarytime'] = '<em class="t"></em>';				}				else				{					$info_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';				}            }            $title = '订单出库-'.date('Ymd',time());            $titlename = "<table border=1>".$t."</table>";			$tail = "\n";            $filename = $title.".xls";            $this->excel->get_fz2($info_list,$titlename,$filename,$tail);		}	}	public function _pdf($pdf,$title)    {		$time = date('Ymd',time());    	$pdf_path = './data/pdf/'.$time.'/';        $file_base64 = $pdf;         $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);          $file_base64 = base64_decode($file_base64);		if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建        file_put_contents($pdf_path.$title.'.pdf',$file_base64);		return 'data/pdf/'.$time.'/'.$title.'.pdf';    }	public function _fhd($arg_array)    {		$id = $arg_array[0];		$data = $this->fullorder->read($id);		$country = $this->country->read($data['country']);		$express = $this->express->read($data['express']);		$data['country'] = $country['ename'];		$data['express'] = $express['servicename'];		$this->data['data'] = $data;		$this->_Template('apt_fhd',$this->data);    }	public function _fhddata()    {		$post = $this->input->post(NULL, TRUE);		if(isset($post['g']))  		{			$id = $this->input->post('g',true);			$data = $this->fullorder->read($id);			$country = $this->country->read($data['country']);			$express = $this->express->read($data['express']);			$data['country'] = $country['ename'];			$data['express'] = $express['servicename'];			echo json_encode(array('express'=>$data['express'],'orderinfo'=>$data['orderinfo'],'country'=>$data['country'],'number'=>$data['number'],'shipremarks'=>$data['shipremarks'],'ts'=>$data['ts'],'printnumber'=>$data['printnumber'],'barcode'=>'<img id="imgId" src="http://'.$_SERVER['HTTP_HOST'].$data['barcode'].'" style="width:75%;margin: 10px 0 0 70px;" />','success'=>true));exit;		}    }	public function _fpdata()    {		$post = $this->input->post(NULL, TRUE);		if(isset($post['g']))  		{			$id = $this->input->post('g',true);			$fullorder = $this->fullorder->read($id);			$warehouse = $this->warehouse->read($fullorder['type']);			$al = $this->country->read($warehouse['country']);			foreach ($warehouse as $kk=>$vv)		    {				$warehouse['al'] = $al['lb'];			}			$fullorder['baddress'] = explode(',',$fullorder['baddress']);			$fullorder['baddress'] = array_reverse($fullorder['baddress']);			$country = $this->country->get_al($fullorder['baddress'][1]);			$fullorder['baddress'][1] = $country['ename'];			$fcountry = $this->country->read($warehouse['country']);			$warehouse['country'] = $fcountry['ename'];			$fullorder['warehouse'] = $warehouse;			$fullorder['al'] = $country['lb'];			$fullorder['country'] = $country['ename'];			$fullorder['time'] = date('Y-m-d',time());			$fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;			$fullorder['adr'] = 0;			if(strlen($fullorder['address'].$fullorder['address2']) > 44)			{				$adl = $fullorder['address'].$fullorder['address2'];				$adl1 = substr($adl,0,44);//截取44字符前内容				$adlnum = strripos($adl1," ");//查找最后一次出现空格位置				$adl1 = substr($adl,0,$adlnum);//0到空格前之间的内容				$adl2 = substr($adl,$adlnum+1,strlen($adl));//空格后到最后的内容				$fullorder['adr'] = 1;				$fullorder['adr1'] = $adl1;				$fullorder['adr2'] = $adl2;			}			echo json_encode(array('data'=>$fullorder,'success'=>true));exit;		}    }	public function _shop()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['shop']))  		{		    $shop = $this->shop->find_all();		    echo json_encode(array('msg'=>$shop));exit;		}	}	public function _express()	{		$post = $this->input->post(NULL, TRUE);		if(isset($post['express']))  		{		    $express = $this->express->find_all();		    echo json_encode(array('msg'=>$express));exit;		}	}}
 |