Ab.php 85 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Ab extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_api','api');
  7. $this->load->_model('Model_apismt','apismt');
  8. $this->load->_model('Model_shop','shop');
  9. $this->load->_model('Model_fullorder','fullorder');
  10. $this->load->_model('Model_fullordertt','fullordertt');
  11. $this->load->_model('Model_fullorder_smt','fullorder_smt');
  12. $this->load->_model('Model_fullordersmt','fullordersmt');
  13. $this->load->_model('Model_customersmt','customersmt');
  14. $this->load->_model('Model_country','country');
  15. $this->load->_model('Model_hl','hl');
  16. $this->load->_model('Model_is','is');
  17. $this->load->_model('Model_kdniao','kdniao');
  18. $this->load->_model('Model_typeclass','typeclass');
  19. $this->load->_model('Model_warehouse','warehouse');
  20. $this->load->_model('Model_fullorderexcel','fullorderexcel');
  21. $this->load->_model('Model_dhl','dhl');
  22. $this->load->_model('Model_usps','usps');
  23. $this->load->_model('Model_dhltest','dhltest');
  24. $this->load->_model('Model_customer','customer');
  25. $this->load->_model('Model_express','express');
  26. $this->load->_model('Model_notice','notice');
  27. $this->load->_model('Model_whlabel','whlabel');
  28. $this->load->_model('Model_productdescribe','productdescribe');
  29. $this->load->_model('Model_ljg','ljg');
  30. $this->load->_model('Model_commodityread','commodityread');
  31. $this->load->_model('Model_service','service');
  32. $this->load->_model('Model_fedex','fedex');
  33. $this->load->_model('Model_commodity','commodity');
  34. $this->load->_model('Model_fullordersmtorder','fullordersmtorder');
  35. $this->load->_model('Model_fullordersmthb','fullordersmthb');
  36. $this->load->_model('Model_allocation','allocation');
  37. $this->load->_model('Model_excel','excel');
  38. $this->load->_model('Model_reset','reset');
  39. }
  40. //定义方法的调用规则 获取URI第二段值
  41. public function _remap($arg,$arg_array)
  42. {
  43. if($arg == 'jsf')
  44. {
  45. $this->_jsf($arg_array);
  46. }
  47. else if($arg == 'jsm')
  48. {
  49. $this->_jsm($arg_array);
  50. }
  51. else if($arg == 'sku')
  52. {
  53. $this->_sku($arg_array);
  54. }
  55. else if($arg == 'order')
  56. {
  57. $this->_order($arg_array);//查询获取到fullordersmtorder的单
  58. }
  59. else if($arg == 'data')
  60. {
  61. $this->_data($arg_array);//查询获取到fullordersmtorder的单
  62. }
  63. else if($arg == 'dataxr')
  64. {
  65. $this->_dataxr($arg_array);//查询获取到fullordersmtorder的单写入
  66. }
  67. else if($arg == 'cf')
  68. {
  69. $this->_cf($arg_array);//查询获取到fullordersmtorder的单
  70. }
  71. else if($arg == 'khjz')
  72. {
  73. $this->_khjz($arg_array);
  74. }
  75. else if($arg == 'khjzfs')
  76. {
  77. $this->_khjzfs($arg_array);
  78. }
  79. else if($arg == 'tbsmt')
  80. {
  81. $this->_tbsmt($arg_array);
  82. }
  83. else if($arg == 'xqcx')
  84. {
  85. $this->_xqcx($arg_array);
  86. }
  87. else if($arg == 'dpex')
  88. {
  89. $this->_dpex($arg_array);
  90. }
  91. else if($arg == 'fedexhz')
  92. {
  93. $this->_fedexhz($arg_array);
  94. }
  95. else if($arg == 'smtck')
  96. {
  97. $this->_smtck($arg_array);
  98. }
  99. else if($arg == 'xxfs')
  100. {
  101. $this->_xxfs($arg_array);//消息发送测试
  102. }
  103. else if($arg == 'smtprintout')
  104. {
  105. $this->_smtprintout($arg_array);//速卖通亚马逊操作出库
  106. }
  107. else if($arg == 'feite')
  108. {
  109. $this->_feite($arg_array);//飞特提取内容下载
  110. }
  111. else if($arg == 'rl')
  112. {
  113. $this->_rl($arg_array);//return label信息查找
  114. }
  115. else if($arg == 'cz')
  116. {
  117. $this->_cz($arg_array);//重置恢复打印、出库
  118. }
  119. else if($arg == 'paypal')
  120. {
  121. $this->_paypal($arg_array);//重置恢复打印、出库
  122. }
  123. else if($arg == 'qcfs')
  124. {
  125. $this->_qcfs($arg_array);//清除邮件发送信息
  126. }
  127. else if($arg == 'yd')
  128. {
  129. $this->_yd($arg_array);//测试运单
  130. }
  131. else if($arg == 'jzw')
  132. {
  133. $this->_jzw($arg_array);//矫正whlabel
  134. }
  135. else if($arg == 'qlzd')
  136. {
  137. $this->_qlzd($arg_array);//清除无效占单
  138. }
  139. }
  140. public function _qcfs($arg_array)
  141. {
  142. $a = $this->fullorder->get_number($arg_array[0]);
  143. $this->fullorder->save(array('zdstate'=>'','wltype'=>0,'wlcontent'=>'','wlfstime'=>''),$a['id']);
  144. }
  145. public function _jzw($arg_array)//矫正number和features不一致
  146. {
  147. $d = $this->whlabel->find_pc("1=1",'sku,features,warehouse','*');
  148. foreach ($d as $val)
  149. {
  150. $xd = $this->whlabel->find_all("sku = '".$val['sku']."' and features = '".$val['features']."' and warehouse = '".$val['warehouse']."'",'id,number,features,title,warehouse');
  151. foreach ($xd as $v)
  152. {
  153. $f = str_replace('-','',$v['features']);
  154. if($v['number'] != $f)
  155. {
  156. $this->whlabel->save(array("number"=>$f),$v['id']);
  157. }
  158. }
  159. }
  160. }
  161. public function _qlzd()//清除无效占单
  162. {
  163. $cw = array();$s = array();
  164. $wh = $this->whlabel->find_all("state = '0' and zd != ''");
  165. foreach ($wh as $v)
  166. {
  167. $d = $this->fullorder->get_number($v['zd']);
  168. if(!$d)
  169. {
  170. $d = $this->fullordersmt->get_number($v['zd']);
  171. if(!$d)
  172. {
  173. $d = $this->fullordertt->get_number($v['zd']);
  174. if(!$d)
  175. {
  176. $cw[] = $v['id'];
  177. continue;
  178. }
  179. }
  180. }
  181. if($d['state'] != 207 && $d['state'] != 209)
  182. {
  183. $s[] = $v['zd'];
  184. $this->whlabel->save(array("zd"=>''),$v['id']);
  185. }
  186. }
  187. echo "<pre>";
  188. print_r($s);
  189. }
  190. public function _smtprintout($arg_array)
  191. {
  192. $time = time();
  193. $a = $this->fullordersmt->get_number($arg_array[0]);
  194. if($a)
  195. {
  196. if($a['zsbjz'] < 1)
  197. {
  198. echo "9610要求必须要申报价值!";exit;
  199. }
  200. if($a['waybill'] != '' && $a['printtime'] == '0' && $a['librarytime'] == '0' && $a['warehouse'] == '3')
  201. {
  202. if($this->fullordersmt->save(array('review'=>5,'reviewtime'=>$time,'print'=>3,'printtime'=>$time,'printnumber'=>1,'library'=>2,'librarytime'=>$time,'libraryconfirm'=>2),$a['id']))
  203. {
  204. echo "操作已完成";
  205. }
  206. else
  207. {
  208. echo "操作失败,请重试";
  209. }
  210. }
  211. else
  212. {
  213. echo "操作失败,订单已操作完成或不符合条件";
  214. }
  215. }
  216. else
  217. {
  218. echo "找不到此编号";
  219. }
  220. }
  221. public function _smtck($arg_array)//测试SKU
  222. {
  223. $notice = $this->notice->read($arg_array[1]);
  224. $v = $this->fullorder->get_number($arg_array[0]);
  225. $shop = $this->shop->read($v['shop']);
  226. $express = $this->express->read($v['express']);
  227. $fs = $this->notice->get_god($v,$shop,$express,$notice['content'],$notice['message'],$notice['emailtitle']);
  228. }
  229. public function _sku($arg_array)//测试SKU
  230. {
  231. $gethl = $this->hl->get_hl();//获取即时汇率
  232. $dictionaries = $this->typeclass->find_all('ae!= "" 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)'); //产品人发类型颜色
  233. $dtc = array();
  234. foreach ($dictionaries as $v)
  235. {
  236. if(stripos($v['spare'],'|') !== false)//如果有多个值
  237. {
  238. $v['spare'] = explode('|',$v['spare']);
  239. foreach ($v['spare'] as $k=>$vs)
  240. {
  241. if(stripos($v['zh'],'|') !== false)
  242. {
  243. $vzh = explode('|',$v['zh']);
  244. $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$vzh[$k],'id'=>$v['id']);
  245. }
  246. else
  247. {
  248. $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id']);
  249. }
  250. }
  251. }
  252. else if(stripos($v['spare'],'|') !== false)//如果有多个值
  253. {
  254. $v['spare'] = explode('|',$v['spare']);
  255. foreach ($v['spare'] as $k=>$vs)
  256. {
  257. if(stripos($v['zh'],'|') !== false)
  258. {
  259. $vzh = explode('|',$v['zh']);
  260. $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$vzh[$k],'id'=>$v['id']);
  261. }
  262. else
  263. {
  264. $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id']);
  265. }
  266. }
  267. }
  268. else
  269. {
  270. $dtc[strtolower($v['spare'])] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id']);
  271. }
  272. }
  273. $dictionaries2 = $this->typeclass->find_all();
  274. foreach ($dictionaries2 as $v)
  275. {
  276. $dtctitle[$v['id']] = $v['title'];
  277. }
  278. $dtc['Clip'] = array('classid'=>18,'zh'=>'卡子发卡子发','id'=>0);
  279. $dtc['Clip--D'] = array('classid'=>18,'zh'=>'卡子发卡子发','id'=>0);
  280. $dtc['Clip--L'] = array('classid'=>18,'zh'=>'卡子发卡子发','id'=>0);
  281. $dtc['with bangs'] = array('classid'=>999,'zh'=>'(带齐刘海)','id'=>0);
  282. $dtc['no bangs'] = array('classid'=>999,'zh'=>'(无刘海)','id'=>0);
  283. $dtc['right'] = array('classid'=>999,'zh'=>'右偏分(戴上后U型部分在右边)','id'=>0);
  284. $dtc['middle'] = array('classid'=>999,'zh'=>'中分(戴上后U型部分在中间)','id'=>0);
  285. $dtc['left'] = array('classid'=>999,'zh'=>'左偏分(戴上后U型部分在左边)','id'=>0);
  286. $dtc['freeeyelash'] = array('classid'=>999,'zh'=>'(送假睫毛)','id'=>0);
  287. $dtc['stwbob10'] = array('classid'=>999,'zh'=>'+自然色 直发波波头 10寸','id'=>0);
  288. $dtc['stwbob12'] = array('classid'=>999,'zh'=>'+自然色 直发波波头 12寸','id'=>0);
  289. $dtc['stwbob14'] = array('classid'=>999,'zh'=>'+自然色 直发波波头 14寸','id'=>0);
  290. $dtc['HDTransparent'] = array('classid'=>9,'zh'=>'(HD透明蕾丝)','id'=>0);
  291. $dtc['HDLight Brown'] = array('classid'=>9,'zh'=>'(HD透明蕾丝)','id'=>0);
  292. $dtc['nwb'] = array('classid'=>15,'zh'=>'扁头 自然曲','id'=>111);//中文词不一样,ID一样
  293. $dtctitle[126] = 'Hair Weaving';
  294. $dtctitle[127] = 'Closure';
  295. $dtctitle[128] = 'Wigs';
  296. $dtctitle[130] = 'Clip-in Full Head';
  297. /* 匹配结束 */
  298. /* 价格加入 */
  299. $money = array();
  300. $productdescribe = $this->productdescribe->find_all('1=1','number,purchase,cost,salesprice,title');
  301. foreach ($productdescribe as $v)
  302. {
  303. $money[$v['number']] = array('purchase'=>$v['purchase'],'cost'=>$v['cost'],'salesprice'=>$v['salesprice'],'title'=>$v['title']);
  304. }
  305. /* 价格加入 */
  306. /* 匹配ID加入 */
  307. $int = array();
  308. $intdata = $this->typeclass->find_all('classid=14','id,ae');
  309. foreach ($intdata as $v)
  310. {
  311. $v['spare'] = explode('|',$v['spare']);
  312. $int[$v['id']] = $v['spare'][0];
  313. }
  314. /* 匹配ID结束 */
  315. /* 匹配状态加入 */
  316. $zt = array();$ste = array();
  317. $ztdata = $this->typeclass->find_all('classid=29','id,classtitle');
  318. foreach ($ztdata as $v)
  319. {
  320. $zt[$v['classtitle']] = $v['id'];
  321. $ste[$v['id']] = $v['classtitle'];
  322. }
  323. /* 匹配状态结束 */
  324. /* 国家加入键值-k */
  325. $cuy = array();
  326. $cuydata = $this->country->find_all('1=1','al,lb,id');
  327. foreach ($cuydata as $v)
  328. {
  329. $cuy[$v['al']] = array('id'=>$v['id'],'lb'=>$v['lb']);//获取到国家ID
  330. }
  331. /* 国家加入键值-j */
  332. /* 币种加入键值-k */
  333. $typeclass = array();
  334. $tdata = $this->typeclass->find_all('classid=30','id,title');
  335. foreach ($tdata as $v)
  336. {
  337. $typeclass[$v['title']] = $v['id'];
  338. }
  339. /* 币种加入键值-j */
  340. $is = $this->is->find_all('1=1','*','number asc');//获取仓库平匹配表
  341. $r = $this->api->matching('1;1','BW--3+13*6F-24 26 28-20',$dtc,$money,$int,$dtctitle);
  342. echo "<pre>";
  343. print_r($r);
  344. }
  345. public function _cf($arg_array) //速卖通订单拆分
  346. {
  347. $b = $this->fullordersmt->get_orderinfo($arg_array[0]);
  348. if($b['merge'] == $b['id'])
  349. {
  350. $data = $this->fullordersmt->find_all("merge = '".$b['merge']."'");
  351. foreach ($data as $v)
  352. {
  353. $a = $this->fullordersmthb->get_orderinfo($v['orderinfo']);
  354. if($a)
  355. {
  356. $this->fullordersmt->save($a,$v['id']);
  357. }
  358. }
  359. }
  360. }
  361. public function _khjzfs($arg_array)//独立站客户下单数量矫正
  362. {
  363. //@$this->allocation->insert(array('title'=>'khfs - '.date('Y-m-d H:i:s',time())));
  364. $customer = $this->customer->find_all("time < '100'",'id,email,shop','id desc',$arg_array[0],$arg_array[1]);
  365. foreach ($customer as $k=>$v)
  366. {
  367. $num = $this->fullorder->find_all("email = '".$v['email']."' and shop = '".$v['shop']."' and mergeid = 0","dtime","dtime desc");
  368. $n = count($num);
  369. if($n > 0)
  370. {
  371. $this->customer->save(array('num'=>$n,'time'=>$num[0]['dtime']),$v['id']);
  372. }
  373. else
  374. {
  375. $this->customer->save(array('num'=>$n),$v['id']);
  376. }
  377. }
  378. }
  379. public function _khjz($arg_array)//独立站客户下单数量矫正
  380. {
  381. $customer = $this->customer->find_count("time < '100'");
  382. $customer = ceil($customer/20000);
  383. for($i=0;$i<$customer;$i++)
  384. {
  385. $a = ($i=='0')?0:$i*20000;
  386. $b = ($i+1)*20000;
  387. $ch = curl_init();
  388. $url = 'http://kh'.$i.'.wepolicy.cn/ab/khjzfs/'.$a.'/'.$b;
  389. curl_setopt($ch,CURLOPT_URL,$url);
  390. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  391. curl_setopt($ch,CURLOPT_HEADER,0);
  392. curl_setopt($ch,CURLOPT_POST, 1);
  393. curl_setopt($ch,CURLOPT_TIMEOUT,20);
  394. //设置post数据
  395. $post = array();
  396. $post['data'] = 1;
  397. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
  398. $res = curl_exec($ch);
  399. curl_close($ch);
  400. }
  401. }
  402. public function _tbsmt($arg_array)//同步速卖通新店
  403. {
  404. $ch = curl_init();
  405. $url = 'http://39.100.97.180/start/order';
  406. curl_setopt($ch,CURLOPT_URL,$url);
  407. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  408. curl_setopt($ch,CURLOPT_HEADER,0);
  409. curl_setopt($ch,CURLOPT_POST, 1);
  410. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,600);
  411. //设置post数据
  412. $post = array();
  413. $post['starttime'] = 1393606800;
  414. $post['endtime'] = 1590021229;
  415. $post['page'] = $arg_array[0];
  416. $post['size'] = 50;
  417. $post['state'] = '["IN_CANCEL","WAIT_SELLER_SEND_GOODS","SELLER_PART_SEND_GOODS","WAIT_BUYER_ACCEPT_GOODS","FUND_PROCESSING","IN_ISSUE","IN_FROZEN","WAIT_SELLER_EXAMINE_MONEY","RISK_CONTROL"]';
  418. $post['code'] = '50002100d409LZqwnvDc1iVenS9ysG7EbP4LuxhnfuHykTwEciGd1129c3d57tI3Sin';
  419. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
  420. $res = curl_exec($ch);
  421. curl_close($ch);
  422. $res = json_decode($res,true);
  423. echo "<pre>";
  424. print_r($res);
  425. }
  426. public function _xqcx($arg_array)
  427. {
  428. $cw = array();
  429. $class = array();$classdata = array();$lx = array();$pm = array();
  430. $a = $this->typeclass->find_all('classid=6 or classid=7 or classid=8 or classid=10 or classid=12 or classid=13 or classid=15 or classid=19 or classid=20 or classid=21 or classid=22 or classid=23 or classid=24');
  431. foreach ($a as $val)
  432. {
  433. $class[] = '-'.$val['id'].'-';
  434. }
  435. $b = $this->typeclass->find_all();
  436. foreach ($b as $val)
  437. {
  438. $classdata[$val['id']] = $val['title'];
  439. $lx[$val['id']] = $val['classid'];
  440. $pm[$val['id']] = $val['zh'];
  441. }
  442. //Closure wigs
  443. $dataa = $this->fullorder->find_all("librarytime > '1598889600' and librarytime < '1601395200' and (fpdata like '%Closure%' or fpdata like '%Wigs%')",'number,fpdata','id desc');
  444. $datab = $this->fullordersmt->find_all("librarytime > '1598889600' and librarytime < '1601395200' and (fpdata like '%Closure%' or fpdata like '%Wigs%')",'number,fpdata','id desc');
  445. $data = array_merge($dataa,$datab);
  446. $p = $class;
  447. $resdata = array();
  448. foreach ($data as $val)
  449. {
  450. $f = explode(';',trim($val['fpdata'],';'));
  451. foreach ($f as $v)
  452. {
  453. if((stripos($v,'-127-') !== false || stripos($v,'-128-') !== false) && stripos($v,'-57-') !== false)
  454. {
  455. $e = explode('|',$v);
  456. $d = str_replace($p,'-',$e[0]);
  457. $q = str_replace(array('-163-','-164-','-165-','-166-'),'-',$e[0]);
  458. $q = explode('-',trim($q,'-'));
  459. $c = explode(',',$e[0]);
  460. if(!isset($resdata[$d]))
  461. {
  462. if(stripos($v,'-127-') !== false)
  463. {
  464. if(isset($q[9]))
  465. {
  466. $s = ($q[9] != 68 && $q[9] != 69)?1:2;
  467. }
  468. else
  469. {
  470. $s = 1;
  471. }
  472. $bt = (!isset($q[8]))?$q[5]:$q[8];//360类型的蕾丝尺寸直接显示为类型名称
  473. if($lx[$q[5]] == '27')//如果是发块类型
  474. {
  475. $resdata[$d] = array($e[2],rtrim($classdata[$c[0]],'inch'),$q[5],$bt,$s);//数量、尺寸、类型、蕾丝尺寸、蕾丝颜色
  476. }
  477. }
  478. else
  479. {
  480. if(isset($q[8]))
  481. {
  482. $s = ($q[8] != 68 && $q[8] != 69)?1:2;
  483. }
  484. else
  485. {
  486. $s = 1;
  487. }
  488. if($lx[$q[5]] == '18')//如果是头套种类
  489. {
  490. $resdata[$d] = array($e[2],rtrim($classdata[$c[0]],'inch'),$q[5],$s);//数量、尺寸、头套种类、蕾丝颜色
  491. }
  492. }
  493. }
  494. else
  495. {
  496. if(is_array($e[2]) || !is_numeric($e[2]))
  497. {
  498. $cw[] = $v;
  499. continue;
  500. }
  501. else
  502. {
  503. $resdata[$d][0] += $e[2];
  504. }
  505. }
  506. }
  507. }
  508. }
  509. $data = array();
  510. foreach ($resdata as $v)
  511. {
  512. if(isset($v[4]))
  513. {
  514. if(!isset($data[$v[1].$v[2].$v[3].$v[4]]))
  515. {
  516. $data[$v[1].$v[2].$v[3].$v[4]] = array($v[0],$v[1],$pm[$v[2]],$classdata[$v[3]],$v[4]);//$classdata[$v[2]]英文名,$pm[$v[2]]中文名
  517. }
  518. else
  519. {
  520. $data[$v[1].$v[2].$v[3].$v[4]][0] += $v[0];
  521. }
  522. }
  523. else
  524. {
  525. if(!isset($data[$v[1].$v[2].$v[3]]))
  526. {
  527. $data[$v[1].$v[2].$v[3]] = array($v[0],$v[1],$pm[$v[2]],$v[3]);//$classdata[$v[2]]英文名,$pm[$v[2]]中文名
  528. }
  529. else
  530. {
  531. $data[$v[1].$v[2].$v[3]][0] += $v[0];
  532. }
  533. }
  534. }
  535. $list = array();
  536. foreach ($data as $v)
  537. {
  538. $x = (isset($v[4]))?$v[3]:$v[2];
  539. if(!isset($list[$v[2]]))
  540. {
  541. $list[$v[2]] = array();
  542. if(!isset($list[$v[2]][$x]))
  543. {
  544. $list[$v[2]][$x] = array();
  545. $list[$v[2]][$x][] = $v;
  546. }
  547. else
  548. {
  549. $list[$v[2]][$x][] = $v;
  550. }
  551. }
  552. else
  553. {
  554. if(!isset($list[$v[2]][$x]))
  555. {
  556. $list[$v[2]][$x] = array();
  557. $list[$v[2]][$x][] = $v;
  558. }
  559. else
  560. {
  561. $list[$v[2]][$x][] = $v;
  562. }
  563. }
  564. }
  565. foreach ($list as $key=>$val)
  566. {
  567. foreach ($val as $k=>$va)
  568. {
  569. $dd = array();
  570. foreach ($va as $v)
  571. {
  572. $ss = (!isset($v[4]))?$v[3]:$v[4];
  573. if(!isset($dd[$v['1']]))
  574. {
  575. $dd[$v['1']] = array();
  576. $dd[$v['1']][$ss] = $v;
  577. }
  578. else
  579. {
  580. $dd[$v['1']][$ss] = $v;
  581. }
  582. }
  583. ksort($dd);
  584. $list[$key][$k] = $dd;
  585. }
  586. }
  587. //echo count($list);
  588. //echo "<pre>";
  589. //print_r($list);
  590. $str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
  591. <head>
  592. <!--[if gte mso 9]><xml>
  593. <x:ExcelWorkbook>
  594. <x:ExcelWorksheets>
  595. <x:ExcelWorksheet>
  596. <x:Name>EXCEL</x:Name>
  597. <x:WorksheetOptions>
  598. <x:Print>
  599. <x:ValidPrinterInfo />
  600. </x:Print>
  601. </x:WorksheetOptions>
  602. </x:ExcelWorksheet>
  603. </x:ExcelWorksheets>
  604. </x:ExcelWorkbook>
  605. </xml>
  606. <![endif]-->
  607. </head><body>";
  608. foreach ($list as $key=>$val)
  609. {
  610. $btnum = count($val);
  611. $str .= "<table border=1>
  612. <tr style='color: #F00;'><th colspan='".($btnum+$btnum*2)."' align='left'><h3>".$key."<h3></th></tr>
  613. <tr>";
  614. foreach ($val as $k=>$v)
  615. {
  616. $str .="<td style='background-color: #ffff00;color: #F00;width:20px'>".$k."</td>
  617. <td>中棕</td>
  618. <td>透明</td>";
  619. }
  620. $str .= "</tr>
  621. </table>";
  622. $str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'><tr>";
  623. foreach ($val as $k=>$v)
  624. {
  625. $str .= "<td><table border=1>";
  626. foreach ($v as $sk=>$s)
  627. {
  628. $xk1 = (isset($s[1]))?$s[1][0]:0;
  629. $xk2 = (isset($s[2]))?$s[2][0]:0;
  630. $str .="<tr><td style='color: #F00;'>".$sk."</td><td>".$xk1."</td><td>".$xk2."</td></tr>";
  631. }
  632. $str .= "</table></td>";
  633. }
  634. $str .= "</table>";
  635. }
  636. $str .= "</body></html>";
  637. header( "Content-Type: application/vnd.ms-excel; name='excel'" );
  638. header( "Content-type: application/octet-stream" );
  639. header( "Content-Disposition: attachment; filename=".time().'.xls' );
  640. header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" );
  641. header( "Pragma: no-cache" );
  642. header( "Expires: 0" );
  643. exit($str);
  644. }
  645. public function _fedexhz($arg_array)
  646. {
  647. $fullorder = $this->fullorder->get_number($arg_array[0]);
  648. if(!$fullorder)
  649. {
  650. $fullorder = $this->fullordersmt->get_number($arg_array[0]);
  651. }
  652. $fullorder = $this->_text($fullorder);
  653. $data = $fullorder;
  654. $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');
  655. $data['province'] = preg_replace('/( | | |\s)/',' ',$data['province']);
  656. $data['province'] = trim($data['province'],' ');
  657. $dataprovince = strlen($data['province'])==2?$data['province']:$ToState[strtolower($data['province'])];
  658. $data['province'] = $dataprovince;
  659. //your account details here
  660. /**许昌联邦账号
  661. $key = 'L7Vtg0uUP0BxgNfp';
  662. $password = 'iOqmHwfjx12sxszdEZstGtRYs';
  663. $AccountNumber = '644155250';
  664. $MeterNumber = '250140772';
  665. **/
  666. //杭州联邦账号
  667. $key = 'Jx8Rq9QL34sMKJTK';
  668. $password = 'lmnYVRVcOISI0D1i48CEiXpYh';
  669. $AccountNumber = '692362136';
  670. $MeterNumber = '250759448';
  671. $xml = '<?xml version="1.0" encoding="UTF-8"?>';
  672. $xml.='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v26="http://fedex.com/ws/ship/v26">';
  673. $xml.='<soapenv:Header/>';
  674. $xml.='<soapenv:Body>';
  675. $xml.='<v26:ProcessShipmentRequest>';
  676. $xml.='<v26:WebAuthenticationDetail>';
  677. $xml.='<v26:ParentCredential>';
  678. $xml.='<v26:Key>'.$key.'</v26:Key>';
  679. $xml.='<v26:Password>'.$password.'</v26:Password>';
  680. $xml.='</v26:ParentCredential>';
  681. $xml.='<v26:UserCredential>';
  682. $xml.='<v26:Key>'.$key.'</v26:Key>';
  683. $xml.='<v26:Password>'.$password.'</v26:Password>';
  684. $xml.='</v26:UserCredential>';
  685. $xml.='</v26:WebAuthenticationDetail>';
  686. $xml.='<v26:ClientDetail>';
  687. $xml.='<v26:AccountNumber>'.$AccountNumber.'</v26:AccountNumber>';
  688. $xml.='<v26:MeterNumber>'.$MeterNumber.'</v26:MeterNumber>';
  689. $xml.='</v26:ClientDetail>';
  690. $xml.='<v26:TransactionDetail>';
  691. //$xml.='<v26:CustomerTransactionId>Ship_International_basic</v26:CustomerTransactionId>';
  692. $xml.='</v26:TransactionDetail>';
  693. $xml.='<v26:Version>';
  694. $xml.='<v26:ServiceId>ship</v26:ServiceId>';
  695. $xml.='<v26:Major>26</v26:Major>';
  696. $xml.='<v26:Intermediate>0</v26:Intermediate>';
  697. $xml.='<v26:Minor>0</v26:Minor>';
  698. $xml.='</v26:Version>';
  699. $xml.='<v26:RequestedShipment>';
  700. $xml.='<v26:ShipTimestamp>'.date('Y-m-d',time()).'T'.date('H:i:s',time()).'-12:00'.'</v26:ShipTimestamp>';
  701. $xml.='<v26:DropoffType>REGULAR_PICKUP</v26:DropoffType>';
  702. $xml.='<v26:ServiceType>FEDEX_INTERNATIONAL_PRIORITY</v26:ServiceType>';//FEDEX_INTERNATIONAL_PRIORITY、FEDEX_INTERNATIONAL_PRIORITY_EXPRESS也是优先。INTERNATIONAL_ECONOMY经济
  703. //超过重量需要换包装,现在不设置,超出也按0.4走
  704. if($data['zzl'] < '9999999')//现在限制死,只有0.4 实际应填写 $data['zzl'] < 0.5
  705. {
  706. $xml.='<v26:PackagingType>FEDEX_PAK</v26:PackagingType>';
  707. }
  708. else
  709. {
  710. $xml.='<v26:PackagingType>FEDEX_BOX</v26:PackagingType>';
  711. }
  712. $xml.='<v26:Shipper>';//发货人信息开始
  713. $xml.='<v26:AccountNumber>'.$AccountNumber.'</v26:AccountNumber>';
  714. $xml.='<v26:Contact>';
  715. $xml.='<v26:PersonName>LONGYI</v26:PersonName>';//$data['warehouse']['company']
  716. $xml.='<v26:CompanyName>LONGYI</v26:CompanyName>';//$data['warehouse']['company']
  717. $xml.='<v26:PhoneNumber>18539006340</v26:PhoneNumber>';//$data['warehouse']['phone']
  718. //$xml.='<v26:EMailAddress>'.$data['warehouse']['name'].'</v26:EMailAddress>';
  719. $xml.='</v26:Contact>';
  720. $xml.='<v26:Address>';
  721. $xml.='<v26:StreetLines>4703,building C,bodi center,ningwei street</v26:StreetLines>';//$data['warehouse']['address']
  722. $xml.='<v26:City>Hang Zhou</v26:City>';//$data['warehouse']['city']
  723. //$xml.='<v26:StateOrProvinceCode>TN</v26:StateOrProvinceCode>';
  724. $xml.='<v26:PostalCode>310000</v26:PostalCode>';//$data['warehouse']['zipcode'] //许昌联邦要求使用郑州邮编:450016
  725. $xml.='<v26:CountryCode>'.$data['warehouse']['lb'].'</v26:CountryCode>';
  726. $xml.='</v26:Address>';
  727. $xml.='</v26:Shipper>';
  728. $xml.='<v26:Recipient>';//收货人信息开始
  729. $xml.='<v26:AccountNumber>'.$AccountNumber.'</v26:AccountNumber>';
  730. $xml.='<v26:Contact>';
  731. $xml.='<v26:PersonName>'.$data['name'].'</v26:PersonName>';
  732. $xml.='<v26:CompanyName>'.$data['client'].'</v26:CompanyName>';
  733. $xml.='<v26:PhoneNumber>'.$data['phone'].'</v26:PhoneNumber>';
  734. //$xml.='<v26:EMailAddress>'.$data['name'].'</v26:EMailAddress>';
  735. $xml.='</v26:Contact>';
  736. $xml.='<v26:Address>';
  737. $xml.='<v26:StreetLines>'.$data['address'].'</v26:StreetLines>';
  738. $xml.='<v26:StreetLines>'.$data['address2'].'</v26:StreetLines>';
  739. $xml.='<v26:City>'.$data['city'].'</v26:City>';
  740. $xml.='<v26:StateOrProvinceCode>'.$data['province'].'</v26:StateOrProvinceCode>';
  741. $xml.='<v26:PostalCode>'.$data['zipcode'].'</v26:PostalCode>';
  742. $xml.='<v26:CountryCode>'.$data['lb'].'</v26:CountryCode>';
  743. $xml.='</v26:Address>';
  744. $xml.='</v26:Recipient>';
  745. $xml.='<v26:ShippingChargesPayment>';
  746. $xml.='<v26:PaymentType>SENDER</v26:PaymentType>';
  747. $xml.='<v26:Payor>';
  748. $xml.='<v26:ResponsibleParty>';
  749. $xml.='<v26:AccountNumber>'.$AccountNumber.'</v26:AccountNumber>';
  750. $xml.='<v26:Contact>';
  751. $xml.='<v26:PersonName>He Cong</v26:PersonName>';
  752. //$xml.='<v26:EMailAddress></v26:EMailAddress>';
  753. $xml.='</v26:Contact>';
  754. $xml.='</v26:ResponsibleParty>';
  755. $xml.='</v26:Payor>';
  756. $xml.='</v26:ShippingChargesPayment>';
  757. //ETD开始
  758. $xml.='<v26:SpecialServicesRequested>';
  759. $xml.='<v26:SpecialServiceTypes>ELECTRONIC_TRADE_DOCUMENTS</v26:SpecialServiceTypes>';
  760. $xml.='<v26:EtdDetail>';
  761. $xml.='<v26:RequestedDocumentCopies>COMMERCIAL_INVOICE</v26:RequestedDocumentCopies>';
  762. $xml.='</v26:EtdDetail>';
  763. $xml.='</v26:SpecialServicesRequested>';
  764. //ETD结束
  765. $xml.='<v26:CustomsClearanceDetail>';
  766. $xml.='<v26:DutiesPayment>';
  767. $xml.='<v26:PaymentType>RECIPIENT</v26:PaymentType>';
  768. $xml.='<v26:Payor>';
  769. $xml.='<v26:ResponsibleParty>';
  770. $xml.='<v26:AccountNumber></v26:AccountNumber>';
  771. //$xml.='<v26:Tins>';
  772. //$xml.='<v26:TinType>BUSINESS_STATE</v26:TinType>';//雇主识别代码BUSINESS_NATIONAL、BUSINESS_STATE、BUSINESS_UNION、PERSONAL_NATIONAL、PERSONAL_STATE
  773. //$xml.='<v26:Number>213456</v26:Number>';//这里填税号
  774. //$xml.='</v26:Tins>';
  775. //$xml.='<v26:Contact>';
  776. //$xml.='<v26:ContactId>12345</v26:ContactId>';
  777. //$xml.='<v26:PersonName>INPUT YOUR INFORMATION</v26:PersonName>';
  778. //$xml.='</v26:Contact>';
  779. $xml.='</v26:ResponsibleParty>';
  780. $xml.='</v26:Payor>';
  781. $xml.='</v26:DutiesPayment>';
  782. $xml.='<v26:DocumentContent>DOCUMENTS_ONLY</v26:DocumentContent>';
  783. $xml.='<v26:CustomsValue>';
  784. $xml.='<v26:Currency>USD</v26:Currency>';
  785. $xml.='<v26:Amount>'.$data['zsbjz'].'</v26:Amount>';
  786. $xml.='</v26:CustomsValue>';
  787. //DESC1---:Commodities循环
  788. $xml.='<v26:Commodities>';
  789. $xml.='<v26:NumberOfPieces>1</v26:NumberOfPieces>';//件数
  790. $xml.='<v26:Description>satin bags-100PCS</v26:Description>';//品名和数量
  791. $xml.='<v26:CountryOfManufacture>CN</v26:CountryOfManufacture>';
  792. $xml.='<v26:HarmonizedCode>4202320000</v26:HarmonizedCode>';//海关编码
  793. $xml.='<v26:Weight>';
  794. $xml.='<v26:Units>KG</v26:Units>';//重量:磅
  795. $xml.='<v26:Value>0.1</v26:Value>';//重量填写单位为KG $data['zzl'] 现在限制死,只有0.4
  796. $xml.='</v26:Weight>';
  797. $xml.='<v26:Quantity>100</v26:Quantity>';//需要填写数量
  798. $xml.='<v26:QuantityUnits>cm</v26:QuantityUnits>';
  799. $xml.='<v26:UnitPrice>';
  800. $xml.='<v26:Currency>USD</v26:Currency>';
  801. $xml.='<v26:Amount>0.2</v26:Amount>';//单条申报价值
  802. $xml.='</v26:UnitPrice>';
  803. $xml.='</v26:Commodities>';
  804. //DESC2
  805. $xml.='<v26:Commodities>';
  806. $xml.='<v26:NumberOfPieces>1</v26:NumberOfPieces>';//件数
  807. $xml.='<v26:Description>hair accessories-100PCS</v26:Description>';//品名和数量
  808. $xml.='<v26:CountryOfManufacture>CN</v26:CountryOfManufacture>';
  809. $xml.='<v26:HarmonizedCode>9615110000</v26:HarmonizedCode>';//海关编码
  810. $xml.='<v26:Weight>';
  811. $xml.='<v26:Units>KG</v26:Units>';//重量:磅
  812. $xml.='<v26:Value>0.1</v26:Value>';//重量填写单位为KG $data['zzl'] 现在限制死,只有0.4
  813. $xml.='</v26:Weight>';
  814. $xml.='<v26:Quantity>100</v26:Quantity>';//需要填写数量
  815. $xml.='<v26:QuantityUnits>cm</v26:QuantityUnits>';
  816. $xml.='<v26:UnitPrice>';
  817. $xml.='<v26:Currency>USD</v26:Currency>';
  818. $xml.='<v26:Amount>0.3</v26:Amount>';//单条申报价值
  819. $xml.='</v26:UnitPrice>';
  820. $xml.='</v26:Commodities>';
  821. //DESC3
  822. $xml.='<v26:Commodities>';
  823. $xml.='<v26:NumberOfPieces>1</v26:NumberOfPieces>';//件数
  824. $xml.='<v26:Description>woven label-1000PCS</v26:Description>';//品名和数量
  825. $xml.='<v26:CountryOfManufacture>CN</v26:CountryOfManufacture>';
  826. $xml.='<v26:HarmonizedCode>5901101090</v26:HarmonizedCode>';//海关编码
  827. $xml.='<v26:Weight>';
  828. $xml.='<v26:Units>KG</v26:Units>';//重量:磅
  829. $xml.='<v26:Value>0.2</v26:Value>';//重量填写单位为KG $data['zzl'] 现在限制死,只有0.4
  830. $xml.='</v26:Weight>';
  831. $xml.='<v26:Quantity>1000</v26:Quantity>';//需要填写数量
  832. $xml.='<v26:QuantityUnits>cm</v26:QuantityUnits>';
  833. $xml.='<v26:UnitPrice>';
  834. $xml.='<v26:Currency>USD</v26:Currency>';
  835. $xml.='<v26:Amount>0.05</v26:Amount>';//单条申报价值
  836. $xml.='</v26:UnitPrice>';
  837. $xml.='</v26:Commodities>';
  838. /**
  839. //DESC4
  840. $xml.='<v26:Commodities>';
  841. $xml.='<v26:NumberOfPieces>1</v26:NumberOfPieces>';//件数
  842. $xml.='<v26:Description>satin bags-100PCS</v26:Description>';//品名和数量
  843. $xml.='<v26:CountryOfManufacture>CN</v26:CountryOfManufacture>';
  844. $xml.='<v26:HarmonizedCode>4202320000</v26:HarmonizedCode>';//海关编码
  845. $xml.='<v26:Weight>';
  846. $xml.='<v26:Units>KG</v26:Units>';//重量:磅
  847. $xml.='<v26:Value>0.2</v26:Value>';//重量填写单位为KG $data['zzl'] 现在限制死,只有0.4
  848. $xml.='</v26:Weight>';
  849. $xml.='<v26:Quantity>100</v26:Quantity>';//需要填写数量
  850. $xml.='<v26:QuantityUnits>cm</v26:QuantityUnits>';
  851. $xml.='<v26:UnitPrice>';
  852. $xml.='<v26:Currency>USD</v26:Currency>';
  853. $xml.='<v26:Amount>0.2</v26:Amount>';//单条申报价值
  854. $xml.='</v26:UnitPrice>';
  855. $xml.='</v26:Commodities>';
  856. **/
  857. $xml.='<v26:ExportDetail>';
  858. $xml.='<v26:ExportComplianceStatement>30.37(f)</v26:ExportComplianceStatement>';
  859. $xml.='</v26:ExportDetail>';
  860. $xml.='</v26:CustomsClearanceDetail>';
  861. $xml.='<v26:LabelSpecification>';
  862. $xml.='<v26:LabelFormatType>COMMON2D</v26:LabelFormatType>';
  863. $xml.='<v26:ImageType>PDF</v26:ImageType>';
  864. $xml.='<v26:LabelStockType>STOCK_4X6.75</v26:LabelStockType>';
  865. $xml.='</v26:LabelSpecification>';
  866. //发票参数开始
  867. $xml.='<v26:ShippingDocumentSpecification>';
  868. $xml.='<v26:ShippingDocumentTypes>COMMERCIAL_INVOICE</v26:ShippingDocumentTypes>';
  869. //ETD
  870. $xml.='<v26:CommercialInvoiceDetail>';
  871. $xml.='<v26:Format>';
  872. $xml.='<v26:ImageType>PDF</v26:ImageType>';
  873. $xml.='<v26:StockType>PAPER_LETTER</v26:StockType>';
  874. $xml.='<v26:ProvideInstructions>true</v26:ProvideInstructions>';
  875. $xml.='</v26:Format>';
  876. $xml.='<v26:CustomerImageUsages>';
  877. $xml.='<v26:Type>LETTER_HEAD</v26:Type>';
  878. $xml.='<v26:Id>IMAGE_1</v26:Id>';
  879. $xml.='</v26:CustomerImageUsages>';
  880. $xml.='<v26:CustomerImageUsages>';
  881. $xml.='<v26:Type>SIGNATURE</v26:Type>';
  882. $xml.='<v26:Id>IMAGE_2</v26:Id>';
  883. $xml.='</v26:CustomerImageUsages>';
  884. //ETD
  885. $xml.='</v26:CommercialInvoiceDetail>';
  886. $xml.='</v26:ShippingDocumentSpecification>';
  887. //发票参数结束
  888. $xml.='<v26:RateRequestTypes>LIST</v26:RateRequestTypes>';//费率请求类型
  889. $xml.='<v26:PackageCount>'.$data['zjs'].'</v26:PackageCount>';//包装数量
  890. $xml.='<v26:RequestedPackageLineItems>';
  891. $xml.='<v26:SequenceNumber>1</v26:SequenceNumber>';
  892. //$xml.='<v26:InsuredValue><v26:Currency>USD</v26:Currency><v26:Amount>120.00</v26:Amount></v26:InsuredValue>';//保险金额
  893. $xml.='<v26:Weight>';
  894. $xml.='<v26:Units>KG</v26:Units>';
  895. $xml.='<v26:Value>0.4</v26:Value>';//现在限制死,只有0.4 '.$data['zzl'].'
  896. $xml.='</v26:Weight>';
  897. //超过重量需要填尺寸,现在不设置,超出也按0.4走
  898. if($data['zzl'] > '99999')//这个正常设置应该是$data['zzl'] > '0.4'
  899. {
  900. $xml.='<v26:Dimensions>';
  901. $xml.='<v26:Length>4</v26:Length>';
  902. $xml.='<v26:Width>20</v26:Width>';
  903. $xml.='<v26:Height>30</v26:Height>';
  904. $xml.='<v26:Units>CM</v26:Units>';
  905. $xml.='</v26:Dimensions>';
  906. }
  907. //$xml.='<v26:ItemDescription>Book</v26:ItemDescription>';//阿联酋需要选择
  908. $xml.='<v26:CustomerReferences>';
  909. $xml.='<v26:CustomerReferenceType>CUSTOMER_REFERENCE</v26:CustomerReferenceType>';
  910. $xml.='<v26:Value>'.$data['number'].'</v26:Value>';
  911. $xml.='</v26:CustomerReferences>';
  912. //签名开始
  913. if($data['qm'] > 0)
  914. {
  915. $qm = ($data['qm']=='1')?'ADULT':'INDIRECT';//DIRECT直接签名 ADULT成人签名 INDIRECT间接签名
  916. $xml.='<v26:SpecialServicesRequested>';
  917. $xml.='<v26:SpecialServiceTypes>SIGNATURE_OPTION</v26:SpecialServiceTypes>';
  918. $xml.='<v26:SignatureOptionDetail>';
  919. $xml.='<v26:OptionType>'.$qm.'</v26:OptionType>';
  920. $xml.='</v26:SignatureOptionDetail>';
  921. $xml.='</v26:SpecialServicesRequested>';
  922. }
  923. //签名结束
  924. $xml.='</v26:RequestedPackageLineItems>';
  925. $xml.='</v26:RequestedShipment>';
  926. $xml.='</v26:ProcessShipmentRequest>';
  927. $xml.='</soapenv:Body>';
  928. $xml.='</soapenv:Envelope>';
  929. /**
  930. $ch = curl_init();
  931. curl_setopt($ch, CURLOPT_URL, 'https://ws.fedex.com:443/web-services/ship');
  932. curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
  933. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  934. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  935. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  936. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  937. curl_setopt($ch, CURLOPT_POST, 1);
  938. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,35);
  939. $result_xml = curl_exec($ch);
  940. $result_xml = str_replace(array(':','-'), '', $result_xml);
  941. @$values = json_decode(json_encode(simplexml_load_string($result_xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
  942. **/
  943. $ch = curl_init();
  944. $url = 'http://z.wepolicy.cn/fedexhz.php';
  945. curl_setopt($ch,CURLOPT_URL,$url);
  946. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  947. curl_setopt($ch,CURLOPT_HEADER,0);
  948. curl_setopt($ch,CURLOPT_POST, 1);
  949. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,35);
  950. //设置post数据
  951. $post = array();
  952. $post['data'] = $xml;
  953. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
  954. $res = curl_exec($ch);
  955. curl_close($ch);
  956. $values = json_decode($res,true);
  957. if(isset($values['SOAPENVBody']['ProcessShipmentReply']['CompletedShipmentDetail']['MasterTrackingId']['TrackingNumber']))
  958. {
  959. $g = array('x'=>'1','waybill'=>$values['SOAPENVBody']['ProcessShipmentReply']['CompletedShipmentDetail']['MasterTrackingId']['TrackingNumber'],'label'=>$values['SOAPENVBody']['ProcessShipmentReply']['CompletedShipmentDetail']['CompletedPackageDetails']['Label']['Parts']['Image'],'invoice'=>$values['SOAPENVBody']['ProcessShipmentReply']['CompletedShipmentDetail']['ShipmentDocuments']['Parts']['Image']);
  960. }
  961. else if(isset($values['SOAPENVBody']['ProcessShipmentReply']['Notifications']))
  962. {
  963. $a = '';
  964. if(isset($values['SOAPENVBody']['ProcessShipmentReply']['Notifications']['LocalizedMessage']))
  965. {
  966. $a = $values['SOAPENVBody']['ProcessShipmentReply']['Notifications']['LocalizedMessage'];
  967. }
  968. else
  969. {
  970. foreach ($values['SOAPENVBody']['ProcessShipmentReply']['Notifications'] as $v)
  971. {
  972. $a .= $v['LocalizedMessage'].'--';
  973. }
  974. }
  975. $g = array('x'=>'0','Description'=>$a);
  976. }
  977. else
  978. {
  979. $g = array('x'=>'0','Description'=>'未知错误');
  980. }
  981. echo "<pre>";
  982. print_r($g);
  983. }
  984. public function _text($fullorder)
  985. {
  986. /** 发票地址信息暂时无用
  987. $fullorder['baddress'] = explode(',',$fullorder['baddress']);
  988. $fullorder['baddress'] = array_reverse($fullorder['baddress']);
  989. $fullorder['baddress'][1] = $country['ename'];
  990. **/
  991. //获取所用相关信息
  992. $warehouse = $this->warehouse->read($fullorder['type']);
  993. $country = $this->country->read($fullorder['country']);//订单国家信息
  994. $fcountry = $this->country->read($warehouse['country']);//仓库国家信息
  995. $warehouse['country'] = $fcountry['ename'];//仓库国家名
  996. $warehouse['lb'] = $fcountry['lb'];//仓库国家编码
  997. $fullorder['warehouse'] = $warehouse;//仓库数据加入订单
  998. $fullorder['lb'] = $country['lb'];//订单国家编码加入
  999. $fullorder['country'] = $country['ename'];//订单国家名
  1000. $fullorder['zhou'] = $country['continent'];//所属州
  1001. $express = $this->express->read($fullorder['express']);
  1002. $fullorder['express'] = $express['servicename'];
  1003. $fullorder['account'] = $express['account'];
  1004. $fullorder['printcode'] = $express['printcode'];
  1005. $fullorder['time'] = date('Y-m-d',time());
  1006. $fullorder['times'] = date('Y-m-d H:i',time());
  1007. $fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  1008. $fullorder['address'] = str_replace(array('&'),array('&#38;'),$fullorder['address']);
  1009. $fullorder['address2'] = str_replace(array('&'),array('&#38;'),$fullorder['address2']);
  1010. $fullorder['shipremarks'] = str_replace(array('<','>',';',';'),array('&lt','&gt',';<br>',';<br>'),$fullorder['shipremarks']);
  1011. $shop = $this->shop->read($fullorder['shop']);
  1012. $fullorder['shop'] = $shop['shopname'];
  1013. if(is_numeric($fullorder['pay']))
  1014. {
  1015. $pay = $this->typeclass->read($fullorder['pay']);
  1016. if($pay['classid'] == '4')
  1017. {
  1018. $fullorder['pay'] = $pay['title'];
  1019. }
  1020. }
  1021. if($fullorder['printcode'] != "USPS")
  1022. {
  1023. $fullorder['client'] = htmlspecialchars($fullorder['client']);
  1024. $fullorder['name'] = htmlspecialchars($fullorder['name']);
  1025. }
  1026. //增加退货单所需信息
  1027. $pt = '';
  1028. $fpdata = explode(';',trim($fullorder['fpdata'],';'));
  1029. foreach ($fpdata as $v)
  1030. {
  1031. $p = explode('|',trim($v,'|'));
  1032. $pt .= '<p>'.$p[1].' * '.$p[2].'</p>';
  1033. }
  1034. $fullorder['pt'] = $pt;
  1035. return $fullorder;
  1036. }
  1037. public function _dpex($arg_array)
  1038. {
  1039. $fullorder = $this->fullorder->get_number($arg_array[0]);
  1040. if(!$fullorder)
  1041. {
  1042. $fullorder = $this->fullordersmt->get_number($arg_array[0]);
  1043. }
  1044. $fullorder = $this->_text($fullorder);
  1045. /**
  1046. $warehouse = $this->warehouse->read($fullorder['type']);
  1047. $country = $this->country->read($fullorder['country']);//订单国家信息
  1048. $fcountry = $this->country->read($warehouse['country']);//仓库国家信息
  1049. $warehouse['country'] = $fcountry['ename'];//仓库国家名
  1050. $warehouse['lb'] = $fcountry['lb'];//仓库国家编码
  1051. $fullorder['warehouse'] = $warehouse;//仓库数据加入订单
  1052. $fullorder['lb'] = $country['lb'];//订单国家编码加入
  1053. $fullorder['country'] = $country['ename'];//订单国家名
  1054. $fullorder['zhou'] = $country['continent'];//所属州
  1055. $express = $this->express->read($fullorder['express']);
  1056. $fullorder['express'] = $express['servicename'];
  1057. $fullorder['account'] = $express['account'];
  1058. $fullorder['printcode'] = $express['printcode'];
  1059. $fullorder['time'] = date('Y-m-d',time());
  1060. $fullorder['times'] = date('Y-m-d H:i',time());
  1061. $fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  1062. $fullorder['address'] = str_replace(array('&'),array('&#38;'),$fullorder['address']);
  1063. $fullorder['address2'] = str_replace(array('&'),array('&#38;'),$fullorder['address2']);
  1064. $shop = $this->shop->read($fullorder['shop']);
  1065. $fullorder['shop'] = $shop['shopname'];
  1066. **/
  1067. $fullorder['number'] = $fullorder['number'].'-1';//订单号重复修改新订单好
  1068. $data = $fullorder;
  1069. $url = "http://ambcargo.kingtrans.cn/PostInterfaceService?method=createOrder";
  1070. $Clientid = 'LYFZP';
  1071. $Token = 'NGkJSDx3bAxojl1YN232';
  1072. $code = array('DPEX'=>array('11','DPEX','1'),'ARAMEX'=>array('002','安迈世',0),'FEDEX'=>array('FEDEX_1CC','FEDEX_1CC',';lab10_10'),'UPS'=>array('04','UPS',0),'DHL'=>array('06','DHL',';lab10_10'),'FED-SN-IP'=>array('07','FED-SN-IP',';lab10_10'),'WML-FEDEX-ZZ'=>array('05','WML-FEDEX-ZZ',';lab10_10'),'FED-XS-F'=>array('03','FED-XS-F',';lab10_10'),'CNE'=>array('08','全球优先CNE','label10x10;0'),'TCNE'=>array('09','E速宝特惠','label10x10;0'));
  1073. $printcode = $code[$data['printcode']];
  1074. //创建并预报订单
  1075. $count = array(
  1076. 'Verify' => array(
  1077. 'Clientid'=>$Clientid,
  1078. 'Token'=>$Token
  1079. ),
  1080. 'OrderType' => '1',//1:快件订单 2:快递制单-非实时返回单号 3:仓储订单 4:快递制单-实时返回单号(等待时间较 长)。此方法选择 4,后续如需调用其他 方法,例如调用删除接口,其他方法 OrderType 请选择 2。
  1081. 'OrderDatas' => array(0=>array(
  1082. 'CustomerNumber' => $data['number'],//订单号
  1083. 'ChannelCode' => $printcode[0],//渠道代码
  1084. 'CountryCode' => $data['lb'],//国家二字码
  1085. 'TotalWeight' => $data['zzl'],//订单重量
  1086. 'TotalValue' => $data['zsbjz'],//申报价值
  1087. 'Number' => $data['zjs'],//件数
  1088. 'Note' => $data['number'],//备注
  1089. /**
  1090. 'Insurance' => array(//是否购买保险
  1091. 'Code' => '',//保险类型
  1092. 'Value' => '',//保险金额
  1093. ),
  1094. **/
  1095. 'FeePayData' => array(//运费支付信息
  1096. 'FeePayType' => 'PP',//支付方式 [ PP:预付,CC:到付, TP:第三方]
  1097. 'FeePayAccountNumber' => '',//支付账号 支付方式为 TP 时必传 支付方式为 PP 并且渠道 UPS 时必传
  1098. 'FeePayCountryCode' => '',//支付账号对应国家 支付方式为 TP 时必传
  1099. 'FeePayPostCode' => '',//支付账号对应邮编 支付方式为 TP 并且渠道 FEDEX 时必传
  1100. ),
  1101. 'TaxPayData' => array(//税金/关税支付信息 OrderType 为 [快递制单] 时必传字段
  1102. 'TaxPayType' => 'PP',//支付方式 [ PP:预付,CC:到付, TP:第三方]
  1103. 'TaxPayAccountNumber' => '',//支付账号 支付方式为 TP 时必传 支付方式为 PP 并且渠道 UPS 时必传
  1104. 'TaxPayCountryCode' => '',//支付账号对应国家 支付方式为 TP 时必传
  1105. 'TaxPayPostCode' => '',//支付账号对应邮编 支付方式为 TP 并且渠道 FEDEX 时必传
  1106. ),
  1107. 'Recipient' => array(//收件人信息
  1108. 'Name' => $data['name'],//姓名
  1109. 'Addres1' => $data['address'],//地址1
  1110. 'Addres2' => $data['address2'],//地址2
  1111. 'Mobile' => preg_replace('/\D/s','',$data['phone']),//手机
  1112. 'Province' => $data['province'],//省/州
  1113. 'City' => $data['city'],//城市
  1114. 'Post' => trim($data['zipcode'],' '),//邮编
  1115. ),
  1116. 'OrderItems' => array(
  1117. 0=>array(//订单明细
  1118. 'Money' => 'USD',//货币单位
  1119. //'Sku' => '123123',//产品 Sku (OrderType 为仓储订单必传)
  1120. 'Cnname' => '化纤发',//产品中文名
  1121. 'Enname' => 'synthetic hair*1',//产品英文名
  1122. 'Price' => '10',//单价
  1123. 'Weight' => '0.1',//重量
  1124. 'Num' => 1,//数量
  1125. 'CustomsCode'=>6704190000//海关编码
  1126. ),
  1127. 1=>array(//订单明细
  1128. 'Money' => 'USD',//货币单位
  1129. //'Sku' => '123123',//产品 Sku (OrderType 为仓储订单必传)
  1130. 'Cnname' => '头饰',//产品中文名
  1131. 'Enname' => 'hair accessories*1',//产品英文名
  1132. 'Price' => '0.5',//单价
  1133. 'Weight' => '0.1',//重量
  1134. 'Num' => '1',//数量
  1135. 'CustomsCode'=>9615110000//海关编码
  1136. ),
  1137. 2=>array(//订单明细
  1138. 'Money' => 'USD',//货币单位
  1139. //'Sku' => '123123',//产品 Sku (OrderType 为仓储订单必传)
  1140. 'Cnname' => '小发刷',//产品中文名
  1141. 'Enname' => 'Hairbrush*1',//产品英文名
  1142. 'Price' => '0.5',//单价
  1143. 'Weight' => '0.1',//重量
  1144. 'Num' => '1',//数量
  1145. 'CustomsCode'=>9603290090//海关编码
  1146. ),
  1147. 3=>array(//订单明细
  1148. 'Money' => 'USD',//货币单位
  1149. //'Sku' => '123123',//产品 Sku (OrderType 为仓储订单必传)
  1150. 'Cnname' => '袋子',//产品中文名
  1151. 'Enname' => 'Satin Bag*1',//产品英文名
  1152. 'Price' => '0.5',//单价
  1153. 'Weight' => '0.1',//重量
  1154. 'Num' => '1',//数量
  1155. 'CustomsCode'=>4202320000//海关编码
  1156. ),
  1157. 4=>array(//订单明细
  1158. 'Money' => 'USD',//货币单位
  1159. //'Sku' => '123123',//产品 Sku (OrderType 为仓储订单必传)
  1160. 'Cnname' => '假睫毛',//产品中文名
  1161. 'Enname' => 'Eyelashes*1',//产品英文名
  1162. 'Price' => '0.5',//单价
  1163. 'Weight' => '0.1',//重量
  1164. 'Num' => '1',//数量
  1165. 'CustomsCode'=>6704200000//海关编码
  1166. ),
  1167. /**
  1168. 2=>array(//订单明细
  1169. 'Money' => 'USD',//货币单位
  1170. //'Sku' => '123123',//产品 Sku (OrderType 为仓储订单必传)
  1171. 'Cnname' => '假睫毛',//产品中文名
  1172. 'Enname' => 'Eyelashes*1',//产品英文名
  1173. 'Price' => '0.5',//单价
  1174. 'Weight' => '0.1',//重量
  1175. 'Num' => '1',//数量
  1176. 'CustomsCode'=>6704200000//海关编码
  1177. ),
  1178. 3=>array(//订单明细
  1179. 'Money' => 'USD',//货币单位
  1180. //'Sku' => '123123',//产品 Sku (OrderType 为仓储订单必传)
  1181. 'Cnname' => '袋子',//产品中文名
  1182. 'Enname' => 'Satin Bag*1',//产品英文名
  1183. 'Price' => '0.5',//单价
  1184. 'Weight' => '0.1',//重量
  1185. 'Num' => '1',//数量
  1186. 'CustomsCode'=>4202320000//海关编码
  1187. )
  1188. **/
  1189. ))
  1190. )
  1191. /**,
  1192. 'Volumes' => array(//材积明细 (OrderType 为快递制单必传)
  1193. 'Weight' => '123123',//实重
  1194. 'Number' => '123123',//件数
  1195. 'Length' => '123123',//长
  1196. 'Width' => '123123',//宽
  1197. 'Height' => '123123',//高
  1198. ),
  1199. **/
  1200. );
  1201. $count = json_encode($count,true);
  1202. $ch = curl_init();
  1203. curl_setopt($ch,CURLOPT_URL,$url);
  1204. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  1205. curl_setopt($ch,CURLOPT_HEADER,0);
  1206. curl_setopt($ch,CURLOPT_POST, 1);
  1207. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,600);
  1208. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query(array('json'=>$count)));
  1209. $res = curl_exec($ch);
  1210. curl_close($ch);
  1211. $res = json_decode($res,true);
  1212. if(!isset($res['returnDatas'][0]['corpBillid']))
  1213. {
  1214. $g = array('x'=>'0','Description'=>$res['returnDatas'][0]['message']);
  1215. }
  1216. else
  1217. {
  1218. $yd = $this->get_dpex_yd($res['returnDatas'][0]['corpBillid'],$printcode[2]);
  1219. $fp = $this->get_dpex_fp($res['returnDatas'][0]['corpBillid'],$count);
  1220. if($yd != 'c' && $fp != 'c')
  1221. {
  1222. $g = array('x'=>'1','waybillid'=>$res['returnDatas'][0]['corpBillid'],'waybill'=>$res['returnDatas'][0]['trackNumber'],'yd'=>'<a href="'.$yd.'" target="_blank">'.$yd.'</a>','fp'=>'<a href="'.$fp.'" target="_blank">'.$fp.'</a>');
  1223. }
  1224. else
  1225. {
  1226. $g = array('x'=>'0','Description'=>'换取运单失败,请重试');
  1227. }
  1228. }
  1229. echo "<pre>";
  1230. print_r($g);
  1231. }
  1232. public function get_dpex_yd($waybill,$PrintPaper)
  1233. {
  1234. $url = "http://ambcargo.kingtrans.cn/PostInterfaceService?method=printOrderLabel";
  1235. $Clientid = 'LYFZP';
  1236. $Token = 'NGkJSDx3bAxojl1YN232';
  1237. $count = array(
  1238. 'Verify' => array(
  1239. 'Clientid'=>$Clientid,
  1240. 'Token'=>$Token
  1241. ),
  1242. 'CorpBillidDatas'=> array(0=>array('CorpBillid'=>$waybill)),
  1243. 'OrderType'=> "1",//1:快件订单 2:快递制单 3:仓库订单
  1244. 'PrintPaper'=> $PrintPaper,//打印纸张 快递制单只固定为:label 和 A4
  1245. 'PrintContent'=> "1"//打印内容 1:地址标签 2:报关单 3:配货信息 可自由组合用“,”号隔开 如:1,2,3
  1246. );
  1247. $count = json_encode($count,true);
  1248. $ch = curl_init();
  1249. curl_setopt($ch,CURLOPT_URL,$url);
  1250. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  1251. curl_setopt($ch,CURLOPT_HEADER,0);
  1252. curl_setopt($ch,CURLOPT_POST, 1);
  1253. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,600);
  1254. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query(array('json'=>$count)));
  1255. $res = curl_exec($ch);
  1256. curl_close($ch);
  1257. $res = json_decode($res,true);
  1258. if($res['statusCode'] == 'success')
  1259. {
  1260. return $res['url'];
  1261. }
  1262. else
  1263. {
  1264. return 'c';
  1265. }
  1266. }
  1267. public function get_dpex_fp($waybill)
  1268. {
  1269. $url = "http://ambcargo.kingtrans.cn/PostInterfaceService?method=printOrderInvoice";
  1270. $Clientid = 'LYFZP';
  1271. $Token = 'NGkJSDx3bAxojl1YN232';
  1272. $count = array(
  1273. 'Verify' => array(
  1274. 'Clientid'=>$Clientid,
  1275. 'Token'=>$Token
  1276. ),
  1277. 'CorpBillidDatas'=> array(0=>array('CorpBillid'=>$waybill))
  1278. );
  1279. $count = json_encode($count,true);
  1280. $ch = curl_init();
  1281. curl_setopt($ch,CURLOPT_URL,$url);
  1282. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  1283. curl_setopt($ch,CURLOPT_HEADER,0);
  1284. curl_setopt($ch,CURLOPT_POST, 1);
  1285. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,600);
  1286. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query(array('json'=>$count)));
  1287. $res = curl_exec($ch);
  1288. curl_close($ch);
  1289. $res = json_decode($res,true);
  1290. if($res['statusCode'] == 'success')
  1291. {
  1292. return $res['url'];
  1293. }
  1294. else
  1295. {
  1296. return 'c';
  1297. }
  1298. }
  1299. public function _feite($waybill)//飞特提取内容下载
  1300. {
  1301. $a = '{"data":{"items":[{"orderId":"F370142205310002","traceId":"1Z88F19Y0396934797","remark":"LY-Supernova-0531-FBA16QRN39JPU-4","importTime":"2022-05-31 15:57:25","sentTime":"2022-06-02 22:40:19","iossNumber":null,"ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F370142205300001","traceId":"1Z287F0E6705824870","remark":"LY-AP-2022053009-FBA16QQ0TC4N","importTime":"2022-05-30 15:45:42","sentTime":"2022-05-31 19:10:01","iossNumber":null,"ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F370142205270006","traceId":"1Z88F19Y0303244340","remark":"LY-WK- 2022052701-FBA16QJXYP99","importTime":"2022-05-27 15:24:16","sentTime":"2022-05-30 15:40:40","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F370142205270005","traceId":"1Z88F19Y0302468708","remark":"LY-SN-2022052701","importTime":"2022-05-27 15:23:16","sentTime":"2022-05-30 15:40:40","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F370142205270001","traceId":"1Z88F19Y0301362654","remark":"LY-Wiggins-2022052705-FBA16QJHKJ5R","importTime":"2022-05-27 11:58:23","sentTime":"2022-05-30 15:40:40","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F370142205120001","traceId":"1Z88F19Y0312674270","remark":"LY-H-2022051203-FBA16PSVQ9YF","importTime":"2022-05-12 09:51:55","sentTime":"2022-05-13 15:40:37","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F37014220511000A","traceId":"1Z88F19Y0315997229","remark":"LY-Wiggins-2022051105-FBA16PRXMZ5L","importTime":"2022-05-11 15:01:31","sentTime":"2022-05-13 15:40:37","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F37014220510000M","traceId":"1Z88F19Y0399360286","remark":"LY-XCLY-20220510-024-FBA00001","importTime":"2022-05-10 14:55:18","sentTime":"2022-05-10 20:19:19","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F37014220510000J","traceId":"1Z88F19Y0397487868","remark":"LY-WK-2022050703-","importTime":"2022-05-10 12:22:22","sentTime":"2022-05-10 12:52:17","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F37014220510000I","traceId":"1Z88F19Y0395774837","remark":"LY-Wiggins-2022050703-","importTime":"2022-05-10 12:22:23","sentTime":"2022-05-10 12:52:17","iossNumber":null,"ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F37014220510000H","traceId":"1Z88F19Y0397543547","remark":"LY-AP-22050711-","importTime":"2022-05-10 12:22:19","sentTime":"2022-05-10 12:52:17","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F370142205090002","traceId":"1Z88F19Y0397647720","remark":"LY-YMS-22050901-FBA16PNXD0GM","importTime":"2022-05-09 09:56:49","sentTime":"2022-05-09 16:54:15","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F370142205090001","traceId":"1Z88F19Y0397194737","remark":"LY-AS-22050902-FBA16PNSGL89","importTime":"2022-05-09 08:39:18","sentTime":"2022-05-09 16:54:15","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F370142205080005","traceId":"1Z88F19Y0399894754","remark":"LY-YMS-22050805","importTime":"2022-05-08 12:19:57","sentTime":"2022-05-09 16:54:15","iossNumber":"","ptName":"FBA-美洲专线(郑州)","countryName":"美国"},{"orderId":"F37014220427000I","traceId":"272474117028","remark":"SUPER-20426-004","importTime":"2022-04-27 16:01:08","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F37014220427000H","traceId":"272474116466","remark":"QQS-20426-052","importTime":"2022-04-27 15:59:38","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F37014220427000G","traceId":"272474117109","remark":"QQS-20426-001","importTime":"2022-04-27 15:59:34","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F37014220427000F","traceId":"272474116352","remark":"QQS-20425-102","importTime":"2022-04-27 15:59:29","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"荷兰"},{"orderId":"F37014220427000D","traceId":"272474117337","remark":"Y-20426-058","importTime":"2022-04-27 14:07:57","sentTime":"2022-04-28 00:19:50","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"德国"},{"orderId":"F37014220427000B","traceId":"272474117017","remark":"KISS-20426-021","importTime":"2022-04-27 14:07:50","sentTime":"2022-04-28 00:19:50","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"芬兰"},{"orderId":"F37014220427000A","traceId":"272474116341","remark":"ALIP-20423-217","importTime":"2022-04-27 14:07:36","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"德国"},{"orderId":"F370142204270009","traceId":"272474117532","remark":"Y-20427-011","importTime":"2022-04-27 14:03:31","sentTime":"2022-04-28 00:19:50","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"葡萄牙"},{"orderId":"F370142204270008","traceId":"272474116569","remark":"AAP-20426-030","importTime":"2022-04-27 14:03:20","sentTime":"2022-04-28 00:19:50","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"荷兰"},{"orderId":"F370142204270004","traceId":"272467942761","remark":"ALIP-20425-072","importTime":"2022-04-27 11:10:19","sentTime":"2022-04-28 00:19:50","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204270003","traceId":"272467945153","remark":"ALIP-20426-015","importTime":"2022-04-27 10:13:06","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"瑞典"},{"orderId":"F370142204270002","traceId":"272467947649","remark":"KISS-20425-019","importTime":"2022-04-27 10:13:03","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204270001","traceId":"272467946860","remark":"AAP-20425-002","importTime":"2022-04-27 10:12:51","sentTime":"2022-04-28 00:19:50","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204260009","traceId":"272419119163","remark":"KISS-20423-033","importTime":"2022-04-26 14:17:33","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"荷兰"},{"orderId":"F370142204260008","traceId":"272419119185","remark":"Y-20426-006","importTime":"2022-04-26 13:12:56","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204260007","traceId":"272419119060","remark":"ALIP-20425-067","importTime":"2022-04-26 13:12:48","sentTime":"2022-04-26 23:54:20","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204260006","traceId":"272419118970","remark":"KISS-20425-023","importTime":"2022-04-26 13:12:39","sentTime":"2022-04-26 23:54:20","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204260005","traceId":"272467947351","remark":"ALIP-20424-090","importTime":"2022-04-26 13:12:30","sentTime":"2022-04-28 00:19:50","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"丹麦"},{"orderId":"F370142204260004","traceId":"272419118671","remark":"ALIP-20424-074","importTime":"2022-04-26 13:12:22","sentTime":"2022-04-26 23:54:20","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"爱尔兰"},{"orderId":"F370142204260003","traceId":"272419119233","remark":"ALIP-20423-157","importTime":"2022-04-26 13:12:13","sentTime":"2022-04-26 23:54:20","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204260002","traceId":"272419118248","remark":"AAP-20425-016","importTime":"2022-04-26 13:12:05","sentTime":"2022-04-26 23:54:20","iossNumber":"IM5280002556","ptName":"中速FEDEX","countryName":"荷兰"},{"orderId":"F370142204260001","traceId":"272419118947","remark":"AAP-20425-023","importTime":"2022-04-26 10:59:31","sentTime":"2022-04-26 23:54:20","iossNumber":"FR76880693544","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F37014220425000H","traceId":"272362120808","remark":"KISS-20423-063","importTime":"2022-04-25 14:12:43","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"荷兰"},{"orderId":"F37014220425000G","traceId":"272362120896","remark":"ALIP-20423-111","importTime":"2022-04-25 14:12:39","sentTime":"2022-04-25 21:38:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"荷兰"},{"orderId":"F37014220425000F","traceId":"272362120234","remark":"KISS-20422-051","importTime":"2022-04-25 14:12:34","sentTime":"2022-04-25 21:38:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F37014220425000E","traceId":"272362120040","remark":"KISS-20417-041","importTime":"2022-04-25 14:12:27","sentTime":"2022-04-28 18:39:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"爱尔兰"},{"orderId":"F37014220425000D","traceId":"272362119918","remark":"AAP-20424-006","importTime":"2022-04-25 14:12:22","sentTime":"2022-04-26 23:54:20","iossNumber":"IM5280002556","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F37014220425000C","traceId":"272362121285","remark":"Y-20423-049","importTime":"2022-04-25 11:54:54","sentTime":"2022-04-25 21:38:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F37014220425000B","traceId":"272362120223","remark":"ALIP-20419-117","importTime":"2022-04-25 11:48:14","sentTime":"2022-04-26 23:54:20","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F37014220425000A","traceId":"272362119540","remark":"ALIP-20422-137","importTime":"2022-04-25 11:42:36","sentTime":"2022-04-25 21:38:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"德国"},{"orderId":"F370142204250009","traceId":"272362119653","remark":"ALIP-20423-100","importTime":"2022-04-25 11:42:23","sentTime":"2022-04-25 21:38:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204250008","traceId":"272362120061","remark":"ALIP-20422-191","importTime":"2022-04-25 11:42:20","sentTime":"2022-04-25 21:38:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"德国"},{"orderId":"F370142204250006","traceId":"272362120495","remark":"AAP-20424-016","importTime":"2022-04-25 11:19:23","sentTime":"2022-04-25 21:38:11","iossNumber":"IM5280002556","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204250005","traceId":"272362119355","remark":"AAP-20424-025","importTime":"2022-04-25 11:02:10","sentTime":"2022-04-25 21:38:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"瑞典"},{"orderId":"F370142204250004","traceId":"272362120407","remark":"AAP-20423-017","importTime":"2022-04-25 10:55:58","sentTime":"2022-04-25 21:38:11","iossNumber":"IM5280002556","ptName":"中速FEDEX","countryName":"荷兰"},{"orderId":"F370142204250003","traceId":"272362120392","remark":"AAP-20423-006","importTime":"2022-04-25 10:55:42","sentTime":"2022-04-25 21:38:11","iossNumber":"IM5280002556","ptName":"中速FEDEX","countryName":"法国"},{"orderId":"F370142204250002","traceId":"272362121171","remark":"Y-20423-003","importTime":"2022-04-25 09:21:30","sentTime":"2022-04-25 21:38:11","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"}],"pageInfo":{"pageIndex":1,"pageSize":1000,"totalCount":51,"totalPage":1}},"status":1,"msg":"","datas":null,"errCode":0}';
  1302. //发货页面当前页数量拉满
  1303. //格式:{"data":{"items":[{"orderId":"F37014220102000D","traceId":"288335360044","remark":"ALIP-11230-109","importTime":"2022-01-02 13:48:27","sentTime":"2022-01-05 07:57:00","iossNumber":"IM3800007691","ptName":"中速FEDEX","countryName":"法国"}],"pageInfo":{"pageIndex":1,"pageSize":1000,"totalCount":563,"totalPage":1}},"status":1,"msg":"","datas":null,"errCode":0}
  1304. $a = json_decode($a,true);$b = array();
  1305. foreach ($a['data']['items'] as $v)
  1306. {
  1307. //if($v['iossNumber'] == 'IM3800007691')
  1308. //{
  1309. $b[] = $v;
  1310. //}
  1311. }
  1312. $title = "飞特";
  1313. $titlename = "<table border=1>
  1314. <tr>
  1315. <td>订单号</td>
  1316. <td>跟踪号</td>
  1317. <td>编号</td>
  1318. <td>导入时间</td>
  1319. <td>发货时间</td>
  1320. <td>IOSS</td>
  1321. <td>快递方式</td>
  1322. <td>国家</td>
  1323. </table>";
  1324. $filename = $title.".xls";
  1325. $tail = "\n";
  1326. $this->excel->get_fz2($b,$titlename,$filename,$tail);
  1327. }
  1328. public function _rl($arg_array)
  1329. {
  1330. $t = (1646064000-1635696000)/(24*3600);
  1331. $list = array();
  1332. for($i=0;$i<$t;$i++)
  1333. {
  1334. $time = ($i>0)?1635696000+($i*24*3600):1646064000;
  1335. $time = date('Ymd',$time);
  1336. $d = $this->fullorder->find_all("returndata like '%$time%'",'number,returndata,js,zzl');
  1337. foreach ($d as $v)
  1338. {
  1339. $list[] = $v;
  1340. }
  1341. $s = $this->fullordersmt->find_all("returndata like '%$time%'",'number,returndata,js,zzl');
  1342. foreach ($s as $v)
  1343. {
  1344. $list[] = $v;
  1345. }
  1346. }
  1347. $data = array();
  1348. foreach ($list as $k=>$v)
  1349. {
  1350. $js = ($v['js'] == '0')?'FIRST CLASS':'PRIORITY';
  1351. $return = explode('/t-',$v['returndata']);
  1352. $time = explode('/pdf/',$return[0]);
  1353. $time = strtotime($time[1]);
  1354. $return = explode('.pdf"',$return[1]);
  1355. $data[] = array($v['number'],$return[0],$js,$v['zzl'],date('Y-m-d',$time));
  1356. }
  1357. $title = 'return';
  1358. $titlename = "<table border=1>
  1359. <tr>
  1360. <td>编号</td>
  1361. <td>return label 运单号</td>
  1362. <td>服务类型</td>
  1363. <td>重量</td>
  1364. <td>return label 时间</td>
  1365. </tr>
  1366. </table>";
  1367. $filename = $title.".xls";
  1368. $tail = "\n";
  1369. $this->excel->get_fz2($data,$titlename,$filename,$tail);
  1370. echo "<pre>";
  1371. print_r($data);
  1372. }
  1373. public function _cz($arg_array)
  1374. {
  1375. $f = 'fullorder';
  1376. $d = $this->fullorder->get_number($arg_array[0]);
  1377. if(!$d)
  1378. {
  1379. $f = 'fullordersmt';
  1380. $d = $this->fullordersmt->get_number($arg_array[0]);
  1381. if(!$d)
  1382. {
  1383. $f = 'fullordertt';
  1384. $d = $this->fullordertt->get_number($arg_array[0]);
  1385. }
  1386. }
  1387. if(!$d)
  1388. {
  1389. echo '找不到此编号';exit;
  1390. }
  1391. $cz = 'reset';
  1392. $c = $this->$cz->find_all("number = '".$arg_array[0]."'",'*','id desc');
  1393. if(!$c)
  1394. {
  1395. echo '找不到此编号';exit;
  1396. }
  1397. $c = $c[0];
  1398. if($c['printtime'] != '无' && $c['librarytime'] != '无')
  1399. {
  1400. $this->$f->save(array('printtime'=>strtotime($c['printtime']),'print'=>3,'printnumber'=>1,'librarytime'=>strtotime($c['librarytime']),'library'=>2,'reviewtime'=>strtotime($c['reviewtime']),'review'=>6),$d['id']);
  1401. }
  1402. else if($c['printtime'] != '无' && $c['librarytime'] == '无')
  1403. {
  1404. $this->$f->save(array('printtime'=>strtotime($c['printtime']),'print'=>3,'printnumber'=>1,'reviewtime'=>strtotime($c['reviewtime']),'review'=>6),$d['id']);
  1405. }
  1406. else if($c['printtime'] == '无' && $c['librarytime'] == '无' && $c['reviewtime'] != '无')
  1407. {
  1408. $this->$f->save(array('reviewtime'=>strtotime($c['reviewtime']),'review'=>6),$d['id']);
  1409. }
  1410. else
  1411. {
  1412. echo '没有可恢复的状态';exit;
  1413. }
  1414. }
  1415. public function _paypal($arg_array)//paypal用 返回头部数据
  1416. {
  1417. $f = $this->fullorder->get_number($arg_array[0]);
  1418. $s = $this->shop->read($f['shop']);
  1419. $client_id = $s['paypalname'];
  1420. $secret_id = $s['paypalpass'];
  1421. $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='.$f['paypal'].'&fields=all&page_size=100&page=1';
  1422. $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');
  1423. $ToState = array_flip($ToState);
  1424. $header[] = "Content-Type: application/json";
  1425. $header[] = "Authorization: Basic ".base64_encode($client_id.":".$secret_id);
  1426. $ch = curl_init();
  1427. curl_setopt($ch, CURLOPT_HTTPGET, true);
  1428. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //TRUE 将curl_exec()获取的信息以字符串返回,而不是直接输出。
  1429. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  1430. curl_setopt($ch, CURLOPT_HEADER, true); //返回response头部信息
  1431. curl_setopt($ch, CURLINFO_HEADER_OUT, true);
  1432. curl_setopt($ch, CURLOPT_URL, $url);
  1433. $result = curl_exec($ch);
  1434. curl_getinfo($ch, CURLINFO_HEADER_OUT);
  1435. curl_close($ch);
  1436. echo "<pre>";
  1437. echo $result;exit;
  1438. }
  1439. public function _yd($arg_array)
  1440. {
  1441. $fullorder = $this->fullorder->get_number($arg_array[0]);
  1442. if(!$fullorder)
  1443. {
  1444. $fullorder = $this->fullordersmt->get_number($arg_array[0]);
  1445. }
  1446. if(!$fullorder)
  1447. {
  1448. echo "编号错误";exit;
  1449. }
  1450. /** 发票地址信息暂时无用
  1451. $fullorder['baddress'] = explode(',',$fullorder['baddress']);
  1452. $fullorder['baddress'] = array_reverse($fullorder['baddress']);
  1453. $fullorder['baddress'][1] = $country['ename'];
  1454. **/
  1455. //获取所用相关信息
  1456. $warehouse = $this->warehouse->read($fullorder['type']);
  1457. $country = $this->country->read($fullorder['country']);//订单国家信息
  1458. $fcountry = $this->country->read($warehouse['country']);//仓库国家信息
  1459. $warehouse['country'] = $fcountry['ename'];//仓库国家名
  1460. $warehouse['lb'] = $fcountry['lb'];//仓库国家编码
  1461. $fullorder['warehouse'] = $warehouse;//仓库数据加入订单
  1462. $fullorder['lb'] = $country['lb'];//订单国家编码加入
  1463. $fullorder['country'] = $country['ename'];//订单国家名
  1464. $fullorder['zhou'] = $country['continent'];//所属州
  1465. $express = $this->express->read($fullorder['express']);
  1466. $fullorder['express'] = $express['servicename'];
  1467. $fullorder['account'] = $express['account'];
  1468. $fullorder['printcode'] = $express['printcode'];
  1469. $fullorder['time'] = date('Y-m-d',time());
  1470. $fullorder['times'] = date('Y-m-d H:i',time());
  1471. $fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  1472. $fullorder['address'] = str_replace(array('&'),array('&#38;'),$fullorder['address']);
  1473. $fullorder['address2'] = str_replace(array('&'),array('&#38;'),$fullorder['address2']);
  1474. $fullorder['shipremarks'] = str_replace(array('&lt;','&gt;'),array('<','>'),$fullorder['shipremarks']);
  1475. $fullorder['shipremarks'] = str_replace(array('<','>',';',';'),array('&lt','&gt',';<br>',';<br>'),$fullorder['shipremarks']);
  1476. $shop = $this->shop->read($fullorder['shop']);
  1477. $fullorder['shop'] = $shop['shopname'];
  1478. $fullorder['city'] = preg_replace('/( | | |\s)/',' ',$fullorder['city']);
  1479. $fullorder['province'] = preg_replace('/( | | |\s)/',' ',$fullorder['province']);
  1480. if(is_numeric($fullorder['pay']))
  1481. {
  1482. $pay = $this->typeclass->read($fullorder['pay']);
  1483. if($pay['classid'] == '4')
  1484. {
  1485. $fullorder['pay'] = $pay['title'];
  1486. }
  1487. }
  1488. if($fullorder['printcode'] != "USPS")
  1489. {
  1490. $fullorder['client'] = htmlspecialchars($fullorder['client']);
  1491. $fullorder['name'] = htmlspecialchars($fullorder['name']);
  1492. }
  1493. //增加退货单所需信息
  1494. $pt = '';
  1495. $fpdata = explode(';',trim($fullorder['fpdata'],';'));
  1496. foreach ($fpdata as $v)
  1497. {
  1498. $p = explode('|',trim($v,'|'));
  1499. $pt .= '<p>'.$p[1].' * '.$p[2].'</p>';
  1500. }
  1501. $fullorder['pt'] = $pt;
  1502. //$fullorder['printcode'] = 'HUALEIXW-FEDEX';
  1503. //$fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  1504. //$fullorder['sbbm']= 4202320000;//($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  1505. //$fullorder['sbpm']= 'eyelashes';
  1506. //$fullorder['zwpm']= '假睫毛';
  1507. //$fullorder['sbpm']= 'Satin Bag';
  1508. //$fullorder['zwpm']= '袋子';
  1509. //$fullorder['hgbm']= 4202320000;
  1510. //$fullorder['address'] = '1653 Treutlan Place';
  1511. //$fullorder['address2'] = '';
  1512. //$fullorder['qm'] = 2;
  1513. //$notice = $this->notice->read(6);
  1514. //$fcountry['warehouse']['name'] = 'Hair Me Please LLC';
  1515. //$fullorder['cxcode'] = strtolower($express['cxcode']);
  1516. //$barcode = $this->fedex->get_logistics($fullorder);//获取联邦快递信息
  1517. //echo $fullorder['name'];
  1518. //$b = $this->ups->get_data($fullorder);
  1519. $barcode = $this->get_data($fullorder);
  1520. //$b = $this->usps->get_logistics($fullorder);
  1521. echo "<pre>";
  1522. print_r($barcode);
  1523. //echo "<pre>";
  1524. //echo $barcode['Postage'];
  1525. //$b = $this->_pdf($barcode['yd'],$barcode['waybill'],time());
  1526. //header("Content-type: text/xml");
  1527. //echo $barcode;
  1528. //echo $Hyd;
  1529. //echo "<pre>";
  1530. //print_r($barcode);
  1531. //print_r($barcode);
  1532. /**
  1533. $time = '1586232000';
  1534. $bctime = date('Ymd',$time);
  1535. $Hwaybill = $barcode['waybill'];
  1536. $Hyd = $this->_pdf($barcode['label'],'y-'.$Hwaybill,$bctime);
  1537. $Hfp = $this->_pdf($barcode['invoice'],'f-'.$Hwaybill,$bctime);
  1538. //header("Content-type:text/xml");
  1539. echo 'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf';
  1540. //echo "<pre>";
  1541. //print_r($barcode);
  1542. //$a = $this->whlabel->find_all(array('zd'=>'ASTE-00212-025'));//专属
  1543. **/
  1544. }
  1545. public function get_data($data)
  1546. {
  1547. if($data['pay'] == 1)
  1548. {
  1549. $data['pay'] == 'PayPal';
  1550. }
  1551. else if($data['pay'] == 2)
  1552. {
  1553. $data['pay'] == 'Western Union';
  1554. }
  1555. else if($data['pay'] == 3)
  1556. {
  1557. $data['pay'] == '微信';
  1558. }
  1559. else if($data['pay'] == 4)
  1560. {
  1561. $data['pay'] == '支付宝';
  1562. }
  1563. else if($data['pay'] == 5)
  1564. {
  1565. $data['pay'] == '银行转账';
  1566. }
  1567. else if($data['pay'] == 6)
  1568. {
  1569. $data['pay'] == '现金收款';
  1570. }
  1571. else if($data['pay'] == 7)
  1572. {
  1573. $data['pay'] == 'PingPong金融';
  1574. }
  1575. $id = 'XUCHANGLONGY';
  1576. $pass = 'dJ84as3ELr';
  1577. //$sid = '603521441';//官方DHL
  1578. $sid = '605062090';//官方DHL美国
  1579. $xmend = "\n";
  1580. $Pieces = '';
  1581. for($i=0;$i<$data['zjs'];$i++)
  1582. {
  1583. $Pieces .= "<Piece>".$xmend;
  1584. $Pieces .= "<PieceID>".($i+1)."</PieceID>".$xmend;
  1585. $Pieces .= "<PackageType>EE</PackageType>".$xmend;
  1586. $Pieces .= "<Weight>".$data['zzl']."</Weight>".$xmend;
  1587. $Pieces .= "<Width>15</Width>".$xmend;
  1588. $Pieces .= "<Height>3</Height>".$xmend;
  1589. $Pieces .= "<Depth>5</Depth>".$xmend;
  1590. $Pieces .= "</Piece>".$xmend;
  1591. }
  1592. /** 此内容是添加发票信息
  1593. $dataadress = array();$baddress = '';$ba1 = '';$ba2 = '';
  1594. for($i=5;$i<count($data['baddress']);$i++)
  1595. {
  1596. $dataadress[] = $data['baddress'][$i];
  1597. }
  1598. if(count($dataadress) > 1)
  1599. {
  1600. for($i=0;$i<count($dataadress);$i++)
  1601. {
  1602. if($i < 2)
  1603. {
  1604. $ba1 .= $dataadress[$i].',';
  1605. }
  1606. else
  1607. {
  1608. $ba2 .= $dataadress[$i].',';
  1609. }
  1610. }
  1611. $baddress .= "<BillToAddressLine>".rtrim($ba1,',')."</BillToAddressLine>".$xmend;
  1612. $baddress .= "<BillToAddressLine>".rtrim($ba2,',')."</BillToAddressLine>".$xmend;
  1613. }
  1614. else
  1615. {
  1616. for($i=0;$i<count($dataadress);$i++)
  1617. {
  1618. $ba1 .= $dataadress[$i].',';
  1619. }
  1620. $baddress .= "<BillToAddressLine>".rtrim($ba1,',')."</BillToAddressLine>".$xmend;
  1621. }
  1622. **/
  1623. $hgbm = $data['sbbm'];
  1624. if(isset($data['hgbm']))
  1625. {
  1626. if($data['hgbm'] != '')
  1627. {
  1628. $hgbm = $data['hgbm'];
  1629. }
  1630. }
  1631. $xml = "";
  1632. $xml .= "<?xml version='1.0' encoding='UTF-8'?>".$xmend;
  1633. $xml .= "<req:ShipmentRequest xsi:schemaLocation='http://www.dhl.com ship-val-global-req.xsd' schemaVersion='10.0' xmlns:req='http://www.dhl.com' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>".$xmend;
  1634. $xml .= "<Request>".$xmend;
  1635. $xml .= "<ServiceHeader>".$xmend;
  1636. $xml .= "<MessageTime>".date('c')."</MessageTime>".$xmend;
  1637. //$rand = (strlen($data['orderinfo']) < 15)?rand(10000000,99999999):rand(100000,999999);
  1638. //$xml .= "<MessageReference>".time().$data['orderinfo'].$rand."</MessageReference>".$xmend;
  1639. $xml .= "<MessageReference>".time().time().rand(10000000,99999999)."</MessageReference>".$xmend;
  1640. $xml .= "<SiteID>".$id."</SiteID>".$xmend;//DHL账号
  1641. $xml .= "<Password>".$pass."</Password>".$xmend;//DHL密码
  1642. $xml .= "</ServiceHeader>".$xmend;
  1643. $xml .= "<MetaData>".$xmend;
  1644. $xml .= "<SoftwareName>LongYi ERP</SoftwareName>".$xmend;
  1645. $xml .= "<SoftwareVersion>V1.0.0</SoftwareVersion>".$xmend;
  1646. $xml .= "</MetaData>".$xmend;
  1647. $xml .= "</Request>".$xmend;
  1648. $xml .= "<RegionCode>AP</RegionCode>".$xmend;//地区代码
  1649. $xml .= "<LanguageCode>en</LanguageCode>".$xmend;//语言
  1650. ///$xml .= "<PiecesEnabled>Y</PiecesEnabled>".$xmend;
  1651. $xml .= "<Billing>".$xmend;
  1652. $xml .= "<ShipperAccountNumber>".$sid."</ShipperAccountNumber>".$xmend;
  1653. $xml .= "<ShippingPaymentType>S</ShippingPaymentType>".$xmend;
  1654. $xml .= "<BillingAccountNumber>".$sid."</BillingAccountNumber>".$xmend;
  1655. ///$xml .= "<DutyPaymentType>R</DutyPaymentType>".$xmend;//R为收件人付关税 S发件人付关税
  1656. $xml .= "</Billing>".$xmend;
  1657. $xml .= "<Consignee>".$xmend;
  1658. $xml .= "<CompanyName>".$data['name']."</CompanyName>".$xmend;//收货人名称
  1659. /**
  1660. if(strlen($data['address'].$data['address2']) > 44)
  1661. {
  1662. $adl = $data['address'].$data['address2'];
  1663. $adl1 = substr($adl,0,44);//截取44字符前内容
  1664. $adlnum = strripos($adl1," ");//查找最后一次出现空格位置
  1665. $adl1 = substr($adl,0,$adlnum);//0到空格前之间的内容
  1666. $adl2 = substr($adl,$adlnum+1,strlen($adl));//空格后到最后的内容
  1667. $xml .= "<AddressLine1>".$adl1."</AddressLine1>".$xmend;//收货人地址1
  1668. $xml .= "<AddressLine2>".$adl2."</AddressLine2>".$xmend;//收货人地址2
  1669. }
  1670. **/
  1671. if($data['address2'])
  1672. {
  1673. //$adl = $data['address'].$data['address2'];
  1674. //$adl1 = substr($adl,0,44);//截取44字符前内容
  1675. //$adlnum = strripos($adl1," ");//查找最后一次出现空格位置
  1676. //$adl1 = substr($adl,0,$adlnum);//0到空格前之间的内容
  1677. //$adl2 = substr($adl,$adlnum+1,strlen($adl));//空格后到最后的内容
  1678. $xml .= "<AddressLine1>".$data['address']."</AddressLine1>".$xmend;//收货人地址1
  1679. $xml .= "<AddressLine2>".$data['address2']."</AddressLine2>".$xmend;//收货人地址2
  1680. }
  1681. else
  1682. {
  1683. $xml .= "<AddressLine1>".$data['address'].$data['address2']."</AddressLine1>".$xmend;//收货人地址
  1684. }
  1685. if($data['street'] != '')
  1686. {
  1687. $xml .= "<AddressLine>".$data['street']."</AddressLine>".$xmend;//收货人街道
  1688. }
  1689. $xml .= "<City>".$data['city']."</City>".$xmend;//城市
  1690. if($data['lb'] == 'US')
  1691. {
  1692. $xml .= "<DivisionCode>".$data['province']."</DivisionCode>".$xmend;//州代码,仅美国
  1693. }
  1694. $xml .= "<PostalCode>".trim($data['zipcode'],' ')."</PostalCode>".$xmend;//邮编
  1695. $xml .= "<CountryCode>".$data['lb']."</CountryCode>".$xmend;//国家代码
  1696. $xml .= "<CountryName>".$data['country']."</CountryName>".$xmend;//国家名称
  1697. $xml .= "<Contact>".$xmend;
  1698. $xml .= "<PersonName>".$data['client']."</PersonName>".$xmend;//名称
  1699. $xml .= "<PhoneNumber>".preg_replace('/\D/s','',$data['phone'])."</PhoneNumber>".$xmend;//联系方式
  1700. //$xml .= "<Email>".$data['email']."</Email>".$xmend;//联系邮箱
  1701. $xml .= "</Contact>".$xmend;
  1702. $xml .= "</Consignee>".$xmend;
  1703. $xml .= "<Commodity>".$xmend;//多商品循环此外层标签及内层标签
  1704. $xml .= "<CommodityCode>".$hgbm."</CommodityCode>".$xmend;//商品编码
  1705. $xml .= "<CommodityName>".$data['sbpm']."</CommodityName>".$xmend;//商品名称
  1706. $xml .= "</Commodity>".$xmend;
  1707. $xml .= "<Dutiable>".$xmend;
  1708. $xml .= "<DeclaredValue>".$data['zsbjz']."</DeclaredValue>".$xmend;//申报价值
  1709. $xml .= "<DeclaredCurrency>".$data['currencytitle']."</DeclaredCurrency>".$xmend;//货币代码
  1710. $xml .= "<TermsOfTrade>DAP</TermsOfTrade>".$xmend;//贸易条款
  1711. $xml .= "</Dutiable>".$xmend;
  1712. /** 发票信息开始 **/
  1713. $xml .= "<UseDHLInvoice>Y</UseDHLInvoice>".$xmend;
  1714. $xml .= "<DHLInvoiceLanguageCode>en</DHLInvoiceLanguageCode>".$xmend;
  1715. $xml .= "<DHLInvoiceType>CMI</DHLInvoiceType>".$xmend;
  1716. $xml .= "<ExportDeclaration>".$xmend;
  1717. $xml .= "<ExportReasonCode>P</ExportReasonCode>".$xmend;
  1718. if(strlen($data['paypal']) > 30)
  1719. {
  1720. $xml .= "<InvoiceNumber>".str_replace(array('-'),array(''),$data['paypal'])."</InvoiceNumber>".$xmend;
  1721. }
  1722. else
  1723. {
  1724. $xml .= "<InvoiceNumber>".$data['paypal'].' '.$data['pay']."</InvoiceNumber>".$xmend;
  1725. }
  1726. $xml .= "<InvoiceDate>".date('Y-m-d',time())."</InvoiceDate>".$xmend;
  1727. /**
  1728. $xml .= "<BillToContactName>".$data['client']."</BillToContactName>".$xmend;
  1729. $xml .= "<BillToContanctName>".$data['client']."</BillToContanctName>".$xmend;//账单名称
  1730. $xml .= "<BillToAddressLine1><BillToAddressLine1>";//地址1
  1731. $xml .= "<BillToAddressLine2><BillToAddressLine2>";//地址2
  1732. $xml .= "<BillToCity>".$data['baddress'][4]."</BillToCity>".$xmend;//城市
  1733. $xml .= "<BillToPostcode>".$data['baddress'][2]."</BillToPostcode>".$xmend;//邮编
  1734. $xml .= "<BillToSuburb/>".$xmend;//所在郊区
  1735. if($data['baddress'][1] == 'United States')
  1736. {
  1737. $xml .= "<BillToState>".$data['baddress'][3]."</BillToState>".$xmend;//省、州
  1738. }
  1739. $xml .= "<BillToCountryName>".$data['baddress'][1]."</BillToCountryName>".$xmend;//国家
  1740. $xml .= "<BillToPhoneNumber>".preg_replace('/\D/s','',$data['baddress'][0])."</BillToPhoneNumber>".$xmend;//号码
  1741. **/
  1742. $xml .= "<ExportLineItem>".$xmend;
  1743. $xml .= "<LineNumber>1</LineNumber>".$xmend;//顺序号
  1744. $xml .= "<Quantity>".$data['ts']."</Quantity>".$xmend;//数量
  1745. $xml .= "<QuantityUnit>PCS</QuantityUnit>".$xmend;//单位
  1746. $xml .= "<Description>".$data['sbpm']."</Description>".$xmend;//品名
  1747. $xml .= "<Value>".$data['dtsbjz']."</Value>".$xmend;//单价
  1748. $xml .= "<IsDomestic>Y</IsDomestic>".$xmend;//是否国产,Y本国,N国外
  1749. $xml .= "<CommodityCode>".$hgbm."</CommodityCode>".$xmend;//品名编码
  1750. $xml .= "<Weight>".$xmend;
  1751. $xml .= "<Weight>".$data['zzl']."</Weight>".$xmend;//净重
  1752. $xml .= "<WeightUnit>K</WeightUnit>".$xmend;//重量单位,K千克
  1753. $xml .= "</Weight>".$xmend;
  1754. $xml .= "<GrossWeight>".$xmend;
  1755. $xml .= "<Weight>".$data['zzl']."</Weight>".$xmend;//毛重
  1756. $xml .= "<WeightUnit>K</WeightUnit>".$xmend;//毛重单位,K千克
  1757. $xml .= "</GrossWeight>".$xmend;
  1758. $xml .= "<ManufactureCountryCode>CN</ManufactureCountryCode>".$xmend;//原产国国家代码
  1759. $xml .= "<ManufactureCountryName>CHINA</ManufactureCountryName>".$xmend;//原产国名称
  1760. $xml .= "</ExportLineItem>".$xmend;
  1761. $xml .= "<PlaceOfIncoterm>PEK PORT</PlaceOfIncoterm>".$xmend;//适用港口
  1762. $xml .= "</ExportDeclaration>".$xmend;
  1763. /** 发票信息结束 **/
  1764. $xml .= "<Reference>".$xmend;
  1765. $xml .= "<ReferenceID>".$data['number']."</ReferenceID>".$xmend;
  1766. $xml .= "</Reference>".$xmend;
  1767. $xml .= "<ShipmentDetails>".$xmend;
  1768. ///$xml .= "<NumberOfPieces>".$data['zjs']."</NumberOfPieces>".$xmend;
  1769. $xml .= "<Pieces>".$xmend;
  1770. $xml .= $Pieces;
  1771. $xml .= "</Pieces>".$xmend;
  1772. ///$xml .= "<Weight>".$data['zzl']."</Weight>".$xmend;
  1773. $xml .= "<WeightUnit>K</WeightUnit>".$xmend;
  1774. $xml .= "<GlobalProductCode>P</GlobalProductCode>".$xmend;
  1775. $xml .= "<LocalProductCode>P</LocalProductCode>".$xmend;
  1776. $xml .= "<Date>".date('Y-m-d',time())."</Date>".$xmend;
  1777. $xml .= "<Contents>".$data['sbpm']."</Contents>".$xmend;//内容
  1778. ///$xml .= "<DoorTo>DD</DoorTo>".$xmend;
  1779. $xml .= "<DimensionUnit>C</DimensionUnit>".$xmend;
  1780. ///$xml .= "<InsuredAmount>".$data['bx']."</InsuredAmount>".$xmend;//保险金额
  1781. $xml .= "<PackageType>EE</PackageType>".$xmend;
  1782. $xml .= "<IsDutiable>Y</IsDutiable>".$xmend;
  1783. $xml .= "<CurrencyCode>".$data['currencytitle']."</CurrencyCode>".$xmend;//货币代码
  1784. $xml .= "</ShipmentDetails>".$xmend;
  1785. $xml .= "<Shipper>".$xmend;
  1786. $xml .= "<ShipperID>".$sid."</ShipperID>".$xmend;
  1787. $xml .= "<CompanyName>LongYing</CompanyName>".$xmend;//发货公司名称
  1788. $xml .= "<AddressLine1>LongYingShiYe, Yinghao Rd.</AddressLine1>".$xmend;//发货地址
  1789. $xml .= "<AddressLine2>Shangji Economic Development Zone</AddressLine2>".$xmend;//发货地址
  1790. $xml .= "<City>".$data['warehouse']['city']."</City>".$xmend;//发货城市
  1791. $xml .= "<PostalCode>".$data['warehouse']['zipcode']."</PostalCode>".$xmend;
  1792. $xml .= "<CountryCode>CN</CountryCode>".$xmend;//发货国家代码
  1793. $xml .= "<CountryName>CHINA</CountryName>".$xmend;//发货国家名称
  1794. $xml .= "<Contact>".$xmend;
  1795. $xml .= '<PersonName>GeMengTi</PersonName>'.$xmend;//发货人 '.$data['warehouse']['company'].'
  1796. $xml .= '<PhoneNumber>15939964739</PhoneNumber>'.$xmend;
  1797. $xml .= "</Contact>".$xmend;
  1798. $xml .= "<RegistrationNumbers>".$xmend;
  1799. $xml .= "<RegistrationNumber>".$xmend;
  1800. $xml .= '<Number>91411002MA3X46XC9K</Number>'.$xmend;
  1801. $xml .= '<NumberTypeCode>VAT</NumberTypeCode>'.$xmend;
  1802. $xml .= '<NumberIssuerCountryCode>CN</NumberIssuerCountryCode>'.$xmend;
  1803. $xml .= "</RegistrationNumber>".$xmend;
  1804. $xml .= "</RegistrationNumbers>".$xmend;
  1805. $xml .= "</Shipper>".$xmend;
  1806. /** 无纸化 PLT 开始 **/
  1807. $xml .= "<SpecialService>".$xmend;
  1808. $xml .= "<SpecialServiceType>WY</SpecialServiceType>".$xmend;
  1809. $xml .= "</SpecialService>".$xmend;
  1810. /** 无纸化 PLT 结束 **/
  1811. if($data['bx'] > 0)
  1812. {
  1813. $xml .= "<SpecialService>".$xmend;
  1814. $xml .= "<SpecialServiceType>II</SpecialServiceType>".$xmend;
  1815. $xml .= "<ChargeValue>".$data['bx']."</ChargeValue>".$xmend;
  1816. $xml .= "<CurrencyCode>USD</CurrencyCode>".$xmend;
  1817. $xml .= "</SpecialService>".$xmend;
  1818. }
  1819. $xml .= "<LabelImageFormat>PDF</LabelImageFormat>".$xmend;
  1820. /** 无纸化 PLT 启用这个 **/
  1821. $xml .= "<RequestArchiveDoc>N</RequestArchiveDoc>".$xmend;
  1822. /** 无纸化 PLT 启用这个 **/
  1823. /** 无纸化 PLT 关闭这个 **/
  1824. //$xml .= "<RequestArchiveDoc>Y</RequestArchiveDoc>".$xmend;
  1825. //$xml .= "<NumberOfArchiveDoc>1</NumberOfArchiveDoc>".$xmend;
  1826. /** 无纸化 PLT 关闭这个 **/
  1827. $xml .= "<Label>".$xmend;
  1828. $xml .= "<HideAccount>N</HideAccount>".$xmend;
  1829. $xml .= "<LabelTemplate>8X4_PDF</LabelTemplate>".$xmend;
  1830. $xml .= "<CustomsInvoiceTemplate>COMMERCIAL_INVOICE_P_10</CustomsInvoiceTemplate>".$xmend;
  1831. $xml .= "<Resolution>200</Resolution>".$xmend;
  1832. $xml .= "</Label>".$xmend;
  1833. $xml .= "</req:ShipmentRequest>".$xmend;
  1834. echo "<pre>";
  1835. echo $xml;
  1836. exit;
  1837. $ch = curl_init();
  1838. curl_setopt($ch, CURLOPT_URL,'https://xml-api.dhl.com/XMLShippingServlet');
  1839. curl_setopt($ch, CURLOPT_POST, 1);
  1840. curl_setopt($ch, CURLOPT_HEADER, 0);
  1841. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  1842. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  1843. curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
  1844. curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
  1845. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  1846. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,15);
  1847. $data = curl_exec($ch);
  1848. curl_close($ch);
  1849. $data = utf8_encode($data);
  1850. libxml_disable_entity_loader(true);
  1851. @$values = json_decode(json_encode(simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
  1852. }
  1853. }