Ac.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  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_hualeixw','hualeixw');
  66. $this->load->_model('Model_ck','ck');
  67. $this->load->_model('Model_colour','colour');
  68. $this->load->_model('Model_color','color');
  69. $this->load->_model('Model_emaildata','emaildata');
  70. $this->load->_model('Model_wigprint','wigprint');
  71. $this->load->_model('Model_weight','weight');
  72. $this->load->_model('Model_whlabeltransport','whlabeltransport');
  73. $this->load->_model('Model_pay','pay');
  74. $this->load->_model('Model_orderurl','orderurl');
  75. $this->load->_model('Model_classid','classid');
  76. $this->load->_model('Model_whlabel','whlabel');
  77. $this->load->_model('Model_systemtransfer','systemtransfer');
  78. $this->load->_model('Model_whlabel_bh','whlabel_bh');
  79. $this->load->_model('Model_excel','excel');
  80. $this->load->_model('Model_yuntu','yuntu');
  81. $this->load->_model('Model_fedex_ficp','fedex_ficp');
  82. $this->load->_model('Model_fedexv1','fedexv1');
  83. }
  84. //定义方法的调用规则 获取URI第二段值
  85. public function _remap($arg,$arg_array)
  86. {
  87. if($arg == 'x3')
  88. {
  89. $this->_x3($arg_array);
  90. }
  91. else if($arg == 'qk')
  92. {
  93. $this->_qk();
  94. }
  95. else if($arg == 'qczd')
  96. {
  97. $this->_qczd($arg_array);
  98. }
  99. else if($arg == 'd')
  100. {
  101. $this->_d($arg_array);
  102. }
  103. else if($arg == 'w')
  104. {
  105. $this->_w($arg_array);
  106. }
  107. else if($arg == 'wz')
  108. {
  109. $this->_wz($arg_array);//改仓库位置
  110. }
  111. else if($arg == 'qkyy')
  112. {
  113. $this->_qkyy($arg_array);//清除备货用友数据
  114. }
  115. else if($arg == 'cxxq')
  116. {
  117. $this->_cxxq($arg_array);//查询独立站订单详情
  118. }
  119. else if($arg == 'user')
  120. {
  121. $this->_user($arg_array);//批量添加店铺权限
  122. }
  123. }
  124. public function _x3($arg_array)
  125. {
  126. $fullorder = $this->fullorder->get_number($arg_array[0]);
  127. if(!$fullorder)
  128. {
  129. $fullorder = $this->fullordersmt->get_number($arg_array[0]);
  130. }
  131. if(!$fullorder)
  132. {
  133. $fullorder = $this->fullordertt->get_number($arg_array[0]);
  134. }
  135. if(!$fullorder)
  136. {
  137. $fullorder = $this->fullorderxw->get_number($arg_array[0]);
  138. }
  139. if(!$fullorder)
  140. {
  141. echo "编号错误";exit;
  142. }
  143. /** 发票地址信息暂时无用
  144. $fullorder['baddress'] = explode(',',$fullorder['baddress']);
  145. $fullorder['baddress'] = array_reverse($fullorder['baddress']);
  146. $fullorder['baddress'][1] = $country['ename'];
  147. **/
  148. //获取所用相关信息
  149. $warehouse = $this->warehouse->read($fullorder['type']);
  150. $country = $this->country->read($fullorder['country']);//订单国家信息
  151. $fcountry = $this->country->read($warehouse['country']);//仓库国家信息
  152. $warehouse['country'] = $fcountry['ename'];//仓库国家名
  153. $warehouse['lb'] = $fcountry['lb'];//仓库国家编码
  154. $fullorder['warehouse'] = $warehouse;//仓库数据加入订单
  155. $fullorder['lb'] = $country['lb'];//订单国家编码加入
  156. $fullorder['country'] = $country['ename'];//订单国家名
  157. $fullorder['zhou'] = $country['continent'];//所属州
  158. $express = $this->express->read($fullorder['express']);
  159. $fullorder['express'] = $express['servicename'];
  160. $fullorder['account'] = $express['account'];
  161. $fullorder['printcode'] = $express['printcode'];
  162. $fullorder['time'] = date('Y-m-d',time());
  163. $fullorder['times'] = date('Y-m-d H:i',time());
  164. $fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  165. $fullorder['address'] = str_replace(array('&'),array('&#38;'),$fullorder['address']);
  166. $fullorder['address2'] = str_replace(array('&'),array('&#38;'),$fullorder['address2']);
  167. $fullorder['shipremarks'] = str_replace(array('&lt;','&gt;'),array('<','>'),$fullorder['shipremarks']);
  168. $fullorder['shipremarks'] = str_replace(array('<','>',';',';'),array('&lt','&gt',';<br>',';<br>'),$fullorder['shipremarks']);
  169. $shop = $this->shop->read($fullorder['shop']);
  170. $fullorder['shop'] = $shop['shopname'];
  171. $fullorder['city'] = preg_replace('/( | | |\s)/',' ',$fullorder['city']);
  172. $fullorder['province'] = preg_replace('/( | | |\s)/',' ',$fullorder['province']);
  173. if(is_numeric($fullorder['pay']))
  174. {
  175. $pay = $this->typeclass->read($fullorder['pay']);
  176. if($pay['classid'] == '4')
  177. {
  178. $fullorder['pay'] = $pay['title'];
  179. }
  180. }
  181. if($fullorder['printcode'] != "USPS")
  182. {
  183. $fullorder['client'] = htmlspecialchars($fullorder['client']);
  184. $fullorder['name'] = htmlspecialchars($fullorder['name']);
  185. }
  186. //增加退货单所需信息
  187. $pt = '';
  188. $fpdata = explode(';',trim($fullorder['fpdata'],';'));
  189. foreach ($fpdata as $v)
  190. {
  191. $p = explode('|',trim($v,'|'));
  192. //$pt .= '<p>'.$p[1].' * '.$p[2].'</p>';
  193. }
  194. $fullorder['pt'] = $pt;
  195. $fullorder['printnumber'] += 2;
  196. //$fullorder['printcode'] = 'HUALEIXW-FEDEX';
  197. //$fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  198. //$fullorder['sbbm']= 4202320000;//($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  199. //$fullorder['sbpm']= 'eyelashes';
  200. //$fullorder['zwpm']= '假睫毛';
  201. //$fullorder['sbpm']= 'Satin Bag';
  202. //$fullorder['zwpm']= '袋子';
  203. //$fullorder['hgbm']= 4202320000;
  204. //$fullorder['address'] = '1653 Treutlan Place';
  205. //$fullorder['address2'] = '';
  206. //$fullorder['qm'] = 2;
  207. //$notice = $this->notice->read(6);
  208. //$fcountry['warehouse']['name'] = 'Hair Me Please LLC';
  209. //$fullorder['cxcode'] = strtolower($express['cxcode']);
  210. //$barcode = $this->fedex->get_logistics($fullorder);//获取联邦快递信息
  211. //echo $fullorder['name'];
  212. //$b = $this->yuntu->get_data($fullorder);
  213. //$b = $this->usps->get_logistics($fullorder);
  214. // $fullorder['printcode'] = 'HUALEI-DHL';
  215. //$fullorder['js'] = 1;
  216. $fullorder['printcode'] = 'usps_priority';
  217. $b = $this->cne->get_data($fullorder);
  218. //$b = $this->fedexv1->get_data($fullorder);
  219. echo "<pre>";
  220. print_r($b);
  221. }
  222. public function get_data($data)
  223. {
  224. $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');
  225. $data['province'] = preg_replace('/( | | |\s)/',' ',$data['province']);
  226. $data['province'] = trim($data['province'],' ');
  227. $dataprovince = strlen($data['province'])==2?$data['province']:$ToState[strtolower($data['province'])];
  228. $data['address'] = str_replace(array('#','&#38;','&'),array('%23','%26'),$data['address']);
  229. $data['address2'] = str_replace(array('#','&#38;','&'),array('%23','%26'),$data['address2']);
  230. $data['client'] = str_replace(array('#','&#38;','&'),array('%23','%26'),$data['client']);
  231. $data['name'] = str_replace(array('#','&#38;','&'),array('%23','%26'),$data['name']);
  232. $data['name'] = str_replace(' ',' ',$data['name']);
  233. $xml = "";
  234. $xml .= "<eVSRequest USERID='050GHAIR7974'>";
  235. $xml .= "<Option></Option>";
  236. $xml .= "<Revision>1</Revision>";
  237. $xml .= "<ImageParameters>";
  238. $xml .= "<ImageParameter>4X6LABELP</ImageParameter>";
  239. $xml .= "</ImageParameters>";
  240. $xml .= "<FromName>Kenny Kwok</FromName>";//发件人姓名或公司
  241. $xml .= "<FromFirm>Long Human Hair Factory Inc</FromFirm>";//发件人姓名或公司
  242. $xml .= "<FromAddress1></FromAddress1>";//发件人地址1 公寓或套房号码 不超过50个字符
  243. $xml .= "<FromAddress2>819 6th Avenue Store front</FromAddress2>";//发件人地址2
  244. $xml .= "<FromCity>New York</FromCity>";//发件人城市
  245. $xml .= "<FromState>NY</FromState>";//发件人所属州
  246. $xml .= "<FromZip5>10001</FromZip5>";//发件人邮政编码
  247. $xml .= "<FromZip4></FromZip4>";//发件人邮编2
  248. $xml .= "<FromPhone>8455583605</FromPhone>";//发件人电话,10位
  249. $xml .= "<AllowNonCleansedOriginAddr>true</AllowNonCleansedOriginAddr>";//是否检查地址 true不检查
  250. $xml .= "<ToName>".$data['name']."</ToName>";//收件人名称
  251. $xml .= "<ToFirm></ToFirm>";//收件人名称
  252. if($data['address2'] == "")
  253. {
  254. $xml .= "<ToAddress1>".$data['address2']."</ToAddress1>";//收件人地址1 不超过50个字符
  255. $xml .= "<ToAddress2>".$data['address']."</ToAddress2>";//收件人地址2
  256. }
  257. else
  258. {
  259. $xml .= "<ToAddress1>".$data['address']."</ToAddress1>";//收件人地址1 不超过50个字符
  260. $xml .= "<ToAddress2>".$data['address2']."</ToAddress2>";//收件人地址2
  261. }
  262. $xml .= "<ToCity>".$data['city']."</ToCity>";//收件人城市
  263. $xml .= "<ToState>".$dataprovince."</ToState>";//收件人州
  264. $xml .= "<ToZip5>".trim($data['zipcode'],' ')."</ToZip5>";//收件人邮编
  265. $xml .= "<ToZip4></ToZip4>";//收件人邮编2
  266. $xml .= "<ToPhone></ToPhone>";//收件人电话
  267. $xml .= "<POBox></POBox>";//目标地址是否为邮政信箱。
  268. if($data['qm']==1 && $data['js'] == 1)//如果需要签名,并且快递服务选择优先
  269. {
  270. $ServiceType = 'PRIORITY';
  271. $Container = 'FLAT RATE ENVELOPE';
  272. $ExtraService = '156';
  273. $ExtraServicebx = '125';
  274. }
  275. else if($data['qm']==1 && $data['js'] == 0)//如果需要签名,并且快递服务不选择优先
  276. {
  277. $ServiceType = 'FIRST CLASS';
  278. $Container = 'VARIABLE';
  279. $ExtraService = '120';
  280. $ExtraServicebx = '100';
  281. }
  282. else if($data['qm']==1 && $data['js'] == 2)//如果需要签名,并且快递服务选择PRIORITY EXPRESS
  283. {
  284. $ServiceType = 'PRIORITY EXPRESS';
  285. $Container = 'FLAT RATE ENVELOPE';
  286. $ExtraServicebx = '101';
  287. }
  288. else if($data['qm']==0 && $data['js'] == 1)//如果不需要签名,并且快递服务选择优先
  289. {
  290. $ServiceType = 'PRIORITY';
  291. $Container = 'FLAT RATE ENVELOPE';
  292. $ExtraServicebx = '125';
  293. }
  294. else if($data['qm']==0 && $data['js'] == 0)//如果不需要签名,并且快递服务不选择优先
  295. {
  296. $ServiceType = 'FIRST CLASS';
  297. $Container = 'VARIABLE';
  298. $ExtraServicebx = '100';
  299. }
  300. else if($data['qm']==0 && $data['js'] == 3)//如果不需要签名,并且快递服务不选择优先
  301. {
  302. $ServiceType = 'Standard Mail Marketing Parcel';
  303. $Container = 'VARIABLE';
  304. $ExtraServicebx = '100';
  305. }
  306. else if($data['qm']==0 && $data['js'] == 2)//如果不需要签名,并且快递服务选择PRIORITY EXPRESS
  307. {
  308. $ServiceType = 'PRIORITY EXPRESS';
  309. $Container = 'FLAT RATE ENVELOPE';
  310. $ExtraServicebx = '125';
  311. }
  312. if($data['email'])
  313. {
  314. if(strlen($data['email']) < 60 && stripos($data['email'],'tiktok') === false)
  315. {
  316. $xml .= "<ToContactPreference>EMAIL</ToContactPreference>";
  317. $xml .= "<ToContactEMail>".$data['email']."</ToContactEMail>";
  318. }
  319. }
  320. $xml .= "<AllowNonCleansedDestAddr>false</AllowNonCleansedDestAddr>";
  321. $xml .= "<WeightInOunces>".$data['zzl']."</WeightInOunces>";//重量
  322. $xml .= "<ServiceType>".$ServiceType."</ServiceType>";//服务类型
  323. $xml .= "<Container>".$Container."</Container>";//货物类型
  324. $xml .= "<Width></Width>";//可选
  325. $xml .= "<Length></Length>";//可选
  326. $xml .= "<Height></Height>";//可选
  327. $xml .= "<Machinable></Machinable>";//可选
  328. $xml .= "<ProcessingCategory></ProcessingCategory>";//可选
  329. $xml .= "<PriceOptions></PriceOptions>";//可选
  330. $xml .= "<InsuredAmount>".$data['bx']."</InsuredAmount>";//保险金 可选
  331. $xml .= "<AddressServiceRequested>True</AddressServiceRequested>";//可选 客户变更地址提醒
  332. /**
  333. $data['qm'] = ($data['qm']==1)?'False':'True';
  334. if($data['qm'] == 'False')
  335. {
  336. $xml .= "<ExpressMailOptions>";
  337. //$xml .= "<DeliveryOption>1</DeliveryOption>";//可选 交付选择 默认1:正常交付
  338. $xml .= "<WaiverOfSignature>".$data['qm']."</WaiverOfSignature>";//可选 接收签名用False
  339. $xml .= "</ExpressMailOptions>";
  340. }
  341. **/
  342. if($data['qm']==1 && $data['js'] == 2)
  343. {
  344. $xml .= "<ExpressMailOptions>";
  345. //$xml .= "<DeliveryOption>1</DeliveryOption>";//可选 交付选择 默认1:正常交付
  346. $xml .= "<WaiverOfSignature>FALSE</WaiverOfSignature>";//可选 接收签名用False
  347. $xml .= "</ExpressMailOptions>";
  348. }
  349. $xml .= "<ShipDate>".date('m/d/Y',time()-(12*3600)+($data['yc']*24*3600))."</ShipDate>";//可选 发货日期 当前至7天 格式 mm/ dd/ yyyy 延迟发货
  350. //$xml .= "<ReturnCommitments>true</ReturnCommitments>";
  351. $xml .= "<CustomerRefNo>".$data['number']."</CustomerRefNo>";//可选 内部编号显示在运单 不超过19字符
  352. $xml .= "<ExtraServices>";
  353. if(isset($ExtraService))
  354. {
  355. $xml .= "<ExtraService>".$ExtraService."</ExtraService>";//可选额外服务
  356. }
  357. if($data['bx'] > 0)
  358. {
  359. $xml .= "<ExtraService>".$ExtraServicebx."</ExtraService>";//可选额外服务
  360. }
  361. $xml .= "</ExtraServices>";
  362. $xml .= "<ReceiptOption>NONE</ReceiptOption>";//可选打印布局SEPARATE PAGE 或NONE
  363. $xml .= "<ImageType>PDF</ImageType>";//输出类型
  364. $xml .= "<HoldForManifest>Y</HoldForManifest>";
  365. $xml .= "<PrintCustomerRefNo>true</PrintCustomerRefNo>";//内部编号显示要用这个标签
  366. $xml .= "</eVSRequest>";
  367. /** 直连 **/
  368. $ch = curl_init();
  369. $url = 'https://secure.shippingapis.com/ShippingAPI.dll?API=eVS&XML='.$xml;
  370. $url = str_replace(" ",'%20',$url);
  371. curl_setopt($ch,CURLOPT_URL,$url);
  372. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  373. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,0);
  374. curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts
  375. curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
  376. curl_setopt($ch,CURLOPT_TIMEOUT,25);
  377. $data = curl_exec($ch);
  378. curl_close($ch);
  379. $data = utf8_encode($data);
  380. libxml_disable_entity_loader(true);
  381. // @$values = json_decode(json_encode(simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
  382. return $data;
  383. /**
  384. $ch = curl_init();
  385. $url = 'http://z.wepolicy.cn/usps.php?XML='.$xml;
  386. $url = str_replace(" ",'%20',$url);
  387. curl_setopt($ch,CURLOPT_URL,$url);
  388. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  389. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,0);
  390. curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts
  391. curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, FALSE);
  392. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,35);
  393. $data = curl_exec($ch);
  394. curl_close($ch);
  395. $data = json_decode($data,TRUE);
  396. return $data;
  397. //Description提示错误 LabelImage运单PDF BarcodeNumber运单号
  398. **/
  399. }
  400. public function _qk()//清空用友数据
  401. {
  402. $sc = array();
  403. $a = $this->fullorder->find_all("scapi = '99'");
  404. foreach ($a as $v)
  405. {
  406. if(stripos($v['scid'],'XD') === false || $v['scid'] == '|' || $v['scid'] == '')
  407. {
  408. $this->fullorder->save(array('scid'=>'','scapi'=>0,'dbapi'=>0),$v['id']);
  409. continue;
  410. }
  411. $b = explode('|',trim($v['scid'],'|'));
  412. $b = explode('~',trim($b[0],'~'));
  413. //$c = str_replace('XD','',$b[1]);
  414. if(strlen($b[1]) != 12)
  415. {
  416. $this->fullorder->save(array('scid'=>'','scapi'=>0,'dbapi'=>0),$v['id']);
  417. continue;
  418. }
  419. }
  420. echo "<pre>";
  421. print_r($sc);
  422. exit;
  423. }
  424. public function _w($arg_array)
  425. {
  426. $a = $this->whlabel->read($arg_array[0]);
  427. $s = $this->whlabel->find_all("features = '".$a['features']."'");
  428. echo "<pre>";
  429. print_r($a);
  430. echo "<pre>";
  431. print_r($s);
  432. exit;
  433. }
  434. public function _qczd($arg_array)//清空用友数据
  435. {
  436. $a = $this->whlabel->find_all("zd = '$arg_array[0]'");
  437. foreach ($a as $v)
  438. {
  439. $this->whlabel->save(array('zd'=>''),$v['id']);
  440. }
  441. }
  442. public function _d($arg_array)
  443. {
  444. $a = $this->fullorder->get_number($arg_array[0]);
  445. if(!$a)
  446. {
  447. //$a = $this->fullorder->get_orderinfo($arg_array[0]);
  448. if(!$a)
  449. {
  450. $a = $this->fullordersmt->get_number($arg_array[0]);
  451. if(!$a)
  452. {
  453. //$a = $this->fullordersmt->get_orderinfo($arg_array[0]);
  454. if(!$a)
  455. {
  456. $a = $this->fullordertt->get_number($arg_array[0]);
  457. if(!$a)
  458. {
  459. $a = $this->fullorderxw->get_number($arg_array[0]);
  460. if(!$a)
  461. {
  462. //$a = $this->fullordertt->get_orderinfo($arg_array[0]);
  463. }
  464. }
  465. }
  466. }
  467. }
  468. }
  469. if($a)
  470. {
  471. echo "<pre>";
  472. print_r($a);
  473. }
  474. else
  475. {
  476. echo "没有此数据";
  477. }
  478. exit;
  479. }
  480. public function _wz($arg_array)
  481. {
  482. if(!isset($arg_array[1]))
  483. {
  484. //echo "没有位置数据";
  485. return "没有位置数据";
  486. }
  487. $cid = $this->whlabellabel->find_all("cpid = '".$arg_array[0]."'");
  488. if(isset($cid[0]))
  489. {
  490. $w = $this->whlabel->find_all("number = '".$cid[0]['number']."' and warehouse = '13'");
  491. foreach ($w as $v)
  492. {
  493. $this->whlabel->save(array('details'=>$arg_array[1]),$v['id']);
  494. }
  495. echo json_encode(array('msg'=>'!','success'=>true));exit;
  496. //echo '成功';
  497. //echo "<pre>";
  498. //print_r($w);
  499. }
  500. }
  501. public function _qkyy($arg_array)//清空备货用友数据
  502. {
  503. $y = $this->whlabel_bh->read($arg_array[0]);
  504. if($y)
  505. {
  506. $this->whlabel_bh->save(array('scid'=>'','scapi'=>0,'dbapi'=>0,'state'=>0),$y['id']);
  507. echo 'ok';
  508. }
  509. else
  510. {
  511. echo '没有ID';
  512. }
  513. }
  514. public function _cxxq()//查询独立站订单详情
  515. {
  516. $value = $this->shop->read(3);
  517. $res = $this->get_hq($value['brandname'],$value['shopadmin'],$value);
  518. echo "<pre>";
  519. print_r($res);
  520. }
  521. public function get_hq($name,$shopapi,$shop)
  522. {
  523. $jqtime = ($name=='SuperNova')?24*3600:2*3600;
  524. $fromTime = time()-24*3600-$jqtime;//strtotime('yesterday')-$jqtime;//昨日0点+1小时保险无漏单
  525. $toTime = time();
  526. $post['cs'] = 1;
  527. $post['name'] = $name;
  528. $post['from'] = $fromTime;
  529. $post['to'] = $toTime;
  530. $ch = curl_init();
  531. curl_setopt($ch,CURLOPT_URL,$shopapi);
  532. curl_setopt($ch, CURLOPT_POST, 1);
  533. curl_setopt($ch, CURLOPT_HEADER, 0);
  534. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  535. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  536. curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
  537. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
  538. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  539. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1800000);
  540. $res = curl_exec($ch);
  541. curl_close($ch);
  542. if($res)
  543. {
  544. $res = json_decode($res,true);
  545. $x = array();
  546. foreach ($res as $v)
  547. {
  548. $source = '';
  549. $sc = substr($v['order_id'],0,3);
  550. if($sc == '600')
  551. {
  552. $source = $shop['thurl']; //手机订单
  553. }
  554. else
  555. {
  556. $source = $shop['url'];//PC订单
  557. }
  558. if($v['wjauthorid'] != '' && $v['sourcecontentid'] != '' && $source != '' && $shop['tweak'] != '')
  559. {
  560. $authorid = $this->authorid($source.'?author_id='.$v['wjauthorid'].'&source_content_id='.$v['sourcecontentid'],$shop['tweak']);
  561. if($authorid)
  562. {
  563. $v['authorid'] = $authorid;
  564. }
  565. }
  566. $x[] = $v;
  567. }
  568. return $x;
  569. }
  570. }
  571. public function _user($arg_array)//查询独立站订单详情
  572. {
  573. $id = $arg_array[0];
  574. $d = $arg_array[1];
  575. $shop = $this->shop->read($id);
  576. $value = $this->user->find_all("shop not like '|".$id."|' and shop like '%|".$d."|%'");
  577. foreach ($value as $v)
  578. {
  579. //$this->user->save(array('shop'=>$v['shop'].$id.'|','shoptext'=>$v['shoptext'].$shop[''].'|'),$v['id']);
  580. }
  581. echo "<pre>";
  582. print_r($value);
  583. }
  584. }