From afbafeecc1325bff849a17fb63b9b2b65b48ddf1 Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期四, 27 三月 2025 17:35:09 +0800 Subject: [PATCH] 模拟调度 --- WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/UserInfoPage.cs | 116 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 86 insertions(+), 30 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/UserInfoPage.cs b/WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/UserInfoPage.cs index a275695..98cc463 100644 --- a/WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/UserInfoPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/UserInfoPage.cs @@ -25,6 +25,7 @@ InitializeComponent(); this.PageTitle.Caption = "涓汉涓績"; this.PageTitle.SvgImageSize = new Size(24, 24); + this.Load += UserInfoPage_Load; } private const string _smsTemplate = "hzkw_sms_template";//鎵嬫満鍙风櫥褰曟ā鏉� @@ -34,10 +35,22 @@ //淇敼瀵嗙爜 private void BtnEditPwd_Click(object sender, EventArgs e) { + var dlg = new UpdatePwdDlg(); + dlg.SetBindingData(LoginUserInfo.LoginAccountID); + dlg.ShowDialog(); + } + + //鍒濆鍖� + private void UserInfoPage_Load(object? sender, EventArgs e) + { + this.txtEditUserName.Text = GlobalParas._GlobalParas.LoginName; + this.txtEditAdminType.Text = GlobalParas._GlobalParas.AdminType; + this.txtAccountName.Text = GlobalParas._GlobalParas.AccountName; + this.textAccountType.Text = GlobalParas._GlobalParas.LoginType; } //鎵嬫満缁戝畾 - private async void BtnPhoneBinding_Click(object sender, EventArgs e) + private async void PhoneBinding() { if (!IsValidMobileNumber(this.txtMobileNumber.Text.Trim())) { @@ -48,25 +61,27 @@ var loginType = await BLLFactory<Yw.BLL.UserLoginType>.Instance.GetByIdentifier(LoginType.SMS); if (loginType != null) { - var isExist = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.IsExist(new IsExistUserLoginAccountInput - { - CorpID = GlobalParas._GlobalParas.CorpID, - LoginTypeID = loginType.ID, - Identifier = _smsTemplate, - Credential = this.txtMobileNumber.Text.Trim() - }); + var isExist = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.IsExist + ( + Yw.WinFrmUI.LoginUserInfo.CorpID, + Yw.WinFrmUI.LoginUserInfo.UserID, + _smsTemplate, + this.txtMobileNumber.Text.Trim() + ); if (isExist) { TipFormHelper.ShowError("璐︽埛宸插瓨鍦�!"); return; } - var vmo = new Yw.Vmo.AddUserLoginAccountVmo(); - vmo.CorpID = GlobalParas._GlobalParas.CorpID; - vmo.UserID = GlobalParas._GlobalParas.UserID; - vmo.LoginTypeID = loginType.ID; - vmo.Identifier = _smsTemplate; - vmo.Credential = this.txtMobileNumber.Text.Trim(); - vmo.IfVerified = true; + var vmo = new Yw.Vmo.AddUserLoginAccountVmo() + { + CorpID = Yw.WinFrmUI.LoginUserInfo.CorpID, + UserID = Yw.WinFrmUI.LoginUserInfo.UserID, + LoginTypeID = loginType.ID, + Identifier = _smsTemplate, + Credential = this.txtMobileNumber.Text.Trim(), + IfVerified = true + }; var bol = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.Insert(vmo); if (bol > 0) { @@ -86,7 +101,7 @@ } //寰俊缁戝畾 - private void btnWechatBinding_Click(object sender, EventArgs e) + private void WechatBinding() { var dlg = new WechatBindingDlg(); dlg.SetBindingData(); @@ -97,26 +112,39 @@ { var tokenInfo = await BLLFactory<Yw.BLL.ToolWechat>.Instance.GetTokenInfo(code, _vxTemplate); if (tokenInfo == null) - return; - var isExist = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.IsExist(new IsExistUserLoginAccountInput { - CorpID = GlobalParas._GlobalParas.CorpID, - LoginTypeID = loginType.ID, - Identifier = _vxTemplate, - Credential = tokenInfo.openid - }); + return; + } + var userInfo = await BLLFactory<Yw.BLL.ToolWechat>.Instance.GetUserInfo(tokenInfo.access_token, tokenInfo.openid); + if (userInfo == null) + { + return; + } + + var isExist = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.IsExist + ( + Yw.WinFrmUI.LoginUserInfo.CorpID, + loginType.ID, + _vxTemplate, + tokenInfo.openid + ); if (isExist) { TipFormHelper.ShowError("璐︽埛宸插瓨鍦�!"); return; } - var vmo = new Yw.Vmo.AddUserLoginAccountVmo(); - vmo.CorpID = GlobalParas._GlobalParas.CorpID; - vmo.UserID = GlobalParas._GlobalParas.UserID; - vmo.LoginTypeID = loginType.ID; - vmo.Identifier = _vxTemplate; - vmo.Credential = tokenInfo.openid; - vmo.IfVerified = true; + + var vmo = new Yw.Vmo.AddUserLoginAccountVmo() + { + CorpID = Yw.WinFrmUI.LoginUserInfo.CorpID, + UserID = Yw.WinFrmUI.LoginUserInfo.UserID, + LoginTypeID = loginType.ID, + Identifier = _vxTemplate, + Credential = tokenInfo.openid, + IfVerified = true, + ExtraInfo = JsonHelper.Object2Json(userInfo) + }; + var bol = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.Insert(vmo); if (bol > 0) { @@ -130,5 +158,33 @@ }; dlg.ShowDialog(); } + + //閲嶇疆瀵嗙爜 + private async void BtnResetPwd_Click(object sender, EventArgs e) + { + if (XtraMessageBox.Show($"纭閲嶇疆瀵嗙爜鍚�?", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK) + return; + if (!await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.ResetSystemLoginPwd(GlobalParas._GlobalParas.LoginID)) + { + MessageBoxHelper.ShowError("閲嶇疆澶辫触锛�"); + return; + } + MessageBoxHelper.ShowSuccess("閲嶇疆鎴愬姛锛�"); + } + + private void buttonEditBinding_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) + { + var tag_obj = e.Button.Tag; + switch (tag_obj) + { + case "Phone": + PhoneBinding(); + break; + + case "Wechat": + WechatBinding(); + break; + } + } } } \ No newline at end of file -- Gitblit v1.9.3