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.

submit.php.bak 23 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <?php
  2. /*
  3. * wechat 2.0
  4. * Copyright (c) 2016 yixi wei http://zhizhuchuxing.com/
  5. * Date: 2016.7.12
  6. * Something is to pay QQ1062140302
  7. */
  8. if (ALLOW_ORIGIN)
  9. header("Access-Control-Allow-Origin:*");
  10. date_default_timezone_set('PRC');
  11. $userid =0;//
  12. $member_id = isset($_COOKIE['user_id'])?$_COOKIE['user_id']:'1';
  13. if (!$member_id) {
  14. echo json_encode(array("code" => 1,"iflogin"=>1, "info" => "未登录"));
  15. exit ;
  16. }
  17. //$userid=1;
  18. $myprod = isset($_POST['prod']) ? $_POST['prod'] : "{m152603p1|r202375}";//{m152603p1|r202375}
  19. $prod_id =substr($myprod,strpos($myprod, 'm')+1, strpos($myprod, 'p')-2);
  20. $tic_num =substr($myprod,strpos($myprod, 'p')+1, strpos($myprod, '|')-strpos($myprod, 'p')-1);
  21. if($tic_num==0){
  22. echo json_encode(array("code" => '1', "info" => "订票数量不可为0"));
  23. exit ;
  24. }
  25. $run_id = substr(substr($myprod,strpos($myprod, 'r')+1),0,-1);
  26. $sql_time = "select run_date,run_time 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. $sql_time_wu ="SELECT prod_id FROM `opera_product` where PROD_NAME like '%千岛湖%';";
  32. $result_time_wu= $pdo->query($sql_time_wu);
  33. $row_wu = $result_time_wu->fetchAll(PDO::FETCH_ASSOC);
  34. foreach ($row_wu as $v) {
  35. $prod_wu[] = $v['prod_id'];
  36. }
  37. if(strtotime($run_date.' '.$run_time)- time()<1800){
  38. echo json_encode(array('code'=>1,'info'=>'预定时间已过'));exit();
  39. }
  40. if(in_array($prod_id,$prod_wu)){
  41. if(date('Y-m-d', time())>=$run_date){
  42. echo json_encode(array('code'=>1,'info'=>'预定时间已过'));exit();
  43. }
  44. if(date('H:i:s')>='10:00:01')
  45. echo json_encode(array('code'=>1,'info'=>'预定时间已过'));exit();
  46. }
  47. $mycustomer = isset($_POST['customer']) ? $_POST['customer'] : "nono";
  48. $order_from_org_id =0;
  49. $top_org_id = 0;
  50. $outside_order_id = isset($_POST['outside_order_id']) ? $_POST['outside_order_id'] : '0';
  51. $sql_price = "select cus_price from opera_product_price where prod_id =".$prod_id;
  52. $result_price = $pdo->query($sql_price);
  53. $row_p = $result_price->fetchAll(PDO::FETCH_ASSOC);
  54. $price_list = $prod_id.','.$row_p[0]['cus_price'];//'.$row_p['0']['cus_price'].'
  55. //$u_prod_list=isset($_POST['u_prod_list'])?$_POST['u_prod_list']:"";
  56. //$f_u_prod_list=isset($_POST['f_u_prod_list'])?$_POST['f_u_prod_list']:"";
  57. ///st-xm/Api/add_new_order.php?prod={m152603p1|r202375}&customer={,fuhc_ceshi,1,15821387785,150,511621199502032173,,0,,,}
  58. //&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}
  59. //.返程 1=true 0=false
  60. $ifcheck = isset($_POST['ifback']) ? $_POST['ifback'] : "";
  61. if($ifcheck){
  62. $back_prod = isset($_POST['back_prod']) ? $_POST['back_prod'] : "";
  63. $prod_id_f =substr($back_prod,strpos($back_prod, 'm')+1, strpos($back_prod, 'p')-2);
  64. $sql_price_f = "select cus_price from opera_product_price where prod_id =".$prod_id_f;
  65. $result_price_f = $pdo->query($sql_price_f);
  66. $row_f = $result_price_f->fetchAll(PDO::FETCH_ASSOC);
  67. $price_list_f =$prod_id_f.','.$row_f['0']['cus_price'];
  68. }
  69. //获取渠道号
  70. $top_org_id = 0;
  71. //echo 111;die;
  72. $sql = "call sp_make_order(" . $userid . ",'" . $myprod . "','" . $mycustomer . "'," . $order_from_org_id . ",'" . $outside_order_id . "')";
  73. if ($ifcheck == 0) {//不是含有返程的
  74. writeLog("sp_make_order---san: " . $sql);
  75. $rowset = create_order($sql,$price_list);
  76. if (is_array($rowset) && $rowset[0]['errcode'] == 0 && SEND_MESSAGE == true) { //单程票订票成功
  77. send_msg($rowset[0]['order_id']);
  78. }
  79. if(!isset($rowset[0]['order_id'])){
  80. echo json_encode(array('code'=>1,'info'=>'error'));die;
  81. }
  82. $order_id = $rowset[0]['order_id'];
  83. //更改支付方式为 授信支付
  84. //根据订单号查找订单详情
  85. $sql = "select a.order_id,a.create_time,a.order_price,a.order_pay_main_id,a.customer_name,a.customer_mobile,count(b.order_id) as num,b.run_date,b.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";
  86. $result = $pdo->query($sql);
  87. $order_info = $result->fetchAll(PDO::FETCH_ASSOC);
  88. $sql_pay = "update order_pay_detail set pay_type_id_1 =278 where pay_main_id = ".$order_info[0]['order_pay_main_id'];
  89. $sql_order_status = "update order_main set order_status =145 where order_id= ".$order_id." or parent_order_id=".$order_id;
  90. $sql_cancel = "update order_main set ORDER_BOOK_STATUS =1,member_id = ".$member_id." where order_id= ".$order_id." or parent_order_id=".$order_id;
  91. $result=$pdo->exec($sql_cancel);
  92. $result=$pdo->exec($sql_order_status);
  93. $result=$pdo->exec($sql_pay);
  94. $data['ifback'] =0;
  95. $data['ifdisney'] =0;
  96. $data['code'] = $rowset[0]['errcode'];
  97. $data['info'] = $rowset[0]['errinfo'];
  98. $data['order_id'] = $rowset[0]['order_id'];
  99. $data['go_list'] = $order_info[0];
  100. $data['go_list']['site_type'] = "普通票";
  101. $data['shengyu_time'] = strtotime($order_info[0]['create_time'])+600-time();
  102. echo json_encode($data);
  103. } else {
  104. $rowset = create_order($sql,$price_list);
  105. if(!$rowset){
  106. echo json_encode(array('code'=>1,'info'=>'error'));die;
  107. }
  108. if (is_array($rowset) && $rowset[0]['errcode'] == 0 && SEND_MESSAGE == true) {//返程---单程票订票成功
  109. $order_id_go = $rowset[0]['order_id'];
  110. //根据订单号查找订单详情
  111. $sql = "select a.order_id,a.create_time,a.order_price,a.order_pay_main_id,a.customer_name,a.customer_mobile,count(b.order_id) as num,b.run_date,b.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";
  112. $result = $pdo->query($sql);
  113. $order_info_go = $result->fetchAll(PDO::FETCH_ASSOC);
  114. $sql_pay = "update order_pay_detail set pay_type_id_1 =278 where pay_main_id = ".$order_info[0]['order_pay_main_id'];
  115. $sql_order_status = "update order_main set order_status =145 where order_id= ".$order_id_go." or parent_order_id=".$order_id_go;
  116. $sql_cancel = "update order_main set ORDER_BOOK_STATUS =1,member_id = ".$member_id." where order_id= ".$order_id_go." or parent_order_id=".$order_id_go;
  117. $result=$pdo->exec($sql_cancel);
  118. $pdo->exec($sql_pay);
  119. $pdo->exec($sql_order_status);
  120. //当前时间减10分钟
  121. $data['shengyu_time'] = strtotime($order_info_go[0]['create_time'])+600-time();
  122. // $data['code'] = $rowset[0]['errcode'];
  123. // $data['info'] = $rowset[0]['errinfo'];
  124. $data['order_id'] = $rowset[0]['order_id'];
  125. $data['go_list'] = $order_info_go[0];
  126. $data['go_list']['site_type'] = "普通票";
  127. // $data['code_f'] = "";
  128. // $data['info_f'] = "";
  129. // $data['order_id_f'] = "";
  130. $sql_f = "call sp_make_order(" . $userid . ",'" . $back_prod . "','" . $mycustomer . "'," . $order_from_org_id . ",'" . $outside_order_id . "')";
  131. writeLog('fan_dan_success sql_f========'.$sql_f);
  132. $rowset_f = create_order($sql_f,$price_list_f);
  133. //..判断返程票是否成功,若不成功,则去程订单
  134. if (is_array($rowset_f) && $rowset_f[0]['errcode'] == 0 && SEND_MESSAGE == true) {//返程--返程票订票成功
  135. $order_id_back = $rowset_f[0]['order_id'];
  136. //根据订单号查找订单详情
  137. $sql = "select a.order_id,a.create_time,a.order_price,a.order_pay_main_id,a.customer_name,a.customer_mobile,count(b.order_id) as num,b.run_date,b.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";
  138. $result = $pdo->query($sql);
  139. $order_info_back = $result->fetchAll(PDO::FETCH_ASSOC);
  140. $sql_pay = "update order_pay_detail set pay_type_id_1 =278 where pay_main_id = ".$order_info[0]['order_pay_main_id'];
  141. $sql_order_status = "update order_main set order_status =145 where order_id= ".$order_id_back." or parent_order_id=".$order_id_back;
  142. $sql_cancel = "update order_main set ORDER_BOOK_STATUS =1,member_id = ".$member_id." where order_id= ".$order_id_back." or parent_order_id=".$order_id_back;
  143. $result=$pdo->exec($sql_cancel);
  144. $pdo->exec($sql_pay);
  145. $pdo->exec($sql_order_status);
  146. $data['ifback'] = 1;
  147. $data['ifdisney'] =0;
  148. $data['code'] = $rowset_f[0]['errcode'];
  149. $data['info'] = $rowset_f[0]['errinfo'];
  150. $data['order_id_f'] = $rowset_f[0]['order_id'] ;
  151. $data['back_list'] = $order_info_back[0];
  152. $data['back_list']['site_type'] = "普通票";
  153. writeLog('fan_fan_success');
  154. //发两条短信
  155. // send_msg($rowset[0]['order_id']);
  156. // send_msg($rowset_f[0]['order_id']);
  157. //订票成功写入 往返订单关系表
  158. $to_id = $rowset[0]['order_id'];
  159. $back_id = $rowset_f[0]['order_id'];
  160. $sql_conn = "insert into to_from values(NULL,".$to_id.",".$back_id.",'". date('Y-m-d h:i:s', time())."')";
  161. $pdo= conn();
  162. $pdo->exec($sql_conn);
  163. echo json_encode($data);exit();
  164. } else {//如果返程票订票不成功,则取消单程票
  165. $sql_cancel = "CALL SP_CANCEL_ORDER(" . $userid . "," . $rowset[0]['order_id'] . ")";
  166. writeLog('fan_dan_faile_sql_cancel======'.$sql_cancel);
  167. $pdo_cancel = conn();
  168. $result_cancel = $pdo_cancel -> query($sql_cancel);
  169. $rowset_cancel = $result_cancel -> fetchAll(PDO::FETCH_ASSOC);
  170. $result_cancel -> closeCursor();
  171. //取消单程不发短信,但要写入取消订单原因
  172. $res_content = get_msg_info($rowset[0]['order_id']);
  173. // $tel = isset($res_content[1])?$res_content[1]:"";
  174. $content = $rowset_f[0]['errinfo'] . "-订单已取消";
  175. $comment_type = 0;
  176. $comment_text = "";
  177. $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)";
  178. $result1 = $pdo_cancel -> query($sql1);
  179. $rowset1 = $result1 -> fetchAll(PDO::FETCH_ASSOC);
  180. $result1 -> closeCursor();
  181. writeLog("order_list.php HT_ADD_MSG_COMMENT()::" . $sql1);
  182. $data['code_f'] = $rowset_f[0]['errcode'];
  183. $data['info_f'] = $rowset_f[0]['errinfo'];
  184. $data['order_id_f'] = isset($rowset_f[0]['order_id']) ? $rowset_f[0]['order_id'] : "";
  185. echo json_encode($data);exit();
  186. }
  187. }
  188. }
  189. function create_order($sql,$price_list) {
  190. $pdo = conn();
  191. if (is_object($pdo)) {
  192. $result = $pdo -> query($sql);
  193. if(!$result){
  194. echo json_encode(array('code'=>1,'info'=>'可售资源不足'));die;
  195. }
  196. // echo json_encode(array('aa'=>$sql));die;
  197. $rowset_create = $result -> fetchAll(PDO::FETCH_ASSOC);
  198. $result -> closeCursor();
  199. writeLog('下订单成功');
  200. writeLog(json_encode($rowset_create));
  201. if (is_array($rowset_create) && $rowset_create[0]['errcode'] == 0 && SEND_MESSAGE == true) {
  202. //下订单成功再修改价格
  203. writeLog('change_price.php' . json_encode($_POST));
  204. $sql_up_price = "call SP_CHANGE_PRICE(" . $rowset_create[0]['order_id'] . ",'" . $price_list . "')";
  205. //$sql="update order_main set order_price ='".$price_arr[$k]."' where PROD_ID=".$v." and PARENT_ORDER_ID=".$ordid." and RUN_ID>0";
  206. $result_up_price = $pdo -> query($sql_up_price);
  207. $rowset_up_price = $result_up_price -> fetchAll(PDO::FETCH_ASSOC);
  208. writeLog("change_price.php sql:: " . $sql_up_price . "::rowset ::" . json_encode($rowset_up_price));
  209. $result_up_price -> closeCursor();
  210. }
  211. }
  212. return $rowset_create;
  213. }
  214. //发短信
  215. function send_msg($ORDER_ID) {
  216. $send_pdo=conn();
  217. $order_id = $ORDER_ID;
  218. $res_content = get_msg_info($order_id);
  219. $name = $res_content[0];
  220. $tel = $res_content[1];
  221. $content = $res_content[2];
  222. writeLog("短信模板内容:【" . $content . "】");
  223. //..发短信先取消
  224. $response = sendTelMessage($tel, $name, $content, $order_id);
  225. writeLog(json_encode($response));
  226. $comment_type = 0;
  227. $comment_text = "";
  228. $send_success = (int)$response;
  229. $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})";
  230. $result1 = $send_pdo -> query($sql1);
  231. $rowset1 = $result1 -> fetchAll(PDO::FETCH_ASSOC);
  232. $result1 -> closeCursor();
  233. writeLog("hotel_order_status.php HT_ADD_MSG_COMMENT()::" . $sql1);
  234. //insert order extra
  235. $hotelPrice = isset($_GET['hotelPrice']) ? $_GET['hotelPrice'] : "";
  236. $doorPrice = isset($_GET["doorPrice"]) ? $_GET["doorPrice"] : "";
  237. if ($hotelPrice != "" || $doorPrice != "") {
  238. $sqlInsert = " INSERT INTO order_extra_info (order_id,hotel_price,gate_price) VALUE(" . $ORDER_ID . ",'" . $hotelPrice . "','" . $doorPrice . "') ";
  239. writeLog("insert extra info: " . $sqlInsert);
  240. $result = $send_pdo -> exec($sqlInsert);
  241. }
  242. }
  243. //..短信模板-改为17:30后OK,当天下单也OK
  244. function get_msg_info($ORDER_ID) {
  245. $msg_pdo = conn();
  246. $msg_sql = "CALL SP_GET_MESSAGE_TEMPLATE('" . $ORDER_ID . "')";
  247. $content = '';
  248. if (is_object($msg_pdo)) {
  249. $msg_result = $msg_pdo -> query($msg_sql);
  250. $i = 1;
  251. $data = array();
  252. if ($msg_result) {
  253. $data['code'] = "0";
  254. $data['info'] = "";
  255. do {
  256. $row = $msg_result -> fetchAll(PDO::FETCH_ASSOC);
  257. if ($i == 1) {
  258. $data['seat'] = isset($row) ? $row : array();
  259. } else if ($i == 2) {
  260. $data['run_info'] = isset($row) ? $row : array();
  261. } else if ($i == 3) {
  262. $data['driver'] = isset($row) ? $row : array();
  263. } else if($i==4){
  264. $data['dsn_prod']=isset($row) ? $row : array();
  265. }else if($i==5){
  266. $data['zhou_su_prod']=isset($row) ? $row : array();
  267. }
  268. $i++;
  269. } while($msg_result->nextRowset());
  270. }
  271. $json_obj = json_decode(json_encode($data), TRUE);
  272. $seat = isset($json_obj['seat'][0]) ? $json_obj['seat'][0] : array();
  273. $run_info = isset($json_obj['run_info'][0]) ? $json_obj['run_info'][0] : array();
  274. $driver = isset($json_obj['driver'][0]) ? $json_obj['driver'][0] : array();
  275. $dsn_prod = isset($json_obj['dsn_prod'])?$json_obj['dsn_prod']:array();
  276. $zhou_su_prod=isset($json_obj['zhou_su_prod'])?$json_obj['zhou_su_prod']:array();
  277. $bus_res_id = isset($json_obj['driver'][0]) ? $json_obj['driver'][0]["bus_res_id"] : 0;
  278. $short_url = false;
  279. if( $bus_res_id != 0 ) {
  280. $ary_sell_ary = array(916,917);
  281. if( in_array( $bus_res_id, $ary_sell_ary ) ) {
  282. $ticket_url = TICKET_QR_URL.$ORDER_ID;
  283. $short_url = sinaShortenUrl($ticket_url);
  284. }
  285. }
  286. $extra_message = "";
  287. if( $short_url != false ) {
  288. $extra_message = "点击以下链接获取您的电子票扫码上车:{$short_url}";
  289. }
  290. //出票成功
  291. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车,车牌号{车牌号},司机电话{司机姓司机电话}。";
  292. // 得到明天的时间
  293. date_default_timezone_set('PRC');
  294. //解决时区问题
  295. $tomorrow = date("Y-m-d", strtotime("+1 day"));
  296. $now_time = date('H:i:s', time());
  297. //判断当前时间是否在17:30:00之后
  298. $cur_date = date('Y-m-d', time());
  299. //迪士尼特殊情况parent_prod_id
  300. // $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);
  301. $dsn_arr_prod = array(); //用来保存迪士尼产品的prod_id
  302. foreach($dsn_prod as $temp){
  303. $dsn_arr_prod[]=$temp['prod_id'];
  304. }
  305. $zhou_su_arr_prod = array();
  306. foreach($zhou_su_prod as $temp){
  307. $zhou_su_arr_prod[]=$temp['prod_id'];
  308. }
  309. if (($now_time > "18:30:00" && $run_info['start_date'] == $tomorrow) || $cur_date == $run_info['start_date']) {//17:30之后的订单或者下单时间为今天出行为今天下午 发送短信模板
  310. // if("18:30:00">"17:30:00" && $run_info['start_date']==$tomorrow){ //17:30之后的订单 发送短信模板
  311. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车,车牌号{车牌号},司机电话{司机姓司机电话}。";
  312. $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前三十分钟到达{上车站点}。您的乘车订单号为{订单号},车牌号{车牌号},司机电话{司机姓司机电话},请凭短信订单号乘车{$extra_message},预祝您旅途愉快。";
  313. if (in_array($run_info['parent_prod_id'], $dsn_arr_prod)) {
  314. $content = "您预订的{出发日期}{上车站点}-{下车站点}{票种名}{张数}张,已成功出票,请在{出发时间}前三十分钟到达{上车站点}。您的乘车订单号为{订单号}。请凭短信订单号乘车{$extra_message},预祝您旅途愉快。(如需咨询请致电:021-33280578)【zhizhuchuxing】Congratulations! Your ticket from hotel to Disney has been approved. Your order number is {订单号}. Please keep it and arrive at the place before {出发时间}. Enjoy your trip and have a nice day! If you have any questions, please call: 021-33280578.";
  315. $content = str_replace("{上车站点}", $run_info['res_name'], $content);
  316. $content = str_replace("{下车站点}", $run_info['end_res_name'], $content);
  317. $content = str_replace("{订单号}", $ORDER_ID, $content);
  318. }
  319. } else {
  320. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车。";
  321. $content = "您预订的{出发日期}{出发地}-{目的地}{票种名}{张数}张,已成功出票,请在{出发时间}前三十分钟到达{上车站点}。您的乘车订单号为{订单号},请凭短信订单号乘车。出行前一天下午的18:30会将车牌号与司机电话发送给您,预祝您旅途愉快。";
  322. if (in_array($run_info['parent_prod_id'], $dsn_arr_prod)) {
  323. $ticket_url = TICKET_QR_URL.$ORDER_ID;
  324. $short_url = sinaShortenUrl($ticket_url);
  325. $extra_content = "";
  326. if( $short_url != false ) {
  327. $extra_content = "或点击以下链接获取乘车二维码扫码上车(".$short_url.")";
  328. }
  329. $content = "您预订的{出发日期}{上车站点}-{下车站点}{票种名}{张数}张,已成功出票,请在{出发时间}前三十分钟到达{上车站点}。您的乘车订单号为{订单号}。请凭短信订单号乘车{$extra_content},预祝您旅途愉快。(如需咨询请致电:021-33280578)【zhizhuchuxing】Congratulations! Your ticket from hotel to Disney has been approved. Your order number is {订单号}. Please keep it and arrive at the place before {出发时间}. Enjoy your trip and have a nice day! If you have any questions, please call: 021-33280578.";
  330. $content = str_replace("{上车站点}", $run_info['res_name'], $content);
  331. $content = str_replace("{下车站点}", $run_info['end_res_name'], $content);
  332. $content = str_replace("{订单号}", $ORDER_ID, $content);
  333. }
  334. }
  335. // $content = "您预订的{出发日期 出发时间}{出发地}-{目的地}{票种名}{张数}张,已购票成功。乘车订单号为{订单号},请凭订单号或绑定微信(微信服务号“蜘蛛出行”)扫码上车。";
  336. if ($seat) {
  337. $seat_x = isset($seat['seat_x']) ? $seat['seat_x'] : "";
  338. $seat_y = isset($seat['seat_y']) ? $seat['seat_y'] : "";
  339. $seat_name = isset($seat['seat_name']) ? $seat['seat_name'] : "";
  340. $order_main_id = isset($seat['order_main_id']) ? $seat['order_main_id'] : "";
  341. } else {
  342. }
  343. if ($run_info) {
  344. $order_count = $run_info['order_count'];
  345. $start_date = $run_info['start_date'];
  346. $start_time = $run_info['start_time'];
  347. $parent_order_id = $run_info['parent_order_id'];
  348. $end_date = $run_info['end_date'];
  349. $start_area = $run_info['start_area'];
  350. $end_area = $run_info['end_area'];
  351. $res_name = $run_info['res_name'];
  352. $parent_prod_id = $run_info['parent_prod_id'];
  353. $prod_name = $run_info['prod_name'];
  354. $prod_name = "标准票";
  355. $customer_name = $run_info['customer_name'];
  356. $customer_mobile = $run_info['customer_mobile'];
  357. $start_end_date = $start_date . "," . $start_time;
  358. $content = str_replace("{出发日期}", $start_date, $content);
  359. $content = str_replace("{出发时间}", $start_time, $content);
  360. $content = str_replace("{上车站点}", $res_name, $content);
  361. $content = str_replace("{出发地}", $start_area, $content);
  362. $content = str_replace("{目的地}", $end_area, $content);
  363. $content = str_replace("{票种名}", $prod_name, $content);
  364. $content = str_replace("{张数}", $order_count, $content);
  365. $content = str_replace("{订单号}", $ORDER_ID, $content);
  366. } else {
  367. $content = str_replace("{出发日期}", "", $content);
  368. $content = str_replace("{出发时间}", "", $content);
  369. $content = str_replace("{出发地}", "", $content);
  370. $content = str_replace("{目的地}", "", $content);
  371. $content = str_replace("{票种名}", "", $content);
  372. $content = str_replace("{张数}", "", $content);
  373. $content = str_replace("{订单号}", "", $content);
  374. }
  375. if ($driver) {
  376. $bus_no = isset($driver['bus_no']) ? $driver['bus_no'] : "";
  377. $driver_name = isset($driver['driver_name']) ? $driver['driver_name'] : "";
  378. $driver_mobile = isset($driver['driver_mobile']) ? $driver['driver_mobile'] : "";
  379. if ($bus_no == "") {
  380. $content = str_replace(",车牌号{车牌号}", "", $content);
  381. } else {
  382. $content = str_replace("{车牌号}", $bus_no, $content);
  383. }
  384. if ($driver_name == "") {
  385. $content = str_replace(",司机电话{司机姓司机电话},", "。", $content);
  386. } else {
  387. $driver_xing = mb_substr($driver_name, 0, 1, 'utf-8');
  388. $driver_name_mobile = $driver_xing . $driver_mobile;
  389. $content = str_replace("{司机姓司机电话}", $driver_name_mobile, $content);
  390. }
  391. } else {
  392. $content = str_replace("车牌号{车牌号},", "", $content);
  393. $content = str_replace("司机电话{司机姓司机电话},", "", $content);
  394. }
  395. /*
  396. if( $now_time < "18:30:00" ) {
  397. //判断是不是苏州或周庄
  398. // 判断如果不是迪士尼的票就不发短信
  399. if (!in_array($run_info['parent_prod_id'], $dsn_arr_prod) && !in_array($run_info['parent_prod_id'], $zhou_su_arr_prod)) {
  400. return array("", "-1", "不是迪士尼、苏州、周庄的票,目前不发送短信");
  401. }
  402. }*/
  403. $content.="【重要提示】:因G20峰会影响,7月1号开始实名登记安检,出行时请所有游客携带有效证件(身份证或户口本),凭有效证件上车,如被查出无有效证件,导致无法出行,责任自行承担,谢谢配合!";
  404. return array(isset($customer_name) ? $customer_name : "", isset($customer_mobile) ? $customer_mobile : "", isset($content) ? $content : "短信错误,联系客服!!!");
  405. }
  406. }