From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001 From: lss <316519258@qq.com> Date: 星期五, 12 六月 2020 09:22:04 +0800 Subject: [PATCH] 2020.06.12 --- ZigbeeApp/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs | 71 +++++++++++++++-------------------- 1 files changed, 30 insertions(+), 41 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs index 12e1f94..7ccbfb4 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/OtherParty/OtherPartyAccountMenuForm.cs @@ -82,7 +82,7 @@ { //瑙i櫎缁戝畾 bindTipText = Language.StringByID(R.MyInternationalizationString.uUnBinded); - bindNameText = dicBindData["Wechat"].Nickname; + bindNameText = dicBindData["Wechat"].UserName; } var rowChat = new FrameRowControl(listView.rowSpace / 2); rowChat.Y = Application.GetRealHeight(11); @@ -91,13 +91,13 @@ var btnChat = rowChat.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uWebChat), 400, 60); btnChat.Y = Application.GetRealHeight(12) + rowChat.chidrenYaxis; btnChat.TextSize = 15; - rowChat.AddChidren(btnChat, ChidrenBindMode.BindEventOnly); + rowChat.AddChidren(btnChat, ChidrenBindMode.BindEvent); //鏈巿鏉� OR 鍚嶅瓧 - var btnTip1 = rowChat.AddLeftCaption(bindNameText, 400, 49); + var btnTip1 = rowChat.AddLeftCaption(bindNameText == null ? string.Empty : bindNameText, 400, 50); btnTip1.Y = Application.GetRealHeight(72) + rowChat.chidrenYaxis; btnTip1.TextSize = 12; btnTip1.TextColor = UserCenterColor.Current.TextGrayColor1; - rowChat.AddChidren(btnTip1, ChidrenBindMode.BindEventOnly); + rowChat.AddChidren(btnTip1, ChidrenBindMode.BindEvent); //鍚戝彸鍥炬爣 rowChat.AddRightArrow(); //搴曠嚎 @@ -141,13 +141,13 @@ //var btnQQ = rowQQ.AddLeftCaption("QQ", 400, 60); //btnQQ.Y = Application.GetRealHeight(12) + rowQQ.chidrenYaxis; //btnQQ.TextSize = 15; - //rowQQ.AddChidren(btnQQ, ChidrenBindMode.BindEventOnly); + //rowQQ.AddChidren(btnQQ, ChidrenBindMode.BindEvent); ////鏈巿鏉� OR 鍚嶅瓧 //var btnTip2 = rowQQ.AddLeftCaption(bindNameText, 400, 49); //btnTip2.Y = Application.GetRealHeight(72) + rowQQ.chidrenYaxis; //btnTip2.TextSize = 12; //btnTip2.TextColor = UserCenterColor.Current.TextGrayColor1; - //rowQQ.AddChidren(btnTip2, ChidrenBindMode.BindEventOnly); + //rowQQ.AddChidren(btnTip2, ChidrenBindMode.BindEvent); ////鍚戝彸鍥炬爣 //rowQQ.AddRightArrow(); ////璇风粦瀹� OR 瑙i櫎缁戝畾 @@ -188,23 +188,6 @@ this.dicBindData[info.Platform] = info; } - //鑾峰彇鐢ㄦ埛鏄电О - if (this.dicBindData.ContainsKey("Wechat") == true) - { - var myData = this.dicBindData["Wechat"]; - //缁欎釜榛樿鍊� - myData.Nickname = "Wechat"; - var strUrl = "https://api.weixin.qq.com/sns/userinfo?access_token=" + myData.AccessToken; - strUrl += "&openid=" + myData.OpenID; - var byteData = await Common.CommonPage.Instance.DoRequestZigbeeHttpsInterface(strUrl, null, null, "GET"); - if (byteData != null) - { - var receipData = System.Text.Encoding.UTF8.GetString(byteData); - var nickData = Newtonsoft.Json.JsonConvert.DeserializeObject<NicknameInfo>(receipData); - myData.Nickname = nickData.nickname; - } - } - return true; } @@ -220,6 +203,11 @@ #if Android com.hdl.home.Application.WXLogin(); com.hdl.home.WXEntryActivity.RespAction = (authStr) => +#endif +#if iOS + Home.IOS.AppDelegate.WXLogin(); + Home.IOS.AppDelegate.RespAction = (authStr) => +#endif { if (string.IsNullOrEmpty(authStr) == true) { @@ -229,7 +217,6 @@ //缁戝畾寰俊 this.BindWechat(authRes.access_token, authRes.refresh_token, authRes.openid); }; -#endif } /// <summary> @@ -238,7 +225,19 @@ /// <param name="infoData"></param> private async void BindWechat(string accessToken, string refreshToken, string openID) { - var pra = new { AccessToken = accessToken, RefreshToken = refreshToken, OpenID = openID }; + //鑾峰彇寰俊鏄电О + var strUrl = "https://api.weixin.qq.com/sns/userinfo?access_token=" + accessToken; + strUrl += "&openid=" + openID; + var byteData = await Common.CommonPage.Instance.DoRequestZigbeeHttpsInterface(strUrl, null, null, "GET"); + if (byteData == null) + { + return; + } + var receipData = System.Text.Encoding.UTF8.GetString(byteData); + var nickData = Newtonsoft.Json.JsonConvert.DeserializeObject<NicknameInfo>(receipData); + + //鍏堜笂浼犲井淇¤祫鏂� + var pra = new { AccessToken = accessToken, RefreshToken = refreshToken, OpenID = openID, UserName = nickData.nickname }; var listNotShow = new List<string>() { "UserNoBindAccount" }; var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/InsertOrUpdateAuthUser", false, pra, listNotShow); if (result == false) @@ -246,14 +245,15 @@ return; } + //鍐嶆墽琛岀粦瀹� var pra2 = new { AccountGuid = Common.Config.Instance.Guid, OpenID = openID }; result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindAuthUserToAccount", false, pra2); if (result == true) { - //缁戝畾寰俊鎴愬姛! - string msg = Language.StringByID(R.MyInternationalizationString.uBindSomethingSuccess); - msg = msg.Replace("{0}", Language.StringByID(R.MyInternationalizationString.uWebChat)); - this.ShowMassage(ShowMsgType.Tip, msg); + //缁戝畾鎴愬姛锛佷笅娆′綘鍙互鐢ㄥ井淇0}璐﹀彿蹇�熺櫥褰曞暒 + string msg = Language.StringByID(R.MyInternationalizationString.uBindWebchatSuccessMsg); + msg = msg.Replace("{0}", "\r\n"); + this.ShowMassage(ShowMsgType.Normal, msg, null, Language.StringByID(R.MyInternationalizationString.uWell)); //閲嶆柊鍒锋柊鐣岄潰 this.InitMiddleData(); } @@ -308,20 +308,9 @@ /// </summary> public string Platform = string.Empty; /// <summary> - /// 鏄电О(闇�瑕佽嚜宸卞幓鑾峰彇) - /// </summary> - public string Nickname = string.Empty; - } - - /// <summary> - /// 鏄电О淇℃伅 - /// </summary> - private class NicknameInfo - { - /// <summary> /// 鏄电О /// </summary> - public string nickname = string.Empty; + public string UserName = string.Empty; } #endregion -- Gitblit v1.8.0