wxr
2024-09-26 0fc2962749e7e1f4078717a9914ac8175a2c4b26
可视对讲,注册

1.可视对讲(安卓)点击通知栏进去的时候可以打开接听界面
2.注册增加根据IP地址选择默认服务器
14个文件已修改
235 ■■■■■ 已修改文件
HDL-ON_Android/Other/HDLONUtils.cs 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Other/JPush/JPushReceiver.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/SplashActivity.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/HDLCommon.cs 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/OnAppConfig.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/DriverLayer/Control.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Mqtt/MqttClient.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/HttpUtil.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/Server/NewApiRes.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI1-Login/LoginPage.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI1-Login/RegisterPageBLL.cs 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SiriIntents/Server/HttpUtil.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Other/HDLONUtils.cs
@@ -1,5 +1,7 @@
using System;
using Android.App;
using Android.Content;
using Android.OS;
using Java.IO;
namespace HDL_ON_Android
@@ -32,12 +34,42 @@
            }
        }
        //public static void StartSplashActivity()
        //{
        //    Intent intent = new Intent(Shared.Application.Activity, typeof(SplashActivity));
        //    Shared.Application.Activity.StartActivity(intent);
        //    Shared.Application.Activity.Finish();
        //}
        [Obsolete]
        public static bool IsAppInForeground(Context context)
        {
            ActivityManager activityManager = (ActivityManager)context.GetSystemService(Context.ActivityService);
            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                var appProcesses = activityManager.RunningAppProcesses;
                if (appProcesses != null)
                {
                    string packageName = context.PackageName;
                    foreach (var appProcess in appProcesses)
                    {
                        if (appProcess.Importance == Importance.Foreground && appProcess.ProcessName.Equals(packageName))
                        {
                            return true; // 应用在前台
                        }
                    }
                }
            }
            else
            {
                var tasks = activityManager.GetRunningTasks(1);
                if (tasks != null && tasks.Count > 0)
                {
                    var topActivity = tasks[0].TopActivity;
                    if (topActivity.PackageName.Equals(context.PackageName))
                    {
                        return true; // 应用在前台
                    }
                }
            }
            return false; // 应用不在前台
        }
    }
}
HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -53,11 +53,8 @@
        /// <param name="notificationMessage"></param>
        public override void OnNotifyMessageOpened(Context context, NotificationMessage notificationMessage)
        {
            //2020-12-23 解决点击通知栏打开不了APP问题
            //base.OnNotifyMessageOpened(context, notificationMessage);
            OpenNotification(context, notificationMessage);
            MainPage.Log("接收到推送:点击通知回调");
            OpenNotification(context, notificationMessage,true);
        }
        /// <summary>
@@ -137,15 +134,17 @@
        /// </summary>
        /// <param name="context"></param>
        /// <param name="notificationMessage"></param>
        public static void OpenNotification(Context context, NotificationMessage notificationMessage)
        public static void OpenNotification(Context context, NotificationMessage notificationMessage,bool isNotification = false)
        {
            try
            {
                MainPage.Log("接收到推送:打开消息显示界面");
                var pushMes = new JPushMessageInfo()
                {
                    Title = notificationMessage.NotificationTitle,
                    Content = notificationMessage.NotificationContent,
                    Extras = notificationMessage.NotificationExtras
                    Extras = notificationMessage.NotificationExtras,
                    isNotificationGoing = isNotification
                };
                var jpushExpandData = GetJPushExpandData(pushMes);
@@ -171,11 +170,14 @@
                else
                {
                    Intent i = new Intent(context, typeof(BaseActivity));
                    i.SetFlags(ActivityFlags.SingleTop);
                    i.SetFlags(ActivityFlags.ClearTop);
                    i.SetFlags(ActivityFlags.NewTask);
                    context.StartActivity(i);
                }
                //解析msg
                AdjustPushMessage(pushMes);
            }
            catch
            {
HDL-ON_Android/SplashActivity.cs
@@ -20,7 +20,6 @@
    {
        protected override void OnActivityResult(int requestCode, Result resultVal, Intent data)
        {
            Console.WriteLine("123456");
            if (requestCode == 99)
            {
                if (resultVal == Result.Ok)
@@ -43,7 +42,6 @@
        [Obsolete]
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Console.WriteLine("123456");
            base.OnCreate(savedInstanceState);
            if(Shared.Application.Activity != null && Shared.Application.Activity.GetType() == typeof(BaseActivity))
HDL_ON/Common/HDLCommon.cs
@@ -237,21 +237,6 @@
        #endregion
        ///// <summary>
        ///// 恢复住宅
        ///// 2020-12-03 待测试未检测
        ///// </summary>
        //public void RestoreHomeBackup(string RegionID)
        //{
        //    var isExist = FileUtils.ExistRegion(RegionID);
        //    if (isExist)
        //    {
        //        //存在则恢复
        //        string newRegionRootPath = FileUtils.CreateRegionBackup(RegionID);
        //        FileUtils.RestoreRegionFiles(newRegionRootPath);
        //    }
        //}
        #region ■ 推送处理_______________________
        /// <summary>
        /// 推送消息处理
@@ -262,8 +247,7 @@
        {
            try
            {
                //Console.WriteLine($"接收到推送,,,,.{Newtonsoft.Json.JsonConvert.SerializeObject(jpushMessageInfo).ToString()}");
                //MainPage.Log($"接收到推送,,,,.{Newtonsoft.Json.JsonConvert.SerializeObject(jpushMessageInfo).ToString()}");
                //Extras为空不处理
                if (string.IsNullOrEmpty(jpushMessageInfo.Extras)) return;
@@ -284,7 +268,7 @@
                        //报警推送弹窗提示
                        ShowAlarmPushMessage(jpushMessageInfo, true);
                        //萤石门锁推送
                        HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                        UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.DoorLockPush(jpushMessageInfo);
                    }
                    else if (jpushMessageInfo.messageType == (PushMessageType.FLCall.ToString()))
                    {
@@ -311,12 +295,10 @@
                    }
                    else if (jpushMessageInfo.messageType == PushMessageType.HDL_INTERPHONE.ToString())
                    {
                        if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return;
                        //字段兼容问题,只能直接取值了
                        var json = Newtonsoft.Json.Linq.JObject.Parse(jpushMessageInfo.expantContent);
                        //1.视对讲厂家类型
                        string interphoneTypeEnum = json["interphoneTypeEnum"].ToString();
@@ -371,9 +353,9 @@
                                    }
                                }
                            }
                            catch { }
                            catch (Exception ex) {
                                MainPage.Log("Error", $"自研可视对讲通知异常:{ex.StackTrace}");
                            }
#if __ANDROID__
                            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime = 30;
@@ -401,7 +383,7 @@
                            })
                            { IsBackground = true }.Start();
#elif __IOS__
                            #elif __IOS__
                            SoundPlayer.Ins.PlaySound();
                            new Thread(() => {
                                int count = 0;
@@ -435,21 +417,17 @@
                                }
                            })
                            { IsBackground = true }.Start();
#endif
                            #endif
                            //HDL Linphone 狄耐克
                            MainPage.Log("接收到推送:HDL Linphone 狄耐克");
                            eSVideoInfo.HomeId = jpushMessageInfo.HomeId;
                            eSVideoInfo.callId = json["callId"].ToString();
                            eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString();
                            eSVideoInfo.DeviceName = json["deviceName"].ToString();
                            eSVideoInfo.deviceSipAccount = json["deviceSipAccount"].ToString();
                            eSVideoInfo.spk = json["spk"].ToString();
                            //ShowAlert("狄耐克门口机呼叫");
                            //打开呼叫页面
                            HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo, InterphoneType.HDL.ToString());
                            HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo, InterphoneType.HDL.ToString(), jpushMessageInfo.isNotificationGoing);
                            return;
                        }
                        else if (interphoneTypeEnum == InterphoneType.FREEVIEW.ToString())
@@ -493,8 +471,6 @@
                Utlis.WriteLine("catch: " + EX.ToString());
            }
        }
        //{"code":0,"data":{"list":[{"createTime":"1625798305115","modifyTime":"1625798305115","region":"100000000000000001","id":"1413326644794294273","alarmId":"20210709103818-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709103818-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:38:17","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{"createTime":"1625798057197","modifyTime":"1625798057197","region":"100000000000000001","id":"1413325604946640898","alarmId":"20210709103413-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709103413-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:34:12","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797973320","modifyTime":"1625797973320","region":"100000000000000001","id":"1413325253141004289","alarmId":"20210709103236-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709103236-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:32:31","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797782136","modifyTime":"1625797782136","region":"100000000000000001","id":"1413324451261382658","alarmId":"20210709102937-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709102937-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:29:37","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797668771","modifyTime":"1625797668771","region":"100000000000000001","id":"1413323975769915394","alarmId":"20210709102743-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709102743-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:27:42","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797539846","modifyTime":"1625797539846","region":"100000000000000001","id":"1413323435023466498","alarmId":"20210709102534-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709102534-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:25:34","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625797530627","modifyTime":"1625797530627","region":"100000000000000001","id":"1413323396351983618","alarmId":"20210709102525-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709102525-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:25:25","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625796028089","modifyTime":"1625796028089","region":"100000000000000001","id":"1413317094255034369","alarmId":"20210709100024-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709100024-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T10:00:23","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625795974558","modifyTime":"1625795974558","region":"100000000000000001","id":"1413316869729746946","alarmId":"20210709095931-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709095931-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T09:59:31","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"},{ "createTime":"1625795966933","modifyTime":"1625795966933","region":"100000000000000001","id":"1413316837748178946","alarmId":"20210709095923-F41014762-1-10000","channelNo":1,"deviceSerial":"F41014762","alarmName":"人体感应事件","alarmPicUrl":"https://i.ys7.com/streamer/alarm/url/get?fileId=20210709095923-F41014762-1-10000-2-1&deviceSerialNo=F41014762&cn=1&isEncrypted=0&isCloudStored=0&ct=1&lc=7&bn=1_hikalarm&isDevVideo=0","alarmTime":"2021-07-09T09:59:22","homeId":"1396717478877241345","alarmType":"pir","isChecked":0,"isEncrypt":0,"deleted":0,"tenantId":"20"}],"totalCount":"13","totalPage":"2","pageNo":"1","pageSize":"10"},"timestamp":"1625807415164","isSuccess":true}
        //{"platform":"1","timestamp":"1625805660249","appKey":"HDL-HOME-APP-TEST","sign":"02e433c40485b30451ebdc5ca3cd959c","deviceSerial":"F41014762","homeId":"1396717478877241345"}
        /// <summary>
        /// 解析丰林可视对讲推送数据
        /// </summary>
HDL_ON/Common/OnAppConfig.cs
@@ -70,6 +70,21 @@
            }
        }
        string pushSignStr;
        /// <summary>
        ///
        /// </summary>
        public string PushSignStr {
            get
            {
                if (string.IsNullOrEmpty(pushSignStr))
                {
                    pushSignStr = DateTime.Now.Ticks.ToString();
                }
                return pushSignStr;
            }
        }
        /// <summary>
        /// 存储登录过的用户
        /// </summary>
HDL_ON/DAL/DriverLayer/Control.cs
@@ -1124,7 +1124,7 @@
                        //2021-09-23 新增获取当前网关是否本地加密
                        Ins.IsLocalEncrypt = device.isLocalEncrypt;
                        //MainPage.Log("网关本地加密状态:" + device.local_encrypt.ToString());
                        //登录网关Tcp
                        //登录网关Tcp  tcp连接网关
                        //OpenTcpClent();
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -59,7 +59,7 @@
        /// <summary>
        /// 推送标识
        /// </summary>
        static string PushSignStr = DateTime.Now.Ticks.ToString();
        static string PushSignStr = OnAppConfig.Instance.PushSignStr;
        /// <summary>
        /// 断开远程Mqtt的链接
@@ -872,21 +872,6 @@
            });
        }
        ///// <summary>
        ///// 收到CheckGateway主题
        ///// </summary>
        //static void ReceiveCheckGateway(string mMes)
        //{
        //    if (!Control.Ins.IsRemote) return;
        //    Utlis.WriteLine("ReceiveCheckGateway!");
        //    //CheckIfNeedReadAllDeviceStatus ();
        //    //var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(mMes);
        //    Control.Ins.GatewayOnline = true;
        //}
        /// <summary>
        /// 推送挤下线主题
        /// </summary>
@@ -901,6 +886,7 @@
            {
                case "15626203746":
                case "13580507523":
                case "18475593023":
                    return;
            }
HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,13 +18,13 @@
        /// 固定域名,正式环境
        /// 公共域名就近解析
        /// </summary>
        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        //public const string APP_KEY = "HDL-HOME-APP";
        //public const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC";
        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        public const string APP_KEY = "HDL-HOME-APP";
        public const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC";
        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        public const string APP_KEY = "HDL-HOME-APP-TEST";
        public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        //public const string APP_KEY = "HDL-HOME-APP-TEST";
        //public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
        //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm
        //const string APP_KEY = "CPEVRLRT";
HDL_ON/DAL/Server/NewApiRes.cs
@@ -1523,6 +1523,13 @@
        /// </summary>
        public string sipAccount;
        /// <summary>
        /// 是否是后台进入的信息
        /// 给安卓使用的,安卓从通知栏进入打开可视对讲界面有异常
        /// 应该是打开了两次的问题
        /// </summary>
        public bool isNotificationGoing = false;
    }
    /// <summary>
HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
@@ -523,9 +523,16 @@
        /// 收到推送,后判断呼叫住宅是否为当前住宅,不是的话重新获取SIP账号并登录
        /// </summary>
        /// <param name="mESVideoInfo"></param>
        public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType)
        public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo,string mInterphoneType, bool  isNotificationGoing = false)
        {
            if(this.mHDLCallVideoInfo != null)
#if __ANDROID__
            //isNotificationGoing参数是专门给安卓使用的,因为安卓在后面的时候已经启动了接听的界面了,从通知栏进来的时候,callid已经被使用了,所以要重置掉这个属性
            if (isNotificationGoing)
            {
                this.mHDLCallVideoInfo.CallId = "";
            }
#endif
            if (this.mHDLCallVideoInfo != null)
            {
                if(this.mHDLCallVideoInfo.CallId == mESVideoInfo.callId)
                {
@@ -588,6 +595,7 @@
                    intent.PutExtra("lpTitleName", mHDLCallVideoInfo.DeviceName);
                    intent.PutExtra("lpSipAccount", mHDLCallVideoInfo.DeviceSipAccount);
                }
                MainPage.Log("启动自研可视对讲界面");
                Shared.Application.Activity.StartActivity(intent);
#endif
            }
HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -282,11 +282,6 @@
            {
                Application.HideSoftInput();
            };
            //btnIcon.MouseUpEventHandler = (sender, e) =>
            //{
            //    etAccount.Text = "13580507523";
            //    etPassword.Text = "a123456";
            //};
#if DEBUG
            btnIcon_bg.MouseUpEventHandler += (sender, e) =>
@@ -320,7 +315,8 @@
                    etAccount.Text = "13682244600";
                    etAccount.Text = "pjh@hdlchina.com.cn";
                    etAccount.Text = "13580507523";
                    //etAccount.Text = "18475593023";
                    etAccount.Text = "18475593023";
                    //etAccount.Text = "13960905167";
                }
                else
                {
@@ -537,10 +533,6 @@
            };
            passwordView.AddChidren(etPassword);
            etAccount.Text = "13580507523";
            etPassword.Text = "a123456";
            #region 密码登录-控件加载
            btnVisiblePassword = new Button()
HDL_ON/UI/UI1-Login/RegisterPageBLL.cs
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading;
using HDL_ON.DAL.Server;
using HDL_ON.UI.CSS;
using Newtonsoft.Json.Linq;
using Shared;
namespace HDL_ON.UI.UI1Login
@@ -776,13 +778,34 @@
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
            System.Threading.Tasks.Task.Run(() =>
            System.Threading.Tasks.Task.Run(async () =>
            {
                try
                {
                    Console.WriteLine("GetCountryByIP");
                    var ddd = JLCountrycode.CountryCodeView.Current.GetCountryByIP();
                    Console.WriteLine(ddd);
                    string country = "CN";
                    try
                    {
                        using (HttpClient client = new HttpClient())
                        {
                            // 使用 ipinfo.io 获取位置信息
                            HttpResponseMessage response = await client.GetAsync("https://ipinfo.io/json");
                            if (response.IsSuccessStatusCode)
                            {
                                string json = await response.Content.ReadAsStringAsync();
                                JObject jsonObject = JObject.Parse(json);
                                // 从返回的 JSON 中提取国家信息
                                country = jsonObject["country"].ToString();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MainPage.Log("Error",$"Error fetching IP info: {ex.StackTrace}");
                    }
                    serverList = new List<GlobalRegionListRes>();
                    var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark });
                    var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost);
@@ -796,12 +819,12 @@
                                serverList = responseDataObj;
                                if (serverList.Count > 0)
                                {
                                    if (Language.CurrentLanguage == "Chinese")
                                    if (country == "CN")//if (Language.CurrentLanguage == "Chinese")
                                    {
                                        var server = serverList.Find((obj) => obj.regionUrl.Contains("china-gateway"));
                                        if (server != null)
                                        {
                                            OnAppConfig.Instance.GlobalRegion.regionUrl = server.regionUrl;
                                            OnAppConfig.Instance.GlobalRegion = server;
                                            SetServerText();
                                        }
                                    }
@@ -810,7 +833,7 @@
                                        var server = serverList.Find((obj) => obj.regionUrl.Contains("bahrain-gateway"));
                                        if (server != null)
                                        {
                                            OnAppConfig.Instance.GlobalRegion.regionUrl = server.regionUrl;
                                            OnAppConfig.Instance.GlobalRegion = server;
                                            SetServerText();
                                        }
                                    }
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs
@@ -478,7 +478,7 @@
                    tipValuesView.AddChidren(new Button()
                    {
                        Width = Application.GetRealWidth(151),
                        Text = "40%",
                        Text = "70%",
                        TextAlignment = TextAlignment.Center,
                        TextColor = CSS_Color.FirstLevelTitleColor,
                        TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
@@ -486,7 +486,7 @@
                    tipValuesView.AddChidren(new Button()
                    {
                        Width = Application.GetRealWidth(151),
                        Text = "70%",
                        Text = "40%",
                        TextAlignment = TextAlignment.Center,
                        TextColor = CSS_Color.FirstLevelTitleColor,
                        TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
SiriIntents/Server/HttpUtil.cs
@@ -16,13 +16,13 @@
        /// 固定域名,正式环境
        /// 公共域名就近解析
        /// </summary>
        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        //const string APP_KEY = "HDL-HOME-APP";
        //const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC";
        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
        const string APP_KEY = "HDL-HOME-APP";
        const string SECRET_KEY = "CPL345bn28gHnvi9G4tYbq3cTYkiHC";
        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        public const string APP_KEY = "HDL-HOME-APP-TEST";
        public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
        //public const string APP_KEY = "HDL-HOME-APP-TEST";
        //public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
        //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm
        //const string APP_KEY = "CPEVRLRT";