http.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * Created by Administrator on 2017/11/6.
  3. */
  4. define([''], function () {
  5. return http = {
  6. serverUrl: onemapUrlConfig.meteoUrl + '/earth-apis/', //服务路径
  7. markerUrl: onemapUrlConfig.siteUrl + "/images/meteo/", //marker点图片所使用的绝对路径
  8. myImageUrlJs: "images/meteo/",
  9. //-------------------------站点数据---------------------
  10. station: 'stations', //站点查询(可传中英文或站号)
  11. //-----------------------地面站------------------------
  12. stationInfo: 'stations/weather-real', //(气象)站点数据(加站号为单站数据)
  13. stationReal: 'stations/weather-real/surfseq', //站点实况(变化曲线)
  14. stationFcst: 'stations/weather-fcst/hourseq', //站点预报(3小时
  15. stationFcstDay: 'stations/weather-fcst/dayseq', //站点预报(天
  16. //-----------------------5000站点------------------------------
  17. stationG: 'global/stations', //国外5000站点实况(分布图)
  18. stationGInfo: 'global/real', //国外站点单站实况
  19. stationGReal: 'global/surfseq', //国外站点单站实况(变化曲线)
  20. stationGFcst: 'global/fcstseq', //国外站点单站预报(变化曲线)
  21. //------------------------amsu站--------------------------------
  22. amsu: 'amsu', //站点实况(分布图)
  23. amsuInfo: 'amsu', //站点实况
  24. amsuReal: 'amsu/amsuseq', //单站实况(变化曲线)
  25. amsuFcst: '', //单站预报(变化曲线)
  26. //-------------------------自动站--------------------------
  27. aws: 'aws', //自动站(分布图
  28. awsInfo: 'aws', //自动站(分布图
  29. awsReal: 'aws/hourseq', //自动站实况(变0化曲线
  30. //---------------------------机场--------------------------
  31. airportIndex: 'sasp', //机场分布图
  32. airportInfo: 'sasp', //机场实况
  33. //----------------------------船舶报----------------------------
  34. ship: 'ship',
  35. shipInfo: 'ship',
  36. //-------------------------799--------------------
  37. tIsoLine: 'T799/isoline', //799等值线
  38. tImage: 'T799/images', //799等值线
  39. tData: 'T799/data', //799等值线
  40. //-----------------------热带气旋--------------------------
  41. typhIndex: 'typhs', //台风列表
  42. typhInfo: 'typhs/info', //台风详情
  43. //-------------------------海洋环境-----------------------------
  44. oceanImage: 'ocean/images', //海洋填充图
  45. oceanIsoLine: 'ocean/isoline', //海洋等值线
  46. oceanData: 'ocean/data', //海洋数据(海流速度/方向
  47. oceanC: 'ocean/wave/isoline', //海浪高度数据
  48. oceanCI: 'ocean/wave/images', //海浪高度图片
  49. oceanD: 'ocean/dirmndata', //海浪方向
  50. //--------------------------云图-----------------------------
  51. cloud: 'clouds/images',
  52. //-------------------------空间天气----------------------------
  53. space: 'space',
  54. spaceInfo: 'space/info', //空间天气详情
  55. httpFunction: function (url, par, params, callback, errorBack) {
  56. var myUrl = http.serverUrl + url;
  57. myUrl = par ? myUrl + "/" + par : myUrl;
  58. var uuid = new Date().getTime();
  59. if (myUrl.indexOf("?") != -1) {
  60. myUrl += "&uuid=" + uuid;
  61. } else {
  62. myUrl += "?uuid=" + uuid;
  63. }
  64. $.ajax({
  65. url: myUrl,
  66. dataType: 'JSON',
  67. data: params,
  68. success: function (json) {
  69. callback ? callback(json) : null;
  70. },
  71. error: function (e) {
  72. errorBack ? errorBack() : null;
  73. }
  74. })
  75. },
  76. getLocalJson: function (url, callback) {
  77. var LocalJson = "scripts/meteo/test/";
  78. $.get(LocalJson + url).success(function (json) {
  79. if (url.indexOf(".json") == -1) {
  80. json = JSON.parse(json);
  81. }
  82. callback ? callback(json) : null;
  83. });
  84. }
  85. }
  86. })