From 0ee75b88cfe03e46289de0de96e8ed4580c797d3 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 27 九月 2022 14:04:21 +0800 Subject: [PATCH] Merge branch 'Dev-Branch' into dev--wxr --- HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs | 49 +++++++++++++++++++++++++------------------------ 1 files changed, 25 insertions(+), 24 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs index d37b603..50cdc79 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs @@ -6,13 +6,14 @@ using System.Text; using HDL_ON.DAL.Server; using HDL_ON.Entity; +using Newtonsoft.Json.Linq; using Shared; namespace HDL_ON.UI.Music { public class SendMethod { - private static SendMethod s_Current= null; + private static SendMethod s_Current = null; public static SendMethod Current { get @@ -44,12 +45,11 @@ { new System.Threading.Thread(() => { - DriverLayer.Control.Ins.SendWriteCommand(function, dic,false,0); + DriverLayer.Control.Ins.SendWriteCommand(function, dic, false, 0); }) { IsBackground = true }.Start(); } - //璁板綍姝屾洸鎾斁鏃堕棿 - private int songPlayTime = -1; + /// <summary> /// 鑾峰彇璁惧鏈�鏂扮殑鐘舵�� /// </summary> @@ -69,13 +69,6 @@ } ///鏇存柊鐨勬暟鎹� a31Music.functionMusic = localFunction; - if (int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(UI2.FuntionControlView.Music.KeyProperty.playing_time)) != songPlayTime) - { - ///姝屾洸璁板綍鏃堕棿鍜屽綋鍓嶆椂闂翠笉涓�鏍凤紝绔嬪嵆鏇存柊鏁版嵁鍙嶉鏃堕棿 - a31Music.LastDateTime = DateTime.Now; - ///姝屾洸璁板綍鏃堕棿鍜屽綋鍓嶆椂闂翠笉涓�鏍凤紝绔嬪嵆鏇存柊姝屾洸鎾斁鏃堕棿 - songPlayTime = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(UI2.FuntionControlView.Music.KeyProperty.playing_time)); - } } catch { } @@ -92,12 +85,11 @@ Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceIds", functionIds); - var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_RefreshDeviceStatus); + var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_RefreshDeviceStatus, "鍒锋柊璁惧鐘舵��"); if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") { return; } - } catch { } } @@ -129,7 +121,7 @@ Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("deviceIds", new List<string> { music.deviceId }); - var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_PlayerList); + var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_PlayerList, "鑾峰彇闊充箰鍒楄〃"); if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") { return; @@ -139,7 +131,7 @@ var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PalyListInfo>>(str); if (palyLists == null) { - palyLists = new List<PalyListInfo>(); + palyLists =new List<PalyListInfo>(); } if (palyLists.Count > 0) { @@ -165,7 +157,7 @@ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); d.Add("deviceIds", new List<string> { music.deviceId }); - var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupList); + var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupList, "鑾峰彇鍒楄〃鍚嶅垪琛�"); if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") { return new List<GroupList>(); @@ -204,19 +196,26 @@ d1.Add("groupList", new List<Dictionary<string, object>> { d2 }); d.Add("sidGroups", new List<Dictionary<string, object>> { d1 }); - var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupPlayerList); + var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupPlayerList, "鑾峰彇鍒楄〃闊充箰"); if (responsePackNew.Code != "0" || responsePackNew.Data == null || responsePackNew.Data.ToString() == "") { return new PalyList(); } //鏁版嵁杩斿簭鍒楀寲涓篎unction瀵硅薄 var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data); - var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<PalyList>(str); + var palyLists = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PalyListInfo>>(str); if (palyLists == null) { - palyLists = new PalyList(); + palyLists = new List<PalyListInfo>(); } - return palyLists; + + if (palyLists.Count == 0) + { + return new PalyList(); + } + //榛樿绗竴涓垪琛ㄩ噷闈㈢涓�涓煶涔愬垪琛� + return palyLists[0].playlist.Count > 0 ? palyLists[0].playlist[0] : new PalyList(); + } catch { @@ -227,12 +226,14 @@ /// <summary> ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� /// </summary> + /// <param name="o">鍙戦�佹暟鎹�</param> + /// <param name="api_Url">璇锋眰鍦板潃(涓嶆槸缁濆鍦板潃)</param> + /// <param name="tag">鏍囪->鎻忚堪鎺ュ彛(鑷畾涔�)</param> /// <returns></returns> - public ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 5) + public ResponsePackNew RequestServerhomeId(object o, string api_Url, string tag, int mTimeout = 5) { - var requestJson = HttpUtil.GetSignRequestJson(o); - return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout); - + JObject jobject = JObject.Parse(Newtonsoft.Json.JsonConvert.SerializeObject(o)); + return UI2.Intelligence.Automation.Send.Current.RequestServerhomeId(jobject, api_Url, tag, mTimeout); } } } -- Gitblit v1.8.0