| | |
| | | /// 刷新Token |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public bool RefreshToken() |
| | | public string RefreshToken() |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new RefreshTokenObj() |
| | | { |
| | |
| | | UserInfo.Current.RefreshToken = revertData.refreshToken; |
| | | UserInfo.Current.LastTime = DateTime.Now; |
| | | UserInfo.Current.SaveUserInfo(); |
| | | return true; |
| | | } |
| | | return false; |
| | | return revertObj.Code; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// 获取用户信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public void GetUserInfo(bool bGetHeadImage = true) |
| | | public string GetUserInfo(bool bGetHeadImage = true) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new NullObj()); |
| | | var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfo, requestJson); |
| | |
| | | UserInfo.Current.SaveUserInfo(); |
| | | MainPage.Log("获取用户信息成功。"); |
| | | } |
| | | |
| | | |
| | | // Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | //var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d); |
| | | //var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/GetAccountInfo", requestJson, true); |
| | | |
| | | //if (revertObj.StateCode.ToUpper() == StateCode.SUCCESS) |
| | | //{ |
| | | // var dataStr = JObject.FromObject(revertObj.ResponseData); |
| | | // //"DistributedMark": "96439601-fd26-4768-8440-1d9dfa32c109", < !--帐号Id-- > |
| | | // UserInfo.Current.userEmailInfo = dataStr.GetValue("Email").ToString(); |
| | | // UserInfo.Current.userMobileInfo = dataStr.GetValue("Phone").ToString(); |
| | | // FileStream fs = null; |
| | | // try |
| | | // { |
| | | // var headImageString = dataStr.GetValue("HeadImage").ToString(); |
| | | // if (!string.IsNullOrEmpty(headImageString)) |
| | | // { |
| | | // var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString); |
| | | // var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString); |
| | | // UserInfo.Current.headImagePageBytes = headImageBytes; |
| | | // var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png"); |
| | | // fs = new FileStream(filePath, FileMode.Create, FileAccess.Write); |
| | | // fs.Write(headImageBytes, 0, headImageBytes.Length); |
| | | // fs.Flush(); |
| | | // UserInfo.Current.headImagePagePath = filePath; |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log($"download headImage error : {ex.Message}"); |
| | | // } |
| | | // finally |
| | | // { |
| | | // if (fs != null) |
| | | // { |
| | | // fs.Close(); |
| | | // } |
| | | // } |
| | | // // "GesturePwd": null, < !--手势密码-- > |
| | | // // "StringPwd": null , < !--字符串密码-- > |
| | | // UserInfo.Current.userName = dataStr.GetValue("UserName").ToString(); |
| | | |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // }); |
| | | |
| | | // UserInfo.Current.SaveUserInfo(); |
| | | // MainPage.Log("获取用户信息成功。"); |
| | | //} |
| | | |
| | | return resultObj.Code; |
| | | } |
| | | |
| | | /// <summary> |