Aatest.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Aatest extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_whlabel','whlabel');
  7. $this->load->_model('Model_warehouse','warehouse');
  8. $this->load->_model('Model_productprice','productprice');
  9. $this->load->_model('Model_excel','excel');
  10. $this->load->_model('Model_fullorder','fullorder');
  11. $this->load->_model('Model_fullordertt','fullordertt');
  12. $this->load->_model('Model_fullordersmt','fullordersmt');
  13. $this->load->_model('Model_outbound','outbound');
  14. $this->load->_model('Model_express','express');
  15. $this->load->_model('Model_shop','shop');
  16. $this->load->_model('Model_typeclass','typeclass');
  17. $this->load->_model('Model_country','country');
  18. $this->load->_model('Model_kdniao','kdniao');
  19. $this->load->_model('Model_notice','notice');
  20. $this->load->_model('Model_dhl','dhl');
  21. $this->load->_model('Model_dhlhz','dhlhz');
  22. $this->load->_model('Model_usps','usps');
  23. $this->load->_model('Model_fedex','fedex');
  24. $this->load->_model('Model_fedex_cby','fedex_cby');
  25. $this->load->_model('Model_ups','ups');
  26. $this->load->_model('Model_ali','ali');
  27. $this->load->_model('Model_dpd','dpd');
  28. $this->load->_model('Model_shop','shop');
  29. $this->load->_model('Model_user','user');
  30. $this->load->_model('Model_whlabel','whlabel');
  31. $this->load->_model('Model_specialstock','specialstock');
  32. $this->load->_model('Model_ck','ck');
  33. $this->load->_model('Model_whlabellabel','whlabellabel');
  34. $this->load->_model('Model_apiyy','apiyy');
  35. $this->load->helper('url');
  36. $this->load->_model('Model_whlabel_fc','whlabel_fc');
  37. $this->load->_model('Model_systemtransfer','systemtransfer');
  38. $this->load->_model('Model_classid','classid');
  39. $this->load->_model('Model_allocation','allocation');
  40. $this->load->_model('Model_fullorderxw','fullorderxw');
  41. $this->load->_model('Model_fullorderpaypal','fullorderpaypal');
  42. //$this->load->_model('Model_fedexv1','fedexv1');
  43. $this->load->_model('Model_logic_crm','logic_crm');
  44. $this->load->_model("Model_fullorder","fullorder");
  45. $this->load->_model("Model_express","express");
  46. $this->load->_model("Model_logic_ding","logic_ding");
  47. $this->load->_model("Model_api",'api');
  48. $this->load->_model("Model_usps",'usps');
  49. }
  50. //定义方法的调用规则 获取URI第二段值
  51. public function _remap($arg,$arg_array)
  52. {
  53. if($arg == 'fout')
  54. {
  55. $this->_fout();
  56. }else if($arg == 'ceshi')
  57. {
  58. $this->_ceshi();
  59. }else{
  60. $this->_a($arg_array);
  61. }
  62. }
  63. public function _a($arg_array){
  64. $dtc = array();
  65. /* 订单号加入键值-j */
  66. /* 匹配加入 */
  67. $dictionaries = $this->typeclass->find_all('spare!= "" and classid != 1 and classid != 2 and classid != 3 and classid != 4 and classid != 5 and classid != 11 and classid != 16 and classid != 17 and classid != 20 and classid != 21 and classid != 23 and classid != 24 and classid != 29 and classid != 30 and classid != 31 and classid != 32 and classid != 36');
  68. // 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)
  69. foreach ($dictionaries as $v)
  70. {
  71. if(stripos($v['spare'],'|') !== false)//如果有多个值
  72. {
  73. $v['spare'] = explode('|',$v['spare']);
  74. foreach ($v['spare'] as $k=>$vs)
  75. {
  76. if(stripos($v['zh'],'|') !== false)
  77. {
  78. $vzh = explode('|',$v['zh']);
  79. $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$vzh[$k],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$vs);
  80. }
  81. else
  82. {
  83. $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$vs);
  84. }
  85. }
  86. }
  87. else
  88. {
  89. $dtc[strtolower($v['spare'])] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$v['spare']);
  90. }
  91. }
  92. $dtctitle = [];
  93. $dictionaries2 = $this->typeclass->find_all();
  94. foreach ($dictionaries2 as $v)
  95. {
  96. $dtctitle[$v['id']] = $v['title'];
  97. }
  98. echo "<pre>";
  99. $sku = "Free,Gift--PackQQS,NW--3+Ori6*6C-22 24 26-20-6*6C";
  100. $sl = "1;1;1;";
  101. $r = $this->api->matching($sl,$sku,$dtc,"","",$dtctitle,$shop=[],$extra = [
  102. "price"=>"565.7700",
  103. "row_total"=>"565.7700"
  104. ]);
  105. var_dump($r['title']);
  106. $r = $r['product'];
  107. $rr = explode(";",$r);
  108. print_r($rr);
  109. }
  110. public function _fout()
  111. {
  112. $waybill = $this->input->get('waybill');
  113. $this->usps->get_new_logistics($waybill);
  114. //$this->fedexv1->makeAccessToken();
  115. }
  116. public function _ceshi(){
  117. $arr =[1,2];
  118. var_dump($arr[3]);
  119. // $arr = [
  120. // '4600368432',
  121. // '2800005184',
  122. // '3800007040',
  123. // '3600656330',
  124. // '3600656403',
  125. // '3800006595'
  126. // ];
  127. //$order_list = $this->fullorder->find_all('orderinfo in ('.implode(',',$arr).')');
  128. //foreach ($order_list as $k=>$v){
  129. // $shop = $this->shop->read($v['shop']);
  130. // $this->_klarnadata($v['paypal'],$shop['klarnaname'],$shop['klarnapass'],$v['number']);
  131. // usleep(10);
  132. //}
  133. }
  134. public function _klarnadata($paypal,$name,$pass,$number)
  135. {
  136. $url = 'https://api-na.klarna.com/ordermanagement/v1/orders/'.$paypal;
  137. $header[] = "Content-Type:application/json";
  138. $header[] = "Authorization: Basic ".base64_encode($name.":".$pass);
  139. $ch = curl_init();
  140. curl_setopt($ch, CURLOPT_URL, $url);
  141. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  142. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  143. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  144. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  145. $res = curl_exec($ch);
  146. curl_close($ch);
  147. $res = json_decode($res,true);
  148. $this->logic_ding->sendToDing($number."API【2042】".json_encode($res));
  149. }
  150. }