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.
 
 
 
 
 
 

52 lines
1.5 KiB

  1. <?php
  2. /*
  3. * wechat 2.0
  4. * Copyright (c) 2016 yixi wei http://zhizhuchuxing.com/
  5. * Date: 2016.7.12
  6. * Something is to pay QQ1062140302
  7. */
  8. //获取jssdk配置
  9. require_once __DIR__.'/../jssdk/jssdk_wx.php';
  10. //require_once __DIR__.'/../Common/Config.php';
  11. require_once __DIR__.'/../Common_fx/Mysql.php';
  12. $pdo = conn();
  13. header("Access-Control-Allow-Origin:*");
  14. $jssdk = new JSSDK(APPID, APPSECRET);
  15. if (isset($_POST['url'])){
  16. $url=$_POST['url'];
  17. }else{
  18. $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
  19. $url = "$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  20. }
  21. if(isset($_POST["bus_no"]))
  22. $order_bus_no = $_POST["bus_no"];
  23. else
  24. $order_bus_no ='000';
  25. //$order_driver_name = $rowset[0]["SEND_DRIVER_NAME"];
  26. $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."'";
  27. //$pdo = conn();
  28. $result = $pdo -> query($sql);
  29. $rowset = $result -> fetchAll(PDO::FETCH_ASSOC);
  30. if(isset($rowset[0]['PROPERTY'])){
  31. $ifgps ='1';
  32. $position = get_position($rowset[0]['PROPERTY']);
  33. $j = $position['j'];
  34. $w = $position['w'];
  35. $speed = $position['speed'];
  36. }else{
  37. $ifgps ='0';
  38. $j = '0';
  39. $w = '0';
  40. $speed = '0';
  41. }
  42. $signPackage = $jssdk->GetSignPackage($url);
  43. $signPackage['j'] =$j;
  44. $signPackage['w'] =$w;
  45. $signPackage['speed'] =$speed;
  46. $signPackage['ifgps'] =$ifgps;
  47. echo json_encode($signPackage);