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.
 
 
 
 

438 line
24 KiB

  1. <?php
  2. require_once __DIR__.'/../st-xm/Common/Mysql.php';
  3. require_once __DIR__.'/../st-xm/Common/config_api.inc';
  4. require_once '/usr/share/nginx/ZZCS/coding/st-xm/Common/sinaAPI.php';
  5. require_once '/usr/share/nginx/ZZCS/coding/st-xm/Common/zizai_orderAPI.php';
  6. header("Access-Control-Allow-Origin:*");
  7. date_default_timezone_set('PRC');
  8. $current_time = time();
  9. $current_hour = date("H:i:s",$current_time);
  10. $tomorrow_day = date("Y-m-d",strtotime("+1 days"));
  11. $today = date("Y-m-d");
  12. $limit_time = date("H:i", strtotime("+30 minutes"));
  13. //拼接数组
  14. $post_data = array();
  15. $post_data["agentId"] = QUNAR_AGENT_ID;
  16. $post_data["time"] = $current_time;
  17. $post_data["auth"] = get_qunar_auth($post_data);
  18. $return_data = send_post( QUNAR_CHECK_ORDER_URL, $post_data);
  19. $return_array = json_decode($return_data,true);
  20. if( !isset($return_array["orderNum"]) || $return_array["orderNum"] <= 0 ) {
  21. print_r($return_array);
  22. return;
  23. }
  24. //print_r($return_array);exit();//test
  25. $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);
  26. $limit_sell_prod = array( 448568, 448569,448778,448779,448780,448781);
  27. $userid = 1;
  28. $current_time = date("Y-m-d H:i:s");
  29. $pdo=conn1();
  30. $order_array = $return_array["data"];
  31. foreach( $order_array as $order_info ) {
  32. $run_code = $order_info["coachNo"];
  33. $run_code_array = explode("_",$run_code);
  34. if( isset($run_code_array[1]) ) {
  35. $run_code = $run_code_array[0];
  36. $prod_id = $run_code_array[1];
  37. } else {
  38. //zizai
  39. $run_code = $run_code_array[1];
  40. }
  41. $ticket_num = $order_info["ticketNum"];
  42. $customer_name = $order_info["contactName"];
  43. $customer_mobile = descryption_by_shif($order_info["contactPhone"]);
  44. $customer_id_no = descryption_by_shif($order_info["contactId"]);
  45. $out_order_no = $order_info["orderNo"];
  46. $passengers = $order_info["passengers"];
  47. $passengers_array = array();
  48. foreach( $passengers as $passenger_info ) {
  49. $passengers_array[] = $passenger_info["passengerName"]."*".descryption_by_shif($passenger_info["passengerId"]);
  50. }
  51. $passengers_list = implode("/",$passengers_array);
  52. $sql = " SELECT * FROM order_main WHERE OUTSIDE_ORDER_NO='{$out_order_no}' AND PARENT_ORDER_ID = 0 ";
  53. $result = $pdo->query($sql);
  54. $rowset = $result->fetchAll();
  55. $result->closeCursor();
  56. if ($rowset != false) {
  57. continue;
  58. }
  59. if( isset($run_code_array[1]) ) {
  60. $sql = " SELECT * FROM run_main WHERE RUN_ID={$run_code} ";
  61. $result = $pdo->query($sql);
  62. $rowset = $result->fetchAll();
  63. $result->closeCursor();
  64. $run_main_info = $rowset[0];
  65. if( $run_main_info["RUN_DATE"] != $order_info["date"] ) {
  66. $sql = " SELECT * FROM run_main WHERE PROD_ID={$run_main_info["PROD_ID"]} AND RUN_DATE='{$order_info["date"]}' ";
  67. $result = $pdo->query($sql);
  68. $rowset = $result->fetchAll();
  69. $result->closeCursor();
  70. $run_main_info = $rowset[0];
  71. $run_code = $run_main_info["RUN_ID"];
  72. }
  73. $sql = " SELECT * FROM opera_product_price WHERE PROD_ID={$prod_id} ";
  74. $result = $pdo->query($sql);
  75. $rowset = $result->fetchAll();
  76. $result->closeCursor();
  77. $per_price = $rowset[0]["CUS_PRICE"];
  78. $all_price = $per_price * $ticket_num;
  79. } else {
  80. //zizai
  81. $prod_id = $run_code_array[0];
  82. $sql = " SELECT * FROM outside_run WHERE prod_code='".$prod_id."' AND cancel_flag = 0 ";
  83. $result=$pdo->query($sql);
  84. $rowset=$result->fetchAll();
  85. $result->closeCursor();
  86. if( false == $rowset ) {
  87. $post_data = array();
  88. $post_data["agentId"] = QUNAR_AGENT_ID;
  89. $post_data["time"] = $current_time;
  90. $post_data["comment"] = "出票失败:该线路已停售";
  91. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  92. $post_data["auth"] = get_qunar_auth($post_data);
  93. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  94. continue;
  95. }
  96. $run_info = $rowset[0];
  97. $per_price = $rowset[0]["cus_price"];
  98. $all_price = $per_price * $ticket_num;
  99. }
  100. $pdo_insert = conn1();
  101. $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(" .
  102. "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}') ";
  103. $pdo_insert->exec($sql_insert);
  104. if( !isset($run_code_array[1]) ) {
  105. $remain_count = $run_info["remain_count"] > 3 ? $run_info["remain_count"] - 3 : 0;
  106. $update_date = substr($run_info["update_time"],0,10);
  107. if( $update_date < $today ) {
  108. $remain_count = 0;
  109. }
  110. if( $remain_count < $ticket_num ) {
  111. $post_data = array();
  112. $post_data["agentId"] = QUNAR_AGENT_ID;
  113. $post_data["time"] = $current_time;
  114. $post_data["comment"] = "出票失败:该线路已停售";
  115. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  116. $post_data["auth"] = get_qunar_auth($post_data);
  117. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  118. continue;
  119. }
  120. $run_code = $run_info["run_code"];
  121. //自在下票
  122. $setOrder = new orderService();
  123. //票务系统锁定
  124. $zizai_cus = "{|".$customer_name."|".$customer_mobile."|".$customer_id_no."||}";
  125. $lock_order = $setOrder->createOrder(zizaiArgs::$USER, $prod_id."P".$ticket_num."|", $customer_name,$customer_mobile,$customer_id_no,'', 0);
  126. //$lock_order = $setOrder->lock(zizaiArgs::$USER, 30, $prod_id."P".$ticket_num."|", $zizai_cus );
  127. if ($lock_order['code']!=0) {
  128. $post_data = array();
  129. $post_data["agentId"] = QUNAR_AGENT_ID;
  130. $post_data["time"] = $current_time;
  131. $post_data["comment"] = "出票失败:该线路已停售";
  132. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  133. $post_data["auth"] = get_qunar_auth($post_data);
  134. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  135. continue;
  136. }
  137. $tradeno = $lock_order['tradeno'];
  138. $customerlist = "";
  139. foreach( $passengers as $passenger_info ) {
  140. $customerlist .= '{'.$prod_id.'|'.$passenger_info["passengerName"].'||'.descryption_by_shif($passenger_info["passengerId"]).'}';
  141. }
  142. $return_info = $setOrder->customer(zizaiArgs::$USER, $tradeno, $customerlist);
  143. $pdo_update3 = conn1();
  144. $sql_update = " UPDATE outside_submit_order set supply_order_id='{$tradeno}' WHERE outside_order_no='{$out_order_no}'";
  145. $pdo_update3->exec($sql_update);
  146. $post_data = array();
  147. $post_data["agentId"] = QUNAR_AGENT_ID;
  148. $post_data["time"] = $current_time;
  149. $prod_name = $run_info["prod_name"];
  150. $post_data["comment"] = "出票成功:您已成功订购了{$run_info["line_name"]}[{$prod_name}]{$ticket_num}张。订单号为:".$tradeno."。出发时间:{$run_info["start_date"]} {$run_info["start_time"]}。上车地点:{$run_info["start_res"]}。请于发车前到上车站点的服务台领票。咨询电话4008872626";
  151. $ticketCode = sprintf("%d",$tradeno);
  152. for( $ticket_index = 1; $ticket_index < $ticket_num; $ticket_index++ ) {
  153. $ticketCode .= "|".sprintf("%d",$tradeno);
  154. }
  155. $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 )) );
  156. $post_data["auth"] = get_qunar_auth($post_data);
  157. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  158. /*
  159. $res_order = $setOrder->eticket(zizaiArgs::$USER, $tradeno);
  160. if ($res_order['code']!=0) {
  161. $post_data = array();
  162. $post_data["agentId"] = QUNAR_AGENT_ID;
  163. $post_data["time"] = $current_time;
  164. $post_data["comment"] = "出票失败:该线路已停售";
  165. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  166. $post_data["auth"] = get_qunar_auth($post_data);
  167. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  168. continue;
  169. }*/
  170. //出发地和目的地的area_id
  171. $sql = " SELECT ID,AREA_NAME FROM base_area WHERE AREA_NAME like \"".$run_info["start_area"]."%%\" AND cancel_flag = 0 ";
  172. $result=$pdo->query($sql);
  173. $rowset=$result->fetchAll();
  174. $result->closeCursor();
  175. if( $rowset == false ) {
  176. $start_area_id = 791;
  177. } else {
  178. $start_area_id = $rowset[0]["ID"];
  179. }
  180. $sql = " SELECT ID,AREA_NAME FROM base_area WHERE AREA_NAME like \"".$run_info["end_area"]."%%\" AND cancel_flag = 0 ";
  181. $result=$pdo->query($sql);
  182. $rowset=$result->fetchAll();
  183. $result->closeCursor();
  184. if( $rowset == false ) {
  185. $end_area_id = 791;
  186. } else {
  187. $end_area_id = $rowset[0]["ID"];
  188. }
  189. $userid = 1;
  190. $prod_id = 380001;
  191. $run_code = 0;
  192. $myprod = '{m'.$prod_id.'p'.$ticket_num.'|r'.$run_code.'}';
  193. $mycustomer = "{,".$customer_name.",,".$customer_mobile.",150,".$customer_id_no.",,,,".$passenger_txt."}";
  194. $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."}";
  195. $sql_insert="call sp_make_order_for_zizai(".$userid.",'".$myprod."','".$mycustomer."', 28, '".$out_order_no."',".$run_info["cus_price"].", '".$run_info_txt."')";
  196. writeLog($sql_insert);
  197. $result=$pdo->query($sql_insert);
  198. $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  199. $result->closeCursor();
  200. if (is_array($rowset) && $rowset[0]['errcode'] == 0 ) {
  201. //update submit order
  202. $pdo_update = conn1();
  203. $sql_update = " UPDATE order_main set order_status =146,PROD_SUPPLY_ORG_NAME='自在旅行' WHERE ORDER_ID=".$order_id." OR PARENT_ORDER_ID=".$order_id;
  204. $pdo_update->exec($sql_update);
  205. $pdo_update2 = conn1();
  206. $sql_update = " UPDATE outside_submit_order set submit_status=1 WHERE outside_order_no='{$out_order_no}'";
  207. $pdo_update2->exec($sql_update);
  208. continue;
  209. } else {
  210. /*
  211. $post_data = array();
  212. $post_data["agentId"] = QUNAR_AGENT_ID;
  213. $post_data["time"] = $current_time;
  214. $post_data["comment"] = "出票失败:该线路已停售";
  215. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  216. $post_data["auth"] = get_qunar_auth($post_data);
  217. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  218. */
  219. continue;
  220. }
  221. continue;
  222. }
  223. 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 )) {
  224. $post_data = array();
  225. $post_data["agentId"] = QUNAR_AGENT_ID;
  226. $post_data["time"] = $current_time;
  227. $post_data["comment"] = "出票失败:该线路已停售";
  228. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  229. $post_data["auth"] = get_qunar_auth($post_data);
  230. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  231. continue;
  232. } else if( $run_main_info["RUN_DATE"] == $today && $limit_time >= $current_hour ) {
  233. $post_data = array();
  234. $post_data["agentId"] = QUNAR_AGENT_ID;
  235. $post_data["time"] = $current_time;
  236. $post_data["comment"] = "出票失败:该线路已停售";
  237. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  238. $post_data["auth"] = get_qunar_auth($post_data);
  239. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  240. continue;
  241. }
  242. if( in_array($prod_id,$no_sell_array) ) {
  243. $post_data = array();
  244. $post_data["agentId"] = QUNAR_AGENT_ID;
  245. $post_data["time"] = $current_time;
  246. $post_data["comment"] = "出票失败:该线路已停售";
  247. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  248. $post_data["auth"] = get_qunar_auth($post_data);
  249. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  250. continue;
  251. }
  252. $myprod = '{m'.$prod_id.'p'.$ticket_num.'|r'.$run_code.'}';
  253. $mycustomer = '{,'.$customer_name.',,'.$customer_mobile.',150,'.$customer_id_no.',,,,'.$passengers_list.'}';
  254. $sql_insert="call sp_make_order(".$userid.",'".$myprod."','".$mycustomer."', 28, '".$out_order_no."')";
  255. $result=$pdo->query($sql_insert);
  256. $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  257. $result->closeCursor();
  258. $post_data = array();
  259. $post_data["agentId"] = QUNAR_AGENT_ID;
  260. $post_data["time"] = $current_time;
  261. if ( is_array($rowset) && $rowset[0]['errcode'] == 0 ) {
  262. $order_id=$rowset[0]['order_id'];
  263. $res_content=get_msg_info($order_id);
  264. $name=$res_content[0];
  265. $tel=$res_content[1];
  266. $content=$res_content[2];
  267. $post_data["comment"] = $content;
  268. $ticketCode = sprintf("%d",$order_id);
  269. for( $ticket_index = 1; $ticket_index < $ticket_num; $ticket_index++ ) {
  270. $ticketCode .= "|".sprintf("%d",$order_id);
  271. }
  272. $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 )) );
  273. } else {
  274. $post_data["comment"] = "出票失败:".$rowset_back[0]['errinfo'];
  275. $post_data["ticketInfo"] = json_encode(array( "ret" => false, "data" => array("orderNo" => $out_order_no, "ticketStatu" => 1)) );
  276. }
  277. $post_data["auth"] = get_qunar_auth($post_data);
  278. $complete_result = send_post( QUNAR_COMPLETE_ORDER_URL, $post_data );
  279. $complete_result_array = json_decode($complete_result,true);
  280. if ( is_array($rowset) && $rowset[0]['errcode'] == 0 ) {
  281. $comment_type = 0;
  282. $comment_text = "";
  283. $send_success = 0;
  284. $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})";
  285. $result1 = $pdo->query($sql1);
  286. $rowset1 = $result1->fetchAll(PDO::FETCH_ASSOC);
  287. $result1->closeCursor();
  288. $pdo_update = conn1();
  289. $sql_update = " UPDATE outside_submit_order set submit_status=1 WHERE outside_order_no='{$out_order_no}'";
  290. $pdo_update->exec($sql_update);
  291. $sql_order_status = "update order_main set order_status =146 where order_id= ".$order_id." or parent_order_id = ".$order_id;
  292. $pdo_update2 = conn1();
  293. $pdo_update2->exec($sql_order_status);
  294. }
  295. }
  296. echo "success";
  297. exit();
  298. function get_msg_info($ORDER_ID) {
  299. $msg_pdo = conn1();
  300. $msg_sql = "CALL SP_GET_MESSAGE_TEMPLATE('" . $ORDER_ID . "')";
  301. $content = '';
  302. if (is_object($msg_pdo)) {
  303. $msg_result = $msg_pdo -> query($msg_sql);
  304. $i = 1;
  305. $data = array();
  306. if ($msg_result) {
  307. $data['code'] = "0";
  308. $data['info'] = "";
  309. do {
  310. $row = $msg_result -> fetchAll(PDO::FETCH_ASSOC);
  311. if ($i == 1) {
  312. $data['seat'] = isset($row) ? $row : array();
  313. } else if ($i == 2) {
  314. $data['run_info'] = isset($row) ? $row : array();
  315. } else if ($i == 3) {
  316. $data['driver'] = isset($row) ? $row : array();
  317. } else {
  318. }
  319. $i++;
  320. } while($msg_result->nextRowset());
  321. }
  322. $json_obj = json_decode(json_encode($data), TRUE);
  323. $seat = isset($json_obj['seat'][0]) ? $json_obj['seat'][0] : array();
  324. $run_info = isset($json_obj['run_info'][0]) ? $json_obj['run_info'][0] : array();
  325. $driver = isset($json_obj['driver'][0]) ? $json_obj['driver'][0] : array();
  326. $bus_res_id = isset($json_obj['driver'][0]) ? $json_obj['driver'][0]["bus_res_id"] : 0;
  327. $short_url = false;
  328. if( $bus_res_id != 0 ) {
  329. $ary_sell_ary = array(916,917);
  330. if( in_array( $bus_res_id, $ary_sell_ary ) ) {
  331. $ticket_url = TICKET_QR_URL.$ORDER_ID;
  332. $short_url = sinaShortenUrl($ticket_url);
  333. }
  334. }
  335. $extra_message = "";
  336. if( $short_url != false ) {
  337. $extra_message = "点击以下链接获取您的电子票扫码上车:{$short_url}";
  338. }
  339. //出票成功
  340. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车,车牌号{车牌号},司机电话{司机姓司机电话}。";
  341. // 得到明天的时间
  342. date_default_timezone_set('PRC');
  343. //解决时区问题
  344. $tomorrow = date("Y-m-d", strtotime("+1 day"));
  345. $now_time = date('H:i:s', time());
  346. //判断当前时间是否在17:30:00之后
  347. $cur_date = date('Y-m-d', time());
  348. $new_message_array = array(448569,448568);
  349. if( in_array( $run_info['parent_prod_id'], $new_message_array ) ) {
  350. $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前十五分钟到达{上车站点}。出行前一天下午的18:00左右将会有导游和您联系,预祝您旅途愉快。";
  351. } else if (($now_time > "17:30:00" && $run_info['start_date'] == $tomorrow) || $cur_date == $run_info['start_date']) {//17:30之后的订单或者下单时间为今天出行为今天下午 发送短信模板
  352. // if("18:30:00">"17:30:00" && $run_info['start_date']==$tomorrow){ //17:30之后的订单 发送短信模板
  353. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车,车牌号{车牌号},司机电话{司机姓司机电话}。";
  354. $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前三十分钟到达{上车站点}。您的乘车订单号为{订单号},车牌号{车牌号},司机电话{司机姓司机电话},请凭短信订单号乘车".$extra_message.",预祝您旅途愉快。";
  355. } else {
  356. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车。";
  357. $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前三十分钟到达{上车站点}。您的乘车订单号为{订单号},请凭短信订单号乘车".$extra_message."。出行前一天下午的18:30会将车牌号与司机电话发送给您,预祝您旅途愉快。";
  358. }
  359. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车。";
  360. if ($seat) {
  361. $seat_x = isset($seat['seat_x']) ? $seat['seat_x'] : "";
  362. $seat_y = isset($seat['seat_y']) ? $seat['seat_y'] : "";
  363. $seat_name = isset($seat['seat_name']) ? $seat['seat_name'] : "";
  364. $order_main_id = isset($seat['order_main_id']) ? $seat['order_main_id'] : "";
  365. } else {
  366. }
  367. if ($run_info) {
  368. $order_count = $run_info['order_count'];
  369. $start_date = $run_info['start_date'];
  370. $start_time = $run_info['start_time'];
  371. $parent_order_id = $run_info['parent_order_id'];
  372. $end_date = $run_info['end_date'];
  373. $start_area = $run_info['start_area'];
  374. $end_area = $run_info['end_area'];
  375. $res_name = $run_info['res_name'];
  376. $prod_name = $run_info['prod_name'];
  377. $prod_name = "标准票";
  378. $customer_name = $run_info['customer_name'];
  379. $customer_mobile = $run_info['customer_mobile'];
  380. $start_end_date = $start_date . "," . $start_time;
  381. $content = str_replace("{出发日期}", $start_date, $content);
  382. $content = str_replace("{出发时间}", $start_time, $content);
  383. $content = str_replace("{上车站点}", $res_name, $content);
  384. $content = str_replace("{出发地}", $start_area, $content);
  385. $content = str_replace("{目的地}", $end_area, $content);
  386. $content = str_replace("{票种名}", $prod_name, $content);
  387. $content = str_replace("{张数}", $order_count, $content);
  388. $content = str_replace("{订单号}", $ORDER_ID, $content);
  389. } else {
  390. $content = str_replace("{出发日期}", "", $content);
  391. $content = str_replace("{出发时间}", "", $content);
  392. $content = str_replace("{出发地}", "", $content);
  393. $content = str_replace("{目的地}", "", $content);
  394. $content = str_replace("{票种名}", "", $content);
  395. $content = str_replace("{张数}", "", $content);
  396. $content = str_replace("{订单号}", "", $content);
  397. }
  398. if ($driver) {
  399. $bus_no = isset($driver['bus_no']) ? $driver['bus_no'] : "";
  400. $driver_name = isset($driver['driver_name']) ? $driver['driver_name'] : "";
  401. $driver_mobile = isset($driver['driver_mobile']) ? $driver['driver_mobile'] : "";
  402. if ($bus_no == "") {
  403. $content = str_replace(",车牌号{车牌号}", "", $content);
  404. } else {
  405. $content = str_replace("{车牌号}", $bus_no, $content);
  406. }
  407. if ($driver_name == "") {
  408. $content = str_replace(",司机电话{司机姓司机电话},", "。", $content);
  409. } else {
  410. $driver_xing = mb_substr($driver_name, 0, 1, 'utf-8');
  411. $driver_name_mobile = $driver_xing . $driver_mobile;
  412. $content = str_replace("{司机姓司机电话}", $driver_name_mobile, $content);
  413. }
  414. } else {
  415. $content = str_replace("车牌号{车牌号},", "", $content);
  416. $content = str_replace("司机电话{司机姓司机电话},", "", $content);
  417. }
  418. $content.="【重要提示】:因G20峰会影响,7月1号开始实名登记安检,出行时请所有游客携带有效证件(身份证或户口本),凭有效证件上车,如被查出无有效证件,导致无法出行,责任自行承担,谢谢配合!";
  419. return array(isset($customer_name) ? $customer_name : "", isset($customer_mobile) ? $customer_mobile : "", isset($content) ? $content : "短信错误,联系客服!!!");
  420. }
  421. }