kdniao_notify.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. require_once(BASE_MOBILE_PATH . '/control/app_pay.php');
  3. require_once (BASE_DATA_PATH . '/logic/delivery.logic.php');
  4. require_once(BASE_ROOT_PATH . '/helper/kdn_helper.php');
  5. $requestData = $_POST['RequestData']; // 快递鸟数据
  6. $deliver_info = json_decode(urldecode($requestData),true);
  7. $success = true;
  8. $reson = '';
  9. //数据不正确, 记录并退出
  10. if ($deliver_info === false || empty($deliver_info))
  11. {
  12. $success = false;
  13. $reson = 'data is empty.';
  14. Log::record("kdniao_notify:cannot query delivery info from kuaidn.",Log::ERR);
  15. }
  16. else
  17. {
  18. Log::record("start handle....",Log::DEBUG);
  19. $count = intval($deliver_info['Count']);
  20. if($count <= 0 || $deliver_info['EBusinessID'] != kdn_helper::cur_businessid()) {
  21. $success = false;
  22. $reson = "count={$count} or EBusinessID = {$deliver_info['EBusinessID']} != " . kdn_helper::cur_businessid();
  23. }
  24. else
  25. {
  26. foreach($deliver_info['Data'] as $item) {
  27. kdn_helper::onCallback($item);
  28. }
  29. }
  30. }
  31. echo (json_encode(array('EBusinessID' => kdn_helper::cur_businessid(),'UpdateTime' => strftime("%Y-%m-%d %H:%M:%S",time()), 'Success' => $success,'Reason' => $reson)));
  32. ?>