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.
 
 
 
 

444 lines
22 KiB

  1. <?php
  2. if (ALLOW_ORIGIN)
  3. header("Access-Control-Allow-Origin:*");
  4. date_default_timezone_set('PRC');
  5. define("MAKE_ORDER_URL", "http://cs1.zhizhuchuxing.com/api/submit-order");
  6. $user_id =$_COOKIE['user_id'];//getUserId();
  7. $top_org_id=$_COOKIE['top_org_id'];
  8. //$sql_user="select ";
  9. if (!$user_id) {
  10. echo json_encode(array("code" => 1,"iflogin"=>1, "info" => "未登录"));
  11. exit ;
  12. }
  13. $pdo_user = conn();
  14. $sql_user = " SELECT STATUS,CANCEL_FLAG FROM base_user WHERE ID={$user_id} ";
  15. $result_user= $pdo_user->query($sql_user);
  16. $row_user = $result_user->fetchAll(PDO::FETCH_ASSOC);
  17. if( $row_user[0]["CANCEL_FLAG"] == 1 || $row_user[0]["STATUS"] == 1 ) {
  18. echo json_encode(array('code'=>1,'info'=>'该账号已被停用,请联系管理员并使用新分销系统'));exit();
  19. exit ;
  20. }
  21. writeLog( json_encode($row_user));
  22. $pdo= conn();
  23. $ticket_info = $_POST['ticket_info'];
  24. $customer_info = $_POST['customer_info'];
  25. $run_id = $_POST['run_id'];
  26. $sql_time = "select run_date,run_time,prod_id from run_main where run_id =".$run_id;
  27. $result_time= $pdo->query($sql_time);
  28. $row_t = $result_time->fetchAll(PDO::FETCH_ASSOC);
  29. $run_date = $row_t[0]['run_date'];
  30. $run_time = $row_t[0]['run_time'];
  31. $prod_wu=array(448568,448569,/*448778,448779,*/448780,448781);
  32. $first_ticket_id = isset($_POST['first_ticket_id']) ? $_POST['first_ticket_id'] : false;
  33. if( $first_ticket_id != false ) {
  34. $sql_start_time = "select run_station.start_time
  35. from run_station
  36. left join run_prod ON run_prod.run_id = run_station.run_id AND run_station.STATION_RES_ID=run_prod.START_STATION_RES_ID
  37. where run_station.run_id = {$run_id} and run_prod.PROD_ID= {$first_ticket_id}";
  38. $result_time2= $pdo->query($sql_start_time);
  39. $row_t2 = $result_time2->fetchAll(PDO::FETCH_ASSOC);
  40. $run_time = $row_t2[0]['start_time'];
  41. }
  42. if(strtotime($run_date.' '.$run_time)- time() < 300){
  43. writeLog( "超出预定时间:{$run_date} {$run_time} |POST".json_encode($_POST) );
  44. echo json_encode(array('code'=>1,'info'=>'预定时间已过,截至售卖时间为发车前5分钟'));exit();
  45. }
  46. if(in_array($row_t[0]['prod_id'],$prod_wu)){
  47. if(date('Y-m-d', time())>=$run_date){
  48. echo json_encode(array('code'=>1,'info'=>'预定时间已过'));exit();
  49. }elseif(date('Y-m-d', time()+24*60*60)==$run_date && date('H:i', time())>'10:01'){
  50. echo json_encode(array('code'=>1,'info'=>'预定时间已过'));exit();
  51. }
  52. }
  53. $channel_id = isset($_COOKIE['org_id']) ? $_COOKIE['org_id'] : 0;
  54. /**
  55. * 下订单必填信息
  56. */
  57. $channel_order_id = '0';
  58. $salesman = '分销';
  59. $pay_type = 275;
  60. //add by qius on 2017-05-09
  61. $customer_info_temp = substr( $customer_info , 1, strlen($customer_info) -2 );
  62. $customer_info_array = explode(",", $customer_info_temp);
  63. $customer_name = $customer_info_array[0];
  64. $customer_mobile = $customer_info_array[1];
  65. $passenger_txt = $customer_info_array[2];
  66. $customer_info_str = "{{$customer_name},{$customer_mobile},,,$passenger_txt}";
  67. $order_info_str = "{{$user_id},0,{$channel_id},,1,{$pay_type},1,{$salesman}}";
  68. $prod_str = $ticket_info;
  69. $passenger_txt_array = explode("/", $passenger_txt );
  70. $passenger_info_array = array();
  71. foreach( $passenger_txt_array as $passenger_txt_tmp ) {
  72. $passenger_info_tmp = explode("*", $passenger_txt_tmp );
  73. $passenger_info_ary[] = array( "passenger_name" => $passenger_info_tmp[0], "passenger_cardid" => $passenger_info_tmp[1] );
  74. }
  75. $make_order_array = array(
  76. "action" => "submit_bus_order",
  77. "prod_str" => $prod_str,
  78. "order_info_str" => $order_info_str,
  79. "customer_info_str" => $customer_info_str,
  80. "is_send_msg" => 0,
  81. "passenger_info" => json_encode($passenger_info_ary)
  82. );
  83. writeLog( "SFX PC LINE".__LINE__.":param=".json_encode($make_order_array) );
  84. $rowset = httpRequest( MAKE_ORDER_URL, $make_order_array );
  85. writeLog( "SFX PC LINE".__LINE__.":result=".json_encode($rowset) );
  86. $make_order_result = json_decode($rowset, true);
  87. if( !isset($make_order_result["code"]) || $make_order_result["code"] != 0 ) {
  88. $return_msg = $make_order_result["info"];
  89. if( isset($make_order_result["error"]) ) {
  90. $return_msg .= "({$make_order_result["error"]})";
  91. }
  92. echo json_encode( array( 'code'=>1, 'info'=> $return_msg ) );die;
  93. } else {
  94. $order_id_group = $make_order_result['data'];
  95. $post_data['order_id'] = $order_id_group;
  96. $post_data['order_status'] = 451;
  97. httpRequest("http://cs.zhizhuchuxing.com/st-xm/Api/add_order_status_log.php",$post_data);
  98. }
  99. //end of add by qius on 2017-05-09
  100. /*
  101. $sql = "call sp_make_order1(" . $user_id . ",'" . $ticket_info . "','" . $customer_info . "'," . $channel_id . ",'" . $channel_order_id . "','" . $salesman . "'," . $pay_type . ")";
  102. writeLog( "SFX PC LINE".__LINE__.":sql=".$sql );
  103. $result = $pdo -> query($sql);
  104. if(!$result){
  105. echo json_encode(array('code'=>1,'info'=>'可售资源不足,下单失败'));die;
  106. }
  107. do {
  108. $rowset = $result->fetchAll(PDO::FETCH_ASSOC);
  109. $data_arr[] = $rowset;;
  110. } while ($result->nextRowset());
  111. $result->closeCursor();
  112. writeLog( "LINE".__LINE__.":data_arr=".json_encode($data_arr) );
  113. if($data_arr[0][0]['errcode'] == 0){
  114. $order_id_group = $data_arr[1][0]['order_id'];
  115. $post_data['order_id'] = $order_id_group;
  116. $post_data['order_status'] = 451;
  117. httpRequest("http://cs.zhizhuchuxing.com/st-xm/Api/add_order_status_log.php",$post_data);
  118. }else{
  119. echo json_encode(array('code'=>1,'info'=>'可售资源不足'));die;
  120. }
  121. */
  122. //修改book_status和支付状态
  123. if($top_org_id == 0 || isset($_COOKIE['login_type'])){
  124. $sql_pay = "update order_pay_detail set pay_type_id_1 =278 where pay_main_id in(".$order_id_group.")";
  125. $pdo->exec($sql_pay);
  126. $sql_order_status = "update order_main set ORDER_BOOK_STATUS =1 where order_id in(".$order_id_group.") or parent_order_id in(".$order_id_group.")";
  127. //$pdo->query($sql_order_status);
  128. }else{
  129. $sql_order_status = "update order_main set order_status =146,ORDER_BOOK_STATUS =1 where order_id in(".$order_id_group.") or parent_order_id in(".$order_id_group.")";
  130. $post_data['order_id'] = $order_id_group;
  131. $post_data['order_status'] = '452,453';
  132. httpRequest("http://cs.zhizhuchuxing.com/st-xm/Api/add_order_status_log.php",$post_data);
  133. }
  134. $pdo->exec($sql_order_status);
  135. //取得订单渠道名称
  136. $from_org_name = "";
  137. $sql = " SELECT SUPPLIER_NAME FROM base_supplier WHERE ID={$channel_id} ";
  138. $sql = " SELECT ORG_NAME as SUPPLIER_NAME FROM base_organization WHERE ORG_ID={$channel_id} ";
  139. $result=$pdo->query($sql);
  140. if( $result != false ) {
  141. $rowset = $result->fetchAll();
  142. $result->closeCursor();
  143. if( $rowset != false && count($rowset) > 0 ) {
  144. $from_org_name = $rowset[0]["SUPPLIER_NAME"];
  145. }
  146. }
  147. //判断票是否为往返
  148. $order_id_arr = explode(',',$order_id_group);
  149. $go_order_id = $order_id_arr[0];
  150. if(count($order_id_arr) > 1){
  151. $back_order_id = $order_id_arr[1];
  152. //订票成功写入 往返订单关系表
  153. $sql_conn = "insert into to_from values(NULL,".$go_order_id.",".$back_order_id.",'". date('Y-m-d h:i:s', time())."')";
  154. $pdo->exec($sql_conn);
  155. }else{
  156. $back_order_id = '0';
  157. }
  158. if($top_org_id!=0 && !isset($_COOKIE['login_type'])){
  159. send_msg($go_order_id);
  160. if($back_order_id != '0'){
  161. send_msg($back_order_id);
  162. }
  163. }
  164. $data['code'] = '0';
  165. $data['info'] = '下单成功';
  166. $sql = "select a.order_id,a.order_price,a.order_pay_main_id,a.customer_name,a.customer_mobile,a.customer_id_no,a.customer_memo, 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 = " . $go_order_id . " group by a.order_id";
  167. $result = $pdo->query($sql);
  168. $order_info_go = $result->fetchAll(PDO::FETCH_ASSOC);
  169. $data['order_id'] = $go_order_id;
  170. $data['go_list'] = $order_info_go[0];
  171. $data['go_list']['site_type'] = "普通票";
  172. if($back_order_id != '0'){
  173. $sql = "select a.order_id,a.order_price,a.order_pay_main_id,a.customer_name,a.customer_mobile,a.customer_id_no,a.customer_memo, 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 = " . $back_order_id . " group by a.order_id";
  174. $result = $pdo->query($sql);
  175. $order_info_back = $result->fetchAll(PDO::FETCH_ASSOC);
  176. $data['order_id_f'] = $back_order_id;
  177. $data['back_list'] = $order_info_back[0];
  178. $data['back_list']['site_type'] = "普通票";
  179. $data['ifdisney'] = 0;
  180. }
  181. $current_time = date("Y-m-d H:i:s");
  182. //add opera log
  183. $order_all_price = $order_info_go[0]["order_price"];
  184. $ticket_num = $order_info_go[0]["num"];
  185. $order_per_price = $order_all_price / $ticket_num;
  186. $run_date = $order_info_go[0]["run_date"];
  187. $customer_name = $order_info_go[0]["customer_name"];
  188. $customer_mobile = $order_info_go[0]["customer_mobile"];
  189. $customer_id_no = $order_info_go[0]["customer_id_no"];
  190. $customer_memo = $order_info_go[0]["customer_memo"];
  191. $pdo_insert2 = conn1();
  192. //$opera_detail = "创建订单,出发日期{$run_date},订单渠道{$from_org_name},单价{$order_per_price},总额{$order_all_price},联系人信息:{$customer_name}, {$customer_mobile}, {$customer_id_no}, 备注信息:{$customer_memo}";
  193. //$sql = "insert into order_opera_log(order_id,opera_user_id,opera_type,opera_time,opera_detail,opera_platform) VALUES ({$go_order_id},$user_id,1,'{$current_time}','{$opera_detail}','分销系统')";
  194. //$result = $pdo_insert2->exec($sql);
  195. //if($back_order_id != '0') {
  196. // $order_all_price = $order_info_back[0]["order_price"];
  197. // $ticket_num = $order_info_back[0]["num"];
  198. // $order_per_price = $order_all_price / $ticket_num;
  199. // $run_date = $order_info_back[0]["run_date"];
  200. // $customer_name = $order_info_back[0]["customer_name"];
  201. // $customer_mobile = $order_info_back[0]["customer_mobile"];
  202. // $customer_id_no = $order_info_back[0]["customer_id_no"];
  203. // $customer_memo = $order_info_back[0]["customer_memo"];
  204. // $pdo_insert2 = conn1();
  205. // $opera_detail = "创建订单,出发日期{$run_date},订单渠道{$from_org_name},单价{$order_per_price},总额{$order_all_price},联系人信息:{$customer_name}, {$customer_mobile}, {$customer_id_no}, 备注信息:{$customer_memo}";
  206. // $sql = "insert into order_opera_log(order_id,opera_user_id,opera_type,opera_time,opera_detail,opera_platform) VALUES ({$back_order_id},$user_id,1,'{$current_time}','{$opera_detail}','分销系统')";
  207. // $result = $pdo_insert2->exec($sql);
  208. //}
  209. //end of add opera log
  210. echo json_encode($data);die;
  211. //发短信
  212. function send_msg($ORDER_ID) {
  213. $send_pdo=conn();
  214. $order_id = $ORDER_ID;
  215. $url='http://cs1.zhizhuchuxing.com/api/msg/order-send-msg';
  216. $sendInfo=array();
  217. $sendInfo['order_id']=$order_id;
  218. $sendInfo['msg_type']='sfx';
  219. $res_content = httpRequest($url,$sendInfo);
  220. //insert order extra
  221. $hotelPrice = isset($_GET['hotelPrice']) ? $_GET['hotelPrice'] : "";
  222. $doorPrice = isset($_GET["doorPrice"]) ? $_GET["doorPrice"] : "";
  223. if ($hotelPrice != "" || $doorPrice != "") {
  224. $sqlInsert = " INSERT INTO order_extra_info (order_id,hotel_price,gate_price) VALUE(" . $ORDER_ID . ",'" . $hotelPrice . "','" . $doorPrice . "') ";
  225. writeLog("insert extra info: " . $sqlInsert);
  226. $result = $send_pdo -> exec($sqlInsert);
  227. }
  228. }
  229. //..短信模板-改为17:30后OK,当天下单也OK
  230. function get_msg_info($ORDER_ID) {
  231. $msg_pdo = conn();
  232. $msg_sql = "CALL SP_GET_MESSAGE_TEMPLATE('" . $ORDER_ID . "')";
  233. $content = '';
  234. if (is_object($msg_pdo)) {
  235. $msg_result = $msg_pdo -> query($msg_sql);
  236. $i = 1;
  237. $data = array();
  238. if ($msg_result) {
  239. $data['code'] = "0";
  240. $data['info'] = "";
  241. do {
  242. $row = $msg_result -> fetchAll(PDO::FETCH_ASSOC);
  243. if ($i == 1) {
  244. $data['seat'] = isset($row) ? $row : array();
  245. } else if ($i == 2) {
  246. $data['run_info'] = isset($row) ? $row : array();
  247. } else if ($i == 3) {
  248. $data['driver'] = isset($row) ? $row : array();
  249. } else if($i==4){
  250. $data['dsn_prod']=isset($row) ? $row : array();
  251. }else if($i==5){
  252. $data['zhou_su_prod']=isset($row) ? $row : array();
  253. }
  254. $i++;
  255. } while($msg_result->nextRowset());
  256. }
  257. $json_obj = json_decode(json_encode($data), TRUE);
  258. $seat = isset($json_obj['seat'][0]) ? $json_obj['seat'][0] : array();
  259. $run_info = isset($json_obj['run_info'][0]) ? $json_obj['run_info'][0] : array();
  260. $driver = isset($json_obj['driver'][0]) ? $json_obj['driver'][0] : array();
  261. $dsn_prod = isset($json_obj['dsn_prod'])?$json_obj['dsn_prod']:array();
  262. $zhou_su_prod=isset($json_obj['zhou_su_prod'])?$json_obj['zhou_su_prod']:array();
  263. $bus_res_id = isset($json_obj['driver'][0]) ? $json_obj['driver'][0]["bus_res_id"] : 0;
  264. $short_url = false;
  265. $ticket_url = TICKET_QR_URL.$ORDER_ID;
  266. $short_url = sinaShortenUrl($ticket_url);
  267. $extra_message = "";
  268. if( $short_url != false ) {
  269. $extra_message = "点击以下链接获取您的电子票扫码上车:{$short_url}";
  270. }
  271. //出票成功
  272. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车,车牌号{车牌号},司机电话{司机姓司机电话}。";
  273. // 得到明天的时间
  274. date_default_timezone_set('PRC');
  275. //解决时区问题
  276. $tomorrow = date("Y-m-d", strtotime("+1 day"));
  277. $now_time = date('H:i:s', time());
  278. //判断当前时间是否在17:30:00之后
  279. $cur_date = date('Y-m-d', time());
  280. //迪士尼特殊情况parent_prod_id
  281. // $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);
  282. $dsn_arr_prod = array(); //用来保存迪士尼产品的prod_id
  283. foreach($dsn_prod as $temp){
  284. $dsn_arr_prod[]=$temp['prod_id'];
  285. }
  286. $zhou_su_arr_prod = array();
  287. foreach($zhou_su_prod as $temp){
  288. $zhou_su_arr_prod[]=$temp['prod_id'];
  289. }
  290. $new_message_array = array(448569,448568);
  291. $new_message_array3 = array(450517,450522);
  292. if( in_array( $run_info['parent_prod_id'], $new_message_array ) ) {
  293. $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前十五分钟到达{上车站点}。出行前一天下午的18:00左右将会有导游和您联系,预祝您旅途愉快。";
  294. } else if( in_array( $run_info['parent_prod_id'], $new_message_array3 ) ) {
  295. if( $run_info['parent_prod_id'] == 450517 ) {
  296. $address_txt = "上车地点:吴山广场西侧河坊巷8号(吴山广场旅游集散中心候车室); 上车方式:请至吴山广场旅游集散中心候车室服务台,凭预定姓名和手机号码上车。";
  297. } else {
  298. $address_txt = "上车地点:普陀城北长途客运中心;取票方式:请提前到达(学运路18号)普陀城北长途客运中心候车大厅服务台报预订名字和电话取票。";
  299. }
  300. $content = "您已成功预定{出发日期} {出发时间} {出发地}-{目的地}汽车票{张数}张(请最晚提前10分钟到达)。{$address_txt}紧急电话:15888866564。";
  301. } else if (($now_time > "18:30:00" && $run_info['start_date'] == $tomorrow) || $cur_date == $run_info['start_date']) {//17:30之后的订单或者下单时间为今天出行为今天下午 发送短信模板
  302. // if("18:30:00">"17:30:00" && $run_info['start_date']==$tomorrow){ //17:30之后的订单 发送短信模板
  303. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车,车牌号{车牌号},司机电话{司机姓司机电话}。";
  304. $content = "订单号{订单号},{出发地}({上车站点})—{目的地}({下车站点})标准票{张数}张将于{出发日期} {出发时间}准点发车。车牌号{车牌号},司机电话{司机姓司机电话},请提前10分钟抵达上车地点:{上车站点详细地址}并点开电子车票{$short_url}进行验票。如有疑问请拨打客服电话021-33280519。";
  305. } else {
  306. $content = "订单号{订单号},{出发日期} {出发时间}{出发地}({上车站点})—{目的地}({下车站点})标准票{张数}张预定成功。发车前一天19点会短信通知您车牌号及司机电话,如未收到短信请拨打客服电话021-33280519。";
  307. }
  308. $new_message_array4 = array(450588,450589);
  309. if( in_array( $run_info['parent_prod_id'], $new_message_array4 ) ) {
  310. $content .= "紧急联系电话:18100158199。";
  311. }
  312. $new_message_array5 = array(451437,451438);
  313. if( in_array( $run_info['parent_prod_id'], $new_message_array5 ) ) {
  314. $content .= "司机会提前与您联系,如有疑问,请联系021-33280578 。";
  315. }
  316. $new_message_array5 = array(451440,451441);
  317. $new_message_array6 = array(448780,450008,448781);
  318. if( in_array( $run_info['parent_prod_id'], $new_message_array5 ) ) {
  319. $content = "订单号{订单号},{出发日期} {出发时间}{上车站点}—{目的地}标准票{张数}张预定成功。发车前一天19点会短信通知您车牌号及司机电话,如未收到短信请拨打客服电话021-33280519。";
  320. } else if( in_array( $run_info['parent_prod_id'], $new_message_array6 ) ) {
  321. $content = "订单号{订单号},{出发日期} {出发时间}{上车站点}—{目的地}标准票{张数}张预定成功。发车前一天19点会短信通知您乘车信息,如未收到短信请拨打客服电话021-33280519。";
  322. }
  323. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车。";
  324. if ($seat) {
  325. $seat_x = isset($seat['seat_x']) ? $seat['seat_x'] : "";
  326. $seat_y = isset($seat['seat_y']) ? $seat['seat_y'] : "";
  327. $seat_name = isset($seat['seat_name']) ? $seat['seat_name'] : "";
  328. $order_main_id = isset($seat['order_main_id']) ? $seat['order_main_id'] : "";
  329. } else {
  330. }
  331. if ($run_info) {
  332. $order_count = $run_info['order_count'];
  333. $start_date = $run_info['start_date'];
  334. $start_time = $run_info['start_time'];
  335. $parent_order_id = $run_info['parent_order_id'];
  336. $end_date = $run_info['end_date'];
  337. $start_area = $run_info['start_area'];
  338. $end_area = $run_info['end_area'];
  339. $res_name = $run_info['res_name'];
  340. $parent_prod_id = $run_info['parent_prod_id'];
  341. $prod_name = $run_info['prod_name'];
  342. $prod_name = "标准票";
  343. $customer_name = $run_info['customer_name'];
  344. $customer_mobile = $run_info['customer_mobile'];
  345. $start_end_date = $start_date . "," . $start_time;
  346. $start_station_address = $run_info['start_station_address'];
  347. if( $parent_prod_id == 450504 && $start_date >= "2017-01-27" && $start_date <= "2017-02-02" ) {
  348. $res_name = "迪士尼唐老鸭P停车场";
  349. $start_station_address = "上海迪士尼度假区迪士尼唐老鸭P停车场";
  350. }
  351. $content = str_replace("{出发日期}", $start_date, $content);
  352. $content = str_replace("{出发时间}", $start_time, $content);
  353. $content = str_replace("{上车站点}", $res_name, $content);
  354. $content = str_replace("{下车站点}", $run_info['end_res_name'], $content);
  355. $content = str_replace("{出发地}", $start_area, $content);
  356. $content = str_replace("{目的地}", $end_area, $content);
  357. $content = str_replace("{票种名}", $prod_name, $content);
  358. $content = str_replace("{张数}", $order_count, $content);
  359. $content = str_replace("{订单号}", $ORDER_ID, $content);
  360. $content = str_replace("{上车站点详细地址}", $start_station_address, $content);
  361. } else {
  362. $content = str_replace("{出发日期}", "", $content);
  363. $content = str_replace("{出发时间}", "", $content);
  364. $content = str_replace("{出发地}", "", $content);
  365. $content = str_replace("{目的地}", "", $content);
  366. $content = str_replace("{票种名}", "", $content);
  367. $content = str_replace("{张数}", "", $content);
  368. $content = str_replace("{订单号}", "", $content);
  369. $content = str_replace("{上车站点详细地址}", "", $content);
  370. }
  371. if ($driver) {
  372. $bus_no = isset($driver['bus_no']) ? $driver['bus_no'] : "";
  373. $driver_name = isset($driver['driver_name']) ? $driver['driver_name'] : "";
  374. $driver_mobile = isset($driver['driver_mobile']) ? $driver['driver_mobile'] : "";
  375. if ($bus_no == "") {
  376. $content = str_replace(",车牌号{车牌号}", "", $content);
  377. } else {
  378. $content = str_replace("{车牌号}", $bus_no, $content);
  379. }
  380. if ($driver_name == "") {
  381. $content = str_replace(",司机电话{司机姓司机电话},", "。", $content);
  382. } else {
  383. $driver_xing = mb_substr($driver_name, 0, 1, 'utf-8');
  384. $driver_name_mobile = $driver_xing . $driver_mobile;
  385. $content = str_replace("{司机姓司机电话}", $driver_name_mobile, $content);
  386. }
  387. } else {
  388. $content = str_replace("车牌号{车牌号},", "", $content);
  389. $content = str_replace("司机电话{司机姓司机电话},", "", $content);
  390. }
  391. /*
  392. if( $now_time < "18:30:00" ) {
  393. //判断是不是苏州或周庄
  394. // 判断如果不是迪士尼的票就不发短信
  395. if (!in_array($run_info['parent_prod_id'], $dsn_arr_prod) && !in_array($run_info['parent_prod_id'], $zhou_su_arr_prod)) {
  396. return array("", "-1", "不是迪士尼、苏州、周庄的票,目前不发送短信");
  397. }
  398. }*/
  399. return array(isset($customer_name) ? $customer_name : "", isset($customer_mobile) ? $customer_mobile : "", isset($content) ? $content : "短信错误,联系客服!!!");
  400. }
  401. }