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.
 
 
 
 
 

115 lines
4.4 KiB

  1. <?php
  2. /*
  3. * wechat 2.0
  4. * Copyright (c) 2016 yixi wei http://zhizhuchuxing.com/
  5. * Date: 2016.09.07
  6. * Something is to pay QQ1062140302
  7. */
  8. //处理特殊订单的测试文件
  9. if (ALLOW_ORIGIN)
  10. header("Access-Control-Allow-Origin:*");
  11. date_default_timezone_set('PRC');
  12. require_once __DIR__.'/../../api/cancelOrder.php';
  13. require_once __DIR__.'/../dictionary.php';
  14. $order_id = isset($_POST['order_id']) ? $_POST['order_id'] : "454259";
  15. //echo json_encode(array("code" => 1, "info" => "退票业务暂未开放"));
  16. // exit ;
  17. $pdo = conn();
  18. $list = Find($order_id);
  19. $time_cut = strtotime($list['run_time'])-time();
  20. foreach ($array_line_info[$list['line_id']]['start'] as $v) {
  21. if($v['name']==$list['start_res_name']){
  22. $start_id = $v['id'];
  23. }
  24. }
  25. foreach ($array_line_info[$list['line_id']]['end'] as $v) {
  26. if($v['name']==$list['end_res_name']){
  27. $end_id = $v['id'];
  28. }
  29. }
  30. if($time_cut<=13600){
  31. $code ='1';
  32. $info = 'fail';
  33. $massge = '开车前30分钟禁止退票';
  34. $list = "";
  35. }else{
  36. if(1){
  37. $code = '0';
  38. $info = 'success';
  39. $massge = '订单已取消';
  40. $cancel_order = new cancelOrder();
  41. $res = $cancel_order ->cancel_order($list['run_id'], $list['run_bus_order_id'],$start_id,$end_id,$order_id, $list['tic_num']);
  42. $massge=$res;
  43. }else{
  44. $code = '1';
  45. $info =$rowset[0]['errorinfo'];
  46. $massge = $rowset[0]['errorinfo'];
  47. }
  48. }
  49. $data['code']=$code;
  50. $data['info']=$massge;
  51. echo json_encode($data);die;
  52. function Find($order_id){
  53. $pdo= conn();
  54. $sql = "select order_description,order_price,order_pay_main_id "
  55. . "from order_main "
  56. . "where order_id=".$order_id;
  57. $result=$pdo->query($sql);
  58. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  59. $order_price = $rowset[0];//订单总价格 订单票的数量
  60. $sql = "SELECT DISTINCT
  61. order_description,parent_order_id,run_date,run_id,run_time,run_bus_order_id,prod_id,parent_prod_id,PROD_START_STATION_AREA_NAME,PROD_START_STATION_RES_NAME,PROD_END_STATION_AREA_NAME,PROD_END_STATION_RES_NAME
  62. FROM `order_main`
  63. where PARENT_ORDER_ID=".$order_id;
  64. $result=$pdo->query($sql);
  65. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  66. $order_station = $rowset[0];//订单来往地址 订单时间 订单好
  67. if(empty($order_station))
  68. return false;
  69. $array_order_desc=array();
  70. $arr_temp = explode('|',$order_price['order_description']);
  71. $arr=array();
  72. foreach ($arr_temp as $k=>$v2) {
  73. if(!empty($v2))
  74. $array_order_desc[]= explode (',', $v2); //订单票 * 数量
  75. }
  76. $list = array();
  77. //上海(黄浦旅游集散站) - 乌镇(西栅1号停车场)//反的数组
  78. $list['station'] = $order_station['PROD_START_STATION_AREA_NAME'].'('.$order_station['PROD_START_STATION_RES_NAME'].')'
  79. .'-'.$order_station['PROD_END_STATION_AREA_NAME'].'('.$order_station['PROD_END_STATION_RES_NAME'].')';
  80. $list['start_station']=$order_station['PROD_START_STATION_AREA_NAME'];
  81. $list['end_station']=$order_station['PROD_END_STATION_AREA_NAME'];
  82. $list['start_res_name'] = $order_station['PROD_START_STATION_RES_NAME'];
  83. $list['end_res_name'] = $order_station['PROD_END_STATION_RES_NAME'];
  84. $list['run_date'] = $order_station['run_date'];
  85. $list['run_time'] = $order_station['run_date'].' '.$order_station['run_time'];
  86. $list['count']='';
  87. $list['tic_num'] = 0;
  88. foreach ($array_order_desc as $v){
  89. $list['count'] .= ' '.$v[0].' × '.$v[2];
  90. $list['tic_num'] +=$v[2] ;
  91. }
  92. $list['order_price'] = $order_price['order_price'];
  93. $sql = "select pay_serial_number from order_pay_detail where pay_main_id =".$order_price['order_pay_main_id'];
  94. $result=$pdo->query($sql);
  95. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  96. $list['pay_num'] = $rowset[0]['pay_serial_number'];
  97. $list['line_id'] = $order_station['parent_prod_id'];
  98. $list['run_id'] = $order_station['run_id'];//run_bus_order_id
  99. $list['run_bus_order_id'] = $order_station['run_bus_order_id'];//parent_order_id
  100. $list['parent_order_id'] = $order_station['parent_order_id'];
  101. $list['prod_id'] = $order_station['prod_id'];
  102. return $list;
  103. }