|
- <?php
- /**
- * Created by PhpStorm.
- * User: Steven
- * Date: 2016/8/12
- * Time: 9:25
- * 下单和更新订单接口
- */
- header('Content_Type: application/xml;charset=utf-8');
- date_default_timezone_set('Asia/Shanghai');
- require_once 'commonUtil.class.php';
- /**
- * @param $operateType 操作类型 add:新增 update:更新
- * @param $serialId 分销平台订单流水号
- * @param string $confirmNumber 分销平台确认码,没有可不传
- * @param $sceneryId 景点ID
- * @param string $sceneryName 景区名称,如果不传则默认为智慧旅游系统对应的景区名称
- * @param $ticketTypeId 智慧旅游景区票型Id(各分销平台同步前需做相应的转换)
- * @param string $ticketTypeName 景区名称,如果不传则默认为智慧旅游系统对应的景区名称
- * @param $retailPrice 票面价
- * @param $webPrice 单价(单张网上售价)
- * @param $costPrice 成本价(即单张票的结算价)
- * @param $ticketCount 取票数量
- * @param $totalAmount 总金额(单张网上售价*预订数量)
- * @param $realPayAmount 实付金额
- * @param $payType 支付方式 景区现付:scenerycash或空字符串 在线支付:onlinepayment
- * @param $playDate 游玩时间(订单有效开始时间)
- * @param string $expiryDate 截止日期(订单有效截止日期,如不提供,则默认与playDate同) 可空
- * @param $orderStatus 订单状态 N: 新订单未支付,即景区收款 P: 已支付,即平台收款 C:已取消 T:已取票
- * @param $travelerName 取票人姓名
- * @param $travelerMobile 取票人手机
- * @param $orderDate 预订时间
- * @param string $identityCard 身份证
- * @param string $captcha 数字确认码
- * @param string $isParcelTicket 是否包票 0不是包票,1是包票
- * @return array|bool
- */
- 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 = "")
- {
- $zzUtils = new zzUtils();
- //组装header
- $array_info['header'] = array();
- $base_array = $array_info['header'];
- $request_time = date("Y-m-d H:i:s", time()); //订单请求时间
- $array_header = array(
- "accountID" => app::$accountID,
- "serviceName" => 'SyncOrder',
- "digitalSign" => $zzUtils->sign_md5(app::$accountID, app::$accountPassword, $request_time),
- "reqTime" => $request_time
- );
- $result_array = $zzUtils->addXml($base_array, $array_header);
- $array_info['header'] = $result_array;
-
- //组装body
- $array_info['body']['order'] = array();
- $base_body = $array_info['body']['order'];
- $arr_body = array
- (
- "operateType" => $operateType,
- "serialId" => $serialId,
- "comfirmNumber" => $confirmNumber,
- "sceneryId" => $sceneryId,
- "sceneryName" => $sceneryName,
- "ticketTypeId" => $ticketTypeId,
- "ticketTypeName" => $ticketTypeName,
- "retailPrice" => $retailPrice,
- "webPrice" => $webPrice,
- "costPrice" => $costPrice,
- "ticketCount" => $ticketCount,
- "totalAmount" => $totalAmount,
- "realPayAmount" => $realPayAmount,
- "payType" => $payType,
- "playDate" => $playDate,
- "expiryDate" => $expiryDate,
- "orderStatus" => $orderStatus,
- "travelerName" => $travelerName,
- "travelerMobile" => $travelerMobile,
- "orderDate" => $orderDate,
- "identityCard" => $identityCard,
- "captcha" => $captcha,
- "isParcelTicket" => $isParcelTicket
- );
- writeLog("tictctInfo::".json_encode($arr_body));
- $res_body = $zzUtils->addXml($base_body, $arr_body);
- $array_info['body']['order'] = $res_body;
- $arr_result['request'] = $array_info;
- $res_xml = $zzUtils->array_to_xml($arr_result);
- $res = $zzUtils->xml_post_request(app::$url, $res_xml); //发送请求
- $arr_res = $zzUtils->xml_to_array($res);
- $arrOrderInfo = array();
- if ($arr_res['header']['rspCode'] == '0000') {
- foreach ($arr_res['body'] as $orderInfo) {
- $arrOrderInfo = $orderInfo;
- }
- return $arrOrderInfo;
- } else {
- return false;
- }
-
- }
-
- /*$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',"","");
-
- var_dump($SyncOrder);*/
|