Pārlūkot izejas kodu

提交规范化地址

wartheking2024 9 stundas atpakaļ
vecāks
revīzija
fa314a3036
2 mainītis faili ar 41 papildinājumiem un 20 dzēšanām
  1. 8 20
      Assets/Scripts/HttpHelper.cs
  2. 33 0
      Assets/Scripts/UI/Tools/ServerAddress.cs

+ 8 - 20
Assets/Scripts/HttpHelper.cs

@@ -2139,7 +2139,7 @@ public class HttpHelper : MonoBehaviour
     public async UniTaskVoid GetGCYW_Station()
     {
         Debug.Log("获取B08GCYW 站点列表");
-        using UnityWebRequest www = UnityWebRequest.Get("http://58.19.230.46:9180/prod-api/project/xunjianStation/treeList?pageNum=1&pageSize=999");
+        using UnityWebRequest www = UnityWebRequest.Get(ServerAddress.APIGCYWStation);
         www.downloadHandler = new DownloadHandlerBuffer();
         www.SetRequestHeader("Content-Type", "application/json");
         await www.SendWebRequest();
@@ -2216,7 +2216,7 @@ public class HttpHelper : MonoBehaviour
         string tempStr = JsonConvert.SerializeObject(sendData);
         //Debug.Log($"GetStatistics data:{tempStr}");
         var sendByte = System.Text.Encoding.UTF8.GetBytes(tempStr);
-        using UnityWebRequest www = new UnityWebRequest("http://58.19.230.46:9180/prod-api/project/workOrder/statistics","POST");
+        using UnityWebRequest www = new UnityWebRequest(ServerAddress.APIGCYWWorkOrder,"POST");
         www.uploadHandler = new UploadHandlerRaw(sendByte);
         www.downloadHandler = new DownloadHandlerBuffer();
         www.SetRequestHeader("Content-Type", "application/json");
@@ -2230,7 +2230,7 @@ public class HttpHelper : MonoBehaviour
     {
         GlobalData.B08_Type = ids;
         string TFSJ_cmd =
-            $"http://58.19.230.46:9180/prod-api/project/workOrder/list?pageNum=1&pageSize=999&type=2&stationId={ids}&isAsc=desc";
+            ServerAddress.APIGCYWList + $"?pageNum=1&pageSize=999&type=2&stationId={ids}&isAsc=desc";
         
         UnityWebRequest TFSJ_www = new UnityWebRequest(TFSJ_cmd, "Get");
         TFSJ_www.downloadHandler = new DownloadHandlerBuffer();
@@ -2269,7 +2269,7 @@ public class HttpHelper : MonoBehaviour
         Debug.Log(TFSJ_result);
         Debug.Log("!!!!!!!!!!!!!!!!!!!!");
 
-        string XJRW_cmd = $"http://58.19.230.46:9180/prod-api/project/workOrder/list?pageNum=1&pageSize=999&type=3&stationId={ids}&isAsc=desc";
+        string XJRW_cmd = ServerAddress.APIGCYWList + $"?pageNum=1&pageSize=999&type=3&stationId={ids}&isAsc=desc";
         UnityWebRequest XJRW_www = new UnityWebRequest(XJRW_cmd, "Get");
         XJRW_www.downloadHandler = new DownloadHandlerBuffer();
         XJRW_www.SetRequestHeader("Content-Type", "application/json");
@@ -2285,19 +2285,7 @@ public class HttpHelper : MonoBehaviour
         Debug.Log(XJRW_result);
         Debug.Log("!!!!!!!!!!!!!!!!!!!!");
         
-        // string RWXQ_cmd = $"http://58.19.230.46:9180/prod-api/project/workOrder/list?pageNum=1&pageSize=999&type=3&stationId={ids}&isAsc=desc";
-        // UnityWebRequest RWXQ_www = new UnityWebRequest(RWXQ_cmd, "Get");
-        // RWXQ_www.downloadHandler = new DownloadHandlerBuffer();
-        // RWXQ_www.SetRequestHeader("Content-Type", "application/json");
-        // RWXQ_www.SetRequestHeader("Authorization", "Bearer "+token);
-        // await RWXQ_www.SendWebRequest();
-        // if (RWXQ_www.result != UnityWebRequest.Result.Success)
-        // {
-        //     Debug.LogWarning($"获取{RWXQ_cmd}数据不成功,原因:返request不成功:" + RWXQ_www.downloadHandler.text);
-        // }
-        // string RWXQ_result = RWXQ_www.downloadHandler.text;
-        // Debug.Log(RWXQ_result);
-        // Debug.Log("!!!!!!!!!!!!!!!!!!!!");
+        
         
     }
     
@@ -2321,7 +2309,7 @@ public class HttpHelper : MonoBehaviour
     
     public async Task<string> B08_API_TaskInfo(string id)
     {
-        string cmdUrl = $"http://58.19.230.46:9180/prod-api/project/workOrder/{id}/combined?limit=100";
+        string cmdUrl = ServerAddress.APIGCYWWorkOrderDetail +  $"/{id}/combined?limit=100";
         Debug.Log("!!!:" + cmdUrl +" token:"+token);
         UnityWebRequest www = new UnityWebRequest(cmdUrl, "Get");
         www.downloadHandler = new DownloadHandlerBuffer();
@@ -2339,7 +2327,7 @@ public class HttpHelper : MonoBehaviour
     
     public async UniTaskVoid B08_ChartInfo()
     {
-        string cmdUrl = "http://58.19.230.46:9180/prod-api/project/workOrder/eventProjectTypeCount";
+        string cmdUrl = ServerAddress.APIGCYWChartInfo;
         Debug.Log("!!!:" + cmdUrl +" token:"+token);
         UnityWebRequest www = new UnityWebRequest(cmdUrl, "Get");
         www.downloadHandler = new DownloadHandlerBuffer();
@@ -2357,7 +2345,7 @@ public class HttpHelper : MonoBehaviour
         }
         www.Dispose();
 
-        cmdUrl = "http://58.19.230.46:9180/prod-api/project/workOrder/eventGradeCount";
+        cmdUrl = ServerAddress.APIGCYWGradeCount;
         Debug.Log("!!!:" + cmdUrl +" token:"+token);
         www = new UnityWebRequest(cmdUrl, "Get");
         www.downloadHandler = new DownloadHandlerBuffer();

+ 33 - 0
Assets/Scripts/UI/Tools/ServerAddress.cs

@@ -5,6 +5,7 @@ using UnityEngine;
 public class ServerAddress
 {
     public static string YZTServerAddress = "http://58.19.230.46:9081";
+    public static string YZTServerAddress1 = "http://58.19.230.46:9180";
     public static string YZTServerPYAddress = "http://58.19.230.46:15005";
     public static string Server_UploadPath = "http://58.19.230.46:15001";
     public static string ModbusSeverAddress = "http://58.19.230.46:8300";
@@ -203,4 +204,36 @@ public class ServerAddress
     /// </summary>
     public static string APIGetDeviceTrend = YZTServerAddress + "/open/sensor/trend2";
 
+
+    /// <summary>
+    /// 获取B08GCYW 站点列表
+    /// </summary>
+    public static string APIGCYWStation = YZTServerAddress1 + "/prod-api/project/xunjianStation/treeList?pageNum=1&pageSize=999";
+
+
+    /// <summary>
+    /// 获取B08GCYW任务列表
+    /// </summary>
+    public static string APIGCYWWorkOrder = YZTServerAddress1 + "/prod-api/project/workOrder/statistics";
+
+    /// <summary>
+    /// 获取B08GCYW
+    /// </summary>
+    public static string APIGCYWList = YZTServerAddress1 + "/prod-api/project/workOrder/list";
+
+    /// <summary>
+    /// 获取B08GCYW任务列表
+    /// </summary>
+    public static string APIGCYWWorkOrderDetail = YZTServerAddress1 + "/prod-api/project/workOrder";
+
+
+    /// <summary>
+    /// 获取B08GCYW饼状图
+    /// </summary>
+    public static string APIGCYWChartInfo = YZTServerAddress1 + "/prod-api/project/workOrder/eventProjectTypeCount";
+
+    /// <summary>
+    /// 获取B08GCYW饼状图2
+    /// </summary>
+    public static string APIGCYWGradeCount = YZTServerAddress1 + "/prod-api/project/workOrder/eventGradeCount";
 }