Browse Source

新增获取机房列表接口 默认用第一个机房

DGJ 1 year ago
parent
commit
7581ec9117

+ 28 - 0
Assets/LangChaoJiekou.cs

@@ -37,6 +37,8 @@ public class LangChaoJiekou : MonoSingleton<LangChaoJiekou>
 
     public const string execute = "/inms/metaverse-cooperate/record/execute";
 
+    public const string getmachinelist = "/inms/metaverse-cooperate/task/getRoom";
+
     public string token = "";
 
 
@@ -69,7 +71,33 @@ public class LangChaoJiekou : MonoSingleton<LangChaoJiekou>
         }));
     }
 
+    public void GetMachineList( Action<List<string>> callback)
+    {
+        StartCoroutine(SendHttp(getmachinelist, "", (msg) =>
+          {
+              Debug.Log(getmachinelist + "  " + msg);
+              JsonData data = JsonMapper.ToObject(msg);
+
+              string str = data["data"].ToString();
+
+              Debug.Log(str);
+
+              Person listMachineArry = JsonConvert.DeserializeObject<Person>(msg);
+
+            
+
+              callback(listMachineArry.data);
+
+          }, "application/json",false));
+    }
 
+    public class Person
+    {
+        public string code { get; set; }
+        public string msg { get; set; }
+        public List<string> data { get; set; }
+        public string traceId { get; set; }
+    }
     //检查是否有巡检
     public void checkXunjian(string distributeTarget,Action<TaskItem> callback)
     {

+ 4 - 0
Assets/Scenes/LangChaoDemo2.unity

@@ -15086,6 +15086,10 @@ PrefabInstance:
       propertyPath: m_RootOrder
       value: 0
       objectReference: {fileID: 0}
+    - target: {fileID: 9017032404431050513, guid: 516b1dd9af80bba42b8206d3a09635bb, type: 3}
+      propertyPath: m_IsActive
+      value: 0
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 516b1dd9af80bba42b8206d3a09635bb, type: 3}
 --- !u!1 &1067717208 stripped

+ 31 - 14
Assets/Scripts/UI/XunJianDataManager.cs

@@ -9,26 +9,43 @@ public class XunJianDataManager : MonoSingleton<XunJianDataManager>
 {
     public void checkXunjian( Action<string> callBack)
     {
-        LangChaoJiekou.Instance.checkXunjian("机房A",(taskItem) => {
-            if (taskItem == null)
-            {
-                callBack("当前机房暂无巡检任务!");
-            }
-            else
+
+        LangChaoJiekou.Instance.GetMachineList((List<string> listMachine )=>
+        {
+            Debug.Log("");
+            if (listMachine.Count > 0)
             {
-                callBack(null);
-                XunJianAllData.taskItem = taskItem;
 
-                LangChaoJiekou.Instance.getXunJian(taskItem, (listRoomItem) => {
+                LangChaoJiekou.Instance.checkXunjian(listMachine[0], (taskItem) => {
+                    if (taskItem == null)
+                    {
+                        callBack("当前机房暂无巡检任务!");
+                    }
+                    else
+                    {
+                        callBack(null);
+                        XunJianAllData.taskItem = taskItem;
+
+                        LangChaoJiekou.Instance.getXunJian(taskItem, (listRoomItem) => {
+
 
-                    
-                    XunJianAllData.listRoomItem = listRoomItem;
-                    Debug.Log(" DGJ ===> getXunJian " + JsonConvert.SerializeObject(listRoomItem));
+                            XunJianAllData.listRoomItem = listRoomItem;
+                            Debug.Log(" DGJ ===> getXunJian " + JsonConvert.SerializeObject(listRoomItem));
 
+                        });
+
+                    }
                 });
-               
             }
-        } );
+            else
+            {
+                Debug.LogError(" 当前账号内无机房列表 ");
+            }
+         
+
+        });
+
+      
     }
     
 }

+ 3 - 1
ProjectSettings/ProjectSettings.asset

@@ -146,7 +146,9 @@ PlayerSettings:
     16:9: 1
     Others: 1
   bundleVersion: 1.0.0
-  preloadedAssets: []
+  preloadedAssets:
+  - {fileID: -3507145773158424512, guid: 3df6047a2585e9a4b87f07c19a70fec7, type: 2}
+  - {fileID: -6724271008176559649, guid: aba1d4d6205d4914784889e2d8ed78c4, type: 2}
   metroInputSource: 0
   wsaTransparentSwapchain: 0
   m_HolographicPauseOnTrackingLoss: 1