query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); //var_dump($rowset); $i = 0; foreach ($rowset as $temp) { $order_id = $temp['ORDER_ID']; $order_info = $temp["ORDER_DESCRIPTION"]; $temp_temp = explode(',', $order_info); $seat_type = str_replace("票", "", $temp_temp[0]); //座位类型 $seat_num = str_replace("|", "", $temp_temp[2]); //座位数量 $sql = "SELECT order_status,parent_prod_id,RUN_ID,RUN_DATE,RUN_TIME,RUN_BUS_ORDER_ID,PROD_START_STATION_RES_NAME,PROD_START_STATION_AREA_NAME,PROD_END_STATION_RES_NAME,PROD_END_STATION_AREA_NAME,PROD_END_STATION_TIME_MINUTES,PROD_START_STATION_TIME_MINUTES FROM ORDER_MAIN WHERE PARENT_ORDER_ID=" . $temp["ORDER_ID"] . " AND CANCEL_FLAG=0"; $pdo = conn(); $result = $pdo -> query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); //var_dump($rowset); $time = $rowset[0]["RUN_TIME"]; $date = $rowset[0]["RUN_DATE"]; $temp_time = $date . " " . $time; $start_time = strtotime($temp_time); $now_time = time(); if ($start_time >= $now_time) { //将要出行的订单 $order_start_date = date("n月j日", $start_time); //日期 $order_start_time = $time; //时间 $weekarray = array("日", "一", "二", "三", "四", "五", "六"); //先定义一个数组 $start_week = "星期" . $weekarray[date("w",$start_time)]; if (date('Y-m-d', time()) == $date) { $start_week = "今天"; } $list_going[$i]["week"] = $start_week; $list_going[$i]["year"] = $date; $run_time_start = $rowset[0]["PROD_START_STATION_TIME_MINUTES"]; $run_time_end = $rowset[0]["PROD_END_STATION_TIME_MINUTES"]; $order_hour = floor(($run_time_end - $run_time_start) / 60); //小时 $order_min = ($run_time_end - $run_time_start) % 60; //分钟 $order_used_time = $order_hour . "时" . $order_min . "分"; //耗时 $order_start_res_name = $rowset[0]["PROD_START_STATION_RES_NAME"]; //起始res名字 $order_start_area_name = $rowset[0]["PROD_START_STATION_AREA_NAME"]; //起始地区名字 $order_end_res_name = $rowset[0]["PROD_END_STATION_RES_NAME"]; //终点res名字 $order_end_area_name = $rowset[0]["PROD_END_STATION_AREA_NAME"]; //检票状态 if($rowset[0]['order_status'] ==146){ $check ='0'; }else{ $check = '1'; } //是否显示二维码 if(in_array($rowset[0]['parent_prod_id'], $disney_prod)){ $ercode = '1'; }else{ $ercode = '0'; } if(in_array($rowset[0]['parent_prod_id'], $DZBS)){ $ifdzbs = '1'; //是定制巴士 }else{ $ifdzbs = '0'; } //终点地区名字 $sql = "SELECT SEND_BUS_NO,SEND_DRIVER_NAME,SEND_DRIVER_MOBILE FROM RUN_BUS WHERE CANCEL_FLAG=0 AND RUN_ID=" . $rowset[0]["RUN_ID"] . " AND BUS_ORDER_ID=" . $rowset[0]["RUN_BUS_ORDER_ID"]; $pdo = conn(); $result = $pdo -> query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); //var_dump($rowset); $order_bus_no = ""; //车牌号 $order_driver_name = ""; //司机名称 if (!empty($rowset[0]["SEND_BUS_NO"])) { $driver_mobile = $rowset[0]['SEND_DRIVER_MOBILE']; $order_bus_no = $rowset[0]["SEND_BUS_NO"]; $order_driver_name = $rowset[0]["SEND_DRIVER_NAME"]; $sql = "SELECT b.PROPERTY FROM base_resource a LEFT JOIN `base_resource_property` b on a.RES_ID =b.RES_ID where b.TYPE_ID=283 and a.RES_NAME ='".$order_bus_no."'"; //$pdo = conn(); $result = $pdo -> query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); $time_cut =strtotime($date.' '.$time) - time(); if(isset($rowset[0]['PROPERTY']) && $time_cut<1800){ $ifgps ='1'; }else if($time_cut<1800){ if(!getposition($order_bus_no)){ $ifgps ='3';//没有gps }else{ $ifgps ='1'; } }else{ $ifgps = '0';//没有到时间 } } else { $ifgps ='2'; //没有排车 $order_bus_no = "暂未指派"; $order_driver_name = "暂未指派"; } $list_going[$i]["ifdzbs"] = $ifdzbs; $list_going[$i]["ifgps"] = $ifgps; $list_going[$i]["driver_mobile"] = $driver_mobile; $list_going[$i]["order_id"] = $order_id; $list_going[$i]["2bcode"] = $ercode; $list_going[$i]["ifcheck"] = $check; $list_going[$i]["order_driver_name"] = $order_driver_name; $list_going[$i]["order_bus_no"] = $order_bus_no; $list_going[$i]["order_end_area_name"] = $order_end_area_name; $list_going[$i]["order_end_res_name"] = $order_end_res_name; $list_going[$i]["order_start_area_name"] = $order_start_area_name; $list_going[$i]["order_start_res_name"] = $order_start_res_name; $list_going[$i]["order_used_time"] = $order_used_time; $list_going[$i]["order_start_time"] = $order_start_time; $list_going[$i]["order_start_date"] = $order_start_date; $list_going[$i]["seat_num"] = $seat_num; $list_going[$i]["seat_type"] = $seat_type; $i++; } } if (empty($list_going)) { $jason_array = array(); $jason_array["code"] = "0"; $jason_array["info"] = array(); $jason_array["list"] = ""; echo json_encode($jason_array); exit(); } else { $jason_array = array(); $jason_array["code"] = "0"; $jason_array["info"] = "查询成功"; $temp_temp_temp = strtotime($list_going["0"]["year"]) - 86400 + 64800; if (time() > $temp_temp_temp) { $list_going["0"]["year"] = "即将出行"; } $jason_array["list"] = $list_going; echo json_encode($jason_array); exit(); } } else { //输入用户名为空 $jason_array = array(); $jason_array["code"] = "1"; $jason_array["info"] = "查询失败"; $jason_array["list"] = ""; echo json_encode($jason_array); exit(); } function get_dsnprod(){ $msg_pdo = conn(); $msg_sql = "CALL SP_GET_MESSAGE_TEMPLATE('1')"; $content = ''; if (is_object($msg_pdo)) { $msg_result = $msg_pdo -> query($msg_sql); $i = 1; $data = array(); if ($msg_result) { $data['code'] = "0"; $data['info'] = ""; do { $row = $msg_result -> fetchAll(PDO::FETCH_ASSOC); if ($i == 1) { $data['seat'] = isset($row) ? $row : array(); } else if ($i == 2) { $data['run_info'] = isset($row) ? $row : array(); } else if ($i == 3) { $data['driver'] = isset($row) ? $row : array(); } else if($i==4){ $data['dsn_prod']=isset($row) ? $row : array(); }else if($i==5){ $data['zhou_su_prod']=isset($row) ? $row : array(); } $i++; } while($msg_result->nextRowset()); } $json_obj = json_decode(json_encode($data), TRUE); } foreach($data['dsn_prod'] as $temp){ $dsn_arr_prod[]=$temp['prod_id']; } return $dsn_arr_prod; }