|
- <?php
- require_once __DIR__.'/../st-xm/Common/Mysql.php';
- require_once __DIR__.'/../st-xm/Common/config_api.inc';
- require_once '/usr/share/nginx/ZZCS/coding/st-xm/Common/sinaAPI.php';
- require_once '/usr/share/nginx/ZZCS/coding/st-xm/Common/zizai_orderAPI.php';
- header("Access-Control-Allow-Origin:*");
- $current_time = time();
- $current_hour = date("H:i:s",$current_time);
- $tomorrow_day = date("Y-m-d",strtotime("+1 days"));
- $today = date("Y-m-d");
- $limit_time = date("H:i", strtotime("+30 minutes"));
- //拼接数组
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["auth"] = get_qunar_auth($post_data);
- $return_data = send_post( QUNAR_CHECK_ORDER_URL, $post_data);
- $return_array = json_decode($return_data,true);
- if( !isset($return_array["orderNum"]) || $return_array["orderNum"] <= 0 ) {
- print_r($return_array);
- return;
- }
- //print_r($return_array);exit();//test
- $no_sell_array = array(152739,152740,152741,152691,152697,152715,152709,152715,153133,153135,153137,152569,152570,152571,152572,152573,152575,152577,152579,152581,152582,152695,152696,152706,152707,448587,449825,449827,449829,449831,449832,449843,449847,449825,449827,449829,449831);
-
- $limit_sell_prod = array( 448568, 448569,448778,448779,448780,448781);
-
- $userid = 1;
- $current_time = date("Y-m-d H:i:s");
- $pdo=conn1();
- $order_array = $return_array["data"];
- foreach( $order_array as $order_info ) {
- $run_code = $order_info["coachNo"];
- $run_code_array = explode("_",$run_code);
- if( isset($run_code_array[1]) ) {
- $run_code = $run_code_array[0];
- $prod_id = $run_code_array[1];
- } else {
- //zizai
- $run_code = $run_code_array[1];
- }
- $ticket_num = $order_info["ticketNum"];
- $customer_name = $order_info["contactName"];
- $customer_mobile = descryption_by_shif($order_info["contactPhone"]);
- $customer_id_no = descryption_by_shif($order_info["contactId"]);
- $out_order_no = $order_info["orderNo"];
- $passengers = $order_info["passengers"];
- $passengers_array = array();
- foreach( $passengers as $passenger_info ) {
- $passengers_array[] = $passenger_info["passengerName"]."*".descryption_by_shif($passenger_info["passengerId"]);
- }
- $passengers_list = implode("/",$passengers_array);
- $sql = " SELECT * FROM order_main WHERE OUTSIDE_ORDER_NO='{$out_order_no}' AND PARENT_ORDER_ID = 0 ";
- $result = $pdo->query($sql);
- $rowset = $result->fetchAll();
- $result->closeCursor();
- if ($rowset != false) {
- continue;
- }
- if( isset($run_code_array[1]) ) {
- $sql = " SELECT * FROM run_main WHERE RUN_ID={$run_code} ";
- $result = $pdo->query($sql);
- $rowset = $result->fetchAll();
- $result->closeCursor();
- $run_main_info = $rowset[0];
-
- if( $run_main_info["RUN_DATE"] != $order_info["date"] ) {
- $sql = " SELECT * FROM run_main WHERE PROD_ID={$run_main_info["PROD_ID"]} AND RUN_DATE='{$order_info["date"]}' ";
- $result = $pdo->query($sql);
- $rowset = $result->fetchAll();
- $result->closeCursor();
- $run_main_info = $rowset[0];
- $run_code = $run_main_info["RUN_ID"];
- }
-
- $sql = " SELECT * FROM opera_product_price WHERE PROD_ID={$prod_id} ";
- $result = $pdo->query($sql);
- $rowset = $result->fetchAll();
- $result->closeCursor();
- $per_price = $rowset[0]["CUS_PRICE"];
- $all_price = $per_price * $ticket_num;
- } else {
- //zizai
- $prod_id = $run_code_array[0];
- $sql = " SELECT * FROM outside_run WHERE prod_code='".$prod_id."' AND cancel_flag = 0 ";
- $result=$pdo->query($sql);
- $rowset=$result->fetchAll();
- $result->closeCursor();
- if( false == $rowset ) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- }
- $run_info = $rowset[0];
- if( $run_info["start_date"] != $order_info["date"] ) {
- $sql = " SELECT * FROM outside_run WHERE line_code='{$run_info["line_code"]}' AND start_date='{$order_info["date"]}' AND start_time='{$order_info["startTime"]}' AND prod_name='{$run_info["prod_name"]}'";
- $result = $pdo->query($sql);
- $rowset = $result == false ? false : $result->fetchAll();
- $result->closeCursor();
- if( false == $rowset ) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- }
- $run_info = $rowset[0];
- $prod_id = $run_info["prod_code"];
- }
- $per_price = $run_info["cus_price"];
- $all_price = $per_price * $ticket_num;
- }
-
- $pdo_insert = conn1();
- $sql_insert = " INSERT INTO outside_submit_order (from_org_id,outside_order_no,prod_id,ticket_num,per_price,all_price,customer_name,customer_mobile,customer_id_no,submit_status,opera_time,passenger) VALUE(" .
- "28,'{$out_order_no}','{$order_info["coachNo"]}',{$ticket_num},{$per_price},{$all_price},'{$customer_name}','{$customer_mobile}','{$customer_id_no}',0,'{$current_time}','{$passengers_list}') ";
- $pdo_insert->exec($sql_insert);
- if( !isset($run_code_array[1]) ) {
- $remain_count = $run_info["remain_count"] > 3 ? $run_info["remain_count"] - 3 : 0;
- $update_date = substr($run_info["update_time"],0,10);
- if( $update_date < $today ) {
- $remain_count = 0;
- }
- if( $remain_count < $ticket_num ) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- }
- $run_code = $run_info["run_code"];
- //自在下票
- $setOrder = new orderService();
- //票务系统锁定
- $zizai_cus = "{|".$customer_name."|".$customer_mobile."|".$customer_id_no."||}";
- $lock_order = $setOrder->createOrder(zizaiArgs::$USER, $prod_id."P".$ticket_num."|", $customer_name,$customer_mobile,$customer_id_no,'', 0);
- //$lock_order = $setOrder->lock(zizaiArgs::$USER, 30, $prod_id."P".$ticket_num."|", $zizai_cus );
- if ($lock_order['code']!=0) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- }
- $tradeno = $lock_order['tradeno'];
- $customerlist = "";
- foreach( $passengers as $passenger_info ) {
- $customerlist .= '{'.$prod_id.'|'.$passenger_info["passengerName"].'||'.descryption_by_shif($passenger_info["passengerId"]).'}';
- }
- $return_info = $setOrder->customer(zizaiArgs::$USER, $tradeno, $customerlist);
- $pdo_update3 = conn1();
- $sql_update = " UPDATE outside_submit_order set supply_order_id='{$tradeno}' WHERE outside_order_no='{$out_order_no}'";
- $pdo_update3->exec($sql_update);
-
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $line_name = str_replace("舟山","普陀山",$run_info["line_name"]);
- $post_data["comment"] = "出票成功:您已成功订购了{$line_name}[{$run_info["prod_name"]}]{$ticket_num}张。订单号为:".$tradeno."。出发时间:{$run_info["start_date"]} {$run_info["start_time"]}。上车地点:{$run_info["start_res"]}。请于发车前到上车站点的服务台领票。咨询电话4008872626";
- $ticketCode = sprintf("%d",$tradeno);
- for( $ticket_index = 1; $ticket_index < $ticket_num; $ticket_index++ ) {
- $ticketCode .= "|".sprintf("%d",$tradeno);
- }
- $post_data["ticketInfo"] = json_encode(array( "ret" => true, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 0, "ticketNum" => sprintf("%d",$ticket_num), "ticketPassword" => $ticketCode, "ticketCode" => $ticketCode )) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
-
- /*
- $res_order = $setOrder->eticket(zizaiArgs::$USER, $tradeno);
- if ($res_order['code']!=0) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- }*/
- //出发地和目的地的area_id
- $sql = " SELECT ID,AREA_NAME FROM base_area WHERE AREA_NAME like \"".$run_info["start_area"]."%%\" AND cancel_flag = 0 ";
- $result=$pdo->query($sql);
- $rowset=$result->fetchAll();
- $result->closeCursor();
- if( $rowset == false ) {
- $start_area_id = 791;
- } else {
- $start_area_id = $rowset[0]["ID"];
- }
- $sql = " SELECT ID,AREA_NAME FROM base_area WHERE AREA_NAME like \"".$run_info["end_area"]."%%\" AND cancel_flag = 0 ";
- $result=$pdo->query($sql);
- $rowset=$result->fetchAll();
- $result->closeCursor();
- if( $rowset == false ) {
- $end_area_id = 791;
- } else {
- $end_area_id = $rowset[0]["ID"];
- }
-
- $userid = 1;
- $prod_id = 380001;
- $run_code = 0;
- $myprod = '{m'.$prod_id.'p'.$ticket_num.'|r'.$run_code.'}';
- $mycustomer = "{,".$customer_name.",,".$customer_mobile.",150,".$customer_id_no.",,,,".$passenger_txt."}";
- $run_info_txt = "{0,普通座票,".$run_info["line_name"].",".$run_info["start_date"].",".$run_info["start_time"].",".$run_info["start_res"].",".$run_info["start_date"].",".$run_info["start_time"].",".$run_info["start_area"].",".$run_info["end_res"].",,,".$run_info["end_area"].",".$start_area_id.",".$end_area_id."}";
- $sql_insert="call sp_make_order_for_zizai(".$userid.",'".$myprod."','".$mycustomer."', 28, '".$out_order_no."',".$run_info["cus_price"].", '".$run_info_txt."')";
- writeLog($sql_insert);
- $result=$pdo->query($sql_insert);
- $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
- $result->closeCursor();
- if (is_array($rowset) && $rowset[0]['errcode'] == 0 ) {
- $order_id=$rowset[0]['order_id'];
- //update submit order
- $pdo_update = conn1();
- $sql_update = " UPDATE order_main set order_status =146,PROD_SUPPLY_ORG_NAME='自在旅行' WHERE ORDER_ID=".$order_id." OR PARENT_ORDER_ID=".$order_id;
- $pdo_update->exec($sql_update);
- $pdo_update2 = conn1();
- $sql_update = " UPDATE outside_submit_order set submit_status=1 WHERE outside_order_no='{$out_order_no}'";
- $pdo_update2->exec($sql_update);
- continue;
- } else {
- /*
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- */
- continue;
- }
- continue;
- }
-
- if( in_array($run_main_info["PROD_ID"], $limit_sell_prod) && (($current_hour >= "15:00" && $run_main_info["RUN_DATE"] <= $tomorrow_day) || $run_main_info["RUN_DATE"] < $tomorrow_day )) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- } else if( $run_main_info["RUN_DATE"] == $today && $limit_time >= $run_main_info["RUN_TIME"] ) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- }
- if( in_array($prod_id,$no_sell_array) ) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- }
-
- $myprod = '{m'.$prod_id.'p'.$ticket_num.'|r'.$run_code.'}';
- $mycustomer = '{,'.$customer_name.',,'.$customer_mobile.',150,'.$customer_id_no.',,,,'.$passengers_list.'}';
- if($prod_id== "449862" || $prod_id == "449867" ){
-
- if($prod_id== "449862") {
- $result = post2('http://wx.zhizhuchuxing.com/ZZDZ/application/custom_made/control.php', array(
- 'type' => 'order_submitforout',
- 'prod_list' => $myprod,
- 'customer_info' => $mycustomer,
- 'start_name' => '南京五塘广场',
- 'end_name' => '南通政务中心',
- 'startx_y' => '32.116682,118.784105',
- 'endx_y' => '32.011714,120.894448',
- 'line_id' => '449860',
- 'start_time' => '07:37',
- 'end_time' => '10:30'
- ));
- } else {
- $result = post2('http://wx.zhizhuchuxing.com/ZZDZ/application/custom_made/control.php',array(
- 'type' =>'order_submitforout',
- 'prod_list'=>$myprod,
- 'customer_info'=>$mycustomer,
- 'start_name'=>'南通政务中心',
- 'end_name'=>'南京五塘广场',
- 'endx_y'=>'32.116682,118.784105',
- 'startx_y'=>'32.011714,120.894448',
- 'line_id'=>'449865',
- 'start_time'=>'07:37',
- 'end_time'=>'10:30'
- ));
- }
- $result_array = json_decode($result,true);
-
- writeLog($result);
- if( $result_array["code"] == 0 ) {
- $order_id = $result_array['order_id'];
- $sql_order_status = "update order_main set order_status =146,OUTSIDE_SALE_ORG_ID=28,OUTSIDE_ORDER_NO='".$out_order_no."' where order_id= " . $order_id . " or parent_order_id = " . $order_id;
- $pdo_update2 = conn1();
- $pdo_update2->exec($sql_order_status);
- $res_content = get_msg_info($order_id);
- $name = $res_content[0];
- $tel = $res_content[1];
- $content = $res_content[2];
- $post_data["comment"] = $content;
-
- $comment_type = 0;
- $comment_text = "";
- $send_success = 0;
- $sql1 = "CALL HT_ADD_MSG_COMMENT(2,'addmsg'," . $order_id . "," . $comment_type . ",'" . $comment_text . "','" . $tel . "','" . $content . "','" . date("Y-m-d H:i:s") . "',{$send_success})";
- $result1 = $pdo->query($sql1);
- $rowset1 = $result1->fetchAll(PDO::FETCH_ASSOC);
- $result1->closeCursor();
- $pdo_update = conn1();
- $sql_update = " UPDATE outside_submit_order set submit_status=1 WHERE outside_order_no='{$out_order_no}'";
- $pdo_update->exec($sql_update);
-
- $ticketCode = sprintf("%d", $order_id);
- for ($ticket_index = 1; $ticket_index < $ticket_num; $ticket_index++) {
- $ticketCode .= "|" . sprintf("%d", $order_id);
- }
- $post_data["ticketInfo"] = json_encode(array("ret" => true, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 0, "ticketNum" => sprintf("%d", $ticket_num), "ticketPassword" => $ticketCode, "ticketCode" => $ticketCode)));
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post(QUNAR_COMPLETE_ORDER_URL, $post_data);
- $complete_result_array = json_decode($complete_result, true);
- continue;
- } else if( $result_array["code"] == 101 ) {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- } else {
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- $post_data["comment"] = "出票失败:该线路已停售";
- $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
- continue;
- }
-
- } else {
- $sql_insert = "call sp_make_order(" . $userid . ",'" . $myprod . "','" . $mycustomer . "', 28, '" . $out_order_no . "')";
- $result = $pdo->query($sql_insert);
- $rowset = $result->fetchAll(PDO::FETCH_ASSOC);
- $result->closeCursor();
- $post_data = array();
- $post_data["agentId"] = QUNAR_AGENT_ID;
- $post_data["time"] = $current_time;
- if (is_array($rowset) && $rowset[0]['errcode'] == 0) {
- $order_id = $rowset[0]['order_id'];
- $res_content = get_msg_info($order_id);
- $name = $res_content[0];
- $tel = $res_content[1];
- $content = $res_content[2];
- $post_data["comment"] = $content;
- $ticketCode = sprintf("%d", $order_id);
- for ($ticket_index = 1; $ticket_index < $ticket_num; $ticket_index++) {
- $ticketCode .= "|" . sprintf("%d", $order_id);
- }
- $post_data["ticketInfo"] = json_encode(array("ret" => true, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 0, "ticketNum" => sprintf("%d", $ticket_num), "ticketPassword" => $ticketCode, "ticketCode" => $ticketCode)));
- } else {
- $post_data["comment"] = "出票失败:" . $rowset_back[0]['errinfo'];
- $post_data["ticketInfo"] = json_encode(array("ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)));
- }
- $post_data["auth"] = get_qunar_auth($post_data);
- $complete_result = send_post(QUNAR_COMPLETE_ORDER_URL, $post_data);
- $complete_result_array = json_decode($complete_result, true);
-
- if (is_array($rowset) && $rowset[0]['errcode'] == 0) {
- $comment_type = 0;
- $comment_text = "";
- $send_success = 0;
- $sql1 = "CALL HT_ADD_MSG_COMMENT(2,'addmsg'," . $order_id . "," . $comment_type . ",'" . $comment_text . "','" . $tel . "','" . $content . "','" . date("Y-m-d H:i:s") . "',{$send_success})";
- $result1 = $pdo->query($sql1);
- $rowset1 = $result1->fetchAll(PDO::FETCH_ASSOC);
- $result1->closeCursor();
- $pdo_update = conn1();
- $sql_update = " UPDATE outside_submit_order set submit_status=1 WHERE outside_order_no='{$out_order_no}'";
- $pdo_update->exec($sql_update);
- $sql_order_status = "update order_main set order_status =146 where order_id= " . $order_id . " or parent_order_id = " . $order_id;
- $pdo_update2 = conn1();
- $pdo_update2->exec($sql_order_status);
- }
- }
- }
- echo "success";
- exit();
-
- function get_msg_info($ORDER_ID) {
- $msg_pdo = conn1();
- $msg_sql = "CALL SP_GET_MESSAGE_TEMPLATE('" . $ORDER_ID . "')";
- $content = '';
- if (is_object($msg_pdo)) {
- $msg_result = $msg_pdo -> query($msg_sql);
- $i = 1;
- $data = array();
- if ($msg_result) {
- $data['code'] = "0";
- $data['info'] = "";
- do {
- $row = $msg_result -> fetchAll(PDO::FETCH_ASSOC);
- if ($i == 1) {
- $data['seat'] = isset($row) ? $row : array();
- } else if ($i == 2) {
- $data['run_info'] = isset($row) ? $row : array();
- } else if ($i == 3) {
- $data['driver'] = isset($row) ? $row : array();
- } else {
- }
- $i++;
- } while($msg_result->nextRowset());
- }
- $json_obj = json_decode(json_encode($data), TRUE);
- $seat = isset($json_obj['seat'][0]) ? $json_obj['seat'][0] : array();
- $run_info = isset($json_obj['run_info'][0]) ? $json_obj['run_info'][0] : array();
- $driver = isset($json_obj['driver'][0]) ? $json_obj['driver'][0] : array();
- $bus_res_id = isset($json_obj['driver'][0]) ? $json_obj['driver'][0]["bus_res_id"] : 0;
- $short_url = false;
- if( $bus_res_id != 0 ) {
- $ary_sell_ary = array(916,917);
- if( in_array( $bus_res_id, $ary_sell_ary ) ) {
- $ticket_url = TICKET_QR_URL.$ORDER_ID;
- $short_url = sinaShortenUrl($ticket_url);
- }
- }
- $extra_message = "";
- if( $short_url != false ) {
- $extra_message = "点击以下链接获取您的电子票扫码上车:{$short_url}";
- }
-
- //出票成功
- // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车,车牌号{车牌号},司机电话{司机姓司机电话}。";
- // 得到明天的时间
- date_default_timezone_set('prc');
- //解决时区问题
- $tomorrow = date("Y-m-d", strtotime("+1 day"));
- $now_time = date('H:i:s', time());
- //判断当前时间是否在17:30:00之后
- $cur_date = date('Y-m-d', time());
- $new_message_array = array(448569,448568);
- $new_message_array2 = array(449860,449865);
- if( in_array( $run_info['parent_prod_id'], $new_message_array ) ) {
- $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前十五分钟到达{上车站点}。出行前一天下午的18:00左右将会有导游和您联系,预祝您旅途愉快。";
- } else if( in_array( $run_info['parent_prod_id'], $new_message_array2 ) ) {
- $content = "您已成功预订{出发地}-{目的地}城际商务车{张数}张车票,车型为奔驰7座,发车时间为{出发日期} {出发时间},请提前10分钟到达{上车站点}。车辆和司机联系方式会在出行前一天18:30发送给您。";
- } else if (($now_time > "17:30:00" && $run_info['start_date'] == $tomorrow) || $cur_date == $run_info['start_date']) {//17:30之后的订单或者下单时间为今天出行为今天下午 发送短信模板
- // if("18:30:00">"17:30:00" && $run_info['start_date']==$tomorrow){ //17:30之后的订单 发送短信模板
- // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车,车牌号{车牌号},司机电话{司机姓司机电话}。";
- $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前三十分钟到达{上车站点}。您的乘车订单号为{订单号},车牌号{车牌号},司机电话{司机姓司机电话},请凭短信订单号乘车".$extra_message.",预祝您旅途愉快。";
-
- } else {
- // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车。";
- $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前三十分钟到达{上车站点}。您的乘车订单号为{订单号},请凭短信订单号乘车".$extra_message."。出行前一天下午的18:30会将车牌号与司机电话发送给您,预祝您旅途愉快。";
- }
- // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车。";
- if ($seat) {
- $seat_x = isset($seat['seat_x']) ? $seat['seat_x'] : "";
- $seat_y = isset($seat['seat_y']) ? $seat['seat_y'] : "";
- $seat_name = isset($seat['seat_name']) ? $seat['seat_name'] : "";
- $order_main_id = isset($seat['order_main_id']) ? $seat['order_main_id'] : "";
- } else {
-
- }
- if ($run_info) {
- $order_count = $run_info['order_count'];
- $start_date = $run_info['start_date'];
- $start_time = $run_info['start_time'];
- $parent_order_id = $run_info['parent_order_id'];
- $end_date = $run_info['end_date'];
- $start_area = $run_info['start_area'];
- $end_area = $run_info['end_area'];
- $res_name = $run_info['res_name'];
- $prod_name = $run_info['prod_name'];
- $prod_name = "标准票";
- $customer_name = $run_info['customer_name'];
- $customer_mobile = $run_info['customer_mobile'];
- $start_end_date = $start_date . "," . $start_time;
- $content = str_replace("{出发日期}", $start_date, $content);
- $content = str_replace("{出发时间}", $start_time, $content);
- $content = str_replace("{上车站点}", $res_name, $content);
- $content = str_replace("{出发地}", $start_area, $content);
- $content = str_replace("{目的地}", $end_area, $content);
- $content = str_replace("{票种名}", $prod_name, $content);
- $content = str_replace("{张数}", $order_count, $content);
- $content = str_replace("{订单号}", $ORDER_ID, $content);
- } else {
- $content = str_replace("{出发日期}", "", $content);
- $content = str_replace("{出发时间}", "", $content);
- $content = str_replace("{出发地}", "", $content);
- $content = str_replace("{目的地}", "", $content);
- $content = str_replace("{票种名}", "", $content);
- $content = str_replace("{张数}", "", $content);
- $content = str_replace("{订单号}", "", $content);
- }
- if ($driver) {
- $bus_no = isset($driver['bus_no']) ? $driver['bus_no'] : "";
- $driver_name = isset($driver['driver_name']) ? $driver['driver_name'] : "";
- $driver_mobile = isset($driver['driver_mobile']) ? $driver['driver_mobile'] : "";
-
- if ($bus_no == "") {
- $content = str_replace(",车牌号{车牌号}", "", $content);
- } else {
- $content = str_replace("{车牌号}", $bus_no, $content);
- }
- if ($driver_name == "") {
- $content = str_replace(",司机电话{司机姓司机电话},", "。", $content);
- } else {
- $driver_xing = mb_substr($driver_name, 0, 1, 'utf-8');
- $driver_name_mobile = $driver_xing . $driver_mobile;
- $content = str_replace("{司机姓司机电话}", $driver_name_mobile, $content);
- }
- } else {
- $content = str_replace("车牌号{车牌号},", "", $content);
- $content = str_replace("司机电话{司机姓司机电话},", "", $content);
- }
- return array(isset($customer_name) ? $customer_name : "", isset($customer_mobile) ? $customer_mobile : "", isset($content) ? $content : "短信错误,联系客服!!!");
- }
- <<<<<<< .mine
- }
- =======
- }
-
- function post2($url, $data){//file_get_content
- $postdata = http_build_query(
- $data
- );
- $opts = array('http' =>
- array(
- 'method' => 'POST',
- 'header' => 'Content-type: application/x-www-form-urlencoded',
- 'content' => $postdata
- )
- );
-
- $context = stream_context_create($opts);
- $result = file_get_contents($url, false, $context);
- return $result;
- }>>>>>>> .r1099
|