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.
 
 
 
 

511 lines
23 KiB

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