| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588 | 
							- <?php defined('BASEPATH') OR exit('No direct script access allowed');
 
- class Aa 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_fullordersmt','fullordersmt');
 
- 		$this->load->_model('Model_fullorderxw','fullorderxw');
 
- 		$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_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_apiyy','apiyy');
 
- 		$this->load->_model('Model_purchase','purchase');
 
- 		$this->load->_model('Model_apitt','apitt');
 
- 		$this->load->_model('Model_whlabel_bh','whlabel_bh');
 
- 		$this->load->_model('Model_whlabel_fc','whlabel_fc');
 
- 		$this->load->_model('Model_systemtransfer','systemtransfer');
 
- 		$this->load->_model('Model_systemtransfer_del','systemtransfer_del');
 
- 		$this->load->_model('Model_power','power');
 
- 		$this->load->_model('Model_fullorderexcel','fullorderexcel');
 
- 		$this->load->_model('Model_fullorderexcelclassid','fullorderexcelclassid');
 
- 		$this->load->_model('Model_awlgx','awlgx');
 
- 		$this->load->_model('Model_shopsku','shopsku');
 
- 		$this->load->_model('Model_ttwebhook','ttwebhook');
 
- 		$this->load->_model('Model_awlgx','awlgx');
 
- 		$this->load->_model('Model_customertt','customertt');
 
- 		$this->load->_model('Model_returncw','returncw');
 
- 		$this->load->_model('Model_systemtransfer_cr','systemtransfer_cr');
 
- 		$this->load->_model('Model_systemtransfer','systemtransfer');
 
- 		$this->load->_model('Model_producttitle','producttitle');
 
- 		$this->load->_model('Model_setting','setting');
 
- 		$this->load->_model('Model_whlabel_qh','whlabel_qh');
 
- 		$this->load->_model('Model_afspaypal','afspaypal');
 
- 		$this->load->_model('Model_whlabel_list','whlabel_list');
 
- 		$this->load->_model('Model_message','message');
 
- 		$this->load->_model('Model_whlabel_type','whlabel_type');
 
- 	}
 
- 	//定义方法的调用规则 获取URI第二段值
 
-     public function _remap($arg,$arg_array)
 
-     {
 
- 		if($arg == 'a')
 
-         {
 
-              $this->_a($arg_array);
 
-         }
 
- 		else if($arg == 'ac')
 
-         {
 
-              $this->_ac($arg_array);
 
-         }
 
- 		else if($arg == 'x')
 
-         {
 
-              $this->_x($arg_array);
 
-         }
 
- 		else if($arg == 'x2')
 
-         {
 
-              $this->_x2($arg_array);
 
-         }
 
- 		else if($arg == 'x3')
 
-         {
 
-              $this->_x3($arg_array);
 
-         }
 
- 		else if($arg == 'xx')
 
-         {
 
-              $this->_xx($arg_array);
 
-         }
 
- 		else if($arg == 'Token')
 
-         {
 
-              $this->_sku($arg_array);
 
-         }
 
- 		else if($arg == 'dhl')
 
-         {
 
-              $this->_dhl($arg_array);
 
-         }
 
-     }
 
- 	
 
- 	
 
- 	public function get_hq($name,$shopapi,$shop)
 
- 	{
 
- 		$fromTime = time()-130*24*3600;//strtotime('yesterday')-$jqtime;//昨日0点+1小时保险无漏单
 
- 		$toTime = time()-125*24*3600;;
 
- 		
 
- 			$post = array();
 
- 			$post['synchronization'] = 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);
 
- 			//$this->logic_ding->sendToDing("测试获取magento订单".$res);
 
- 			curl_close($ch);
 
-    	    	if($res)
 
- 			{
 
- 				$res = json_decode($res,true);
 
- 				$x = array();
 
- 				if($res)
 
- 				{
 
- 				foreach ($res as $v)
 
- 				{
 
- 					if(!isset($v['order_id']))
 
- 					{
 
- 						continue;
 
- 					}
 
- 					$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 _a($arg_array)
 
- 	{
 
- 	$sid = '';$sd = array();
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 		    $user = explode('|',trim($user['shop'],'|'));
 
- 			foreach ($user as $value) 
 
- 		    {
 
- 				$sid .= " id = '$value' or";
 
- 			}
 
- 			$sid = " and (".rtrim($sid,'or').")";
 
- 		}
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		$api = $this->input->get('api',true);
 
- 		$dshop = $this->input->get('dshop',true);
 
- 		//@$gethl = $this->hl->get_hl();//获取即时汇率
 
- 		$gethl = array();
 
- 		/*  订单号加入键值-k  */
 
- 		/**
 
- 		$dataorder = array();
 
- 		$fdata = $this->fullorder->find_all('dtime > "'.(time()-96*3600).'"','orderinfo');
 
- 		foreach ($fdata as $v) 
 
- 		{
 
- 			$dataorder[$v['orderinfo']] = "";//获取到单号
 
- 		}
 
- 		**/
 
- 		/*  订单号加入键值-j  */
 
- 		/*  匹配加入  */
 
- 		$dictionaries = $this->typeclass->find_all('spare!= "" and classid != 1 and classid != 2 and classid != 3 and classid != 4 and classid != 5 and classid != 11 and classid != 16 and classid != 17 and classid != 20 and classid != 21 and classid != 23 and classid != 24 and classid != 29 and classid != 30 and classid != 31 and classid != 32 and classid != 36');
 
- 		// and (classid=13 or classid=22 or classid=8 or classid=15 or classid=27 or classid=25 or classid=26 or classid=18 or classid=14 or classid=9 or classid=12 or classid=10 or classid=6 or classid=100 or classid=999)
 
- 		$dtc = array();
 
- 		foreach ($dictionaries as $v) 
 
- 		{
 
- 			if(stripos($v['spare'],'|') !== false)//如果有多个值
 
- 			{
 
- 				$v['spare'] = explode('|',$v['spare']);
 
- 				foreach ($v['spare'] as $k=>$vs) 
 
- 		        {
 
- 					if(stripos($v['zh'],'|') !== false)
 
- 					{
 
- 						$vzh = explode('|',$v['zh']);
 
- 						$dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$vzh[$k],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$vs);
 
- 					}
 
- 					else
 
- 					{
 
- 					    $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$vs);
 
- 					}
 
- 				}
 
- 			}
 
- 			else
 
- 			{
 
- 				$dtc[strtolower($v['spare'])] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$v['spare']);
 
- 			}
 
- 			
 
- 		}
 
- 		$dictionaries2 = $this->typeclass->find_all();
 
- 		foreach ($dictionaries2 as $v)
 
- 		{
 
- 			$dtctitle[$v['id']] = $v['title'];
 
- 		}
 
- 		/*  匹配结束  */    
 
- 		/*  价格加入  */ 
 
- 		/** 
 
- 		$money = array();
 
- 		$productdescribe = $this->productdescribe->find_all('1=1','number,purchase,cost,salesprice,title');
 
- 		foreach ($productdescribe as $v) 
 
- 		{
 
- 			$money[$v['number']] = array('purchase'=>$v['purchase'],'cost'=>$v['cost'],'salesprice'=>$v['salesprice'],'title'=>$v['title']);
 
- 		}
 
- 		**/
 
- 		/*  价格加入  */
 
- 		/*  匹配ID加入  */
 
- 		$int = array();
 
- 		$intdata = $this->typeclass->find_all('classid=14','id,spare');
 
- 		foreach ($intdata as $v) 
 
- 		{
 
- 			$v['spare'] = explode('|',$v['spare']);
 
- 			$int[$v['id']] = $v['spare'][0];
 
- 		}
 
- 		/*  匹配ID结束  */
 
- 		/*  国家加入键值-k  */
 
- 		$cuy = array();
 
- 		$cuydata = $this->country->find_all('1=1','lb,id');
 
- 		foreach ($cuydata as $v) 
 
- 		{
 
- 			$cuy[$v['lb']] = $v['id'];//获取到国家ID
 
- 		}
 
- 		/*  国家加入键值-j  */
 
- 		/*  币种加入键值-k  */
 
- 		$typeclass = array();
 
- 		$tdata = $this->typeclass->find_all('classid=30','id,title');
 
- 		foreach ($tdata as $v) 
 
- 		{
 
- 			$typeclass[$v['title']] = $v['id'];
 
- 		}
 
- 		/*  币种加入键值-j  */
 
- 		/*  支付方式-k  */
 
- 		$pay = array();
 
- 		$tdata = $this->typeclass->find_all('classid=4','id,spare');
 
- 		foreach ($tdata as $v) 
 
- 		{
 
- 			$paytype = $this->pay->get_typeclass($v['id']);
 
- 			if(isset($paytype['estimaterate']))
 
- 			{
 
- 				$estimaterate = $paytype['estimaterate'];
 
- 			}
 
- 			else
 
- 			{
 
- 				$estimaterate = 0;
 
- 			}
 
- 			if(stripos($v['spare'],'|') !== false)//如果有多个值
 
- 			{
 
- 				$v['spare'] = explode('|',$v['spare']);
 
- 				foreach ($v['spare'] as $k=>$vs) 
 
- 		        {
 
- 					$pay[$vs] = array('id'=>$v['id'],'estimaterate'=>$estimaterate);
 
- 				}
 
- 			}
 
- 			else
 
- 			{
 
- 				$pay[$v['spare']] = array('id'=>$v['id'],'estimaterate'=>$estimaterate);
 
- 			}
 
- 		}
 
- 		$pay['stripeios'] = $pay['stripe_payments'];
 
- 		/*  支付方式-j  */
 
- 		/*  新增SKU-k  */
 
- 		$zjsku = array();
 
- 		$shopsku = $this->shopsku->find_all();
 
- 		foreach ($shopsku as $val) 
 
- 		{
 
- 			$ss = explode(',',trim($val['shop'],','));
 
- 			foreach ($ss as $v) 
 
- 			{
 
- 				if(isset($zjsku[$v]))
 
- 				{
 
- 					$zjsku[$v] .= ','.trim($val['sku'],',');
 
- 				}
 
- 				else
 
- 				{
 
- 					$zjsku[$v] = trim($val['sku'],',');
 
- 				}
 
- 			}
 
- 		}	
 
- 		$value = $this->shop->read(4);//获取独立站信息
 
- 	
 
- 		$is = $this->is->find_all('1=1','*','number asc');//获取仓库平匹配表
 
- 	
 
- 			
 
- 				$setting = $this->setting->get_settings();
 
- 				$res = $this->get_hq($value['brandname'],$value['shopadmin'],$value);
 
- 	
 
- $sjc = 1;
 
-                 $ck = array();
 
- 					foreach ($res as $v) 
 
- 		        	{
 
- 							if($value['id'] == 1)
 
- 							{
 
- 								$time = strtotime($v['purchased_on'])-7*3600-$sjc;//-$sjc;//之前是+$sjc
 
- 							}
 
- 							else
 
- 							{
 
- 								$time = strtotime($v['purchased_on'])-7*3600-$sjc;//订单时间更为时间戳 //之前是+$sjc
 
- 							}
 
- 						
 
- 						$num = $this->fullorder->find_count('gtime = "'.date('Ymd',$time).'" and shop = "'.$value['id'].'"');
 
- 						$order_id = $value['id'].$v['order_id'];
 
- 						$tc = 0;
 
- 						if(isset($v['global_currency_code']))
 
- 						{
 
- 						    $tc = isset($typeclass[$v['global_currency_code']])?$typeclass[$v['global_currency_code']]:0;
 
- 						}
 
- 						$dataorder = $this->fullorder->get_orderinfo($order_id);
 
- 						$hmdid = '';
 
- 						
 
- 							if(!isset($cuy[$v['country']]))
 
- 							{    
 
- 							    $cuy[$v['country']] = 1004;
 
- 							}
 
- 			          	    $post = $this->api->get_data($value,$v,$gethl,$time,$cuy[$v['country']],$is,$num,$v['country'],$tc,$dtc,array(),$int,$dtctitle,$pay,$zjsku);
 
- 							
 
- 						
 
- 							/**
 
- 							else if($post['pay'] == 22 && $value['paypalname'] != '' && $value['paypalpass'] != '')
 
- 							{
 
- 							    $paypal = $this->_paypaldata($post['paypal'],$value['paypalname'],$value['paypalpass']);
 
- 								if($paypal != '')
 
- 								{
 
- 								    $post['klarnadata'] = $paypal;
 
- 								}
 
- 								
 
- 							}
 
- 							**/
 
- 							
 
- 							/** 启用自动分配仓库 **/
 
- 							/**
 
- 							$post['express'] = 0;
 
- 							$warehouse = $this->warehouse->find_all("fpzd = '1'",'*','fpsx desc');
 
- 							foreach ($warehouse as $v) 
 
- 		        	        {
 
- 								if($v['bdcountry'] != 0 && $v['bdcountry'] != $post['country'])
 
- 								{
 
- 									continue;
 
- 								}
 
- 								$yx = 'get_yx_'.$v['bdck'];
 
- 								$kczd = $this->ck->$yx($post['state'],$v,$post['shop'],$post['number'],$post['whlabel'],$post['fpdata']);
 
- 								if($kczd['t'] == 0)
 
- 								{
 
- 									$country = $this->country->read($post['country']);//获取国家中配置物流
 
- 									if($country['express'] != 0)
 
- 									{
 
- 										$post['express'] = $country['express'];
 
- 									}
 
- 									if($v['express'] != 0)//优先使用仓库指定物流,替换掉上面的国家配置物流
 
- 									{
 
- 										$post['express'] = $v['express'];
 
- 									}
 
- 									$post['type'] = $v['id'];
 
- 									$post['whlabel'] = $kczd['whlabel'];
 
- 									$post['fpdata'] = $kczd['fpdata'];
 
- 									if(stripos($kczd['whlabel'],$v['hz']) !== false)
 
- 									{
 
- 									    break 1;
 
- 									}
 
- 								}
 
- 							}
 
- 							$qdw = $this->warehouse->read($post['type']);
 
- 							$fl = $this->ck->get_fl($qdw['hz'],$post['whlabel'],$post['fpdata']);
 
- 							$post['sfxh'] = $fl['sfxh'];
 
- 							$post['ckfl'] = $fl['ckfl'];
 
- 							$zipcode =  substr($post['zipcode'],0,1);
 
- 							if($post['type'] == 5 && $zipcode > 4)
 
- 							{
 
- 								$post['express'] = 63;
 
- 							}
 
- 							if($post['express'] > 0)
 
- 							{
 
- 								$xze = $this->express->read($post['express']);
 
- 								$post['printtype'] = $xze['type'];
 
- 							}
 
- 							**/
 
- 							//自动写位置 开始
 
- 							$zclp = array();$pxsl = array();
 
- 							$slpx = explode('|',$post['slpx']);//排序
 
- 							foreach ($slpx as $k=>$v) 
 
- 							{
 
- 								$v = explode('-',$v);
 
- 								if(!isset($v[1]))
 
- 								{
 
- 									$v[1] == 1;
 
- 								}
 
- 								for($i=$v[0];$i<$v[1];$i++)
 
- 								{
 
- 			    					$pxsl[$i] = $k;
 
- 								}
 
- 							}
 
- 							$mc = $qdw['bdck'];$zdidjl = '';$zdwzjl = '';
 
- 							if($qdw['wz'] == 1)
 
- 							{
 
- 								$pm = explode(';',trim($post['shipremarks'],';'));
 
- 								foreach ($pm as $k=>$vv) 
 
- 		        				{
 
- 									$vv = trim($vv,' ');
 
- 									$lp = $this->typeclass->find_all("zh = '$vv'");
 
- 									if(isset($lp[0]['classid']))
 
- 									{
 
- 										$zclp[] = $vv;
 
- 										unset($pm[$k]);
 
- 									}
 
- 								}
 
- 								$pm = array_values($pm);
 
- 								$w = explode('|',trim($post['whlabel'],'|'));
 
- 								foreach ($w as $k=>$val) 
 
- 		        	    		{
 
- 									$hwm = '';
 
- 									if(stripos($val,$qdw['hz']) !== false)
 
- 									{
 
- 										$num = explode('-',trim($val,'-'));
 
- 										$xq = explode('~',trim($num[2],'~'));
 
- 										$pmxq = '(';
 
- 										foreach ($xq as $v) 
 
- 		        	           			{
 
- 											$zdidjl .= '('.trim($v,$qdw['hz']).')';
 
- 											$h = $this->$mc->read(trim($v,$qdw['hz']));
 
- 											if($h['details'] != '')
 
- 											{
 
- 									            $pmxq .= $qdw['title'].':'.$h['details'].(($h['cpid']>0)?'-'.$h['cpid']:'').',';
 
- 											}
 
- 								        }
 
- 										$xrid = ($h['cpid']>0)?'-'.$h['cpid']:'';
 
- 										if(isset($pxsl[$k]))
 
- 										{
 
- 											if(stripos($pm[$pxsl[$k]],$qdw['title'].':'.$h['details'].$xrid) === false)
 
- 											{
 
- 												$pm[$pxsl[$k]] .= trim($pmxq,',').')';
 
- 											}
 
- 										}
 
- 										$zdwzjl .= $h['details'].(($h['cpid']>0)?'-'.$h['cpid']:'');
 
- 							        }
 
- 						        }
 
- 								if($zclp)
 
- 								{
 
- 									$zclp = ';'.implode(";",$zclp);
 
- 								}
 
- 								else
 
- 								{
 
- 									$zclp = '';
 
- 								}
 
- 								$post['shipremarks'] = implode(";",$pm).$zclp;
 
- 								$post['contents'] = $zdidjl.' - '.$zdwzjl;
 
- 					        }
 
- 							//自动写位置 结束
 
- 							//条数及申报
 
- 							$ts = 0;
 
- 							$dtsbjz = 0;
 
- 							$zsbjz = 0;
 
- 							$w = explode('|',trim($post['whlabel'],'|'));
 
- 							foreach ($w as $k=>$val) 
 
- 		        	    	{
 
- 								$num = explode('-',trim($val,'-'));
 
- 								$ts += $num[1];
 
- 							}
 
- 							if($ts > 0 && $ts < 6 && $post['country'] == 192)
 
- 							{
 
- 								$dtsbjz = ($ts==3)?sprintf("%.1f",100/$ts):100/$ts;
 
- 								$zsbjz = sprintf("%.2f",$dtsbjz*$ts);
 
- 							}
 
- 							$post['ts'] = $ts;
 
- 							$post['dtsbjz'] = $dtsbjz;
 
- 							$post['zsbjz'] = $zsbjz;
 
- 							/** **/
 
- 							//合并重复项
 
- 							$hbcfw = explode('|',trim($post['whlabel'],'|'));
 
- 							$hbcff = explode(';',trim($post['fpdata'],';'));
 
- 							$c = 0;
 
- 							$hbw = array();
 
- 							$hbf = array();
 
- 							for($i=0;$i<count($hbcfw);$i++)
 
- 							{
 
- 								$w = explode('-',$hbcfw[$i]);
 
- 								$f = explode('|',$hbcff[$i]);
 
- 								$w2 = ($w[2]==0)?0:'';
 
- 								if(!isset($hbw[$w[0].$w2]))
 
- 								{
 
- 									$hbw[$w[0].$w2] = $hbcfw[$i];
 
- 									$hbf[$w[0].$w2] = $hbcff[$i];
 
- 								}
 
- 								else
 
- 								{
 
- 									$c++;
 
- 									$cw = explode('-',$hbw[$w[0].$w2]);
 
- 									$cf = explode('|',$hbf[$w[0].$w2]);
 
- 									if($cw[2] != 0 && $w[2] != 0)
 
- 									{
 
- 										$cf[2] += $f[2];
 
- 										$cf[9] .= '~'.$f[9];
 
- 									    $hbf[$w[0].$w2] = implode("|",$cf);
 
- 									    $cw[1] += $f[2];
 
- 										$cw[2] .= '~'.$f[9];
 
- 									    $hbw[$w[0].$w2] = implode("-",$cw);
 
- 									}
 
- 									else if($cw[2] == 0 && $w[2] == 0)
 
- 									{
 
- 									    $cf[2] += $f[2];
 
- 									    $hbf[$w[0].$w2] = implode("|",$cf);
 
- 									    $cw[1] += $f[2];
 
- 									    $hbw[$w[0].$w2] = implode("-",$cw);
 
- 									}
 
- 									else
 
- 									{
 
- 										$hbw[] = $hbcfw[$i];
 
- 									    $hbf[] = $hbcff[$i];
 
- 									}
 
- 								}
 
- 							}
 
- 							if($c > 0)
 
- 							{
 
- 								$post['fpdata'] = implode(";",$hbf).';';
 
- 								$post['whlabel'] = '|'.implode("|",$hbw).'|';
 
- 							}
 
- 							//合并重复项结束
 
- 							//非占单设置为禁止占单开始
 
- 							$hbw = explode('|',trim($post['whlabel'],'|'));
 
- 							$hbf = explode(';',trim($post['fpdata'],';'));
 
- 							foreach ($hbw as $k=>$val) 
 
- 		        	    	{
 
- 								$w = explode('-',$val);
 
- 								$f = explode('|',$hbf[$k]);
 
- 								if(!isset($w[2]) || $w[2] == 0)
 
- 								{
 
- 									$w[2] = "DNOTO";
 
- 								    $f[9] = "DNOTO";
 
- 								    $hbf[$k] =  implode("|",$f);
 
- 								    $hbw[$k] = implode("-",$w);
 
- 								}
 
- 							}
 
- 							$post['fpdata'] = implode(";",$hbf).';';
 
- 							$post['whlabel'] = '|'.implode("|",$hbw).'|';
 
- 							//非占单设置为禁止占单结束
 
- 							//查询净重开始
 
- 							$post['jweight'] = $this->weight->get_weightcx($post['fpdata']);
 
- 							$post['zzl'] = ($post['jweight']+100)/1000;
 
- 							if($post['express'] == 2)
 
- 							{
 
- 								$post['zzl'] = intval(($post['jweight']+100)*0.035);
 
- 							}
 
- 							//查询净重结束
 
- 							$ck[] = $post;
 
- 					}
 
- 			
 
- 	echo "<pre>";
 
- 	print_r($ck);
 
- 	exit;
 
- 	
 
- foreach ($a as $v)
 
- 		    {
 
-                $d = $this->fullorder->get_orderinfo($v[0]);
 
- 			  $this->fullorder->save(array('dtime'=>strtotime($v[1]),'buytime'=>strtotime($v[1])),$d['id']);
 
- 			}
 
- 		exit;
 
- 		$v = $this->fullorder->get_number("QQS-40929-102");
 
- 		$post = array();
 
- 		$orderinfo = preg_replace('/^' . preg_quote($v['shop'], '/') . '/', '', $v['orderinfo']);
 
- 		$post['incrementId'] = $orderinfo;
 
- 		$post['trackingNumber'] = $v['waybill'];
 
- 		$ex = $this->express->read($v['express']);
 
- 		$post['carrier'] = $ex['iscode'];
 
- 		$shop = $this->shop->read($v['shop']);
 
- 		$url = 'https://www.romandhair.com/applepay/payment/addTrack';
 
- 		$ch = curl_init();
 
- 			curl_setopt($ch,CURLOPT_URL,$url);
 
- 			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);
 
- 		echo $post['incrementId'];
 
- 		echo "<pre>";
 
- 		print_r($res);
 
- 		
 
- 		exit;
 
- 	 $app_key = '6e17v02701qja';
 
- 			$code = 'ROW_Ndy4iwAAAAABEL6iLL6-MEYtcOmfF9z17OX066ypDSjWGDjXIbo-ODGO0v7Ui6sSw6H4dKnxir58biBqFqHPWP3kuW2XEvB73nNq0PLD9yyG9inJWhCMnBRNxvCTTIPfTiwt-NdA4F8s2fgBugiU8CK8xNBEX9_bgRhcapvE5E7MtAZLggjTFxWvlRmGi1xyWvURHI7whEaEIPa1gvFg69lsabcgTfIZjqsAZPdk2fwKGWf4Q5QcL6_q2Cwv8wqvPlC6ouHA4nqiynDo4BGswullj3GglvIAW11l1mCw7IWKiNertCXtg4NrpTCimLmsEqEOqBthC9Lg985BoMY1i1IQV1_7wQXUsau34Py3TxT40djLmC1lPLxi67o_tkZuKGtKI5kCIyVRc5at8xqTedkFwawAFIpUfPU5FjNFhDhWg6b7GmLlLw&locale';
 
- 		
 
- 				$shop = $this->shop->app_key($app_key);
 
- 				if($shop)
 
- 				{
 
- 				    $url = 'https://auth.tiktok-shops.com/api/v2/token/get?app_key='.$app_key.'&auth_code='.$code.'&app_secret='.$shop['app_secret'].'&grant_type=authorized_code';
 
- 				    $ch = curl_init();
 
-        		        curl_setopt($ch, CURLOPT_URL,$url);
 
-        		        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
 
-        		        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
 
-        		        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
-        		        $res = curl_exec($ch);
 
-        		        curl_close($ch);
 
- 					echo $res;
 
-        		        $res = json_decode($res,true);
 
- 					echo "<pre>";
 
- 						print_r($res);
 
- 					/**
 
- 				    if(isset($res['data']))
 
- 				    {
 
- 						$shop['token'] = $res['data']['access_token'];
 
- 						$shop['refresh_token'] = $res['data']['refresh_token'];
 
- 						$shop_cipher = '';
 
- 						$shopcipher = $this->_shop_cipher($shop);
 
- 						if(isset($shopcipher['data']['shops'][0]['cipher']))
 
- 						{
 
- 							$shop_cipher = $shopcipher['data']['shops'][0]['cipher'];
 
- 						}
 
- 					    $this->shop->save(array('token'=>$res['data']['access_token'],'tokentime'=>$res['data']['access_token_expire_in']-48*3600,'refresh_token'=>$res['data']['refresh_token'],'app_key'=>$app_key,'code'=>$code,'shop_cipher'=>$shop_cipher),$shop['id']);
 
- 					    echo 'ok';
 
- 						echo "<pre>";
 
- 						print_r($res);
 
- 				    }
 
- 					else
 
- 					{
 
- 						echo json_encode($res);
 
- 					}
 
- 					**/
 
- 					
 
- 				}
 
- 			
 
- 				exit;
 
- 		
 
- 		exit;
 
- $app_key='6e17v02701qja';
 
- $code = 'ROW_1HX6eQAAAAABEL6iLL6-MEYtcOmfF9z17OX066ypDSjWGDjXIbo-OAP3ojehHnSvVv_F1crabS_0BrWAW_cMO1HQSIq8PfsfX_4L40n5FznGhDmY1W6BCSmJKiOZHCcLdIAqUWF0oPtKQKeBwvyDxXb-ezdT4bn2t17DZ5aEARbX7V6qVAqWyFHrYgTtfjGIGxCgKrxR1-_KhqfC-2rD8PX8DItMw7dyS2MPei6E8O_IcJRc-dSAo7TpuAASCHKYpRunra40zJhjfGjQV0TJ6PI0qWOQoqwgBYHxXocLjJyJwWhJwt-Z4L1OXXDmpm25yI_hig5jBu5UlMprsyDVlFP2o7wMgrXt_WFiSuqKM4PRydNqVoFBY4J7bXFRx8iVokbpaTmM8K8ZD1MorctjSpgCV8L8_A1iDhmVqiANLDXPba49yMPmuA';
 
- $shop = $this->shop->read(59);
 
- 		 $url = 'https://access_tokenrefresh_tokenGETauth.tiktok-shops.com/api/v2/token/get?app_key='.$app_key.'&auth_code='.$code.'&app_secret='.$shop['app_secret'].'&grant_type=authorized_code';
 
- 				    $ch = curl_init();
 
-        		        curl_setopt($ch, CURLOPT_URL,$url);
 
-        		        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
 
-        		        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
 
-        		        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
-        		        $res = curl_exec($ch);
 
-        		        curl_close($ch);
 
- 					echo $res;
 
- 					echo "<pre>";
 
-        		        $res = json_decode($res,true);
 
- 					print_r($res);
 
- 					exit;
 
- 				    if(isset($res['data']))
 
- 				    {
 
- 						$shop['token'] = $res['data']['access_token'];
 
- 						$shop['refresh_token'] = $res['data']['refresh_token'];
 
- 						$shop_cipher = '';
 
- 						$shopcipher = $this->_shop_cipher($shop);
 
- 						if(isset($shopcipher['data']['shops'][0]['cipher']))
 
- 						{
 
- 							$shop_cipher = $shopcipher['data']['shops'][0]['cipher'];
 
- 						}
 
- 					    $this->shop->save(array('token'=>$res['data']['access_token'],'tokentime'=>$res['data']['access_token_expire_in']-48*3600,'refresh_token'=>$res['data']['refresh_token'],'app_key'=>$app_key,'code'=>$code,'shop_cipher'=>$shop_cipher),$shop['id']);
 
- 					    echo 'ok';
 
- 						echo "<pre>";
 
- 						print_r($res);
 
- 				    }
 
- 					else
 
- 					{
 
- 						echo json_encode($res);
 
- 					}
 
- 					
 
- 					
 
- 		exit;
 
- 		
 
- 		
 
- 		$this->fullorder->save(array('state'=>216,'print'=>3,'printtime'=>$time,'printnumber'=>1,'libraryconfirm'=>2,'library'=>2,'librarytime'=>$time,'weight'=>'0.4kg','review'=>6,'reviewtime'=>$time),$a['id']);
 
- 		
 
- 			exit;
 
- 							//自动写位置 开始
 
- 							$zclp = array();$pxsl = array();
 
- 							$slpx = explode('|',$post['slpx']);//排序
 
- 							foreach ($slpx as $k=>$v) 
 
- 							{
 
- 								$v = explode('-',$v);
 
- 								if(!isset($v[1]))
 
- 								{
 
- 									$v[1] == 1;
 
- 								}
 
- 								for($i=$v[0];$i<$v[1];$i++)
 
- 								{
 
- 			    					$pxsl[$i] = $k;
 
- 								}
 
- 							}
 
- 							$mc = $qdw['bdck'];$zdidjl = '';$zdwzjl = '';
 
- 							if($qdw['wz'] == 1)
 
- 							{
 
- 								$pm = explode(';',trim($post['shipremarks'],';'));
 
- 								foreach ($pm as $k=>$vv) 
 
- 		        				{
 
- 									$vv = trim($vv,' ');
 
- 									$lp = $this->typeclass->find_all("zh = '$vv'");
 
- 									if(isset($lp[0]['classid']))
 
- 									{
 
- 										$zclp[] = $vv;
 
- 										unset($pm[$k]);
 
- 									}
 
- 								}
 
- 								$pm = array_values($pm);
 
- 								$w = explode('|',trim($post['whlabel'],'|'));
 
- 								foreach ($w as $k=>$val) 
 
- 		        	    		{
 
- 									$hwm = '';
 
- 									if(stripos($val,$qdw['hz']) !== false)
 
- 									{
 
- 										$num = explode('-',trim($val,'-'));
 
- 										$xq = explode('~',trim($num[2],'~'));
 
- 										$pmxq = '(';
 
- 										foreach ($xq as $v) 
 
- 		        	           			{
 
- 											$zdidjl .= '('.trim($v,$qdw['hz']).')';
 
- 											$h = $this->$mc->read(trim($v,$qdw['hz']));
 
- 											if($h['details'] != '')
 
- 											{
 
- 									            $pmxq .= $qdw['title'].':'.$h['details'].(($h['cpid']>0)?'-'.$h['cpid']:'').',';
 
- 											}
 
- 								        }
 
- 										$xrid = ($h['cpid']>0)?'-'.$h['cpid']:'';
 
- 										if(isset($pxsl[$k]))
 
- 										{
 
- 											if(stripos($pm[$pxsl[$k]],$qdw['title'].':'.$h['details'].$xrid) === false)
 
- 											{
 
- 												$pm[$pxsl[$k]] .= trim($pmxq,',').')';
 
- 											}
 
- 										}
 
- 										$zdwzjl .= $h['details'].(($h['cpid']>0)?'-'.$h['cpid']:'');
 
- 							        }
 
- 						        }
 
- 								if($zclp)
 
- 								{
 
- 									$zclp = ';'.implode(";",$zclp);
 
- 								}
 
- 								else
 
- 								{
 
- 									$zclp = '';
 
- 								}
 
- 								$post['shipremarks'] = implode(";",$pm).$zclp;
 
- 								$post['contents'] = $zdidjl.' - '.$zdwzjl;
 
- 					        }
 
- 							//自动写位置 结束
 
- 							//条数及申报
 
- 							$ts = 0;
 
- 							$dtsbjz = 0;
 
- 							$zsbjz = 0;
 
- 							$w = explode('|',trim($post['whlabel'],'|'));
 
- 							foreach ($w as $k=>$val) 
 
- 		        	    	{
 
- 								$num = explode('-',trim($val,'-'));
 
- 								$ts += $num[1];
 
- 							}
 
- 							if($ts > 0 && $ts < 6 && $post['country'] == 192)
 
- 							{
 
- 								$dtsbjz = ($ts==3)?sprintf("%.1f",100/$ts):100/$ts;
 
- 								$zsbjz = sprintf("%.2f",$dtsbjz*$ts);
 
- 							}
 
- 							$post['ts'] = $ts;
 
- 							$post['dtsbjz'] = $dtsbjz;
 
- 							$post['zsbjz'] = $zsbjz;
 
- 							/** **/
 
- 							//合并重复项
 
- 							$hbcfw = explode('|',trim($post['whlabel'],'|'));
 
- 							$hbcff = explode(';',trim($post['fpdata'],';'));
 
- 							$c = 0;
 
- 							$hbw = array();
 
- 							$hbf = array();
 
- 							for($i=0;$i<count($hbcfw);$i++)
 
- 							{
 
- 								$w = explode('-',$hbcfw[$i]);
 
- 								$f = explode('|',$hbcff[$i]);
 
- 								$w2 = ($w[2]==0)?0:'';
 
- 								if(!isset($hbw[$w[0].$w2]))
 
- 								{
 
- 									$hbw[$w[0].$w2] = $hbcfw[$i];
 
- 									$hbf[$w[0].$w2] = $hbcff[$i];
 
- 								}
 
- 								else
 
- 								{
 
- 									$c++;
 
- 									$cw = explode('-',$hbw[$w[0].$w2]);
 
- 									$cf = explode('|',$hbf[$w[0].$w2]);
 
- 									if($cw[2] != 0 && $w[2] != 0)
 
- 									{
 
- 										$cf[2] += $f[2];
 
- 										$cf[9] .= '~'.$f[9];
 
- 									    $hbf[$w[0].$w2] = implode("|",$cf);
 
- 									    $cw[1] += $f[2];
 
- 										$cw[2] .= '~'.$f[9];
 
- 									    $hbw[$w[0].$w2] = implode("-",$cw);
 
- 									}
 
- 									else if($cw[2] == 0 && $w[2] == 0)
 
- 									{
 
- 									    $cf[2] += $f[2];
 
- 									    $hbf[$w[0].$w2] = implode("|",$cf);
 
- 									    $cw[1] += $f[2];
 
- 									    $hbw[$w[0].$w2] = implode("-",$cw);
 
- 									}
 
- 									else
 
- 									{
 
- 										$hbw[] = $hbcfw[$i];
 
- 									    $hbf[] = $hbcff[$i];
 
- 									}
 
- 								}
 
- 							}
 
- 							if($c > 0)
 
- 							{
 
- 								$post['fpdata'] = implode(";",$hbf).';';
 
- 								$post['whlabel'] = '|'.implode("|",$hbw).'|';
 
- 							}
 
- 							//合并重复项结束
 
- 							//非占单设置为禁止占单开始
 
- 							$hbw = explode('|',trim($post['whlabel'],'|'));
 
- 							$hbf = explode(';',trim($post['fpdata'],';'));
 
- 							foreach ($hbw as $k=>$val) 
 
- 		        	    	{
 
- 								$w = explode('-',$val);
 
- 								$f = explode('|',$hbf[$k]);
 
- 								if(!isset($w[2]) || $w[2] == 0)
 
- 								{
 
- 									$w[2] = "DNOTO";
 
- 								    $f[9] = "DNOTO";
 
- 								    $hbf[$k] =  implode("|",$f);
 
- 								    $hbw[$k] = implode("-",$w);
 
- 								}
 
- 							}
 
- 							$post['fpdata'] = implode(";",$hbf).';';
 
- 							$post['whlabel'] = '|'.implode("|",$hbw).'|';
 
- 							//非占单设置为禁止占单结束
 
- 							//查询净重开始
 
- 							$post['jweight'] = $this->weight->get_weightcx($post['fpdata']);
 
- 							$post['zzl'] = ($post['jweight']+100)/1000;
 
- 							if($post['express'] == 2)
 
- 							{
 
- 								$post['zzl'] = intval(($post['jweight']+100)*0.035);
 
- 							}
 
- 						
 
- 	}
 
- 	
 
- 	public function _aasd($arg_array)
 
- 	{
 
- 		
 
- 		/**
 
- 		$time = time()-3*24*3600;
 
- 		 $this->db->set('cktype', 1)
 
-              ->where('warehouse', 5)
 
-              ->where('cktype ', 0)
 
- 			 ->where('state ', 10)
 
- 			 ->where('outk > ', $time)
 
-              ->update('whlabel');
 
- 			 exit;
 
- 		
 
- 		
 
- 		$time = time()-15*24*3600;
 
- 		$list = $this->whlabel->find_all("sku = 'HDJCLFW24-250D' and outk > '$time'");
 
- 		foreach ($list as $k=>$v) 
 
-         {
 
- 			$list[$k]['outk'] = date('Y-m-d H:i:s',$v['outk']);
 
- 		}
 
- 		echo "<pre>";
 
- 		print_r($list);
 
- 		exit;
 
- 		exit;
 
- 		  $this->db->set('rktype', 1)
 
-              ->where('warehouse', 5)
 
-              ->where('rktype ', 0)
 
-              ->update('whlabel');
 
- 			 exit;
 
- 		
 
- 		$ktime = time()-30*24*3600;
 
- 		$list = $this->whlabel->read($arg_array[0]);
 
- 		$this->whlabel->save(array('cktype'=>1),$arg_array[0]);
 
- 		echo "<pre>";
 
- 		print_r($list);
 
- 		exit;
 
- 		
 
- 		$dtime = strtotime('2024/10/17 13:30:10');
 
- 		echo substr(date('ymd',$dtime),1);
 
- 		exit;
 
- 				$time = 1728638040;
 
- 		$a = $this->fullorder->get_number('QQS-41008-016');
 
- 		$this->fullorder->save(array('state'=>216,'print'=>3,'printtime'=>$time,'printnumber'=>1,'libraryconfirm'=>2,'library'=>2,'librarytime'=>$time,'weight'=>'0.4kg','review'=>6,'reviewtime'=>$time),$a['id']);
 
- 				exit;
 
- 		$y = $this->fullorder->get_number('ASTE-40913-019');
 
- 		//$this->fullorder->save(array('librarytime'=>1727359200),$a['id']);
 
- 		$post['waybill'] = $y['waybill'];
 
- 			$post['express'] = $y['express'];
 
- 			$post['printtype'] = $y['printtype'];
 
- 			$post['ioss'] = $y['ioss'];
 
- 			$post['review'] = 6;
 
- 			$post['bx'] = $y['bx'];
 
- 			$post['qm'] = $y['qm'];
 
- 			$post['js'] = $y['js'];
 
- 			$post['state'] = 216;
 
- 			$post['print'] = $y['print'];
 
- 			$post['printtime'] = $y['printtime'];
 
- 			$post['library'] = 2;
 
- 			$post['librarytime'] = $y['librarytime'];
 
- 			$post['libraryconfirm'] = 2;
 
- 			$post['librarynot'] = '';
 
- 				$this->fullorder->save($post,1168209);
 
- 		//$this->fullorder->save(array('libraryconfirm'=>2,'library'=>1,'librarytime'=>0,'weight'=>'0'),$a['id']);
 
- 		
 
- 		echo "<pre>";
 
- 		//print_r($a);
 
- 		exit;
 
- 		$a = $this->fullordertt->get_number('QQS-40911-071');
 
- 		$paypal = $a['paypal'];
 
- 		$shop = $this->shop->read($a['shop']);
 
- 		$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');
 
- 		$ToState = array_flip($ToState);
 
- 		$url = 'https://api-m.paypal.com/v1/reporting/transactions?start_date='.date('Y-m-d',time()-26*24*3600).'T00:00:00-0700&end_date='.date('Y-m-d',time()+24*3600).'T23:59:59-0700&transaction_id='.$paypal.'&fields=all&page_size=100&page=1';
 
- 		$token = $this->token($shop);
 
- 		$header[] = "Content-Type: application/json";
 
-         //$header[] = "Authorization: Basic ".base64_encode($name.":".$pass);
 
- 		$header[] = "Authorization: Bearer ".$token;
 
-         $ch = curl_init();
 
-         curl_setopt($ch, CURLOPT_URL, $url);
 
-         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
-         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
 
- 		curl_setopt($ch, CURLOPT_HTTPGET, true);
 
-         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
 
-         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
-         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
 
-         $res = curl_exec($ch);
 
-         curl_close($ch);
 
- 		$res = json_decode($res,true);
 
- 		//$time = 1561846608;
 
- 		//$a = $this->fullordertt->get_number('ALIP-90630-020');
 
- 		//$this->fullordertt->save(array('state'=>216,'print'=>3,'printtime'=>$time,'printnumber'=>1,'libraryconfirm'=>2,'library'=>2,'librarytime'=>$time,'weight'=>'0.4kg','review'=>6,'reviewtime'=>$time),$a['id']);
 
- 		
 
- 		//$a = $this->fullorder->get_number('Y-40624-009');
 
- 		//$this->fullorder->save(array('library'=>2,'retreattime'=>0),$a['id']);
 
- 		//$a = $this->whlabel->find_all("sku = 'RTG-DEEP4*7WIG16-130D'");
 
- 		echo "<pre>";
 
- 		print_r($res);
 
- 		
 
- 			
 
- 			
 
- 			
 
- 			exit;
 
- 		$a = $this->fullorder->get_number('Alipearl-70419-001');
 
- 		$b = $this->fullorder->get_number('Alipearl-70418-001');
 
- 		$this->fullorder->save(array('merge'=>0,'mergeid'=>0,'dtime'=>1492531200),$a['id']);
 
- 		$this->fullorder->save(array('merge'=>0,'mergeid'=>0,'dtime'=>1492444800),$b['id']);
 
- 		
 
- 		
 
- 		
 
- 		exit;
 
- 		$customer = $this->customer->find_all("email = 'denee_francis@yahoo.com' and shop = 2",'id,email,shop');
 
- 		foreach ($customer as $k=>$v) 
 
-         {
 
- 			$num =  $this->fullorder->find_all("email = '".$v['email']."' and shop = '".$v['shop']."' and mergeid = 0","*","dtime desc");
 
- 			$money = sprintf("%01.2f",array_sum(array_column($num,'shouldmoney')));
 
- 			$n = count($num);
 
- 			if($n > 0)
 
- 			{
 
- 			    $this->customer->save(array('num'=>$n,'money'=>$money,'time'=>$num[0]['dtime']),$v['id']);
 
- 			}
 
- 			else
 
- 			{
 
- 				$this->customer->save(array('num'=>$n),$v['id']);
 
- 			}
 
- 		}
 
- 		
 
- 		exit;
 
- 		$a = $this->whlabel->find_all("type != 0");
 
- 		foreach ($a as $v) 
 
- 		{
 
- 			$this->whlabel->save(array('type'=>0),$v['id']);
 
- 		}
 
- 		exit;
 
- 		
 
- 		//$data = $this->fullorder->get_number($arg_array[0]);
 
- 		$data = array();
 
- 		$data['roles'][0]['roleName'] = 'SHIPPER';
 
- 		$data['roles'][0]['CRID'] = '27426217';
 
- 		$data['roles'][0]['MID'] = '902531035';
 
- 		$data['roles'][0]['manifestMID'] = '902531035';
 
- 		$data['roles'][0]['accountType'] = 'PERMIT';
 
- 		$data['roles'][0]['accountNumber'] = '8982';
 
- 		$token = $this->usps->get_token();
 
- 		
 
- 		$url = 'https://api.usps.com/payments/v3/payment-authorization';
 
-     // 将请求数据编码为JSON格式
 
-     $data = json_encode($data);
 
-     // 初始化cURL会话
 
-     $ch = curl_init($url);
 
-     // 设置cURL选项
 
-     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
-     curl_setopt($ch, CURLOPT_HTTPHEADER, [
 
-         'Authorization: Bearer ' . $token,
 
-         'Content-Type: application/json'
 
-     ]);
 
-     curl_setopt($ch, CURLOPT_POST, true);
 
-     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
 
- 	curl_setopt($ch, CURLOPT_VERBOSE, true);
 
-     // 执行cURL请求
 
-     $response = curl_exec($ch);
 
-     // 检查是否有错误
 
-     if (curl_errno($ch)) {
 
-         echo '请求错误: ' . curl_error($ch);
 
-         curl_close($ch);
 
-     }
 
-     // 获取HTTP状态码
 
-     $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
 
-     // 关闭cURL会话
 
-     curl_close($ch);
 
-     // 解析响应数据
 
-     $responseData = json_decode($response, true);
 
-     if ($httpCode == 200) {
 
-         echo 1; // 请求成功,返回响应数据
 
-     } else {
 
-         echo '请求失败,HTTP状态码: ' . $httpCode . "\n";
 
-         
 
-     }
 
- 	print_r($responseData);
 
- 	exit;
 
- 	
 
- 	**/
 
- 	    
 
-         $data = $this->fullorder->get_number('TB-50109-003');
 
- 		
 
- 		$res = $this->usps->get_data_new($data);
 
- 		echo "<pre>";
 
- 		print_r($res);
 
- 		exit;
 
- 		
 
- 		
 
- 		
 
- 		
 
- 	
 
- }
 
- 	public function _email($arg_array)//不能删
 
- 	{
 
- 		
 
- 		
 
- 		$time = time();
 
- 		$shop = $this->shop->find_all("emailid != '' and emailsecret != ''");
 
- 		foreach ($shop as $v) 
 
- 		{
 
- 			if($v['emailtokentime'] < $time)
 
- 			{
 
- 				// 请求参数
 
-                 $post = array();
 
- 				$post['grant_type'] = 'client_credentials';
 
- 				$post['client_id'] = $v['emailid'];
 
- 				$post['client_secret'] = $v['emailsecret'];
 
-       			$url = 'https://alimail-cn.aliyuncs.com/oauth2/v2.0/token';
 
- 				$headers = array('Content-Type: application/x-www-form-urlencoded');
 
- 				$data = $this->su_curl($post,$url,$headers,$date_type='json',$timeout=300,$httptype="POST",$userpwd='');
 
- 				$data = json_decode($data,true);
 
- 				$this->shop->save(array('emailtokentime'=>0,'emailtoken'=>$data['access_token']),$v['id']);
 
- 			}
 
- 		}
 
- 		/**
 
- 		$url = 'https://alimail-cn.aliyuncs.com/v2/users/paypal@supernovahair.com/mailFolders/1/messages?$select=from,toRecipients,id&size=100&cursor=';
 
- 		$headers = array('Authorization: Bearer '.$token,'Content-Type: application/json');
 
- 		$data = $this->su_curl('',$url,$headers,$date_type='json',$timeout=300,$httptype="GET",$userpwd='');
 
- 		$data = json_decode($data,true);
 
- 		echo "<pre>";
 
- print_r($data);
 
- **/
 
- 				echo "<pre>";
 
- //print_r($res);
 
- 		
 
- 		exit;
 
- 		
 
- 	}
 
- 	
 
- 	public function _cz($shop,$token,$w,$next='')
 
- 	{
 
- 		$cs = array();
 
- 		$url = 'https://alimail-cn.aliyuncs.com/v2/users/'.$shop['shopid'].'/mailFolders/'.$w.'/messages?$select=from,toRecipients,sentDateTime,id&size=100&cursor='.$next;
 
- 		$headers = array('Authorization: Bearer '.$token,'Content-Type: application/json');
 
- 		$data = $this->su_curl('',$url,$headers,$date_type='json',$timeout=300,$httptype="GET",$userpwd='');
 
- 		$data = json_decode($data,true);
 
- 		if(isset($data['messages'][0]))
 
- 		{
 
- 		    foreach ($data['messages'] as $v) 
 
- 		    {
 
- 				
 
- 				$fs = $v['from']['email'];
 
- 				$js = isset($v['toRecipients'][0])?$v['toRecipients'][0]['email']:(isset($v['toRecipients']['email'])?$v['toRecipients']['email']:'');
 
- 				$type = 0;
 
- 				$useremail = '';
 
- 				if($fs == $shop['shopid'])
 
- 				{
 
- 					$type = 1;
 
- 					$useremail = $js;
 
- 				}
 
- 				else if($js == $shop['shopid'])
 
- 				{
 
- 					$type = 2;
 
- 					$useremail = $fs;
 
- 				}
 
- 				$pc = $this->email->get_uid($v['id']);
 
- 				if($pc)
 
- 				{
 
- 					break;
 
- 				}
 
- 				$this->email->insert(array('type'=>$type,'useremail'=>$useremail,'shopemail'=>$shop['shopid'],'uid'=>$v['id'],'fid'=>$w,'time'=>strtotime($v['sentDateTime'])));
 
- 				//
 
- 		    }
 
- 			if(isset($data['nextCursor']) && $data['nextCursor'] != '')
 
- 			{
 
- 				$this->_cz($shop,$token,$w,$data['nextCursor']);
 
- 			}
 
- 		}
 
- 		return $cs;
 
- 	}
 
- 	
 
- 		public function _b($arg_array)
 
- 	{
 
- 		
 
- 		// 目标 URL
 
- $url = 'https://alimail-cn.aliyuncs.com/oauth2/v2.0/token';
 
- // 请求参数
 
- $postData = array(
 
-     'grant_type' => 'client_credentials',
 
-     'client_id' => '8jLYqQdJWno8c95B',
 
-     'client_secret' => 'km9xLaK0SNqqT0ghTRIBcfvhB95B8UCqIOAZIBEk9GeROzj4rJDwNqBhkaorCMux',
 
- );
 
- // 初始化 curl
 
- $ch = curl_init();
 
- // 设置 curl 选项
 
- curl_setopt($ch, CURLOPT_URL, $url); // 设置 URL
 
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回 response 而不是输出
 
- curl_setopt($ch, CURLOPT_POST, true); // 设置为 POST 请求
 
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData)); // 设置 POST 数据
 
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
 
-     'Content-Type: application/x-www-form-urlencoded', // 设置请求头为 application/x-www-form-urlencoded
 
- ));
 
- // 执行请求并获取返回数据
 
- $response = curl_exec($ch);
 
- // 检查是否有错误发生
 
- if ($response === false) {
 
-     echo 'cURL Error: ' . curl_error($ch);
 
- } else {
 
-     // 处理返回的数据
 
-     echo $response;
 
- }
 
- // 关闭 curl 资源
 
- curl_close($ch);
 
- exit;
 
- // 您的邮箱地址和密码
 
- $username = 'paypal@supernovahair.com';
 
- $password = 'Hsn0723.';
 
- // 阿里云邮箱的 IMAP 服务器地址和端口号
 
- $hostname = '{imap.mxhichina.com:993/imap/ssl}INBOX';
 
- // 尝试连接到 IMAP 服务器
 
- $inbox = imap_open($hostname, $username, $password);
 
- if (!$inbox) {
 
-     die('IMAP connection failed: ' . imap_last_error());
 
- }
 
- // 要搜索的邮件 UID
 
- $search_uid = 77098; // 替换为您要搜索的具体 UID
 
- // 获取邮箱中的所有邮件概述信息
 
- $mail_overviews = imap_fetch_overview($inbox, '1:' . imap_num_msg($inbox), 0);
 
- if ($mail_overviews) {
 
-     $data = array();
 
-     // 遍历所有邮件概述信息
 
-     foreach ($mail_overviews as $overview) {
 
-         // 获取邮件 UID
 
-         $mail_uid = isset($overview->uid) ? $overview->uid : 0;
 
-         // 检查邮件 UID 是否匹配搜索条件
 
-         if ($mail_uid == $search_uid) {
 
-             // 获取发件人信息
 
-             $sender_email = isset($overview->from) ? $overview->from : '';
 
-             // 获取收件人信息
 
-             $recipient_email = isset($overview->to) ? $overview->to : '';
 
-             // 获取邮件主题
 
-             $subject = isset($overview->subject) ? $overview->subject : '';
 
-             // 获取邮件时间
 
-             $timestamp = isset($overview->date) ? strtotime($overview->date) : '';
 
-             // 构建数据数组
 
-             $data[] = array(
 
-                 "UID:" => $mail_uid,
 
-                 "标题:" => $subject,
 
-                 "发送人:" => $sender_email,
 
-                 "接收人:" => $recipient_email,
 
-                 "时间:" => date('Y-m-d H:i:s', $timestamp),
 
-             );
 
-         }
 
-     }
 
-     // 输出符合条件的邮件数据
 
-     echo "<pre>";
 
-     print_r($data);
 
-     echo "</pre>";
 
- } else {
 
-     echo "未找到符合条件的邮件";
 
- }
 
- // 关闭连接
 
- imap_close($inbox);
 
- exit;
 
-  
 
- // 阿里云邮箱的 IMAP 服务器地址和端口号
 
- $hostname = '{imap.mxhichina.com:993/imap/ssl}INBOX';
 
- // 尝试连接到阿里云邮箱的 IMAP 服务器
 
- $inbox = imap_open($hostname, $username, $password);
 
-    // 获取邮箱中的邮件数量
 
-     $total_emails = imap_num_msg($inbox);
 
- $data = array();
 
-     // 读取前10封邮件的内容
 
-     for ($i = 1; $i <= min($total_emails, 20); $i++) 
 
- 	{
 
-         // 获取邮件头信息
 
-         $header = imap_header($inbox, $i);
 
-         
 
-         // 获取邮件内容
 
-         $body = imap_fetchbody($inbox, $i, 1); // 参数2表示获取邮件的第1个部分,通常为邮件正文
 
-         
 
-         // 获取邮件编码类型
 
-         $encoding = isset($header->encoding) ? $header->encoding : null;
 
-         
 
-         // 如果邮件内容是base64编码的,则解码
 
-         if ($encoding == 3) 
 
- 		{
 
-             $body = base64_decode($body);
 
-         }
 
- 		$uid = imap_uid($inbox, $i);
 
- 		
 
- 	   $fsr = $header->from;
 
- 	   $jsr = $header->to;
 
-        $data[] = array(
 
- 	   "UID:"=>$uid,
 
- 	   "标题:"=>$header->subject,
 
- 	   "发送人:"=>$fsr[0]->mailbox.'@'.$fsr[0]->host,
 
- 	   "接收人:"=>$jsr[0]->mailbox.'@'.$jsr[0]->host,
 
- 	   "关联ID:"=>$header->references,
 
- 	   "关联原始ID:"=>$header->in_reply_to,
 
- 	   "时间:"=>$header->udate,
 
- 	   "内容:"=>$body); // nl2br() 函数用于将换行符转换为 HTML 的换行标签
 
-     }
 
-     // 关闭连接
 
-     imap_close($inbox);
 
- 	
 
- 	echo "<pre>";
 
- 	print_r($data);
 
- exit;
 
- 	}
 
- 	
 
- 	
 
- 	public function _dhl($arg_array)//DHL
 
- 	{
 
- 		
 
- 		$y = $this->fullorder->get_number("AS-PF1-40701-002");
 
- 		$a = $this->dhl->get_data_c('AS-PF1-40701-002');
 
- 		print_r($a);
 
- 		exit;
 
- 		$express = $this->express->read($y['express']);
 
- 	if($express['printcode'] == "DHLUSA" && $y['waybill'] != '')
 
- 			{
 
- 				$d = $this->dhl->get_data_9610($y);
 
- 				if($d != 1)
 
- 				{
 
- 					$this->allocation->insert(array('order'=>1,'title'=>$y['number'],'content'=>$d));
 
- 					return '9610失败,'.$d;exit;
 
- 				}
 
- 				$this->allocation->insert(array('order'=>9610,'title'=>$y['number']));
 
- 			}
 
- 			
 
- 			exit;
 
- 		
 
- 		$d = $this->dhl->get_data_9610($data);
 
- 			echo "<pre>";
 
- 		print_r($d);
 
- 		exit;
 
- 		
 
- 		
 
- 	}
 
- 	
 
- 	public function su_curl($data,$url,$header=array(),$date_type='json',$timeout=300,$httptype="POST",$userpwd='')
 
-     {
 
-     
 
-         if ($date_type == 'http_build_query')
 
- 		{
 
-             $data = http_build_query($data);
 
-         }
 
- 		else if ($date_type == 'json')
 
- 		{
 
-             $data = json_encode($data);
 
-         }
 
-         $ch = curl_init();
 
-         curl_setopt($ch, CURLOPT_URL, $url);
 
-         curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
 
-         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
-         curl_setopt($ch, CURLOPT_HEADER, false);
 
-         switch ($httptype)
 
- 		{
 
-             case "GET":
 
-             curl_setopt($ch, CURLOPT_HTTPGET, true);
 
-             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
 
-             break;
 
- 			
 
-             case "POST":
 
-             curl_setopt($ch, CURLOPT_POST, true);
 
-             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
 
-             break;
 
- 			
 
-             case "PUT":
 
-             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
 
-             break;
 
- 			
 
-             case "DELETE":
 
-             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
 
-             break;
 
-         }
 
-         $isSecure = strpos($url, "https://");
 
-         if ($isSecure === 0)
 
- 		{
 
-             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
-             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
 
-         }
 
-         if(!empty($header))
 
- 		{
 
-             curl_setopt($ch, CURLOPT_SSLVERSION , 6); //NEW ADDITION
 
-             curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
 
-         }
 
-         if(!empty($userpwd))
 
- 		{
 
-             curl_setopt($ch,CURLOPT_USERPWD,$userpwd);
 
-         }
 
-         curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
 
-         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
 
-         $result = curl_exec($ch);
 
-         curl_close($ch);
 
-         return $result;
 
- 	}
 
- 	
 
- 	public function _klarnadata($paypal,$name,$pass)
 
-     {
 
- 		$url = 'https://api-na.klarna.com/ordermanagement/v1/orders/'.$paypal;
 
- 		$header[] = "Content-Type:application/json";
 
-         $header[] = "Authorization: Basic ".base64_encode($name.":".$pass);
 
-         $ch = curl_init();
 
-         curl_setopt($ch, CURLOPT_URL, $url);
 
-         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
-         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
 
-         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
-         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
 
-         $res = curl_exec($ch);
 
-         curl_close($ch);
 
- 		$res = json_decode($res,true);
 
- 		$data = '';
 
- 		if(isset($res['fraud_status']))
 
- 		{
 
- 		    $data = (($res['fraud_status'] == 'ACCEPTED')?1:2).'|<strong>'.$res['purchase_currency'].($res['order_amount']/100).'</strong> , '.(($res['fraud_status'] != 'ACCEPTED')?'<font style="color:#f00">'.$res['fraud_status'].'</font>':$res['fraud_status']).' , description:'.$res['initial_payment_method']['description'].' , number of installments:'.$res['initial_payment_method']['number_of_installments'].'|'.$res['billing_address']['street_address'].(($res['billing_address']['street_address2']!='')?' '.$res['billing_address']['street_address2']:'').','.$res['billing_address']['city'].','.$res['billing_address']['region'].','.$res['billing_address']['postal_code'].','.$res['billing_address']['country'].','.$res['billing_address']['given_name'].' '.$res['billing_address']['family_name'].','.$res['billing_address']['phone'].','.$res['billing_address']['email'].'|'.str_replace('|','|',$res['shipping_address']['street_address']).(($res['shipping_address']['street_address2']!='')?' '.str_replace('|','|',$res['shipping_address']['street_address2']):'').','.$res['shipping_address']['city'].','.$res['shipping_address']['region'].','.$res['shipping_address']['postal_code'].','.$res['shipping_address']['country'].','.$res['shipping_address']['given_name'].' '.$res['shipping_address']['family_name'].','.$res['shipping_address']['phone'].','.$res['shipping_address']['email'];
 
- 		}
 
- 		return $data;
 
- 	}
 
- 	
 
- 	public function _afterpay($paypal,$name,$pass)
 
-     {
 
- 		$url = 'https://global-api.afterpay.com/v2/payments?ids='.$paypal;
 
- 		$header[] = "Accept:application/json";
 
- 		$header[] = "User-Agent: Readme.io API Simulator'";
 
-         $header[] = "Authorization: Basic ".base64_encode($name.":".$pass);
 
-         $ch = curl_init();
 
-         curl_setopt($ch, CURLOPT_URL, $url);
 
-         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
-         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
 
-         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
-         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
 
-         $res = curl_exec($ch);
 
-         curl_close($ch);
 
- 		$res = json_decode($res,true);
 
- 		$data = '';
 
- 		if(isset($res['results'][0]['orderDetails']['consumer']['email']))
 
- 		{
 
- 			$data = $res['results'][0]['orderDetails']['consumer']['email'].'|'.str_replace('|','|',$res['results'][0]['orderDetails']['billing']['line1']).','.str_replace('|','|',$res['results'][0]['orderDetails']['billing']['line2']).','.$res['results'][0]['orderDetails']['billing']['area1'].','.$res['results'][0]['orderDetails']['billing']['region'].','.$res['results'][0]['orderDetails']['billing']['postcode'].','.$res['results'][0]['orderDetails']['billing']['countryCode'].','.$res['results'][0]['orderDetails']['billing']['name'].','.$res['results'][0]['orderDetails']['billing']['phoneNumber'].'|'.str_replace('|','|',$res['results'][0]['orderDetails']['shipping']['line1']).','.str_replace('|','|',$res['results'][0]['orderDetails']['shipping']['line2']).','.$res['results'][0]['orderDetails']['shipping']['area1'].','.$res['results'][0]['orderDetails']['shipping']['region'].','.$res['results'][0]['orderDetails']['shipping']['postcode'].','.$res['results'][0]['orderDetails']['shipping']['countryCode'].','.$res['results'][0]['orderDetails']['shipping']['name'].','.$res['results'][0]['orderDetails']['shipping']['phoneNumber'];
 
- 			$data = str_replace(',,',',',$data);
 
- 		}
 
- 		return $data;
 
- 	}
 
- 	
 
- 	public function _clearpay($paypal,$name,$pass)
 
-     {
 
- 		$url = 'https://global-api.afterpay.com/v2/payments?ids='.$paypal;
 
- 		$header[] = "Accept:application/json";
 
- 		$header[] = "User-Agent: Readme.io API Simulator'";
 
-         $header[] = "Authorization: Basic ".base64_encode($name.":".$pass);
 
-         $ch = curl_init();
 
-         curl_setopt($ch, CURLOPT_URL, $url);
 
-         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
-         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
 
-         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
-         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
 
-         $res = curl_exec($ch);
 
-         curl_close($ch);
 
- 		$res = json_decode($res,true);
 
- 		$data = '';
 
- 		if(isset($res['results'][0]['orderDetails']['consumer']['email']))
 
- 		{
 
- 			$data = $res['results'][0]['orderDetails']['consumer']['email'].'|'.str_replace('|','|',$res['results'][0]['orderDetails']['billing']['line1']).','.str_replace('|','|',$res['results'][0]['orderDetails']['billing']['line2']).','.$res['results'][0]['orderDetails']['billing']['area1'].','.$res['results'][0]['orderDetails']['billing']['region'].','.$res['results'][0]['orderDetails']['billing']['postcode'].','.$res['results'][0]['orderDetails']['billing']['countryCode'].','.$res['results'][0]['orderDetails']['billing']['name'].','.$res['results'][0]['orderDetails']['billing']['phoneNumber'].'|'.str_replace('|','|',$res['results'][0]['orderDetails']['shipping']['line1']).','.str_replace('|','|',$res['results'][0]['orderDetails']['shipping']['line2']).','.$res['results'][0]['orderDetails']['shipping']['area1'].','.$res['results'][0]['orderDetails']['shipping']['region'].','.$res['results'][0]['orderDetails']['shipping']['postcode'].','.$res['results'][0]['orderDetails']['shipping']['countryCode'].','.$res['results'][0]['orderDetails']['shipping']['name'].','.$res['results'][0]['orderDetails']['shipping']['phoneNumber'];
 
- 			$data = str_replace(',,',',',$data);
 
- 		}
 
- 		return $data;
 
- 	}
 
- 	
 
- 	public function _text($fullorder)
 
-     {
 
- 		/** 发票地址信息暂时无用 
 
- 		$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());
 
- 		$fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
 
- 		$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'];
 
- 		$shoptype = $this->typeclass->read($shop['type']);
 
- 		$fullorder['shoptype'] = $shoptype['classtitle'];
 
- 		$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,'|'));
 
- 			if(isset($p[1]) && isset($p[2]))
 
- 			{
 
- 			    $pt .= '<p>'.$p[1].' * '.$p[2].'</p>';
 
- 			}
 
- 		}
 
- 		$fullorder['pt'] = $pt;
 
- 		return $fullorder;
 
-     }
 
- }
 
 
  |