Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

80 lignes
3.0 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. header("Access-Control-Allow-Origin:*");
  9. // require_once '../../../config/Mysql.php';
  10. // $pdo= conn1();
  11. $fleet_id = 0;
  12. if(isset($_POST["bus_no"])) {
  13. $order_bus_no = $_POST["bus_no"];
  14. $driver_name = isset($_POST['driver_name'])?$_POST['driver_name']:'';
  15. $sql = "select base_resource_property.RES_ID,base_resource_property.PROPERTY FROM base_resource_property,base_resource WHERE base_resource_property.TYPE_ID = 18 AND base_resource_property.RES_ID = base_resource.RES_ID AND base_resource.RES_NAME='{$order_bus_no}'";
  16. $result = $pdo->query($sql);
  17. if( $result != false ) {
  18. $rowset = $result->fetchAll(PDO::FETCH_ASSOC);
  19. $fleet_id = $rowset == false ? 0 : $rowset[0]["PROPERTY"];
  20. }
  21. } else {
  22. $order_bus_no ='0';
  23. $driver_name= '';
  24. }
  25. $get_car_postion_flag = false;
  26. if( $fleet_id == "9477" ) {
  27. $car_position = get_bailian_bus_position($order_bus_no);
  28. if( false != $car_position ) {
  29. $get_car_postion_flag = true;
  30. $j = $car_position['lon'];
  31. $w = $car_position['lat'];
  32. $speed = $car_position['speed'];
  33. }
  34. }
  35. if( $get_car_postion_flag == false ) {
  36. if ($p = getposition($order_bus_no)) { //通过北斗查找车辆信息
  37. $j = $p['Data'][0]['vehicle']['longitude'];
  38. $w = $p['Data'][0]['vehicle']['latitude'];
  39. $speed = $p['Data'][0]['vehicle']['gpsSpeed'];
  40. } else {
  41. //$order_driver_name = $rowset[0]["SEND_DRIVER_NAME"];
  42. $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 . "'";
  43. //$pdo = conn();
  44. $result = $pdo->query($sql);
  45. $rowset = $result->fetchAll(PDO::FETCH_ASSOC);
  46. $sql_res = "SELECT res_id from base_resource where RES_NAME='" . $driver_name . "'";
  47. $res_id = $pdo->query($sql_res);
  48. $res_id_a = $res_id->fetchAll(PDO::FETCH_ASSOC);
  49. $sql_phone = "SELECT pos_x,pos_y from run_bus_pos where driver_id='" . $res_id_a[0]["res_id"] . "' order by log_time desc";
  50. $res_phone = $pdo->query($sql_phone);
  51. $pos_arr = $res_phone->fetchAll(PDO::FETCH_ASSOC);
  52. //$pdo = conn();
  53. //$result_name = $pdo -> query($sql_name);
  54. //$rowset_name = $result_name -> fetchAll(PDO::FETCH_ASSOC);
  55. if (isset($rowset[0]['PROPERTY'])) {
  56. $position = get_position($rowset[0]['PROPERTY']);
  57. $j = $position['j'];
  58. $w = $position['w'];
  59. $speed = $position['speed'];
  60. } elseif (isset($pos_arr[0]['pos_x'])) {
  61. $j = $pos_arr[0]['pos_y'];
  62. $w = $pos_arr[0]['pos_x'];
  63. $speed = '0';
  64. } else {
  65. $j = '0';
  66. $w = '0';
  67. $speed = '0';
  68. }
  69. }
  70. }
  71. $signPackage['j'] =$j;
  72. $signPackage['w'] =$w;
  73. $signPackage['speed'] =$speed;
  74. echo json_encode(array('code'=>'0','info'=>'','list'=>$signPackage));