wjc
2023-08-28 2c1411a48874e4033a538a9725f09c8465536fa8
2023年08月28日19:03:29

场景输出设备增加音乐
8个文件已修改
253 ■■■■■ 已修改文件
HDL_ON/DAL/Server/HttpUtil.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Function.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Scene.cs 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
        /// 固定域名,正式环境
        /// 公共域名就近解析
        /// </summary>
        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        const string APP_KEY = "HDL-HOME-APP-TEST";
        const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
HDL_ON/Entity/Function/Function.cs
@@ -862,7 +862,22 @@
            }
            else if (spk == SPK.MusicStandard|| spk == SPK.AvMusic)
            {
                list.AddRange(attributes);
                list.Add(new FunctionAttributes
                {
                    key = FunctionAttributeKey.OnOff,
                    curValue = string.Empty,
                });
                list.Add(new FunctionAttributes
                {
                    key = FunctionAttributeKey.Volume,
                    curValue = string.Empty,
                });
                list.Add(new FunctionAttributes
                {
                    key = FunctionAttributeKey.SongName,
                    curValue = string.Empty,
                });
            }
            else if (spk == SPK.ElectricalTvHisense)
            {
@@ -962,7 +977,8 @@
                switch (attr.key)
                {
                    case FunctionAttributeKey.SongName:
                    case FunctionAttributeKey.Volume:
                    case FunctionAttributeKey.SetVolume:
                    case FunctionAttributeKey.Signal:
                    case FunctionAttributeKey.OnOff:
@@ -1611,6 +1627,24 @@
        /// </summary>
        public const string Signal = "signal";
        /// <summary>
        /// 音乐音量
        /// </summary>
        public const string Volume = "volume";
        /// <summary>
        /// 歌曲名
        /// </summary>
        public const string SongName = "song_name";
        /// <summary>
        /// 列表名
        /// </summary>
        public const string PlaylistName = "playlist_name";
        /// <summary>
        /// 播放路径
        /// </summary>
        public const string Url = "url";
    }
    /// <summary>
    /// 设备功能oid
HDL_ON/Entity/Function/Scene.cs
@@ -632,6 +632,32 @@
            {
                sceneFunctionInfo += " " + perAngle.value + "°";
            }
            var perSetVolume = status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
            if (perSetVolume != null)
            {
                sceneFunctionInfo += " " + perSetVolume.value;
            }
            var perSignal = status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
            if (perSignal != null)
            {
                var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
                string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
                sceneFunctionInfo += " " + key;
            }
            var perVolume =status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
            if (perVolume != null)
            {
                sceneFunctionInfo += " " + perVolume.value;
            }
            var perSongName =status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
            if (perSongName != null)
            {
                sceneFunctionInfo += " " + perSongName.value;
            }
            return sceneFunctionInfo;
        }
@@ -711,6 +737,12 @@
                    break;
                case FunctionAttributeKey.Signal:
                    text = Language.StringByID(StringId.xinhaoyuan);
                    break;
                case FunctionAttributeKey.Volume:
                    text = Language.StringByID(StringId.yinliang);
                    break;
                case FunctionAttributeKey.SongName:
                    text = Language.StringByID(StringId.tishiyin);
                    break;
            }
            return text;
@@ -857,14 +889,20 @@
                case "auto":
                    text = Language.StringByID(StringId.Auto);
                    break;
                case FunctionAttributeKey.SetVolume:
                    text = value;
                    break;
                case FunctionAttributeKey.Signal:
                    var p = new UI.UI2.Intelligence.Automation.PublicInterface();
                    var dic = p.GetHisenseSignalSourceDic();
                    text = p.GetKey(dic, value);
                    break;
                case FunctionAttributeKey.SetVolume:
                    text = value;
                    break;
                case FunctionAttributeKey.Volume:
                    text = value;
                    break;
                case FunctionAttributeKey.SongName:
                    text = value;
                    break;
            }
            return text;
        }
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -342,6 +342,7 @@
        /// <param name="stateList">之前状态数据源</param>
        /// <param name="titleText">标题</param>
        /// <param name="action">返回值索引值</param>
        /// <param name="isIcon">数据源没有数据是否显示提示图标(默认(true)显示)</param>
        public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, string titleText, Action<int> action,bool isIcon=true)
        {
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -582,11 +582,17 @@
                //失败时是否要提示
                if (isTip)
                {
                    if (r == null)
                    {
                        r = new ResponsePackNew { message = "没回复,请确认网络是否正常.", Code = "-1", };
                    }
                    new LogicView.TipPopView().FlashingBox(r.message + $"({r.Code})");
                }
            }
            return false;
        }
        /// <summary>
        /// 打印日志
        /// </summary>
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
@@ -585,6 +585,17 @@
                sceneFunctionInfo += " " + key;
            }
            var perVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
            if (perVolume != null)
            {
                sceneFunctionInfo += " " + perVolume.value;
            }
            var perSongName = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
            if (perSongName != null)
            {
                sceneFunctionInfo += " " + perSongName.value;
            }
            return sceneFunctionInfo;
        }
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -127,6 +127,12 @@
                    case FunctionAttributeKey.Signal:
                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal));
                        break;
                    case FunctionAttributeKey.SongName:
                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName));
                        break;
                    case FunctionAttributeKey.Volume:
                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume));
                        break;
                }
            }
@@ -537,6 +543,45 @@
                                sceneStatus.value = p.GetValue(dic, valueStr);
                            });
                            break;
                        case FunctionAttributeKey.Volume:
                            BrightnessView(btnFunctionText.Text, btnFunctionName.Text, (volume, uintStr) =>
                            {
                                btnFunctionText.Text = volume;
                                sceneStatus.value = volume;
                            });
                            break;
                        case FunctionAttributeKey.SongName:
                            MusicListView(btnFunctionText.Text, (playListName, song) =>
                            {
                                btnFunctionText.Text = song.name;
                                sceneStatus.value = song.name;
                                //追加控制属性
                                var oldList = new List<SceneFunctionStatus>();
                                for (int i = 0; i < sceneFunction.status.Count; i++)
                                {
                                    var status = sceneFunction.status[i];
                                    if (status.key == FunctionAttributeKey.PlaylistName)
                                    {
                                        //控制需要(界面不需要显示)
                                        sceneFunction.status.RemoveAt(i);
                                        sceneFunction.status.Insert(i, new SceneFunctionStatus { key = FunctionAttributeKey.PlaylistName, value = playListName });
                                    }
                                    else if (status.key == FunctionAttributeKey.Url)
                                    {
                                        //存在url就一起发送过去
                                        if (!string.IsNullOrEmpty(song.url))
                                        {
                                            //控制需要(界面不需要显示)
                                            sceneFunction.status.RemoveAt(i);
                                            sceneFunction.status.Insert(i, new SceneFunctionStatus { key = FunctionAttributeKey.Url, value = song.url });
                                        }
                                    }
                                }
                            });
                            break;
                    }
                };
@@ -2396,8 +2441,60 @@
            pif.SingleSelectionShow(this, list, titleName, oldStateValue, action);
        }
        #endregion
        /// <summary>
        /// 音乐列表界面
        /// </summary>
        /// <param name="oldStateValue">旧状态值</param>
        ///  <param name="action">回调</param>
        void MusicListView(string oldStateValue, Action<string, Music.SongInfo> action)
        {
            Loading loading = new Loading();
            this.AddChidren(loading);
            loading.Start();
            System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    var palyList = Music.SendMethod.Current.GetSingleSongList(new Function { sid = sceneFunction.sid }, "hdl_special", "");
                    List<string> songNameList = new List<string>();
                    for (int i = 0; i < palyList.songs.Count; i++)
                    {
                        var song = palyList.songs[i];
                        songNameList.Add(song.name);
                    }
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        var publicInterface = new UI2.Intelligence.Automation.PublicInterface();
                        publicInterface.FrameOrVv(this, songNameList, new List<string> { oldStateValue }, palyList.group, (index) =>
                        {
                            if (index > palyList.songs.Count)
                            {
                                index = 0;
                            }
                            var song = palyList.songs[index];
                            action?.Invoke(palyList.group, song);
                            //界面显示选中值
                            //funTypeView.btnState.Text = songSelecetd.name;
                            ////数据封装
                            //AddDictionary("playlist_name", palyList.group);//列表名
                            //AddDictionary("song_name", songSelecetd.name);//歌曲名
                            //if (!string.IsNullOrEmpty(songSelecetd.url))
                            //{
                            //    //存在url就一起发送过去
                            //    AddDictionary("url", songSelecetd.url);
                            //}
                        }, false);
                    });
                }
                catch { }
            });
        }
        #endregion
    }
}
HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
@@ -6,8 +6,10 @@
using System.Text;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock;
using Newtonsoft.Json.Linq;
using Shared;
using static HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod;
namespace HDL_ON.UI.Music
{
@@ -77,8 +79,9 @@
        /// <summary>
        /// 刷新设备状态
        /// </summary>
        /// <param name="tipType">是否需要提示,默认提示</param>
        /// <returns></returns>
        public void RefreshDeviceStatus(List<string> functionIds)
        public void RefreshDeviceStatus(List<string> functionIds,TipType tipType = TipType.flicker)
        {
            try
            {
@@ -86,7 +89,7 @@
                d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
                d.Add("deviceIds", functionIds);
                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_RefreshDeviceStatus, "刷新设备状态");
                if (!this.DataChecking(responsePackNew))
                if (!this.DataChecking(responsePackNew, tipType))
                {
                    return;
                }
@@ -114,8 +117,9 @@
        /// </summary>
        /// <param name="music">音乐播放器</param>
        /// <param name="action">回调</param>
        ///  <param name="tipType">是否需要提示,默认提示</param>
        /// <returns></returns>
        public void GetCurrentPalyList(Function music, Action action)
        public void GetCurrentPalyList(Function music, Action action, TipType tipType = TipType.flicker)
        {
            try
            {
@@ -123,7 +127,7 @@
                d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
                d.Add("deviceIds", new List<string> { music.deviceId });
                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_PlayerList, "获取音乐列表");
                if (!this.DataChecking(responsePackNew))
                if (!this.DataChecking(responsePackNew,tipType))
                {
                    return;
                }
@@ -157,8 +161,9 @@
        /// </summary>
        /// <param name="music"></param>
        /// <param name="source">音乐源为null,支持多个源获取</param>
        ///  <param name="tipType">是否需要提示,默认提示</param>
        /// <returns></returns>
        public List<GroupList> GetMultipleSourceListName(Function music, string source)
        public List<GroupList> GetMultipleSourceListName(Function music, string source,TipType tipType=TipType.flicker)
        {
            try
            {
@@ -173,7 +178,7 @@
                }
                d.Add("deviceInfos", new List<Dictionary<string, object>> { deviceIds });
                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupList, "获取列表名列表");
                if (!this.DataChecking(responsePackNew))
                if (!this.DataChecking(responsePackNew, tipType))
                {
                    return new List<GroupList>();
                }
@@ -218,8 +223,9 @@
        /// <param name="music"></param>
        /// <param name="listName">列表名</param>
        /// <param name="source">音乐源</param>
        /// <param name="tipType">是否需要提示,默认提示</param>
        /// <returns></returns>
        public List<PalyerSongListInfo> GetMultipleSongListM(Function music, string listName, string source)
        public List<PalyerSongListInfo> GetMultipleSongListM(Function music, string listName, string source, TipType tipType= TipType.flicker)
        {
            try
            {
@@ -238,7 +244,7 @@
                d.Add("sidGroups", new List<Dictionary<string, object>> { d1 });
                var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_GroupPlayerList, "通过列表名获取歌曲列表");
                if (!this.DataChecking(responsePackNew))
                if (!this.DataChecking(responsePackNew, tipType))
                {
                    return new List<PalyerSongListInfo>();
                }
@@ -265,9 +271,9 @@
        /// <param name="listName">列表名</param>
        /// <param name="source">音乐源</param>
        /// <returns></returns>
        public SongList GetSingleSongList(Function music, string listName, string source)
        public SongList GetSingleSongList(Function music, string listName, string source, TipType tipType= TipType.flicker)
        {
            List<PalyerSongListInfo> listInfos = this.GetMultipleSongListM(music, listName, source);
            List<PalyerSongListInfo> listInfos = this.GetMultipleSongListM(music, listName, source, tipType);
            if (listInfos.Count == 0)
            {
                return new SongList();
@@ -277,21 +283,41 @@
            return songList;
        }
        /// <summary>
        /// <summary>
        /// 检验数据回复成功或者失败
        /// </summary>
        /// <param name="responsePackNew">回复数据对象</param>
        /// <param name="tipType">是否需要提示</param>
        /// <returns></returns>
        private bool DataChecking(ResponsePackNew responsePackNew)
        private bool DataChecking(ResponsePackNew responsePackNew, TipType tipType)
        {
            if (responsePackNew.Data == null||responsePackNew.Code != "0"  || responsePackNew.Data.ToString() == "")
            {
                if (TipType.flicker == tipType)
                {
                    if (responsePackNew == null)
                    {
                        responsePackNew = new ResponsePackNew { message = "没回复,请确认网络是否正常.", Code = "-1", };
                    }
                    Application.RunOnMainThread(() =>
                    {
                        //new Tip()
                        //{
                        //    CloseTime = 1,
                        //    Text = responsePackNew.message + "(" + responsePackNew.Code + ")",
                        //    Direction = AMPopTipDirection.None,
                        //}.Show(MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1));
                        CommonMethod.Current.ShowTip(responsePackNew.message + "(" + responsePackNew.Code + ")", 3);
                    });
                }
                return false;
            }
            return true;
        }
        /// <summary>
        ///请求服务器(与住宅有关:例如;homeId) 
        /// </summary>