using Blue; using LitJson; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using UnityEngine; public class InspectionService : IInspectionService { public InspectionInfo InspectionInfo { get; private set; } public void OnInit() { } public void Get() { CoroutineSystem.Instance.StartCoroutine( HttpTool.Instance.SendHttp(HttpActionLang.inspection_begin, "", message => { JObject jobject = JObject.Parse(message); if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString())) { Debug.LogError("data:" + jobject["data"].ToString()); InspectionInfo = JsonConvert.DeserializeObject(jobject["data"].ToString()); /* Debug.LogError($"ID:{InspectionInfo.id}"); foreach (var item in InspectionInfo.items) { Debug.LogError($"key:{item.Key},Value:{item.Value}"); } Debug.LogError($"Steps:{InspectionInfo.steps.Count}"); foreach (var item in InspectionInfo.steps) { Debug.LogError($"key:{item.Key}"); Debug.LogError($"normal:{item.Value.normal}"); Debug.LogError($"lable:{item.Value.label}"); Debug.LogError($"images:{item.Value.images}"); } */ } })); } /// /// 机房巡检步骤上报 /// /// 检查项目的编号 1-12 /// 是否正常 /// 标签 /// 巡检编号,巡检开始时返回的id /// 图片文件ID 最多三个 public void Set(int ItemID, bool Normal, string Outliers, int InspectionId, string[] ImageIds) { InspectionStepSet mInspectionStepSet = new InspectionStepSet() { itemId = ItemID, normal = Normal, outliers = Outliers, inspectionId = InspectionId, imageIds = ImageIds }; string JsonString = JsonConvert.SerializeObject(mInspectionStepSet); CoroutineSystem.Instance.StartCoroutine(HttpTool.Instance.SendHttp(HttpActionLang.inspection_step, JsonString, message => { JObject jobject = JObject.Parse(message); if (jobject["code"].ToString() == "200" && !string.IsNullOrWhiteSpace(jobject["data"].ToString())) { //Debug.LogError($"Message:{message}+finished:{jobject["data"]["finished"]}"); } })); } }