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.
 
 
 
 

106 lines
4.5 KiB

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Steven
  5. * Date: 2016/8/12
  6. * Time: 9:25
  7. * 下单和更新订单接口
  8. */
  9. header('Content_Type: application/xml;charset=utf-8');
  10. date_default_timezone_set('Asia/Shanghai');
  11. require_once 'commonUtil.class.php';
  12. /**
  13. * @param $operateType 操作类型 add:新增 update:更新
  14. * @param $serialId 分销平台订单流水号
  15. * @param string $confirmNumber 分销平台确认码,没有可不传
  16. * @param $sceneryId 景点ID
  17. * @param string $sceneryName 景区名称,如果不传则默认为智慧旅游系统对应的景区名称
  18. * @param $ticketTypeId 智慧旅游景区票型Id(各分销平台同步前需做相应的转换)
  19. * @param string $ticketTypeName 景区名称,如果不传则默认为智慧旅游系统对应的景区名称
  20. * @param $retailPrice 票面价
  21. * @param $webPrice 单价(单张网上售价)
  22. * @param $costPrice 成本价(即单张票的结算价)
  23. * @param $ticketCount 取票数量
  24. * @param $totalAmount 总金额(单张网上售价*预订数量)
  25. * @param $realPayAmount 实付金额
  26. * @param $payType 支付方式 景区现付:scenerycash或空字符串 在线支付:onlinepayment
  27. * @param $playDate 游玩时间(订单有效开始时间)
  28. * @param string $expiryDate 截止日期(订单有效截止日期,如不提供,则默认与playDate同) 可空
  29. * @param $orderStatus 订单状态 N: 新订单未支付,即景区收款 P: 已支付,即平台收款 C:已取消 T:已取票
  30. * @param $travelerName 取票人姓名
  31. * @param $travelerMobile 取票人手机
  32. * @param $orderDate 预订时间
  33. * @param string $identityCard 身份证
  34. * @param string $captcha 数字确认码
  35. * @param string $isParcelTicket 是否包票 0不是包票,1是包票
  36. * @return array|bool
  37. */
  38. function SyncOrder($operateType, $serialId, $confirmNumber = "", $sceneryId, $sceneryName = "", $ticketTypeId, $ticketTypeName = "", $retailPrice, $webPrice, $costPrice, $ticketCount, $totalAmount, $realPayAmount, $payType, $playDate, $expiryDate = "", $orderStatus, $travelerName, $travelerMobile, $orderDate, $identityCard = "", $captcha = "", $isParcelTicket = "")
  39. {
  40. $zzUtils = new zzUtils();
  41. //组装header
  42. $array_info['header'] = array();
  43. $base_array = $array_info['header'];
  44. $request_time = date("Y-m-d H:i:s", time()); //订单请求时间
  45. $array_header = array(
  46. "accountID" => app::$accountID,
  47. "serviceName" => 'SyncOrder',
  48. "digitalSign" => $zzUtils->sign_md5(app::$accountID, app::$accountPassword, $request_time),
  49. "reqTime" => $request_time
  50. );
  51. $result_array = $zzUtils->addXml($base_array, $array_header);
  52. $array_info['header'] = $result_array;
  53. //组装body
  54. $array_info['body']['order'] = array();
  55. $base_body = $array_info['body']['order'];
  56. $arr_body = array
  57. (
  58. "operateType" => $operateType,
  59. "serialId" => $serialId,
  60. "comfirmNumber" => $confirmNumber,
  61. "sceneryId" => $sceneryId,
  62. "sceneryName" => $sceneryName,
  63. "ticketTypeId" => $ticketTypeId,
  64. "ticketTypeName" => $ticketTypeName,
  65. "retailPrice" => $retailPrice,
  66. "webPrice" => $webPrice,
  67. "costPrice" => $costPrice,
  68. "ticketCount" => $ticketCount,
  69. "totalAmount" => $totalAmount,
  70. "realPayAmount" => $realPayAmount,
  71. "payType" => $payType,
  72. "playDate" => $playDate,
  73. "expiryDate" => $expiryDate,
  74. "orderStatus" => $orderStatus,
  75. "travelerName" => $travelerName,
  76. "travelerMobile" => $travelerMobile,
  77. "orderDate" => $orderDate,
  78. "identityCard" => $identityCard,
  79. "captcha" => $captcha,
  80. "isParcelTicket" => $isParcelTicket
  81. );
  82. writeLog("tictctInfo::".json_encode($arr_body));
  83. $res_body = $zzUtils->addXml($base_body, $arr_body);
  84. $array_info['body']['order'] = $res_body;
  85. $arr_result['request'] = $array_info;
  86. $res_xml = $zzUtils->array_to_xml($arr_result);
  87. $res = $zzUtils->xml_post_request(app::$url, $res_xml); //发送请求
  88. $arr_res = $zzUtils->xml_to_array($res);
  89. $arrOrderInfo = array();
  90. if ($arr_res['header']['rspCode'] == '0000') {
  91. foreach ($arr_res['body'] as $orderInfo) {
  92. $arrOrderInfo = $orderInfo;
  93. }
  94. return $arrOrderInfo;
  95. } else {
  96. return false;
  97. }
  98. }
  99. /*$SyncOrder = SyncOrder('add',"17999", '',1, '', 336, '', 99, 99, 99, 1, 198, 198, 'onlinepayment', '2016-08-22 00:00:00', '', 'P', '魏意锡', '18663582623','2016-08-20 00:00:00', '371521199011034631',"","");
  100. var_dump($SyncOrder);*/