Ac.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Ac extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->_model('Model_shop','shop');
  6. $this->load->_model('Model_fullorder','fullorder');
  7. $this->load->_model('Model_fullordertt','fullordertt');
  8. $this->load->_model('Model_fullorderxw','fullorderxw');
  9. $this->load->_model('Model_fullordersmt','fullordersmt');
  10. $this->load->_model('Model_fullorder_2020','fullorder2020');
  11. $this->load->_model('Model_fullordersmt_2020','fullordersmt2020');
  12. $this->load->_model('Model_customersmt','customersmt');
  13. $this->load->_model('Model_country','country');
  14. $this->load->_model('Model_hl','hl');
  15. $this->load->_model('Model_is','is');
  16. $this->load->_model('Model_kdniao','kdniao');
  17. $this->load->_model('Model_typeclass','typeclass');
  18. $this->load->_model('Model_warehouse','warehouse');
  19. $this->load->_model('Model_fullorderexcel','fullorderexcel');
  20. $this->load->_model('Model_dhl','dhl');
  21. $this->load->_model('Model_usps','usps');
  22. $this->load->_model('Model_dhltest','dhltest');
  23. $this->load->_model('Model_customer','customer');
  24. $this->load->_model('Model_express','express');
  25. $this->load->_model('Model_notice','notice');
  26. $this->load->_model('Model_whlabel','whlabel');
  27. $this->load->_model('Model_productdescribe','productdescribe');
  28. $this->load->_model('Model_ljg','ljg');
  29. $this->load->_model('Model_commodityread','commodityread');
  30. $this->load->_model('Model_service','service');
  31. $this->load->_model('Model_fedex','fedex');
  32. $this->load->_model('Model_commodity','commodity');
  33. $this->load->_model('Model_fullordersmtorder','fullordersmtorder');
  34. $this->load->_model('Model_ali','ali');
  35. $this->load->_model('Model_fullordersmthb','fullordersmthb');
  36. $this->load->_model('Model_fullordersmtbf','fullordersmtbf');
  37. $this->load->_model('Model_taxzhengzhou','taxzhengzhou');
  38. $this->load->_model('Model_taxshanghai','taxshanghai');
  39. $this->load->_model('Model_excel','excel');
  40. $this->load->_model('Model_ups','ups');
  41. $this->load->_model('Model_dpd','dpd');
  42. $this->load->_model('Model_dpdold','dpdold');
  43. $this->load->_model('Model_dpd_IOSS','dpd_IOSS');
  44. $this->load->_model('Model_dpdxw','dpdxw');
  45. $this->load->_model('Model_cne','cne');
  46. $this->load->_model('Model_outbound','outbound');
  47. $this->load->_model('Model_api','api');
  48. $this->load->_model('Model_dhlhz','dhlhz');
  49. $this->load->_model('Model_apismt','apismt');
  50. $this->load->_model('Model_specialstock','specialstock');
  51. $this->load->_model('Model_systemwigsout','systemwigsout');
  52. $this->load->_model('Model_purchaseorder','purchaseorder');
  53. $this->load->_model('Model_returns','returns');
  54. $this->load->_model('Model_whlabellabel','whlabellabel');
  55. $this->load->_model('Model_whlabelbarcode','whlabelbarcode');
  56. $this->load->_model('Model_tjadd','tjadd');
  57. $this->load->_model('Model_stafflist','stafflist');
  58. $this->load->_model('Model_paypal','paypal');
  59. $this->load->_model('Model_warehousefactory','warehousefactory');
  60. $this->load->_model('Model_commodityread_del','commodityreaddel');
  61. $this->load->_model('Model_als','als');
  62. $this->load->_model('Model_allocation','allocation');
  63. $this->load->_model('Model_17track','17track');
  64. $this->load->_model('Model_hualei','hualei');
  65. $this->load->_model('Model_hualeiv1','hualeiv1');
  66. $this->load->_model('Model_hualeixw','hualeixw');
  67. $this->load->_model('Model_ck','ck');
  68. $this->load->_model('Model_colour','colour');
  69. $this->load->_model('Model_color','color');
  70. $this->load->_model('Model_emaildata','emaildata');
  71. $this->load->_model('Model_wigprint','wigprint');
  72. $this->load->_model('Model_weight','weight');
  73. $this->load->_model('Model_whlabeltransport','whlabeltransport');
  74. $this->load->_model('Model_pay','pay');
  75. $this->load->_model('Model_orderurl','orderurl');
  76. $this->load->_model('Model_classid','classid');
  77. $this->load->_model('Model_whlabel','whlabel');
  78. $this->load->_model('Model_systemtransfer','systemtransfer');
  79. $this->load->_model('Model_whlabel_bh','whlabel_bh');
  80. $this->load->_model('Model_excel','excel');
  81. $this->load->_model('Model_yuntu','yuntu');
  82. $this->load->_model('Model_fedex_ficp','fedex_ficp');
  83. $this->load->_model('Model_fedexv1','fedexv1');
  84. $this->load->_model('Model_fedexv1','fedexv1');
  85. $this->load->_model("Model_zxyuntu","zxyuntu");
  86. $this->load->_model("Model_customsdeclaration","customsdeclaration");
  87. $this->load->_model('Model_yuntuuk','yuntuuk');
  88. }
  89. //定义方法的调用规则 获取URI第二段值
  90. public function _remap($arg,$arg_array)
  91. {
  92. if($arg == 'x3')
  93. {
  94. $this->_x3($arg_array);
  95. }
  96. else if($arg == 'qk')
  97. {
  98. $this->_qk();
  99. }
  100. else if($arg == 'qczd')
  101. {
  102. $this->_qczd($arg_array);
  103. }
  104. else if($arg == 'd')
  105. {
  106. $this->_d($arg_array);
  107. }
  108. else if($arg == 'w')
  109. {
  110. $this->_w($arg_array);
  111. }
  112. else if($arg == 'wz')
  113. {
  114. $this->_wz($arg_array);//改仓库位置
  115. }
  116. else if($arg == 'qkyy')
  117. {
  118. $this->_qkyy($arg_array);//清除备货用友数据
  119. }
  120. else if($arg == 'cxxq')
  121. {
  122. $this->_cxxq($arg_array);//查询独立站订单详情
  123. }
  124. else if($arg == 'user')
  125. {
  126. $this->_user($arg_array);//批量添加店铺权限
  127. }
  128. }
  129. public function _x3($arg_array)
  130. {
  131. die;
  132. $fullorder = $this->fullorder->get_number($arg_array[0]);
  133. if(!$fullorder)
  134. {
  135. $fullorder = $this->fullordersmt->get_number($arg_array[0]);
  136. }
  137. if(!$fullorder)
  138. {
  139. $fullorder = $this->fullordertt->get_number($arg_array[0]);
  140. }
  141. if(!$fullorder)
  142. {
  143. $fullorder = $this->fullorderxw->get_number($arg_array[0]);
  144. }
  145. if(!$fullorder)
  146. {
  147. echo "编号错误";exit;
  148. }
  149. /** 发票地址信息暂时无用
  150. $fullorder['baddress'] = explode(',',$fullorder['baddress']);
  151. $fullorder['baddress'] = array_reverse($fullorder['baddress']);
  152. $fullorder['baddress'][1] = $country['ename'];
  153. **/
  154. //获取所用相关信息
  155. $warehouse = $this->warehouse->read($fullorder['type']);
  156. $country = $this->country->read($fullorder['country']);//订单国家信息
  157. $fcountry = $this->country->read($warehouse['country']);//仓库国家信息
  158. $warehouse['country'] = $fcountry['ename'];//仓库国家名
  159. $warehouse['lb'] = $fcountry['lb'];//仓库国家编码
  160. $fullorder['warehouse'] = $warehouse;//仓库数据加入订单
  161. $fullorder['lb'] = $country['lb'];//订单国家编码加入
  162. $fullorder['country'] = $country['ename'];//订单国家名
  163. $fullorder['zhou'] = $country['continent'];//所属州
  164. $express = $this->express->read($fullorder['express']);
  165. $fullorder['express'] = $express['servicename'];
  166. $fullorder['account'] = $express['account'];
  167. $fullorder['printcode'] = $express['printcode'];
  168. $fullorder['time'] = date('Y-m-d',time());
  169. $fullorder['times'] = date('Y-m-d H:i',time());
  170. $declara_info = $this->customsdeclaration->find("ename like '%".trim($fullorder['sbpm'])."%' ","*");
  171. //var_dump($declara_info);
  172. $sbbm = "";
  173. if(empty($declara_info)){
  174. $sbbm = "";
  175. }else{
  176. $sbbm = $declara_info['bname'];
  177. }
  178. $fullorder['sbbm']= $sbbm;
  179. $fullorder['address'] = str_replace(array('&'),array('&#38;'),$fullorder['address']);
  180. $fullorder['address2'] = str_replace(array('&'),array('&#38;'),$fullorder['address2']);
  181. $fullorder['shipremarks'] = str_replace(array('&lt;','&gt;'),array('<','>'),$fullorder['shipremarks']);
  182. $fullorder['shipremarks'] = str_replace(array('<','>',';',';'),array('&lt','&gt',';<br>',';<br>'),$fullorder['shipremarks']);
  183. $shop = $this->shop->read($fullorder['shop']);
  184. $fullorder['shop'] = $shop['shopname'];
  185. $fullorder['city'] = preg_replace('/( | | |\s)/',' ',$fullorder['city']);
  186. $fullorder['province'] = preg_replace('/( | | |\s)/',' ',$fullorder['province']);
  187. if(is_numeric($fullorder['pay']))
  188. {
  189. $pay = $this->typeclass->read($fullorder['pay']);
  190. if($pay['classid'] == '4')
  191. {
  192. $fullorder['pay'] = $pay['title'];
  193. }
  194. }
  195. if($fullorder['printcode'] != "USPS")
  196. {
  197. $fullorder['client'] = htmlspecialchars($fullorder['client']);
  198. $fullorder['name'] = htmlspecialchars($fullorder['name']);
  199. }
  200. //增加退货单所需信息
  201. $pt = '';
  202. $fpdata = explode(';',trim($fullorder['fpdata'],';'));
  203. foreach ($fpdata as $v)
  204. {
  205. $p = explode('|',trim($v,'|'));
  206. //$pt .= '<p>'.$p[1].' * '.$p[2].'</p>';
  207. }
  208. $fullorder['pt'] = $pt;
  209. $fullorder['printnumber'] = 2;
  210. // $fullorder['address'] = "221 5TH ST # APT305";
  211. // $fullorder['city'] = "W SACRAMENTO";
  212. // echo "<pre>";
  213. // var_dump($fullorder['sbbm']);
  214. // die;
  215. //$fullorder['printcode'] = 'HUALEIXW-FEDEX';
  216. //$fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  217. //$fullorder['sbbm']= 4202320000;//($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  218. //$fullorder['sbpm']= 'eyelashes';
  219. //$fullorder['zwpm']= '假睫毛';
  220. //$fullorder['sbpm']= 'Satin Bag';
  221. //$fullorder['zwpm']= '袋子';
  222. //$fullorder['hgbm']= 4202320000;
  223. //$fullorder['address'] = '1653 Treutlan Place';
  224. //$fullorder['address2'] = '';
  225. //$fullorder['qm'] = 2;
  226. //$notice = $this->notice->read(6);
  227. //$fcountry['warehouse']['name'] = 'Hair Me Please LLC';
  228. //$fullorder['cxcode'] = strtolower($express['cxcode']);
  229. //$barcode = $this->fedex->get_logistics($fullorder);//获取联邦快递信息
  230. //echo $fullorder['name'];
  231. //$b = $this->yuntu->get_data($fullorder);
  232. //$b = $this->usps->get_logistics($fullorder);
  233. // $fullorder['printcode'] = 'HUALEI-DHL';
  234. // $fullorder['js'] = 2;
  235. // $fullorder['bx'] = 110;
  236. //$fullorder['qm'] = 1;
  237. echo "<pre>";
  238. print_r($fullorder);
  239. die;
  240. $b = $this->hualeiv1->get_data($fullorder);
  241. print_r($b);
  242. die;
  243. //$fullorder['printcode'] = 'usps_priority';
  244. // $b = $this->usps->get_data($fullorder);
  245. // print_r($b);
  246. // die;
  247. // echo "<pre>";
  248. // $b = $this->fedexv1->get_data($fullorder);
  249. // var_dump($b);
  250. //echo $fullorder['zzl'];
  251. // echo "<pre>";
  252. // var_dump($fullorder);
  253. // $b = $this->dhl->get_data($fullorder);
  254. // $b = $this->ups->get_data($fullorder);
  255. // echo "<pre>";
  256. // print_r($b);
  257. // $this->_pdf($b['labelImage'],"test",date("Ymd"));
  258. }
  259. public function get_data($data)
  260. {
  261. $ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI','guam'=>'GU','puerto rico'=>'PR');
  262. $data['province'] = preg_replace('/( | | |\s)/',' ',$data['province']);
  263. $data['province'] = trim($data['province'],' ');
  264. $dataprovince = strlen($data['province'])==2?$data['province']:$ToState[strtolower($data['province'])];
  265. $data['address'] = str_replace(array('#','&#38;','&'),array('%23','%26'),$data['address']);
  266. $data['address2'] = str_replace(array('#','&#38;','&'),array('%23','%26'),$data['address2']);
  267. $data['client'] = str_replace(array('#','&#38;','&'),array('%23','%26'),$data['client']);
  268. $data['name'] = str_replace(array('#','&#38;','&'),array('%23','%26'),$data['name']);
  269. $data['name'] = str_replace(' ',' ',$data['name']);
  270. $xml = "";
  271. $xml .= "<eVSRequest USERID='050GHAIR7974'>";
  272. $xml .= "<Option></Option>";
  273. $xml .= "<Revision>1</Revision>";
  274. $xml .= "<ImageParameters>";
  275. $xml .= "<ImageParameter>4X6LABELP</ImageParameter>";
  276. $xml .= "</ImageParameters>";
  277. $xml .= "<FromName>Kenny Kwok</FromName>";//发件人姓名或公司
  278. $xml .= "<FromFirm>Long Human Hair Factory Inc</FromFirm>";//发件人姓名或公司
  279. $xml .= "<FromAddress1></FromAddress1>";//发件人地址1 公寓或套房号码 不超过50个字符
  280. $xml .= "<FromAddress2>819 6th Avenue Store front</FromAddress2>";//发件人地址2
  281. $xml .= "<FromCity>New York</FromCity>";//发件人城市
  282. $xml .= "<FromState>NY</FromState>";//发件人所属州
  283. $xml .= "<FromZip5>10001</FromZip5>";//发件人邮政编码
  284. $xml .= "<FromZip4></FromZip4>";//发件人邮编2
  285. $xml .= "<FromPhone>8455583605</FromPhone>";//发件人电话,10位
  286. $xml .= "<AllowNonCleansedOriginAddr>true</AllowNonCleansedOriginAddr>";//是否检查地址 true不检查
  287. $xml .= "<ToName>".$data['name']."</ToName>";//收件人名称
  288. $xml .= "<ToFirm></ToFirm>";//收件人名称
  289. if($data['address2'] == "")
  290. {
  291. $xml .= "<ToAddress1>".$data['address2']."</ToAddress1>";//收件人地址1 不超过50个字符
  292. $xml .= "<ToAddress2>".$data['address']."</ToAddress2>";//收件人地址2
  293. }
  294. else
  295. {
  296. $xml .= "<ToAddress1>".$data['address']."</ToAddress1>";//收件人地址1 不超过50个字符
  297. $xml .= "<ToAddress2>".$data['address2']."</ToAddress2>";//收件人地址2
  298. }
  299. $xml .= "<ToCity>".$data['city']."</ToCity>";//收件人城市
  300. $xml .= "<ToState>".$dataprovince."</ToState>";//收件人州
  301. $xml .= "<ToZip5>".trim($data['zipcode'],' ')."</ToZip5>";//收件人邮编
  302. $xml .= "<ToZip4></ToZip4>";//收件人邮编2
  303. $xml .= "<ToPhone></ToPhone>";//收件人电话
  304. $xml .= "<POBox></POBox>";//目标地址是否为邮政信箱。
  305. if($data['qm']==1 && $data['js'] == 1)//如果需要签名,并且快递服务选择优先
  306. {
  307. $ServiceType = 'PRIORITY';
  308. $Container = 'FLAT RATE ENVELOPE';
  309. $ExtraService = '156';
  310. $ExtraServicebx = '125';
  311. }
  312. else if($data['qm']==1 && $data['js'] == 0)//如果需要签名,并且快递服务不选择优先
  313. {
  314. $ServiceType = 'FIRST CLASS';
  315. $Container = 'VARIABLE';
  316. $ExtraService = '120';
  317. $ExtraServicebx = '100';
  318. }
  319. else if($data['qm']==1 && $data['js'] == 2)//如果需要签名,并且快递服务选择PRIORITY EXPRESS
  320. {
  321. $ServiceType = 'PRIORITY EXPRESS';
  322. $Container = 'FLAT RATE ENVELOPE';
  323. $ExtraServicebx = '101';
  324. }
  325. else if($data['qm']==0 && $data['js'] == 1)//如果不需要签名,并且快递服务选择优先
  326. {
  327. $ServiceType = 'PRIORITY';
  328. $Container = 'FLAT RATE ENVELOPE';
  329. $ExtraServicebx = '125';
  330. }
  331. else if($data['qm']==0 && $data['js'] == 0)//如果不需要签名,并且快递服务不选择优先
  332. {
  333. $ServiceType = 'FIRST CLASS';
  334. $Container = 'VARIABLE';
  335. $ExtraServicebx = '100';
  336. }
  337. else if($data['qm']==0 && $data['js'] == 3)//如果不需要签名,并且快递服务不选择优先
  338. {
  339. $ServiceType = 'Standard Mail Marketing Parcel';
  340. $Container = 'VARIABLE';
  341. $ExtraServicebx = '100';
  342. }
  343. else if($data['qm']==0 && $data['js'] == 2)//如果不需要签名,并且快递服务选择PRIORITY EXPRESS
  344. {
  345. $ServiceType = 'PRIORITY EXPRESS';
  346. $Container = 'FLAT RATE ENVELOPE';
  347. $ExtraServicebx = '125';
  348. }
  349. if($data['email'])
  350. {
  351. if(strlen($data['email']) < 60 && stripos($data['email'],'tiktok') === false)
  352. {
  353. $xml .= "<ToContactPreference>EMAIL</ToContactPreference>";
  354. $xml .= "<ToContactEMail>".$data['email']."</ToContactEMail>";
  355. }
  356. }
  357. $xml .= "<AllowNonCleansedDestAddr>false</AllowNonCleansedDestAddr>";
  358. $xml .= "<WeightInOunces>".$data['zzl']."</WeightInOunces>";//重量
  359. $xml .= "<ServiceType>".$ServiceType."</ServiceType>";//服务类型
  360. $xml .= "<Container>".$Container."</Container>";//货物类型
  361. $xml .= "<Width></Width>";//可选
  362. $xml .= "<Length></Length>";//可选
  363. $xml .= "<Height></Height>";//可选
  364. $xml .= "<Machinable></Machinable>";//可选
  365. $xml .= "<ProcessingCategory></ProcessingCategory>";//可选
  366. $xml .= "<PriceOptions></PriceOptions>";//可选
  367. $xml .= "<InsuredAmount>".$data['bx']."</InsuredAmount>";//保险金 可选
  368. $xml .= "<AddressServiceRequested>True</AddressServiceRequested>";//可选 客户变更地址提醒
  369. /**
  370. $data['qm'] = ($data['qm']==1)?'False':'True';
  371. if($data['qm'] == 'False')
  372. {
  373. $xml .= "<ExpressMailOptions>";
  374. //$xml .= "<DeliveryOption>1</DeliveryOption>";//可选 交付选择 默认1:正常交付
  375. $xml .= "<WaiverOfSignature>".$data['qm']."</WaiverOfSignature>";//可选 接收签名用False
  376. $xml .= "</ExpressMailOptions>";
  377. }
  378. **/
  379. if($data['qm']==1 && $data['js'] == 2)
  380. {
  381. $xml .= "<ExpressMailOptions>";
  382. //$xml .= "<DeliveryOption>1</DeliveryOption>";//可选 交付选择 默认1:正常交付
  383. $xml .= "<WaiverOfSignature>FALSE</WaiverOfSignature>";//可选 接收签名用False
  384. $xml .= "</ExpressMailOptions>";
  385. }
  386. $xml .= "<ShipDate>".date('m/d/Y',time()-(12*3600)+($data['yc']*24*3600))."</ShipDate>";//可选 发货日期 当前至7天 格式 mm/ dd/ yyyy 延迟发货
  387. //$xml .= "<ReturnCommitments>true</ReturnCommitments>";
  388. $xml .= "<CustomerRefNo>".$data['number']."</CustomerRefNo>";//可选 内部编号显示在运单 不超过19字符
  389. $xml .= "<ExtraServices>";
  390. if(isset($ExtraService))
  391. {
  392. $xml .= "<ExtraService>".$ExtraService."</ExtraService>";//可选额外服务
  393. }
  394. if($data['bx'] > 0)
  395. {
  396. $xml .= "<ExtraService>".$ExtraServicebx."</ExtraService>";//可选额外服务
  397. }
  398. $xml .= "</ExtraServices>";
  399. $xml .= "<ReceiptOption>NONE</ReceiptOption>";//可选打印布局SEPARATE PAGE 或NONE
  400. $xml .= "<ImageType>PDF</ImageType>";//输出类型
  401. $xml .= "<HoldForManifest>Y</HoldForManifest>";
  402. $xml .= "<PrintCustomerRefNo>true</PrintCustomerRefNo>";//内部编号显示要用这个标签
  403. $xml .= "</eVSRequest>";
  404. /** 直连 **/
  405. $ch = curl_init();
  406. $url = 'https://secure.shippingapis.com/ShippingAPI.dll?API=eVS&XML='.$xml;
  407. $url = str_replace(" ",'%20',$url);
  408. curl_setopt($ch,CURLOPT_URL,$url);
  409. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  410. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,0);
  411. curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts
  412. curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
  413. curl_setopt($ch,CURLOPT_TIMEOUT,25);
  414. $data = curl_exec($ch);
  415. curl_close($ch);
  416. $data = utf8_encode($data);
  417. libxml_disable_entity_loader(true);
  418. // @$values = json_decode(json_encode(simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
  419. return $data;
  420. /**
  421. $ch = curl_init();
  422. $url = 'http://z.wepolicy.cn/usps.php?XML='.$xml;
  423. $url = str_replace(" ",'%20',$url);
  424. curl_setopt($ch,CURLOPT_URL,$url);
  425. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  426. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,0);
  427. curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts
  428. curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
  429. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,35);
  430. $data = curl_exec($ch);
  431. curl_close($ch);
  432. $data = json_decode($data,TRUE);
  433. return $data;
  434. //Description提示错误 LabelImage运单PDF BarcodeNumber运单号
  435. **/
  436. }
  437. public function _pdf($pdf,$title,$bctime)
  438. {
  439. $pdf_path = './data/pdf/'.$bctime.'/';
  440. $file_base64 = $pdf;
  441. $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);
  442. $file_base64 = base64_decode($file_base64);
  443. if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
  444. file_put_contents($pdf_path.$title.'.pdf',$file_base64);
  445. return $bctime;
  446. }
  447. public function _qk()//清空用友数据
  448. {
  449. $sc = array();
  450. $a = $this->fullorder->find_all("scapi = '99'");
  451. foreach ($a as $v)
  452. {
  453. if(stripos($v['scid'],'XD') === false || $v['scid'] == '|' || $v['scid'] == '')
  454. {
  455. $this->fullorder->save(array('scid'=>'','scapi'=>0,'dbapi'=>0),$v['id']);
  456. continue;
  457. }
  458. $b = explode('|',trim($v['scid'],'|'));
  459. $b = explode('~',trim($b[0],'~'));
  460. //$c = str_replace('XD','',$b[1]);
  461. if(strlen($b[1]) != 12)
  462. {
  463. $this->fullorder->save(array('scid'=>'','scapi'=>0,'dbapi'=>0),$v['id']);
  464. continue;
  465. }
  466. }
  467. echo "<pre>";
  468. print_r($sc);
  469. exit;
  470. }
  471. public function _w($arg_array)
  472. {
  473. $a = $this->whlabel->read($arg_array[0]);
  474. $s = $this->whlabel->find_all("features = '".$a['features']."'");
  475. echo "<pre>";
  476. print_r($a);
  477. echo "<pre>";
  478. print_r($s);
  479. exit;
  480. }
  481. public function _qczd($arg_array)//清空用友数据
  482. {
  483. $a = $this->whlabel->find_all("zd = '$arg_array[0]'");
  484. foreach ($a as $v)
  485. {
  486. $this->whlabel->save(array('zd'=>''),$v['id']);
  487. }
  488. }
  489. public function _d($arg_array)
  490. {
  491. $a = $this->fullorder->get_number($arg_array[0]);
  492. if(!$a)
  493. {
  494. //$a = $this->fullorder->get_orderinfo($arg_array[0]);
  495. if(!$a)
  496. {
  497. $a = $this->fullordersmt->get_number($arg_array[0]);
  498. if(!$a)
  499. {
  500. //$a = $this->fullordersmt->get_orderinfo($arg_array[0]);
  501. if(!$a)
  502. {
  503. $a = $this->fullordertt->get_number($arg_array[0]);
  504. if(!$a)
  505. {
  506. $a = $this->fullorderxw->get_number($arg_array[0]);
  507. if(!$a)
  508. {
  509. //$a = $this->fullordertt->get_orderinfo($arg_array[0]);
  510. }
  511. }
  512. }
  513. }
  514. }
  515. }
  516. if($a)
  517. {
  518. echo "<pre>";
  519. print_r($a);
  520. }
  521. else
  522. {
  523. echo "没有此数据";
  524. }
  525. exit;
  526. }
  527. public function _wz($arg_array)
  528. {
  529. if(!isset($arg_array[1]))
  530. {
  531. //echo "没有位置数据";
  532. return "没有位置数据";
  533. }
  534. $cid = $this->whlabellabel->find_all("cpid = '".$arg_array[0]."'");
  535. if(isset($cid[0]))
  536. {
  537. $w = $this->whlabel->find_all("number = '".$cid[0]['number']."' and warehouse = '13'");
  538. foreach ($w as $v)
  539. {
  540. $this->whlabel->save(array('details'=>$arg_array[1]),$v['id']);
  541. }
  542. echo json_encode(array('msg'=>'!','success'=>true));exit;
  543. //echo '成功';
  544. //echo "<pre>";
  545. //print_r($w);
  546. }
  547. }
  548. public function _qkyy($arg_array)//清空备货用友数据
  549. {
  550. $y = $this->whlabel_bh->read($arg_array[0]);
  551. if($y)
  552. {
  553. $this->whlabel_bh->save(array('scid'=>'','scapi'=>0,'dbapi'=>0,'state'=>0),$y['id']);
  554. echo 'ok';
  555. }
  556. else
  557. {
  558. echo '没有ID';
  559. }
  560. }
  561. public function _cxxq()//查询独立站订单详情
  562. {
  563. $value = $this->shop->read(3);
  564. $res = $this->get_hq($value['brandname'],$value['shopadmin'],$value);
  565. echo "<pre>";
  566. print_r($res);
  567. }
  568. public function get_hq($name,$shopapi,$shop)
  569. {
  570. $jqtime = ($name=='SuperNova')?24*3600:2*3600;
  571. $fromTime = time()-24*3600-$jqtime;//strtotime('yesterday')-$jqtime;//昨日0点+1小时保险无漏单
  572. $toTime = time();
  573. $post['cs'] = 1;
  574. $post['name'] = $name;
  575. $post['from'] = $fromTime;
  576. $post['to'] = $toTime;
  577. $ch = curl_init();
  578. curl_setopt($ch,CURLOPT_URL,$shopapi);
  579. curl_setopt($ch, CURLOPT_POST, 1);
  580. curl_setopt($ch, CURLOPT_HEADER, 0);
  581. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  582. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  583. curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
  584. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
  585. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  586. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1800000);
  587. $res = curl_exec($ch);
  588. curl_close($ch);
  589. if($res)
  590. {
  591. $res = json_decode($res,true);
  592. $x = array();
  593. foreach ($res as $v)
  594. {
  595. $source = '';
  596. $sc = substr($v['order_id'],0,3);
  597. if($sc == '600')
  598. {
  599. $source = $shop['thurl']; //手机订单
  600. }
  601. else
  602. {
  603. $source = $shop['url'];//PC订单
  604. }
  605. if($v['wjauthorid'] != '' && $v['sourcecontentid'] != '' && $source != '' && $shop['tweak'] != '')
  606. {
  607. $authorid = $this->authorid($source.'?author_id='.$v['wjauthorid'].'&source_content_id='.$v['sourcecontentid'],$shop['tweak']);
  608. if($authorid)
  609. {
  610. $v['authorid'] = $authorid;
  611. }
  612. }
  613. $x[] = $v;
  614. }
  615. return $x;
  616. }
  617. }
  618. public function _user($arg_array)//查询独立站订单详情
  619. {
  620. $id = $arg_array[0];
  621. $d = $arg_array[1];
  622. $shop = $this->shop->read($id);
  623. $value = $this->user->find_all("shop not like '|".$id."|' and shop like '%|".$d."|%'");
  624. foreach ($value as $v)
  625. {
  626. //$this->user->save(array('shop'=>$v['shop'].$id.'|','shoptext'=>$v['shoptext'].$shop[''].'|'),$v['id']);
  627. }
  628. echo "<pre>";
  629. print_r($value);
  630. }
  631. }