1,"info"=>"用户未登录")); // exit; //} //if($json[0]=Find($orderid)){ // //}else{ // echo json_encode(array('code'=>1,'info'=>'订单号错误')); //} //if (is_array($json)){ // var_dump($json); ////echo json_encode($json); //} //exit; //require_once '../Common/Config.php'; if($_POST || 1){ $order_id =$orderid; $ifback = "0"; $to_order_id=$order_id; //$order_id=204351; $pdo = conn(); $sql_s = "select * from to_from where to_orderid=".$order_id." or back_orderid=".$order_id; $result=$pdo->query($sql_s); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); if($rowset){ $ifback=1; $to_order_id = $rowset[0]['to_orderid']; $back_order_id = $rowset[0]['back_orderid']; $list1['to'] = Find($to_order_id); // $time_cut = time()-strtotime($list['to']['run_date'].' '.$list['to']['run_time']); $list1['back'] = Find($back_order_id); if($list1['to'] && $list1['back']){ $code = 0; $info = 'success'; $massge = '成功'; $list = $list1['to']; $list['order_price'] = $list1['to']['order_price']+$list1['back']['order_price']; } //$time_cut = time()-strtotime($list['to']['run_time']); ///时间在开场30分钟前可以退票 }else{ if($list = Find($order_id)){ $code = 0; $info = 'success'; $massge = '成功'; $list = $list; //$time_cut = time()-strtotime($list['run_date'].' '.$list['run_time']); }else{ $code =1; $info = 'fail'; $massge = '失败'; $list = ""; } $time_cut = time()-strtotime($list['run_time']); ///时间在开场30分钟前可以退票 } } else { $code =1; $info = 'fail'; $massge = '失败'; $list = ""; } $json= $list; //var_dump($json); echo json_encode($json); die; /** * $pdo= conn(); $sql = "select order_description,order_price,order_status, " . "from order_main " . "where order_id=".$order_id; $result=$pdo->query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); $order_status =$rowset[0]['order_status']; $order_price = $rowset[0];//订单总价格 订单票的数量 $sql = "SELECT DISTINCT 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 FROM `order_main` where PARENT_ORDER_ID=".$order_id; $result=$pdo->query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); if(!$rowset){ return FALSE; } $order_station = $rowset[0];//订单来往地址 订单时间 订单好 if(empty($order_station)) return false; $array_order_desc=array(); $arr_temp = explode('|',$order_price['order_description']); $arr=array(); foreach ($arr_temp as $k=>$v2) { if(!empty($v2)) $array_order_desc[]= explode (',', $v2); //订单票 * 数量 } $list = array(); //上海(黄浦旅游集散站) - 乌镇(西栅1号停车场)//反的数组 $list['station'] = $order_station['PROD_START_STATION_AREA_NAME'].'('.$order_station['PROD_START_STATION_RES_NAME'].')' .'-'.$order_station['PROD_END_STATION_AREA_NAME'].'('.$order_station['PROD_END_STATION_RES_NAME'].')'; $list['start_station']=$order_station['PROD_START_STATION_AREA_NAME']; $list['end_station']=$order_station['PROD_END_STATION_AREA_NAME']; $list['start_res_name'] = $order_station['PROD_START_STATION_RES_NAME']; $list['end_res_name'] = $order_station['PROD_END_STATION_RES_NAME']; $list['run_date'] = $order_station['run_date']; $list['order_status']=$order_status; $list['prod_name'] = $order_station['prod_name']; $list['create_time'] = $order_station['create_time']; $list['run_time'] = $order_station['run_date'].' '.$order_station['run_time']; $list['count']=''; foreach ($array_order_desc as $v){ $list['count'] .= ' '.$v[0].' × '.$v[2]; } $list['order_price'] = $order_price['order_price']; return $list; } * @param type $order_id * @return boolean */ //function Find($order_id){ function Find($order_id){ $pdo= conn(); $sql = "select order_description,order_price,order_status " . "from order_main " . "where order_id=".$order_id; $result=$pdo->query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); $order_price = $rowset[0];//订单总价格 订单票的数量 $sql = "SELECT DISTINCT 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 FROM `order_main` where PARENT_ORDER_ID=".$order_id; $result=$pdo->query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); $order_station = $rowset[0];//订单来往地址 订单时间 订单好 if(empty($order_station)) return false; $array_order_desc=array(); $arr_temp = explode('|',$order_price['order_description']); $arr=array(); foreach ($arr_temp as $k=>$v2) { if(!empty($v2)) $array_order_desc[]= explode (',', $v2); //订单票 * 数量 } $list = array(); //上海(黄浦旅游集散站) - 乌镇(西栅1号停车场)//反的数组 $list['station'] = $order_station['PROD_START_STATION_AREA_NAME'].'('.$order_station['PROD_START_STATION_RES_NAME'].')' .'-'.$order_station['PROD_END_STATION_AREA_NAME'].'('.$order_station['PROD_END_STATION_RES_NAME'].')'; $list['start_station']=$order_station['PROD_START_STATION_AREA_NAME']; $list['end_station']=$order_station['PROD_END_STATION_AREA_NAME']; $list['start_res_name'] = $order_station['PROD_START_STATION_RES_NAME']; $list['end_res_name'] = $order_station['PROD_END_STATION_RES_NAME']; $list['run_date'] = $order_station['run_date']; $list['prod_name'] = $order_station['prod_name']; $list['create_time'] = $order_station['create_time']; $list['run_time'] = $order_station['run_date'].' '.$order_station['run_time']; $list['count']=''; foreach ($array_order_desc as $v){ $list['count'] .= ' '.$v[0].' × '.$v[2]; } $list['order_price'] = $order_price['order_price']; $list['order_status'] = $order_price['order_status']; return $list; }