wxr
2024-09-23 4dc8adc2bf82f1827324c4dbefbc4477202bc433
服务器自动选择;i
9个文件已修改
189 ■■■■ 已修改文件
HDL-ON_iOS/Other/JLCountrycode.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/DB_ResidenceData.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Entity/Function/Function.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/MainPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI1-Login/LoginPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI1-Login/LoginPageBLL.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI1-Login/RegisterPage.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI1-Login/RegisterPageBLL.cs 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI1-Login/SelectServerDialog.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Other/JLCountrycode.cs
@@ -2,6 +2,9 @@
using Shared.IOS.JLCountryCode;
using Foundation;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace JLCountrycode
{
@@ -95,6 +98,39 @@
            return newDictionary;
        }
        /// <summary>
        /// 根据手机当前的IP获取国家信息
        /// </summary>
        /// <returns></returns>
        public async Task<string> GetCountryByIP()
        {
            string country = "Unknown";
            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)
            {
                Console.WriteLine($"Error fetching IP info: {ex.Message}");
            }
            return country;
        }
    }
HDL_ON/Entity/DB_ResidenceData.cs
@@ -159,7 +159,7 @@
            FunctionList.List.ClearDatas();
            ///切换住宅清空前住宅缓存自动化列表;
            HDL_ON.UI.UI2.Intelligence.Automation.Logic.LogicList.Clear();
            UI.UI2.Intelligence.Automation.Logic.LogicList.Clear();
            DAL.Mqtt.MqttClient.DisConnectRemote("退出登录,或者切换住宅");
#if IOS
HDL_ON/Entity/Function/Function.cs
@@ -1727,6 +1727,16 @@
    public static class SPK
    {
        /// <summary>
        /// 未知SPK
        /// (自定义)
        /// </summary>
        public const string NULL = "NULL";
        /// <summary>
        /// 西墨可视对讲门口机
        /// (自定义)
        /// </summary>
        public const string LinphoneXiMo = "door.gate";
        /// <summary>
        /// 群控(自定义)
        /// </summary>
        public const string GroupControl = "groupControl";
HDL_ON/UI/MainPage.cs
@@ -26,7 +26,7 @@
        /// <summary>
        /// 版本号
        /// </summary>
        public static string VersionString = "2.5.1";
        public static string VersionString = "2.7.0";
        ///// <summary>
        ///// 客户端类型
        ///// </summary>
HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -320,7 +320,7 @@
                    etAccount.Text = "13682244600";
                    etAccount.Text = "pjh@hdlchina.com.cn";
                    etAccount.Text = "13580507523";
                    etAccount.Text = "15313316909";
                    etAccount.Text = "18475593023";
                }
                else
                {
HDL_ON/UI/UI1-Login/LoginPageBLL.cs
@@ -740,17 +740,6 @@
            if (loginResult.Code == StateCode.SUCCESS)
            {
                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString());
                // UserInfo.Current = new UserInfo
                //{
                //    userType = revertData.userType,
                //    accountString = account,
                //    password = password,
                //    lastTime = DateTime.Now,
                //    ID = revertData.userId,
                //    loginTokenString = revertData.headerPrefix + revertData.accessToken,
                //    refreshToken = revertData.refreshToken,
                //    userName = revertData.name
                //};
                if (OnAppConfig.Instance.LastLoginUserId != revertData.userId)
                {
                    OnAppConfig.Instance.LastLoginUserId = revertData.userId;
@@ -759,17 +748,12 @@
                UserInfo.Current.ClearUserInfo();
                UserInfo.Current.userType = revertData.userType;
                UserInfo.Current.AccountString = account;
                //UserInfo.Current.password = password;
                UserInfo.Current.LastTime = DateTime.Now;
                UserInfo.Current.ID = revertData.userId;
                UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken;
                UserInfo.Current.AccessToken = revertData.accessToken;
                UserInfo.Current.RefreshToken = revertData.refreshToken;
                UserInfo.Current.userName = revertData.name;
                //UserInfo.Current.userMobileInfo = "";//重置用户手机
                //UserInfo.Current.userEmailInfo = "";//重置用户邮箱
                //UserInfo.Current.headImagePagePath = "LoginIcon/2.png";//
                //UserInfo.Current.CurrentRegion.RegionID = "";
                UserInfo.Current.SaveUserInfo();
                MainPage.Log("登录成功。");
#if __IOS__
HDL_ON/UI/UI1-Login/RegisterPage.cs
@@ -245,6 +245,8 @@
                {
                    OnAppConfig.Instance.GlobalRegion.regionUrl = "";
                }
                getServerList();
            }catch(Exception ex)
            {
                MainPage.Log("Error", "进入注册界面AppConfig异常:" + ex.Message);
@@ -271,7 +273,7 @@
                Application.HideSoftInput();
            };
            new TopViewDiv(this, bodyView, Language.StringByID(StringId.Register)).LoadTopView(backAction);
            new TopViewDiv(this, bodyView, Language.StringByID(StringId.Register)) { maginY = 10 }.LoadTopView(backAction);
            //new PublicAssmebly().LoadTopView(this, bodyView, Language.StringByID(StringId.Register));
            #region 注册方式选择
HDL_ON/UI/UI1-Login/RegisterPageBLL.cs
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Threading;
using HDL_ON.DAL.Server;
@@ -9,6 +10,9 @@
{
    public partial class RegisterPage
    {
        List<GlobalRegionListRes> serverList;
        /// <summary>
        /// 加载事件列表
        /// </summary>
@@ -760,5 +764,83 @@
            }
            return true;
        }
        /// <summary>
        /// 获取服务器列表
        /// </summary>
        void getServerList()
        {
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
            System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    Console.WriteLine("GetCountryByIP");
                    var ddd = JLCountrycode.CountryCodeView.Current.GetCountryByIP();
                    Console.WriteLine(ddd);
                    serverList = new List<GlobalRegionListRes>();
                    var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark });
                    var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost);
                    if (revertObj.Code == StateCode.SUCCESS)
                    {
                        Application.RunOnMainThread(() =>
                        {
                            var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GlobalRegionListRes>>(revertObj.Data.ToString());
                            if (responseDataObj != null)
                            {
                                serverList = responseDataObj;
                                if (serverList.Count > 0)
                                {
                                    if (Language.CurrentLanguage == "Chinese")
                                    {
                                        var server = serverList.Find((obj) => obj.regionUrl.Contains("china-gateway"));
                                        if (server != null)
                                        {
                                            OnAppConfig.Instance.GlobalRegion.regionUrl = server.regionUrl;
                                            SetServerText();
                                        }
                                    }
                                    else
                                    {
                                        var server = serverList.Find((obj) => obj.regionUrl.Contains("bahrain-gateway"));
                                        if (server != null)
                                        {
                                            OnAppConfig.Instance.GlobalRegion.regionUrl = server.regionUrl;
                                            SetServerText();
                                        }
                                    }
                                }
                            }
                        });
                    }
                    else
                    {
                        //提示错误
                        IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code);
                    }
                }
                catch
                {
                }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
                    });
                }
            });
        }
    }
}
HDL_ON/UI/UI1-Login/SelectServerDialog.cs
@@ -44,7 +44,7 @@
            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            this.AddChidren(bodyView);
            //加载顶部菜单栏
            new TopViewDiv(this, bodyView, Language.StringByID(StringId.PlsSelectServer)).LoadTopView();
            new TopViewDiv(this, bodyView, Language.StringByID(StringId.PlsSelectServer)) { maginY = 10}.LoadTopView();
            //加载服务器区域选择
            AddRegionalSelectionView();
            //Show
@@ -60,8 +60,8 @@
            VerticalScrolViewLayout VerticalScrolViewMiddle = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(74),
                Height = bodyView.Height - Application.GetRealHeight(74),
                Y = Application.GetRealHeight(84),
                Height = bodyView.Height - Application.GetRealHeight(84),
                ScrollEnabled = false,
            };
            bodyView.AddChidren(VerticalScrolViewMiddle);
@@ -125,35 +125,6 @@
                }
            });
            //var bottomView = new FrameLayout()
            //{
            //    Y = Application.GetRealHeight(591),
            //    Height = Application.GetRealHeight(76) + Application.GetRealWidth(44),
            //    Radius = (uint)Application.GetRealWidth(22),
            //    BackgroundColor = CSS_Color.MainBackgroundColor,
            //};
            //bodyView.AddChidren(bottomView);
            //btnConfrim = new Button()
            //{
            //    Gravity = Gravity.CenterHorizontal,
            //    Y = Application.GetRealHeight(603),
            //    Width = Application.GetRealWidth(220),
            //    Height = Application.GetRealWidth(44),
            //    Radius = (uint)Application.GetRealWidth(22),
            //    BackgroundColor = CSS_Color.MainColor,
            //    TextColor = CSS_Color.MainBackgroundColor,
            //    TextSize = CSS_FontSize.SubheadingFontSize,
            //    TextAlignment = TextAlignment.Center,
            //    IsBold = true,
            //    TextID = StringId.ConfirmAdd,
            //};
            //bodyView.AddChidren(btnConfrim);
            //btnConfrim.MouseUpEventHandler = (sender, e) => {
            //};
        }
        /// <summary>