diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Common/Data/Config/SearhProjectDataConfig.cs b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Common/Data/Config/SearhProjectDataConfig.cs new file mode 100644 index 00000000..e69de29b diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Common/Data/Config/SearhProjectDataConfig.cs.meta b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Common/Data/Config/SearhProjectDataConfig.cs.meta new file mode 100644 index 00000000..801d0f50 --- /dev/null +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Common/Data/Config/SearhProjectDataConfig.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 33805700c367ede48908889e8492c787 \ No newline at end of file diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Core/System/CompanyDataConfigSystem.cs b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Core/System/CompanyDataConfigSystem.cs index 2d1aa3df..898542ad 100644 --- a/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Core/System/CompanyDataConfigSystem.cs +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Core/System/CompanyDataConfigSystem.cs @@ -17,7 +17,8 @@ namespace GameLogic { return projectData; } - var jsonData = await HttpHandleTool.UnityWebRequestPostJsonByUserCode(page, userCode); + string jsonParm = $"{{\"userCode\":\"{userCode}\"}}"; + var jsonData = await JsonHttpUtility.UnityWebRequestPostJsonByUserCode(page, jsonParm); var projectConfigRoot = JsonUtility.FromJson(jsonData); return GetProjectData(projectConfigRoot.data,userCode); @@ -29,12 +30,15 @@ namespace GameLogic { return projectData; } - var jsonData = await HttpHandleTool.UnityWebRequestPostJsonByUserCode(page, userCode); + string jsonParm = $"{{\"userCode\":\"{userCode}\"}}"; + var jsonData = await JsonHttpUtility.UnityWebRequestPostJsonByUserCode(page, jsonParm); var projectConfigRoot = JsonUtility.FromJson(jsonData); return GetProjectData(projectConfigRoot.data,userCode); } + + #region 场景数据 public ProjectData GetProjectData(string company = null) diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/JsonHttpUtility.cs b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/JsonHttpUtility.cs new file mode 100644 index 00000000..52abae85 --- /dev/null +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/JsonHttpUtility.cs @@ -0,0 +1,43 @@ + +using System.Text; +using Cysharp.Threading.Tasks; +using UnityEngine; +using UnityEngine.Networking; + +namespace GameLogic +{ + public static class JsonHttpUtility + { + + + + public static async UniTask UnityWebRequestPostJsonByUserCode(string page, string data) + { + string url = $"https://www.arsnowslide.com/brounche/brochure/project/selAllProjectsOnWxByPage/{page}"; + using (UnityWebRequest request = new UnityWebRequest(url, "POST")) + { + // 手动构建 JSON 字符串 + string jsonData = data; + byte[] bodyRaw = Encoding.UTF8.GetBytes(jsonData); + request.uploadHandler = new UploadHandlerRaw(bodyRaw); + request.downloadHandler = new DownloadHandlerBuffer(); + request.SetRequestHeader("Content-Type", "application/json"); + + await request.SendWebRequest().ToUniTask(); + + if (request.result == UnityWebRequest.Result.Success) + { + return request.downloadHandler.text; + } + else + { + Debug.LogError($"POST Request failed: {request.error}"); + return ""; + } + } + } + + + } + +} diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/JsonHttpUtility.cs.meta b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/JsonHttpUtility.cs.meta new file mode 100644 index 00000000..31c6d6cf --- /dev/null +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/JsonHttpUtility.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f5f8458a222147e44880cc6c73beccc5 \ No newline at end of file diff --git a/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/Old/HttpHandleTool.cs b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/Old/HttpHandleTool.cs index 811936bf..b65acf7b 100644 --- a/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/Old/HttpHandleTool.cs +++ b/EintooAR/Assets/GameScripts/HotFix/GameLogic/AR Brochure/Utility/Old/HttpHandleTool.cs @@ -341,58 +341,7 @@ namespace GameLogic } } } - - - - public static async UniTask UnityWebRequestPostJsonByUserCode(string url, string userCode,string page= "") - { - using (UnityWebRequest request = new UnityWebRequest(url, "POST")) - { - // 手动构建 JSON 字符串 - string jsonData = $"{{\"userCode\":\"{userCode}\"}}"; - byte[] bodyRaw = Encoding.UTF8.GetBytes(jsonData); - request.uploadHandler = new UploadHandlerRaw(bodyRaw); - request.downloadHandler = new DownloadHandlerBuffer(); - request.SetRequestHeader("Content-Type", "application/json"); - - await request.SendWebRequest().ToUniTask(); - - if (request.result == UnityWebRequest.Result.Success) - { - return request.downloadHandler.text; - } - else - { - Debug.LogError($"POST Request failed: {request.error}"); - return ""; - } - } - } - public static async UniTask UnityWebRequestPostJsonByUserCode(string page, string userCode) - { - string url = $"https://www.arsnowslide.com/brounche/brochure/project/selAllProjectsOnWxByPage/{page}"; - using (UnityWebRequest request = new UnityWebRequest(url, "POST")) - { - // 手动构建 JSON 字符串 - string jsonData = $"{{\"userCode\":\"{userCode}\"}}"; - byte[] bodyRaw = Encoding.UTF8.GetBytes(jsonData); - request.uploadHandler = new UploadHandlerRaw(bodyRaw); - request.downloadHandler = new DownloadHandlerBuffer(); - request.SetRequestHeader("Content-Type", "application/json"); - - await request.SendWebRequest().ToUniTask(); - - if (request.result == UnityWebRequest.Result.Success) - { - return request.downloadHandler.text; - } - else - { - Debug.LogError($"POST Request failed: {request.error}"); - return ""; - } - } - } + #endregion }