| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663 | 
							- <?php defined('BASEPATH') OR exit('No direct script access allowed');
 
- class Ac extends Start_Controller {
 
- 	public function __construct(){
 
- 		parent::__construct();
 
- 		$this->load->_model('Model_shop','shop');
 
- 		$this->load->_model('Model_fullorder','fullorder');
 
- 		$this->load->_model('Model_fullordertt','fullordertt');
 
- 		$this->load->_model('Model_fullorderxw','fullorderxw');
 
- 		$this->load->_model('Model_fullordersmt','fullordersmt');
 
- 		$this->load->_model('Model_fullorder_2020','fullorder2020');
 
- 		$this->load->_model('Model_fullordersmt_2020','fullordersmt2020');
 
- 		$this->load->_model('Model_customersmt','customersmt');
 
- 		$this->load->_model('Model_country','country');
 
- 		$this->load->_model('Model_hl','hl');
 
- 		$this->load->_model('Model_is','is');
 
- 		$this->load->_model('Model_kdniao','kdniao');
 
- 		$this->load->_model('Model_typeclass','typeclass');
 
- 		$this->load->_model('Model_warehouse','warehouse');
 
- 		$this->load->_model('Model_fullorderexcel','fullorderexcel');
 
- 		$this->load->_model('Model_dhl','dhl');
 
- 		$this->load->_model('Model_usps','usps');
 
- 		$this->load->_model('Model_dhltest','dhltest');
 
- 		$this->load->_model('Model_customer','customer');
 
- 		$this->load->_model('Model_express','express');
 
- 		$this->load->_model('Model_notice','notice');
 
- 		$this->load->_model('Model_whlabel','whlabel');
 
- 		$this->load->_model('Model_productdescribe','productdescribe');
 
- 		$this->load->_model('Model_ljg','ljg');
 
- 		$this->load->_model('Model_commodityread','commodityread');
 
- 		$this->load->_model('Model_service','service');
 
- 		$this->load->_model('Model_fedex','fedex');
 
- 		$this->load->_model('Model_commodity','commodity');
 
- 		$this->load->_model('Model_fullordersmtorder','fullordersmtorder');
 
- 		$this->load->_model('Model_ali','ali');
 
- 		$this->load->_model('Model_fullordersmthb','fullordersmthb');
 
- 		$this->load->_model('Model_fullordersmtbf','fullordersmtbf');
 
- 		$this->load->_model('Model_taxzhengzhou','taxzhengzhou');
 
- 		$this->load->_model('Model_taxshanghai','taxshanghai');
 
- 		$this->load->_model('Model_excel','excel');
 
- 		$this->load->_model('Model_ups','ups');
 
- 		$this->load->_model('Model_dpd','dpd');
 
- 		$this->load->_model('Model_dpdold','dpdold');
 
- 		$this->load->_model('Model_dpd_IOSS','dpd_IOSS');
 
- 		$this->load->_model('Model_dpdxw','dpdxw');
 
- 		$this->load->_model('Model_cne','cne');
 
- 		$this->load->_model('Model_outbound','outbound');
 
- 		$this->load->_model('Model_api','api');
 
- 		$this->load->_model('Model_dhlhz','dhlhz');
 
- 		$this->load->_model('Model_apismt','apismt');
 
- 		$this->load->_model('Model_specialstock','specialstock');
 
- 		$this->load->_model('Model_systemwigsout','systemwigsout');
 
- 		$this->load->_model('Model_purchaseorder','purchaseorder');
 
- 		$this->load->_model('Model_returns','returns');
 
- 		$this->load->_model('Model_whlabellabel','whlabellabel');
 
- 		$this->load->_model('Model_whlabelbarcode','whlabelbarcode');
 
- 		$this->load->_model('Model_tjadd','tjadd');
 
- 		$this->load->_model('Model_stafflist','stafflist');
 
- 		$this->load->_model('Model_paypal','paypal');
 
- 		$this->load->_model('Model_warehousefactory','warehousefactory');
 
- 		$this->load->_model('Model_commodityread_del','commodityreaddel');
 
- 		$this->load->_model('Model_als','als');
 
- 		$this->load->_model('Model_allocation','allocation');
 
- 		$this->load->_model('Model_17track','17track');
 
- 		$this->load->_model('Model_hualei','hualei');
 
- 		$this->load->_model('Model_hualeixw','hualeixw');
 
- 		$this->load->_model('Model_ck','ck');
 
- 		$this->load->_model('Model_colour','colour');
 
- 		$this->load->_model('Model_color','color');
 
- 		$this->load->_model('Model_emaildata','emaildata');
 
- 		$this->load->_model('Model_wigprint','wigprint');
 
- 		$this->load->_model('Model_weight','weight');
 
- 		$this->load->_model('Model_whlabeltransport','whlabeltransport');
 
- 		$this->load->_model('Model_pay','pay');
 
- 		$this->load->_model('Model_orderurl','orderurl');
 
- 		$this->load->_model('Model_classid','classid');
 
- 		$this->load->_model('Model_whlabel','whlabel');
 
- 		$this->load->_model('Model_systemtransfer','systemtransfer');
 
- 		$this->load->_model('Model_whlabel_bh','whlabel_bh');
 
- 		$this->load->_model('Model_excel','excel');
 
- 		$this->load->_model('Model_yuntu','yuntu');
 
- 		$this->load->_model('Model_fedex_ficp','fedex_ficp');
 
- 		$this->load->_model('Model_fedexv1','fedexv1');
 
- 		$this->load->_model('Model_fedexv1','fedexv1');
 
- 		$this->load->_model("Model_zxyuntu","zxyuntu");
 
- 		$this->load->_model("Model_customsdeclaration","customsdeclaration");
 
- 	}
 
- 	//定义方法的调用规则 获取URI第二段值
 
-     public function _remap($arg,$arg_array)
 
-     {
 
- 		 if($arg == 'x3')
 
-         {
 
-              $this->_x3($arg_array);
 
-         }
 
- 		else if($arg == 'qk')
 
-         {
 
-              $this->_qk();
 
-         }
 
- 		else if($arg == 'qczd')
 
-         {
 
-              $this->_qczd($arg_array);
 
-         }
 
- 		else if($arg == 'd')
 
-         {
 
-              $this->_d($arg_array);
 
-         }
 
- 		else if($arg == 'w')
 
-         {
 
-              $this->_w($arg_array);
 
-         }
 
- 		else if($arg == 'wz')
 
-         {
 
-              $this->_wz($arg_array);//改仓库位置
 
-         }
 
- 		else if($arg == 'qkyy')
 
-         {
 
-              $this->_qkyy($arg_array);//清除备货用友数据
 
-         }
 
- 		else if($arg == 'cxxq')
 
-         {
 
-              $this->_cxxq($arg_array);//查询独立站订单详情
 
-         }
 
- 		else if($arg == 'user')
 
-         {
 
-              $this->_user($arg_array);//批量添加店铺权限
 
-         }
 
-     }
 
- 	
 
- 	public function _x3($arg_array)
 
- 	{
 
- 	    die;
 
- 		$fullorder = $this->fullorder->get_number($arg_array[0]);
 
- 		if(!$fullorder)
 
- 		{
 
- 			$fullorder = $this->fullordersmt->get_number($arg_array[0]);
 
- 		}
 
- 		if(!$fullorder)
 
- 		{
 
- 			$fullorder = $this->fullordertt->get_number($arg_array[0]);
 
- 		}
 
- 		if(!$fullorder)
 
- 		{
 
- 			$fullorder = $this->fullorderxw->get_number($arg_array[0]);
 
- 		}
 
- 		if(!$fullorder)
 
- 		{
 
- 			echo "编号错误";exit;
 
- 		}
 
- 		/** 发票地址信息暂时无用 
 
- 		$fullorder['baddress'] = explode(',',$fullorder['baddress']);
 
- 		$fullorder['baddress'] = array_reverse($fullorder['baddress']);
 
- 		$fullorder['baddress'][1] = $country['ename'];
 
- 		**/
 
- 		//获取所用相关信息
 
- 		
 
- 		
 
- 		$warehouse = $this->warehouse->read($fullorder['type']);
 
- 		$country = $this->country->read($fullorder['country']);//订单国家信息
 
- 		$fcountry = $this->country->read($warehouse['country']);//仓库国家信息
 
- 	
 
- 		$warehouse['country'] = $fcountry['ename'];//仓库国家名
 
- 		$warehouse['lb'] = $fcountry['lb'];//仓库国家编码
 
- 		$fullorder['warehouse'] = $warehouse;//仓库数据加入订单
 
- 		$fullorder['lb'] = $country['lb'];//订单国家编码加入
 
- 		$fullorder['country'] = $country['ename'];//订单国家名
 
- 		$fullorder['zhou'] = $country['continent'];//所属州
 
- 		$express = $this->express->read($fullorder['express']);
 
- 		$fullorder['express'] = $express['servicename'];
 
- 		$fullorder['account'] = $express['account'];
 
- 		$fullorder['printcode'] = $express['printcode'];
 
- 		$fullorder['time'] = date('Y-m-d',time());
 
- 		$fullorder['times'] = date('Y-m-d H:i',time());
 
- 		$declara_info = $this->customsdeclaration->find("ename like '%".trim($fullorder['sbpm'])."%' ","*");
 
- 	    //var_dump($declara_info);
 
- 		$sbbm = "";
 
- 		if(empty($declara_info)){
 
- 			$sbbm = "";
 
- 		}else{
 
- 		    $sbbm = $declara_info['bname'];
 
- 		}
 
- 	
 
- 		$fullorder['sbbm']= $sbbm;
 
- 		$fullorder['address'] = str_replace(array('&'),array('&'),$fullorder['address']);
 
- 		$fullorder['address2'] = str_replace(array('&'),array('&'),$fullorder['address2']);
 
- 		$fullorder['shipremarks'] = str_replace(array('<','>'),array('<','>'),$fullorder['shipremarks']);
 
- 		$fullorder['shipremarks'] = str_replace(array('<','>',';',';'),array('<','>',';<br>',';<br>'),$fullorder['shipremarks']);
 
- 		$shop = $this->shop->read($fullorder['shop']);
 
- 		$fullorder['shop'] = $shop['shopname'];
 
- 		$fullorder['city'] = preg_replace('/( | | |\s)/',' ',$fullorder['city']);
 
- 		$fullorder['province'] = preg_replace('/( | | |\s)/',' ',$fullorder['province']);
 
- 		if(is_numeric($fullorder['pay']))
 
- 		{
 
- 		    $pay = $this->typeclass->read($fullorder['pay']);
 
- 		    if($pay['classid'] == '4')
 
- 		    {
 
- 		        $fullorder['pay'] = $pay['title'];
 
- 		    }
 
- 		}
 
- 		if($fullorder['printcode'] != "USPS")
 
- 		{
 
- 		    $fullorder['client'] = htmlspecialchars($fullorder['client']);
 
- 		    $fullorder['name'] = htmlspecialchars($fullorder['name']);
 
- 		}
 
- 		//增加退货单所需信息
 
- 		$pt = '';
 
- 		$fpdata = explode(';',trim($fullorder['fpdata'],';'));
 
- 		foreach ($fpdata as $v) 
 
- 		{
 
- 			$p = explode('|',trim($v,'|'));
 
- 			//$pt .= '<p>'.$p[1].' * '.$p[2].'</p>';
 
- 		}
 
- 		$fullorder['pt'] = $pt;
 
- 		//$fullorder['printnumber'] =  6;
 
- // 		$fullorder['address'] = "221 5TH ST # APT305";
 
- // 		$fullorder['city'] = "W SACRAMENTO";
 
- // 		echo "<pre>";
 
- // 		var_dump($fullorder['sbbm']);
 
- // 		die;
 
- 		//$fullorder['printcode'] = 'HUALEIXW-FEDEX';
 
- 		//$fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
 
- 		//$fullorder['sbbm']= 4202320000;//($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
 
- 		//$fullorder['sbpm']= 'eyelashes';
 
- 		//$fullorder['zwpm']= '假睫毛';
 
- 		//$fullorder['sbpm']= 'Satin Bag';
 
- 		//$fullorder['zwpm']= '袋子';
 
- 		//$fullorder['hgbm']= 4202320000;
 
- 		//$fullorder['address'] = '1653 Treutlan Place';
 
- 		//$fullorder['address2'] = '';
 
- 		//$fullorder['qm'] = 2;
 
- 		//$notice = $this->notice->read(6);
 
- 		//$fcountry['warehouse']['name'] = 'Hair Me Please LLC';
 
- 		//$fullorder['cxcode'] = strtolower($express['cxcode']);
 
- 		//$barcode = $this->fedex->get_logistics($fullorder);//获取联邦快递信息
 
- 		//echo $fullorder['name'];
 
- 		//$b = $this->yuntu->get_data($fullorder);
 
- 		//$b = $this->usps->get_logistics($fullorder);
 
- 	//	$fullorder['printcode'] = 'HUALEI-DHL';
 
- // 		$fullorder['js'] = 2;
 
- // 		$fullorder['bx'] = 110;
 
- 		//$fullorder['qm'] = 1;
 
- 		$fullorder['printcode'] = 'FedEx_GD';
 
- 	    echo "<pre>";
 
- 		// print_r($fullorder);
 
- 		// die;
 
- 		$b = $this->cne->get_data($fullorder);
 
- 		print_r($b);
 
- 		die;
 
- 		
 
- 		//$fullorder['printcode'] = 'usps_priority';
 
- //  		$b  = $this->usps->get_data($fullorder);
 
- //  		print_r($b);
 
- //          die;
 
- //         echo "<pre>";
 
- // 		$b = $this->fedexv1->get_data($fullorder);
 
- // 		var_dump($b);
 
- 		//echo $fullorder['zzl'];
 
- // 		echo  "<pre>";
 
- // 		var_dump($fullorder);
 
- 	
 
- // 		$b = $this->dhl->get_data($fullorder);
 
- 		
 
- // 		$b = $this->ups->get_data($fullorder);
 
- // 		echo "<pre>";
 
- // 		print_r($b);
 
- // 		$this->_pdf($b['labelImage'],"test",date("Ymd"));
 
- 		
 
- 	}
 
- 	
 
- 	public function get_data($data)
 
- 	{
 
- 		$ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI','guam'=>'GU','puerto rico'=>'PR');
 
- 		$data['province'] = preg_replace('/( | | |\s)/',' ',$data['province']);
 
- 		$data['province'] = trim($data['province'],' ');
 
- 		$dataprovince = strlen($data['province'])==2?$data['province']:$ToState[strtolower($data['province'])];
 
- 		$data['address'] = str_replace(array('#','&','&'),array('%23','%26'),$data['address']);
 
- 		$data['address2'] = str_replace(array('#','&','&'),array('%23','%26'),$data['address2']);
 
- 		$data['client'] = str_replace(array('#','&','&'),array('%23','%26'),$data['client']);
 
- 		$data['name'] = str_replace(array('#','&','&'),array('%23','%26'),$data['name']);
 
- 		$data['name'] = str_replace('  ',' ',$data['name']);
 
-         $xml = "";
 
-         $xml .= "<eVSRequest USERID='050GHAIR7974'>";
 
-         $xml .= "<Option></Option>";
 
- 		$xml .= "<Revision>1</Revision>";
 
- 		$xml .= "<ImageParameters>";
 
- 		$xml .= "<ImageParameter>4X6LABELP</ImageParameter>";
 
- 		$xml .= "</ImageParameters>";
 
-         $xml .= "<FromName>Kenny Kwok</FromName>";//发件人姓名或公司
 
-         $xml .= "<FromFirm>Long Human Hair Factory Inc</FromFirm>";//发件人姓名或公司
 
-         $xml .= "<FromAddress1></FromAddress1>";//发件人地址1 公寓或套房号码 不超过50个字符
 
-         $xml .= "<FromAddress2>819 6th Avenue Store front</FromAddress2>";//发件人地址2
 
-         $xml .= "<FromCity>New York</FromCity>";//发件人城市
 
-         $xml .= "<FromState>NY</FromState>";//发件人所属州
 
-         $xml .= "<FromZip5>10001</FromZip5>";//发件人邮政编码
 
-         $xml .= "<FromZip4></FromZip4>";//发件人邮编2
 
-         $xml .= "<FromPhone>8455583605</FromPhone>";//发件人电话,10位
 
-         $xml .= "<AllowNonCleansedOriginAddr>true</AllowNonCleansedOriginAddr>";//是否检查地址 true不检查
 
-         $xml .= "<ToName>".$data['name']."</ToName>";//收件人名称
 
-         $xml .= "<ToFirm></ToFirm>";//收件人名称
 
- 		if($data['address2'] == "")
 
- 		{
 
-             $xml .= "<ToAddress1>".$data['address2']."</ToAddress1>";//收件人地址1 不超过50个字符
 
-             $xml .= "<ToAddress2>".$data['address']."</ToAddress2>";//收件人地址2
 
- 		}
 
- 		else
 
- 		{
 
- 			$xml .= "<ToAddress1>".$data['address']."</ToAddress1>";//收件人地址1 不超过50个字符
 
-             $xml .= "<ToAddress2>".$data['address2']."</ToAddress2>";//收件人地址2
 
- 		}
 
-         $xml .= "<ToCity>".$data['city']."</ToCity>";//收件人城市
 
-         $xml .= "<ToState>".$dataprovince."</ToState>";//收件人州
 
-         $xml .= "<ToZip5>".trim($data['zipcode'],' ')."</ToZip5>";//收件人邮编
 
-         $xml .= "<ToZip4></ToZip4>";//收件人邮编2
 
-         $xml .= "<ToPhone></ToPhone>";//收件人电话
 
-         $xml .= "<POBox></POBox>";//目标地址是否为邮政信箱。
 
- 		if($data['qm']==1 && $data['js'] == 1)//如果需要签名,并且快递服务选择优先
 
- 		{
 
- 			$ServiceType = 'PRIORITY';
 
- 			$Container = 'FLAT RATE ENVELOPE';
 
- 			$ExtraService = '156';
 
- 			$ExtraServicebx = '125';
 
- 		}
 
- 		else if($data['qm']==1 && $data['js'] == 0)//如果需要签名,并且快递服务不选择优先
 
- 		{
 
- 			$ServiceType = 'FIRST CLASS';
 
- 			$Container = 'VARIABLE';
 
- 			$ExtraService = '120';
 
- 			$ExtraServicebx = '100';
 
- 		}
 
- 		else if($data['qm']==1 && $data['js'] == 2)//如果需要签名,并且快递服务选择PRIORITY EXPRESS
 
- 		{
 
- 			$ServiceType = 'PRIORITY EXPRESS';
 
- 			$Container = 'FLAT RATE ENVELOPE';
 
- 			$ExtraServicebx = '101';
 
- 		}
 
- 		else if($data['qm']==0 && $data['js'] == 1)//如果不需要签名,并且快递服务选择优先
 
- 		{
 
- 			$ServiceType = 'PRIORITY';
 
- 			$Container = 'FLAT RATE ENVELOPE';
 
- 			$ExtraServicebx = '125';
 
- 		}
 
- 		else if($data['qm']==0 && $data['js'] == 0)//如果不需要签名,并且快递服务不选择优先
 
- 		{
 
- 			$ServiceType = 'FIRST CLASS';
 
- 			$Container = 'VARIABLE';
 
- 			$ExtraServicebx = '100';
 
- 		}
 
- 		else if($data['qm']==0 && $data['js'] == 3)//如果不需要签名,并且快递服务不选择优先
 
- 		{
 
- 			$ServiceType = 'Standard Mail Marketing Parcel';
 
- 			$Container = 'VARIABLE';
 
- 			$ExtraServicebx = '100';
 
- 		}
 
- 		else if($data['qm']==0 && $data['js'] == 2)//如果不需要签名,并且快递服务选择PRIORITY EXPRESS
 
- 		{
 
- 			$ServiceType = 'PRIORITY EXPRESS';
 
- 			$Container = 'FLAT RATE ENVELOPE';
 
- 			$ExtraServicebx = '125';
 
- 		}
 
- 		if($data['email'])
 
- 		{
 
- 			if(strlen($data['email']) < 60 && stripos($data['email'],'tiktok') === false)
 
- 			{
 
- 		        $xml .= "<ToContactPreference>EMAIL</ToContactPreference>";
 
- 		        $xml .= "<ToContactEMail>".$data['email']."</ToContactEMail>";
 
- 			}
 
- 		}
 
-         $xml .= "<AllowNonCleansedDestAddr>false</AllowNonCleansedDestAddr>";
 
-         $xml .= "<WeightInOunces>".$data['zzl']."</WeightInOunces>";//重量
 
-         $xml .= "<ServiceType>".$ServiceType."</ServiceType>";//服务类型
 
-         $xml .= "<Container>".$Container."</Container>";//货物类型
 
-         $xml .= "<Width></Width>";//可选
 
-         $xml .= "<Length></Length>";//可选
 
-         $xml .= "<Height></Height>";//可选
 
-         $xml .= "<Machinable></Machinable>";//可选
 
-         $xml .= "<ProcessingCategory></ProcessingCategory>";//可选
 
-         $xml .= "<PriceOptions></PriceOptions>";//可选
 
-         $xml .= "<InsuredAmount>".$data['bx']."</InsuredAmount>";//保险金 可选
 
-         $xml .= "<AddressServiceRequested>True</AddressServiceRequested>";//可选 客户变更地址提醒
 
- 		/**
 
- 		$data['qm'] = ($data['qm']==1)?'False':'True';
 
- 		if($data['qm'] == 'False')
 
- 		{
 
- 		    $xml .= "<ExpressMailOptions>";
 
- 		    //$xml .= "<DeliveryOption>1</DeliveryOption>";//可选 交付选择 默认1:正常交付
 
- 		    $xml .= "<WaiverOfSignature>".$data['qm']."</WaiverOfSignature>";//可选 接收签名用False
 
-             $xml .= "</ExpressMailOptions>";
 
- 		}
 
-         **/
 
- 		if($data['qm']==1 && $data['js'] == 2)
 
- 		{
 
- 		    $xml .= "<ExpressMailOptions>";
 
- 		    //$xml .= "<DeliveryOption>1</DeliveryOption>";//可选 交付选择 默认1:正常交付
 
- 		    $xml .= "<WaiverOfSignature>FALSE</WaiverOfSignature>";//可选 接收签名用False
 
-             $xml .= "</ExpressMailOptions>";
 
- 		}
 
-         $xml .= "<ShipDate>".date('m/d/Y',time()-(12*3600)+($data['yc']*24*3600))."</ShipDate>";//可选 发货日期 当前至7天 格式 mm/ dd/ yyyy 延迟发货
 
- 		//$xml .= "<ReturnCommitments>true</ReturnCommitments>";
 
-         $xml .= "<CustomerRefNo>".$data['number']."</CustomerRefNo>";//可选 内部编号显示在运单 不超过19字符
 
-         $xml .= "<ExtraServices>";
 
- 		if(isset($ExtraService))
 
- 		{
 
- 		   $xml .= "<ExtraService>".$ExtraService."</ExtraService>";//可选额外服务
 
- 		}
 
- 		if($data['bx'] > 0)
 
- 		{
 
- 		   $xml .= "<ExtraService>".$ExtraServicebx."</ExtraService>";//可选额外服务
 
- 		}
 
-         $xml .= "</ExtraServices>";
 
-         $xml .= "<ReceiptOption>NONE</ReceiptOption>";//可选打印布局SEPARATE PAGE 或NONE
 
-         $xml .= "<ImageType>PDF</ImageType>";//输出类型
 
- 		$xml .= "<HoldForManifest>Y</HoldForManifest>";
 
- 		$xml .= "<PrintCustomerRefNo>true</PrintCustomerRefNo>";//内部编号显示要用这个标签
 
-         $xml .= "</eVSRequest>";
 
- 		
 
- 		/** 直连 **/
 
- 	
 
- 		$ch = curl_init();
 
- 		$url = 'https://secure.shippingapis.com/ShippingAPI.dll?API=eVS&XML='.$xml;
 
- 		$url = str_replace(" ",'%20',$url);
 
- 		curl_setopt($ch,CURLOPT_URL,$url);
 
- 		curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
 
- 		curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,0);
 
- 		curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts
 
-         curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
 
- 		curl_setopt($ch,CURLOPT_TIMEOUT,25);
 
- 		$data = curl_exec($ch);
 
- 		curl_close($ch);
 
- 		$data = utf8_encode($data);
 
-         libxml_disable_entity_loader(true);
 
-        // @$values = json_decode(json_encode(simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
 
- 		return $data;
 
- 	
 
- 		
 
- /**
 
- 		$ch = curl_init();
 
- 		$url = 'http://z.wepolicy.cn/usps.php?XML='.$xml;
 
- 		$url = str_replace(" ",'%20',$url);
 
- 		curl_setopt($ch,CURLOPT_URL,$url);
 
- 		curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
 
- 		curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,0);
 
- 		curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts
 
-         curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
 
- 		curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,35);
 
- 		$data = curl_exec($ch);
 
- 		curl_close($ch);
 
- 		$data = json_decode($data,TRUE);
 
- 		return $data;
 
- 		//Description提示错误    LabelImage运单PDF  BarcodeNumber运单号
 
- 		**/
 
- 		
 
- 	}
 
- 	
 
- 	public function _pdf($pdf,$title,$bctime)
 
-     {
 
-     	$pdf_path = './data/pdf/'.$bctime.'/';
 
-         $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 $bctime;
 
-     }
 
- 	
 
- 	public function _qk()//清空用友数据
 
- 	{
 
- 		$sc = array();
 
- 		$a = $this->fullorder->find_all("scapi = '99'");
 
- 		foreach ($a as $v) 
 
- 		{
 
- 			if(stripos($v['scid'],'XD') === false || $v['scid'] == '|' || $v['scid'] == '')
 
- 			{
 
- 				$this->fullorder->save(array('scid'=>'','scapi'=>0,'dbapi'=>0),$v['id']);
 
- 				continue;
 
- 			}
 
- 			 $b = explode('|',trim($v['scid'],'|'));
 
- 			 $b = explode('~',trim($b[0],'~'));
 
- 			 //$c =  str_replace('XD','',$b[1]);
 
- 			if(strlen($b[1]) != 12)
 
- 			{
 
- 				$this->fullorder->save(array('scid'=>'','scapi'=>0,'dbapi'=>0),$v['id']);
 
- 				continue;
 
- 			}
 
- 		}
 
- 		echo "<pre>";
 
- 		print_r($sc);
 
- 		exit;
 
- 	}
 
- 	
 
- 	public function _w($arg_array)
 
- 	{
 
- 		$a = $this->whlabel->read($arg_array[0]);
 
- 		$s = $this->whlabel->find_all("features = '".$a['features']."'");
 
- 		echo "<pre>";
 
- 		print_r($a);
 
- 		echo "<pre>";
 
- 		print_r($s);
 
- 		exit;
 
- 	}
 
- 	
 
- 	
 
- 	public function _qczd($arg_array)//清空用友数据
 
- 	{
 
- 		$a = $this->whlabel->find_all("zd = '$arg_array[0]'");
 
- 		foreach ($a as $v) 
 
- 		{
 
- 			$this->whlabel->save(array('zd'=>''),$v['id']);
 
- 		}
 
- 	}
 
- 	
 
- 	public function _d($arg_array)
 
- 	{
 
- 		$a = $this->fullorder->get_number($arg_array[0]);
 
- 		if(!$a)
 
- 		{
 
- 			//$a = $this->fullorder->get_orderinfo($arg_array[0]);
 
- 			if(!$a)
 
- 		    {
 
- 				$a = $this->fullordersmt->get_number($arg_array[0]);
 
- 				if(!$a)
 
- 				{
 
- 					//$a = $this->fullordersmt->get_orderinfo($arg_array[0]);
 
- 					if(!$a)
 
- 		    		{
 
- 						$a = $this->fullordertt->get_number($arg_array[0]);
 
- 						if(!$a)
 
- 						{
 
- 							$a = $this->fullorderxw->get_number($arg_array[0]);
 
- 							if(!$a)
 
- 							{
 
- 								//$a = $this->fullordertt->get_orderinfo($arg_array[0]);
 
- 							}
 
- 						}
 
- 					}
 
- 				}
 
- 			}
 
- 		}
 
- 		if($a)
 
- 		{
 
- 			echo "<pre>";
 
- 			print_r($a);
 
- 		}
 
- 		else
 
- 		{
 
- 			echo "没有此数据";
 
- 		}
 
- 		exit;	
 
- 	}
 
-         public function _wz($arg_array)
 
- 		{
 
- 			if(!isset($arg_array[1]))
 
- 			{
 
- 				//echo "没有位置数据";
 
- 				return "没有位置数据";
 
- 			}
 
- 			$cid = $this->whlabellabel->find_all("cpid = '".$arg_array[0]."'");
 
- 			if(isset($cid[0]))
 
- 			{
 
- 			    $w = $this->whlabel->find_all("number = '".$cid[0]['number']."' and warehouse = '13'");
 
- 			    foreach ($w as $v) 
 
- 		        {
 
-                    $this->whlabel->save(array('details'=>$arg_array[1]),$v['id']);
 
-                 }
 
- 				echo json_encode(array('msg'=>'!','success'=>true));exit;
 
- 				//echo '成功';
 
- 				//echo "<pre>";
 
- 				//print_r($w);
 
- 			}
 
- 		}
 
- 		
 
- 		
 
- 		public function _qkyy($arg_array)//清空备货用友数据
 
- 	{
 
- 		$y = $this->whlabel_bh->read($arg_array[0]);
 
- 		if($y)
 
- 		{
 
- 			$this->whlabel_bh->save(array('scid'=>'','scapi'=>0,'dbapi'=>0,'state'=>0),$y['id']);
 
- 			echo 'ok';
 
- 		}
 
- 		else
 
- 		{
 
- 			echo '没有ID';
 
- 		}
 
- 	}
 
- 	
 
- 	
 
- 	public function _cxxq()//查询独立站订单详情
 
- 	{
 
- 		$value = $this->shop->read(3);
 
- 		$res = $this->get_hq($value['brandname'],$value['shopadmin'],$value);
 
- 			
 
- 		echo "<pre>";
 
- 		print_r($res);
 
- 	}
 
- 	
 
- 	public function get_hq($name,$shopapi,$shop)
 
- 	{
 
- 		$jqtime = ($name=='SuperNova')?24*3600:2*3600;
 
- 		$fromTime = time()-24*3600-$jqtime;//strtotime('yesterday')-$jqtime;//昨日0点+1小时保险无漏单
 
- 		$toTime = time();
 
- 		$post['cs'] = 1;
 
- 			$post['name'] = $name;
 
-         	$post['from'] = $fromTime;
 
-         	$post['to'] = $toTime;
 
- 			$ch = curl_init();
 
- 			curl_setopt($ch,CURLOPT_URL,$shopapi);
 
- 			curl_setopt($ch, CURLOPT_POST, 1);
 
- 			curl_setopt($ch, CURLOPT_HEADER, 0);
 
- 			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 
- 			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 
- 			curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
 
- 			curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
 
- 			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
- 			curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1800000);
 
- 			$res = curl_exec($ch);
 
- 			curl_close($ch);
 
-    	    	if($res)
 
- 			{
 
- 				$res = json_decode($res,true);
 
- 				$x = array();
 
- 				foreach ($res as $v)
 
- 				{
 
- 					$source = '';
 
- 					$sc = substr($v['order_id'],0,3);
 
- 					if($sc == '600')
 
- 					{
 
- 						$source = $shop['thurl']; //手机订单
 
- 					}
 
- 					else
 
- 					{
 
- 						$source = $shop['url'];//PC订单
 
- 					}
 
- 					if($v['wjauthorid'] != '' && $v['sourcecontentid'] != '' && $source != '' && $shop['tweak'] != '')
 
- 					{
 
- 						$authorid = $this->authorid($source.'?author_id='.$v['wjauthorid'].'&source_content_id='.$v['sourcecontentid'],$shop['tweak']);
 
- 						if($authorid)
 
- 						{
 
- 							$v['authorid'] = $authorid;
 
- 						}
 
- 					}
 
- 					$x[] = $v;
 
- 				}
 
- 				return $x;
 
- 			}
 
- 	}
 
- 	
 
- 	public function _user($arg_array)//查询独立站订单详情
 
- 	{
 
- 		$id = $arg_array[0];
 
- 		$d = $arg_array[1];
 
- 		$shop = $this->shop->read($id);
 
- 		$value = $this->user->find_all("shop not like '|".$id."|' and shop like '%|".$d."|%'");
 
- 		foreach ($value as $v)
 
- 		{
 
- 			//$this->user->save(array('shop'=>$v['shop'].$id.'|','shoptext'=>$v['shoptext'].$shop[''].'|'),$v['id']);
 
- 		}
 
- 			
 
- 		echo "<pre>";
 
- 		print_r($value);
 
- 	}
 
- }
 
 
  |