|
- <?php
-
- if (ALLOW_ORIGIN)
- header("Access-Control-Allow-Origin:*");
- date_default_timezone_set('PRC');
- //require_once '../../Common/Mysql.php';
- //$res_content=get_msg_info(207678);
- //echo $res_content[2];exit();
- //^1[3,4,5,7,8]\d{9}$/
- //echo substr('{m1452p1|r202375}',strpos('{m5421p1|r202375}', 'm')+1, strpos('{m1254p1|r202375}', 'p')-2);
- $userid =$_COOKIE['user_id'];//getUserId();
- $top_org_id=$_COOKIE['top_org_id'];
- //$sql_user="select ";
- if (!$userid) {
- echo json_encode(array("code" => 1,"iflogin"=>1, "info" => "未登录"));
- exit ;
- }
-
- //$userid=1;
- $pdo= conn();
- $myprod = isset($_POST['prod']) ? $_POST['prod'] : "{m152603p1|r202375}";//{m152603p1|r202375}
- $prod_id =substr($myprod,strpos($myprod, 'm')+1, strpos($myprod, 'p')-2);
- $run_id = substr(substr($myprod,strpos($myprod, 'r')+1),0,-1);
- $sql_time = "select run_date,run_time,prod_id from run_main where run_id =".$run_id;
- $result_time= $pdo->query($sql_time);
- $row_t = $result_time->fetchAll(PDO::FETCH_ASSOC);
- $run_date = $row_t[0]['run_date'];
- $run_time = $row_t[0]['run_time'];
- //$sql_time_wu ="SELECT prod_id FROM `opera_product` where PROD_NAME like '%千岛湖%';";
- //$result_time_wu= $pdo->query($sql_time_wu);
- //$row_wu = $result_time_wu->fetchAll(PDO::FETCH_ASSOC);
- //foreach ($row_wu as $v) {
- // $prod_wu[] = $v['prod_id'];
- //
- //}
- $prod_wu=array(448568,448569,/*448778,448779,*/448780,448781);
- if(strtotime($run_date.' '.$run_time)- time()<1800){
- echo json_encode(array('code'=>1,'info'=>'预定时间已过'));exit();
- }
-
- if(in_array($row_t[0]['prod_id'],$prod_wu)){
- if(date('Y-m-d', time())>=$run_date){
- echo json_encode(array('code'=>1,'info'=>'预定时间已过'));exit();
- }elseif(date('Y-m-d', time()+24*60*60)==$run_date && date('H:i', time())>'10:01'){
- echo json_encode(array('code'=>1,'info'=>'预定时间已过'));exit();
- }
-
- }
- $mycustomer = isset($_POST['customer']) ? $_POST['customer'] : "nono";
- $order_from_org_id = $_COOKIE['org_id'];
- $outside_order_id = isset($_POST['outside_order_id']) ? $_POST['outside_order_id'] : '0';
- $sql_price = "select cus_price from opera_product_price where prod_id =".$prod_id;
-
- $result_price = $pdo->query($sql_price);
- $row_p = $result_price->fetchAll(PDO::FETCH_ASSOC);
- $price_list = $prod_id.','.$row_p[0]['cus_price'];//'.$row_p['0']['cus_price'].'
- //$u_prod_list=isset($_POST['u_prod_list'])?$_POST['u_prod_list']:"";
- //$f_u_prod_list=isset($_POST['f_u_prod_list'])?$_POST['f_u_prod_list']:"";
- ///st-xm/Api/add_new_order.php?prod={m152603p1|r202375}&customer={,fuhc_ceshi,1,15821387785,150,511621199502032173,,0,,,}
- //&order_from_org_id=5&outside_order_id=9999999999999&tt=20160719195230&price={60.00}&doorPrice=10&hotelPrice=20&ifcheck=1&back_pro_id={m152248p1|r203865}
- //.返程 1=true 0=false
- $ifcheck = isset($_POST['ifback']) ? $_POST['ifback'] : "";
- if($ifcheck){
- $back_prod = isset($_POST['back_prod']) ? $_POST['back_prod'] : "";
- $prod_id_f =substr($back_prod,strpos($back_prod, 'm')+1, strpos($back_prod, 'p')-2);
- $sql_price_f = "select cus_price from opera_product_price where prod_id =".$prod_id_f;
- $result_price_f = $pdo->query($sql_price_f);
- $row_f = $result_price_f->fetchAll(PDO::FETCH_ASSOC);
- $price_list_f =$prod_id_f.','.$row_f['0']['cus_price'];
- }
-
- $sql = "call sp_make_order(" . $userid . ",'" . $myprod . "','" . $mycustomer . "'," . $order_from_org_id . ",'" . $outside_order_id . "')";
-
- if ($ifcheck == 0) {//不是含有返程的
-
- writeLog("sp_make_order---san: " . $sql);
- $rowset = create_order($sql,$price_list);
- // echo 111;die;
-
-
- if(!isset($rowset[0]['order_id'])){
- echo json_encode(array('code'=>1,'info'=>'error'));die;
- }
- $order_id = $rowset[0]['order_id'];
- //更改支付方式为 授信支付
-
- //根据订单号查找订单详情PROD_START_STATION_DATE as run_date,PROD_START_STATION_TIME as run_time,
- $sql = "select a.order_id,a.order_price,a.order_pay_main_id,a.customer_name,a.customer_mobile,count(b.order_id) as num,b.PROD_START_STATION_DATE as run_date,b.PROD_START_STATION_TIME as run_time,b.PROD_START_STATION_AREA_NAME AS start_area,b.PROD_END_STATION_AREA_NAME AS end_area,b.PROD_START_STATION_RES_NAME AS start_res,b.PROD_END_STATION_RES_NAME AS end_res from order_main a,order_main b where a.order_id = b.PARENT_ORDER_ID and a.order_id = " . $order_id . " group by a.order_id";
-
- $result = $pdo->query($sql);
-
- $order_info = $result->fetchAll(PDO::FETCH_ASSOC);
- if($top_org_id == 0 || isset($_COOKIE['login_type'])){
- $sql_pay = "update order_pay_detail set pay_type_id_1 =278 where pay_main_id = ".$order_info[0]['order_pay_main_id'];
- $pdo->query($sql_pay);
- $sql_order_status = "update order_main set ORDER_BOOK_STATUS =1 where order_id= ".$order_id." or parent_order_id = ".$order_id;
- $pdo->query($sql_order_status);
- }else{
-
- $sql_pay = "update order_pay_detail set pay_type_id_1 =275 where pay_main_id = ".$order_info[0]['order_pay_main_id'];
- $pdo->query($sql_pay);
- $sql_order_status = "update order_main set order_status =146,ORDER_BOOK_STATUS =1 where order_id= ".$order_id." or parent_order_id = ".$order_id;
- $pdo->query($sql_order_status);
- }
- if (is_array($rowset) && $rowset[0]['errcode'] == 0 && SEND_MESSAGE == true && $top_org_id!=0) { //单程票订票成功
- send_msg($rowset[0]['order_id']);
- }
- $data['code'] = $rowset[0]['errcode'];
- $data['info'] = $rowset[0]['errinfo'];
- $data['order_id'] = $rowset[0]['order_id'];
- $data['go_list'] = $order_info[0];
- $data['go_list']['site_type'] = "普通票";
- $data['ifdisney'] = 0;
- echo json_encode($data);
- } else {
- $rowset = create_order($sql,$price_list);
- if(!$rowset){
- echo json_encode(array('code'=>1,'info'=>'error'));die;
- }
- if (is_array($rowset) && $rowset[0]['errcode'] == 0 && SEND_MESSAGE == true) {//返程---单程票订票成功
- $order_id_go = $rowset[0]['order_id'];
- //根据订单号查找订单详情
- $sql = "select a.order_id,a.order_price,a.order_pay_main_id,a.customer_name,a.customer_mobile,count(b.order_id) as num,b.PROD_START_STATION_DATE as run_date,b.PROD_START_STATION_TIME as run_time,b.PROD_START_STATION_AREA_NAME AS start_area,b.PROD_END_STATION_AREA_NAME AS end_area,b.PROD_START_STATION_RES_NAME AS start_res,b.PROD_END_STATION_RES_NAME AS end_res from order_main a,order_main b where a.order_id = b.PARENT_ORDER_ID and a.order_id = " . $order_id_go . " group by a.order_id";
-
- $result = $pdo->query($sql);
- $order_info_go = $result->fetchAll(PDO::FETCH_ASSOC);
- if($top_org_id == 0 || isset($_COOKIE['login_type'])){
- $sql_pay = "update order_pay_detail set pay_type_id_1 =278 where pay_main_id = ".$order_info_go[0]['order_pay_main_id'];
- $pdo->query($sql_pay);
- $sql_order_status = "update order_main set ORDER_BOOK_STATUS =1 where order_id = ".$order_id_go." or parent_order_id = ".$order_id_go;
- $pdo->query($sql_order_status);
- }else{
- $sql_pay = "update order_pay_detail set pay_type_id_1 =275 where pay_main_id = ".$order_info_go[0]['order_pay_main_id'];
- $sql_order_status = "update order_main set order_status =146,ORDER_BOOK_STATUS =1 where order_id = ".$order_id_go." or parent_order_id = ".$order_id_go;
- $pdo->query($sql_order_status);
- $pdo->query($sql_pay);
- }
-
-
- // $data['code'] = $rowset[0]['errcode'];
- // $data['info'] = $rowset[0]['errinfo'];
- $data['order_id'] = $rowset[0]['order_id'];
- $data['go_list'] = $order_info_go[0];
- $data['go_list']['site_type'] = "普通票";
- // $data['code_f'] = "";
- // $data['info_f'] = "";
- // $data['order_id_f'] = "";
- $sql_f = "call sp_make_order(" . $userid . ",'" . $back_prod . "','" . $mycustomer . "'," . $order_from_org_id . ",'" . $outside_order_id . "')";
- writeLog('fan_dan_success sql_f========'.$sql_f);
-
- $rowset_f = create_order($sql_f,$price_list_f);
- //..判断返程票是否成功,若不成功,则去程订单
- if (is_array($rowset_f) && $rowset_f[0]['errcode'] == 0 && SEND_MESSAGE == true) {//返程--返程票订票成功
-
- $order_id_back = $rowset_f[0]['order_id'];
- //根据订单号查找订单详情
- $sql = "select a.order_id,a.order_price,a.order_pay_main_id,a.customer_name,a.customer_mobile,count(b.order_id) as num,b.PROD_START_STATION_DATE as run_date,b.PROD_START_STATION_TIME as run_time,b.PROD_START_STATION_AREA_NAME AS start_area,b.PROD_END_STATION_AREA_NAME AS end_area,b.PROD_START_STATION_RES_NAME AS start_res,b.PROD_END_STATION_RES_NAME AS end_res from order_main a,order_main b where a.order_id = b.PARENT_ORDER_ID and a.order_id = " . $order_id_back . " group by a.order_id";
-
- $result = $pdo->query($sql);
- $order_info_back = $result->fetchAll(PDO::FETCH_ASSOC);
-
- if($top_org_id == 0 || isset($_COOKIE['login_type'])){
- $sql_pay = "update order_pay_detail set pay_type_id_1 =278 where pay_main_id = ".$order_info_back[0]['order_pay_main_id'];
- $pdo->query($sql_pay);
- $sql_order_status = "update order_main set ORDER_BOOK_STATUS =1 where order_id = ".$order_id_back." or parent_order_id = ".$order_id_back;
- $pdo->query($sql_order_status);
- }else{
-
- $sql_order_status = "update order_main set order_status =146,ORDER_BOOK_STATUS =1 where order_id = ".$order_id_back." or parent_order_id = ".$order_id_back;
- $pdo->query($sql_order_status);
- $sql_pay = "update order_pay_detail set pay_type_id_1 =275 where pay_main_id = ".$order_info_back[0]['order_pay_main_id'];
- $pdo->query($sql_pay);
- }
-
- $data['code'] = $rowset_f[0]['errcode'];
- $data['info'] = $rowset_f[0]['errinfo'];
- $data['order_id_f'] = $rowset_f[0]['order_id'] ;
- $data['back_list'] = $order_info_back[0];
- $data['back_list']['site_type'] = "普通票";
- $data['ifdisney'] = 0;
- writeLog('fan_fan_success');
- //发两条短信
- if($top_org_id!=0){
- send_msg($rowset[0]['order_id']);
- send_msg($rowset_f[0]['order_id']);
- }
-
- //订票成功写入 往返订单关系表
- $to_id = $rowset[0]['order_id'];
- $back_id = $rowset_f[0]['order_id'];
- $sql_conn = "insert into to_from values(NULL,".$to_id.",".$back_id.",'". date('Y-m-d h:i:s', time())."')";
- $pdo= conn();
- $pdo->exec($sql_conn);
- echo json_encode($data);exit();
- } else {//如果返程票订票不成功,则取消单程票
- $sql_cancel = "CALL SP_CANCEL_ORDER(" . $userid . "," . $rowset[0]['order_id'] . ")";
- writeLog('fan_dan_faile_sql_cancel======'.$sql_cancel);
- $pdo_cancel = conn();
- $result_cancel = $pdo_cancel -> query($sql_cancel);
- $rowset_cancel = $result_cancel -> fetchAll(PDO::FETCH_ASSOC);
- $result_cancel -> closeCursor();
-
- //取消单程不发短信,但要写入取消订单原因
- $res_content = get_msg_info($rowset[0]['order_id']);
- // $tel = isset($res_content[1])?$res_content[1]:"";
- $content = $rowset_f[0]['errinfo'] . "-订单已取消";
- $comment_type = 0;
- $comment_text = "";
- $sql1 = "CALL HT_ADD_MSG_COMMENT(2,'addmsg'," . $rowset[0]['order_id'] . "," . $comment_type . ",'" . $comment_text . "','" . $tel . "','" . $content . "','" . date("Y-m-d H:i:s") . "',0)";
- $result1 = $pdo_cancel -> query($sql1);
- $rowset1 = $result1 -> fetchAll(PDO::FETCH_ASSOC);
- $result1 -> closeCursor();
- writeLog("order_list.php HT_ADD_MSG_COMMENT()::" . $sql1);
-
- $data['code_f'] = $rowset_f[0]['errcode'];
- $data['info_f'] = $rowset_f[0]['errinfo'];
- $data['order_id_f'] = isset($rowset_f[0]['order_id']) ? $rowset_f[0]['order_id'] : "";
- echo json_encode($data);exit();
- }
- }
- }
-
-
-
-
-
- function create_order($sql,$price_list) {
-
- $pdo = conn();
- if (is_object($pdo)) {
- $result = $pdo -> query($sql);
- if(!$result){
- echo json_encode(array('code'=>1,'info'=>'可售资源不足'));die;
- }
- // echo json_encode(array('aa'=>$sql));die;
- $rowset_create = $result -> fetchAll(PDO::FETCH_ASSOC);
- $result -> closeCursor();
- writeLog('下订单成功');
- writeLog(json_encode($rowset_create));
- if (is_array($rowset_create) && $rowset_create[0]['errcode'] == 0 && SEND_MESSAGE == true) {
- //下订单成功再修改价格
- writeLog('change_price.php' . json_encode($_POST));
-
- $sql_up_price = "call SP_CHANGE_PRICE(" . $rowset_create[0]['order_id'] . ",'" . $price_list . "')";
- //$sql="update order_main set order_price ='".$price_arr[$k]."' where PROD_ID=".$v." and PARENT_ORDER_ID=".$ordid." and RUN_ID>0";
- $result_up_price = $pdo -> query($sql_up_price);
- $rowset_up_price = $result_up_price -> fetchAll(PDO::FETCH_ASSOC);
- writeLog("change_price.php sql:: " . $sql_up_price . "::rowset ::" . json_encode($rowset_up_price));
- $result_up_price -> closeCursor();
- }
- }
- return $rowset_create;
- }
-
- //发短信
- function send_msg($ORDER_ID) {
- $send_pdo=conn();
- $order_id = $ORDER_ID;
-
- $url='http://cs1.zhizhuchuxing.com/api/msg/order-send-msg';
- $sendInfo=array();
- $sendInfo['order_id']=$order_id;
- $sendInfo['msg_type']='sfx';
- $res_content = httpRequest($url,$sendInfo);
-
- //insert order extra
- $hotelPrice = isset($_GET['hotelPrice']) ? $_GET['hotelPrice'] : "";
- $doorPrice = isset($_GET["doorPrice"]) ? $_GET["doorPrice"] : "";
- if ($hotelPrice != "" || $doorPrice != "") {
- $sqlInsert = " INSERT INTO order_extra_info (order_id,hotel_price,gate_price) VALUE(" . $ORDER_ID . ",'" . $hotelPrice . "','" . $doorPrice . "') ";
- writeLog("insert extra info: " . $sqlInsert);
- $result = $send_pdo -> exec($sqlInsert);
- }
- }
- //..短信模板-改为17:30后OK,当天下单也OK
- function get_msg_info($ORDER_ID) {
- $msg_pdo = conn();
- $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 if($i==4){
- $data['dsn_prod']=isset($row) ? $row : array();
- }else if($i==5){
- $data['zhou_su_prod']=isset($row) ? $row : array();
- }
- $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();
- $dsn_prod = isset($json_obj['dsn_prod'])?$json_obj['dsn_prod']:array();
- $zhou_su_prod=isset($json_obj['zhou_su_prod'])?$json_obj['zhou_su_prod']:array();
- $bus_res_id = isset($json_obj['driver'][0]) ? $json_obj['driver'][0]["bus_res_id"] : 0;
- $short_url = false;
- $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());
- //迪士尼特殊情况parent_prod_id
-
- // $dsn_arr_prod = array(152752, 152759, 152763, 152770, 152777, 152784, 152791, 152801, 152808, 152815, 152822, 152832, 152842, 152852, 152859, 152866, 152873, 152877, 152884, 152891, 152898, 152905, 152915, 152922, 152929, 152936, 152946, 152956, 152966, 152973, 152980, 152990, 153003, 153016, 153023, 153033, 153034, 153044, 153057, 153070, 153083, 153090, 153100, 153110);
- $dsn_arr_prod = array(); //用来保存迪士尼产品的prod_id
- foreach($dsn_prod as $temp){
- $dsn_arr_prod[]=$temp['prod_id'];
- }
-
- $zhou_su_arr_prod = array();
- foreach($zhou_su_prod as $temp){
- $zhou_su_arr_prod[]=$temp['prod_id'];
- }
-
- $new_message_array = array(448569,448568);
- $new_message_array3 = array(450517,450522);
- 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_array3 ) ) {
- if( $run_info['parent_prod_id'] == 450517 ) {
- $address_txt = "上车地点:吴山广场西侧河坊巷8号(吴山广场旅游集散中心候车室); 上车方式:请至吴山广场旅游集散中心候车室服务台,凭预定姓名和手机号码上车。";
- } else {
- $address_txt = "上车地点:普陀城北长途客运中心;取票方式:请提前到达(学运路18号)普陀城北长途客运中心候车大厅服务台报预订名字和电话取票。";
- }
- $content = "您已成功预定{出发日期} {出发时间} {出发地}-{目的地}汽车票{张数}张(请最晚提前10分钟到达)。{$address_txt}紧急电话:15888866564。";
- } else if (($now_time > "18: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 = "订单号{订单号},{出发地}—{目的地}标准票{张数}张将于{出发日期} {出发时间}准点发车。车牌号{车牌号},司机电话{司机姓司机电话},请提前10分钟抵达上车地点:{上车站点详细地址}并点开电子车票{$short_url}进行验票。如有疑问请拨打客服电话021-33280519。";
- } else {
- // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车。";
- $content = "订单号{订单号},{出发日期} {出发时间}{出发地}—{目的地}标准票{张数}张预定成功。发车前一天19点会短信通知您车牌号及司机电话,如未收到短信请拨打客服电话021-33280519。";
- }
-
- $new_message_array4 = array(450588,450589);
- if( in_array( $run_info['parent_prod_id'], $new_message_array4 ) ) {
- $content .= "紧急联系电话:18100158199。";
- }
- $new_message_array5 = array(451437,451438);
- if( in_array( $run_info['parent_prod_id'], $new_message_array5 ) ) {
- $content .= "司机会提前与您联系,如有疑问,请联系021-33280578 。";
- }
- $new_message_array5 = array(451440,451441);
- $new_message_array6 = array(448780,450008,448781);
- if( in_array( $run_info['parent_prod_id'], $new_message_array5 ) ) {
- $content = "订单号{订单号},{出发日期} {出发时间}{上车站点}—{目的地}标准票{张数}张预定成功。发车前一天19点会短信通知您车牌号及司机电话,如未收到短信请拨打客服电话021-33280519。";
- } else if( in_array( $run_info['parent_prod_id'], $new_message_array6 ) ) {
- $content = "订单号{订单号},{出发日期} {出发时间}{上车站点}—{目的地}标准票{张数}张预定成功。发车前一天19点会短信通知您乘车信息,如未收到短信请拨打客服电话021-33280519。";
- }
- // $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'];
- $parent_prod_id = $run_info['parent_prod_id'];
- $prod_name = $run_info['prod_name'];
- $prod_name = "标准票";
- $customer_name = $run_info['customer_name'];
- $customer_mobile = $run_info['customer_mobile'];
- $start_station_address = $run_info['start_station_address'];
- $start_end_date = $start_date . "," . $start_time;
-
- if( $parent_prod_id == 450504 && $start_date >= "2017-01-27" && $start_date <= "2017-02-02" ) {
- $res_name = "迪士尼唐老鸭P停车场";
- $start_station_address = "上海迪士尼度假区迪士尼唐老鸭P停车场";
- }
- $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);
- $content = str_replace("{上车站点详细地址}", $start_station_address, $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);
- $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);
- }
- /*
- if( $now_time < "18:30:00" ) {
- //判断是不是苏州或周庄
- // 判断如果不是迪士尼的票就不发短信
- if (!in_array($run_info['parent_prod_id'], $dsn_arr_prod) && !in_array($run_info['parent_prod_id'], $zhou_su_arr_prod)) {
- return array("", "-1", "不是迪士尼、苏州、周庄的票,目前不发送短信");
- }
- }*/
-
- return array(isset($customer_name) ? $customer_name : "", isset($customer_mobile) ? $customer_mobile : "", isset($content) ? $content : "短信错误,联系客服!!!");
- }
- }
|