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.
 
 
 
 
 

199 line
7.2 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../wechat/Common_fx/Mysql.php';
  7. if (ALLOW_ORIGIN)
  8. header("Access-Control-Allow-Origin:*");
  9. $pdo=conn();
  10. $orderid=isset($_GET['orderno'])?intval($_GET['orderno']):'';
  11. //$userid=73;//getUserId();
  12. //if ($userid ===false){
  13. // echo json_encode(array("code"=>1,"info"=>"用户未登录"));
  14. // exit;
  15. //}
  16. //if($json[0]=Find($orderid)){
  17. //
  18. //}else{
  19. // echo json_encode(array('code'=>1,'info'=>'订单号错误'));
  20. //}
  21. //if (is_array($json)){
  22. // var_dump($json);
  23. ////echo json_encode($json);
  24. //}
  25. //exit;
  26. //require_once '../Common/Config.php';
  27. if($_POST || 1){
  28. $order_id =$orderid;
  29. $ifback = "0";
  30. $to_order_id=$order_id;
  31. //$order_id=204351;
  32. $pdo = conn();
  33. $sql_s = "select * from to_from where to_orderid=".$order_id." or back_orderid=".$order_id;
  34. $result=$pdo->query($sql_s);
  35. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  36. if($rowset){
  37. $ifback=1;
  38. $to_order_id = $rowset[0]['to_orderid'];
  39. $back_order_id = $rowset[0]['back_orderid'];
  40. $list1['to'] = Find($to_order_id);
  41. // $time_cut = time()-strtotime($list['to']['run_date'].' '.$list['to']['run_time']);
  42. $list1['back'] = Find($back_order_id);
  43. if($list1['to'] && $list1['back']){
  44. $code = 0;
  45. $info = 'success';
  46. $massge = '成功';
  47. $list = $list1['to'];
  48. $list['order_price'] = $list1['to']['order_price']+$list1['back']['order_price'];
  49. }
  50. //$time_cut = time()-strtotime($list['to']['run_time']); ///时间在开场30分钟前可以退票
  51. }else{
  52. if($list = Find($order_id)){
  53. $code = 0;
  54. $info = 'success';
  55. $massge = '成功';
  56. $list = $list;
  57. //$time_cut = time()-strtotime($list['run_date'].' '.$list['run_time']);
  58. }else{
  59. $code =1;
  60. $info = 'fail';
  61. $massge = '失败';
  62. $list = "";
  63. }
  64. $time_cut = time()-strtotime($list['run_time']); ///时间在开场30分钟前可以退票
  65. }
  66. } else {
  67. $code =1;
  68. $info = 'fail';
  69. $massge = '失败';
  70. $list = "";
  71. }
  72. $json= $list;
  73. //var_dump($json);
  74. echo json_encode($json);
  75. die;
  76. /**
  77. * $pdo= conn();
  78. $sql = "select order_description,order_price,order_status, "
  79. . "from order_main "
  80. . "where order_id=".$order_id;
  81. $result=$pdo->query($sql);
  82. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  83. $order_status =$rowset[0]['order_status'];
  84. $order_price = $rowset[0];//订单总价格 订单票的数量
  85. $sql = "SELECT DISTINCT
  86. order_description,create_time,prod_name,parent_order_id,run_date,run_time,PROD_START_STATION_AREA_NAME,PROD_START_STATION_RES_NAME,PROD_END_STATION_AREA_NAME,PROD_END_STATION_RES_NAME
  87. FROM `order_main`
  88. where PARENT_ORDER_ID=".$order_id;
  89. $result=$pdo->query($sql);
  90. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  91. if(!$rowset){
  92. return FALSE;
  93. }
  94. $order_station = $rowset[0];//订单来往地址 订单时间 订单好
  95. if(empty($order_station))
  96. return false;
  97. $array_order_desc=array();
  98. $arr_temp = explode('|',$order_price['order_description']);
  99. $arr=array();
  100. foreach ($arr_temp as $k=>$v2) {
  101. if(!empty($v2))
  102. $array_order_desc[]= explode (',', $v2); //订单票 * 数量
  103. }
  104. $list = array();
  105. //上海(黄浦旅游集散站) - 乌镇(西栅1号停车场)//反的数组
  106. $list['station'] = $order_station['PROD_START_STATION_AREA_NAME'].'('.$order_station['PROD_START_STATION_RES_NAME'].')'
  107. .'-'.$order_station['PROD_END_STATION_AREA_NAME'].'('.$order_station['PROD_END_STATION_RES_NAME'].')';
  108. $list['start_station']=$order_station['PROD_START_STATION_AREA_NAME'];
  109. $list['end_station']=$order_station['PROD_END_STATION_AREA_NAME'];
  110. $list['start_res_name'] = $order_station['PROD_START_STATION_RES_NAME'];
  111. $list['end_res_name'] = $order_station['PROD_END_STATION_RES_NAME'];
  112. $list['run_date'] = $order_station['run_date'];
  113. $list['order_status']=$order_status;
  114. $list['prod_name'] = $order_station['prod_name'];
  115. $list['create_time'] = $order_station['create_time'];
  116. $list['run_time'] = $order_station['run_date'].' '.$order_station['run_time'];
  117. $list['count']='';
  118. foreach ($array_order_desc as $v){
  119. $list['count'] .= ' '.$v[0].' × '.$v[2];
  120. }
  121. $list['order_price'] = $order_price['order_price'];
  122. return $list;
  123. }
  124. * @param type $order_id
  125. * @return boolean
  126. */
  127. //function Find($order_id){
  128. function Find($order_id){
  129. $pdo= conn();
  130. $sql = "select order_description,order_price,order_status "
  131. . "from order_main "
  132. . "where order_id=".$order_id;
  133. $result=$pdo->query($sql);
  134. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  135. $order_price = $rowset[0];//订单总价格 订单票的数量
  136. $sql = "SELECT DISTINCT
  137. order_description,parent_order_id,create_time,prod_name,run_date,run_time,PROD_START_STATION_AREA_NAME,PROD_START_STATION_RES_NAME,PROD_END_STATION_AREA_NAME,PROD_END_STATION_RES_NAME
  138. FROM `order_main`
  139. where PARENT_ORDER_ID=".$order_id;
  140. $result=$pdo->query($sql);
  141. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  142. $order_station = $rowset[0];//订单来往地址 订单时间 订单好
  143. if(empty($order_station))
  144. return false;
  145. $array_order_desc=array();
  146. $arr_temp = explode('|',$order_price['order_description']);
  147. $arr=array();
  148. foreach ($arr_temp as $k=>$v2) {
  149. if(!empty($v2))
  150. $array_order_desc[]= explode (',', $v2); //订单票 * 数量
  151. }
  152. $list = array();
  153. //上海(黄浦旅游集散站) - 乌镇(西栅1号停车场)//反的数组
  154. $list['station'] = $order_station['PROD_START_STATION_AREA_NAME'].'('.$order_station['PROD_START_STATION_RES_NAME'].')'
  155. .'-'.$order_station['PROD_END_STATION_AREA_NAME'].'('.$order_station['PROD_END_STATION_RES_NAME'].')';
  156. $list['start_station']=$order_station['PROD_START_STATION_AREA_NAME'];
  157. $list['end_station']=$order_station['PROD_END_STATION_AREA_NAME'];
  158. $list['start_res_name'] = $order_station['PROD_START_STATION_RES_NAME'];
  159. $list['end_res_name'] = $order_station['PROD_END_STATION_RES_NAME'];
  160. $list['run_date'] = $order_station['run_date'];
  161. $list['prod_name'] = $order_station['prod_name'];
  162. $list['create_time'] = $order_station['create_time'];
  163. $list['run_time'] = $order_station['run_date'].' '.$order_station['run_time'];
  164. $list['count']='';
  165. foreach ($array_order_desc as $v){
  166. $list['count'] .= ' '.$v[0].' × '.$v[2];
  167. }
  168. $list['order_price'] = $order_price['order_price'];
  169. $list['order_status'] = $order_price['order_status'];
  170. return $list;
  171. }