JLChen
2020-11-20 437c7a6d88d11e500fc19a3dd198aec28412f06b
HDL_ON/UI/UI1-Login/LoginPageBLL.cs
@@ -28,6 +28,25 @@
        }
        /// <summary>
        /// 检测当前配置域名是否一致,不一致则替换
        /// </summary>
        /// <param name="result"></param>
        void CheckAndSetUserRequestHost(ResponsePackNew result)
        {
            try
            {
                var mGlobalRegionListObj = Newtonsoft.Json.JsonConvert.DeserializeObject<GlobalRegionListRes>(result.Data.ToString());
                if (UserInfo.Current.RequestHttpsHost != mGlobalRegionListObj.regionUrl)
                {
                    UserInfo.Current.RequestHttpsHost = mGlobalRegionListObj.regionUrl;
                    UserInfo.Current.GlobalRegion = mGlobalRegionListObj;
                    UserInfo.Current.SaveUserInfo();
                }
            }
            catch { }
        }
        /// <summary>
        /// 点击按钮获取验证码
        /// </summary>
        void GetVerificationCode()
@@ -78,6 +97,9 @@
                        }
                        else
                        {
                            //检测当前配置域名是否一致,不一致则替换
                            CheckAndSetUserRequestHost(result);
                            //
                            Application.RunOnMainThread(() =>
                            {
                                btnGetVerificationCode.IsSelected = false;
@@ -593,7 +615,7 @@
                        else
                        {
                            //设置用户所注册地区的域名,用户相关操作都用这个域名
                            CheckAndSetUserRequestHost(result);
                        }
                    }
@@ -635,7 +657,7 @@
                                OnAppConfig.Instance.RefreshUserConfig();
                                DB_ResidenceData.InitRoomFunction();
                            }
                            if (MainPage.LoginUser.userEmailInfo == "464027401@qq.com")
                            if ( UserInfo.Current.userEmailInfo == "464027401@qq.com")
                            {
                                DB_ResidenceData.residenceData.floors.Add(new Floor() { name = "1F", sid = "09888" });
                                var r111 = new Room() { sid = "0001", name = "Room-1", floorId = "09888", backgroundImage = "Classification/Room/Roombg.png" };
@@ -910,8 +932,8 @@
                        {
                            //2020-11-13 待确认
                            //获取住宅失败,重新标记为未登录状态
                            MainPage.LoginUser.lastTime = DateTime.MinValue;
                            MainPage.LoginUser.SaveUserInfo();
                             UserInfo.Current.lastTime = DateTime.MinValue;
                             UserInfo.Current.SaveUserInfo();
                            //登录失败,请先添加住宅!
                            Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.FailedGetHomeList));
                        }
@@ -957,18 +979,26 @@
            if (loginResult.Code == StateCode.SUCCESS)
            {
                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString());
                MainPage.LoginUser = 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
                };
                MainPage.LoginUser.SaveUserInfo();
                // 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
                //};
                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.refreshToken = revertData.refreshToken;
                UserInfo.Current.userName = revertData.name;
                UserInfo.Current.SaveUserInfo();
                MainPage.Log("登录成功。");
                result = true;
                //获取用户信息
@@ -1043,7 +1073,7 @@
            if (responsePack == StateCode.SUCCESS)
            {
                //2020-11-13 待确认,没有住宅,不算登录成功
                if (MainPage.LoginUser.regionList != null && MainPage.LoginUser.regionList.Count > 0){
                if ( UserInfo.Current.regionList != null &&  UserInfo.Current.regionList.Count > 0){
                    result = true;
                }
                //result = true;