You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

65 lines
2.5 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once './Config2.php';
  7. require_once './class.db.inc';
  8. require_once './disney.inc';
  9. require_once './Function.php';
  10. require_once './zizai_api.inc';
  11. $postStr = file_get_contents("php://input");
  12. $filename='pay_callback.log';
  13. success_notify(json_encode($postStr),$filename);
  14. if (!empty($postStr)){
  15. libxml_disable_entity_loader(true);
  16. $dataArray= (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
  17. foreach ($dataArray as $key=>$v){
  18. success_notify($key."--".$v,$filename);
  19. }
  20. $ordernoArr=$dataArray['out_trade_no'];
  21. $ordernoArray=explode('-', $ordernoArr);
  22. $orderno=$ordernoArray[0];
  23. $transaction_id=$dataArray['transaction_id'];
  24. //DB
  25. $objDbh = new Db;
  26. $objDbh->setAccount(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
  27. $objDisney = new DbDisney($objDbh);
  28. $sendArray=$objDisney->getUnpaidOrder($orderno);
  29. //need add code here(use zizai api)
  30. $update_array=array("status" => 1,"is_payed"=>1,"pay_type"=>1,"pay_no"=>$transaction_id);
  31. if( $sendArray["good_type"] == 2 || $sendArray["good_type"] == 3 ) {
  32. $trade_no = $sendArray["outside_order_no"];
  33. if( $trade_no != "" && mb_strlen($trade_no) > 0 ) {
  34. $result_info = eticket( API_USER, API_PASSWORD, $trade_no);
  35. if( $result_info["code"] == 0 ) {
  36. $update_array["comment"] = "已在自在自动下单,订单号:".$trade_no;
  37. } else {
  38. $update_array["comment"] = "自在自动下单失败,失败原因:".$result_info["info"];
  39. }
  40. }
  41. }
  42. $result=$objDisney->updateOrderCommonInfo($orderno, $update_array);
  43. success_notify('$reslut::'.$result);
  44. if($result !==false){
  45. success_notify("orderno".$orderno);
  46. /*
  47. $org_address = "";
  48. if( $sendArray['good_type'] == 1 && $sendArray['org_id'] > 0 ) {
  49. $org_info = $objDisney->getBaseOrgInfoFromId($sendArray['org_id']);
  50. $org_address = false != $org_info ? $org_info["org_address"] : "";
  51. }
  52. $send_message = getSendMessage( $sendArray['good_type'], $sendArray['cus_name'], $sendArray['start_date'], $sendArray['prod_name'], $org_address );
  53. success_notify("sendTelMessage".json_encode($sendArray));
  54. sendTelMessage($sendArray['cus_mobile'],$sendArray['cus_name'],$send_message,$sendArray['order_serial_no']);
  55. */
  56. $xml="<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
  57. echo $xml;
  58. }
  59. }
  60. function success_notify($result){
  61. file_put_contents('./disney_pay_callback.txt', date("Y-m-d H:i:s")." ".$result.PHP_EOL,FILE_APPEND);//订单成功后通知后台日志
  62. }