From 33656fa9abd15ed00a390024b439568d2713ca1a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期日, 06 十二月 2020 17:44:36 +0800
Subject: [PATCH] 2020-12-06 1.修改挤下线判断标记。2.修改房间和场景加载云端图片路径
---
HDL_ON/DAL/Server/HttpServerRequest.cs | 165 +++++++++++++++++++++++++-----------------------------
1 files changed, 77 insertions(+), 88 deletions(-)
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index edf40dd..09c3ea8 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -292,32 +292,14 @@
//鏄惁闇�瑕佽幏鍙栧ご鍍�
if (bGetHeadImage)
{
- var headImageBytes = DownHeadImage();
+ var imageKey = ImageUtlis.Current.GetHeadImageKey(info.memberId);
+
+ var headImageBytes = ImageUtlis.Current.DownHeadImage(info.memberId);
+
if (headImageBytes != null && headImageBytes.Length > 0)
{
- UserInfo.Current.headImagePageBytes = headImageBytes;
- FileStream fs = null;
- try
- {
- 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();
- }
- }
-
+ //UserInfo.Current.headImagePageBytes = headImageBytes;
+ UserInfo.Current.headImagePagePath = imageKey;
}
}
@@ -378,11 +360,20 @@
}
/// <summary>
- /// 涓嬭浇鐢ㄦ埛澶村儚
+ /// 鑾峰彇鐢ㄦ埛澶村儚
/// </summary>
- public byte[] DownHeadImage()
+ /// <param name="userId"></param>
+ public void GetUserHeadImage(string userId)
{
- return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Head_Down, null);
+ var imageKey = ImageUtlis.Current.GetHeadImageKey(userId);
+
+ var headImageBytes = ImageUtlis.Current.DownHeadImage(userId);
+
+ if (headImageBytes != null && headImageBytes.Length > 0)
+ {
+ //UserInfo.Current.headImagePageBytes = headImageBytes;
+ UserInfo.Current.headImagePagePath = imageKey;
+ }
}
/// <summary>
@@ -399,17 +390,17 @@
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UpdateMemberInfo, requestJson);
}
- /// <summary>
- /// 鏇存柊鐢ㄦ埛澶村儚
- /// </summary>
- /// <param name="vs"></param>
- /// <returns></returns>
- public string UpdataUserHeadImage(string fileName)
- {
- byte[] bytes = Shared.IO.FileUtils.ReadFile(fileName);
- var revertObj = HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Head_Upload, bytes);
- return revertObj.Code;
- }
+ ///// <summary>
+ ///// 鏇存柊鐢ㄦ埛澶村儚
+ ///// </summary>
+ ///// <param name="vs"></param>
+ ///// <returns></returns>
+ //public string UpdataUserHeadImage(string fileName)
+ //{
+ // byte[] bytes = Shared.IO.FileUtils.ReadFile(fileName);
+ // var revertObj = HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Head_Upload, bytes);
+ // return revertObj.Code;
+ //}
/// <summary>
/// 鏇存敼缁戝畾璐︽埛鐨勯偖绠辨垨鑰呮墜鏈哄彿
@@ -499,7 +490,21 @@
if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID))
{
DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID;
+ //鎭㈠澶囦唤
+ HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID);
}
+ else
+ {
+ var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == DB_ResidenceData.residenceData.CurReginID);
+ if(curRegion == null)
+ {
+ DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID;
+ //鎭㈠澶囦唤
+ HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID);
+ }
+ }
+
+
DB_ResidenceData.residenceData.SaveResidenceData();
UserInfo.Current.SaveUserInfo();
@@ -894,38 +899,19 @@
}
- /// <summary>
- /// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿淇℃伅
- /// </summary>
- /// <returns></returns>
- public ResponsePack GetResidenceMemberAccountInfo(string account)
- {
- Dictionary<string, object> d = new Dictionary<string, object>();
- d.Add("Account", account);
- string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- return RequestHttps($"{severAddress}/ZigbeeUsers/GetSubAccountInfo", jsonString, true);
- }
+ ///// <summary>
+ ///// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿淇℃伅
+ ///// </summary>
+ ///// <returns></returns>
+ //public ResponsePack GetResidenceMemberAccountInfo(string account)
+ //{
+ // Dictionary<string, object> d = new Dictionary<string, object>();
+ // d.Add("Account", account);
+ // string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+ // return RequestHttps($"{severAddress}/ZigbeeUsers/GetSubAccountInfo", jsonString, true);
+ //}
- /// <summary>
- /// 涓嬭浇瀛愯处鍙风敤鎴峰ご鍍�
- /// </summary>
- /// <param name="subaccoun"></param>
- /// <returns></returns>
- public byte[] DownChildHeadImage(ResidenceMemberInfo subaccount)
- {
- var requestObj = new ChildBaseObj()
- {
- childAccountId = subaccount.childAccountId,
- homeId = subaccount.homeId
- };
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
- var replaceToken = "";
- if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
- {
- replaceToken = DB_ResidenceData.residenceData.MasterToken;
- }
- return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Child_DownloadHeadImage, requestJson,null);
- }
+
#endregion
@@ -976,15 +962,15 @@
isProduce = false;
#endif
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) {
+ if (string.IsNullOrEmpty(UserInfo.Current.PushDeviceToken)) {
Utlis.WriteLine("PushDeviceToken 涓虹┖");
return false;
}
var mAddpushinfoObj = new AddpushinfoObj()
{
- pushToken = OnAppConfig.Instance.PushDeviceToken,
- deviceName = OnAppConfig.Instance.PhoneName,
+ pushToken = UserInfo.Current.PushDeviceToken,
+ deviceName = UserInfo.Current.PhoneName,
deviceType = deviceType,
produce = isProduce,
};
@@ -999,8 +985,9 @@
var pushId = revertObj.Data.ToString();
if (!string.IsNullOrEmpty(pushId))
{
- OnAppConfig.Instance.PushId = pushId;
- OnAppConfig.Instance.SaveUserConfig();
+ UserInfo.Current.PushId = pushId;
+ UserInfo.Current.SaveUserInfo();
+ Utlis.WriteLine("PushId: " + pushId);
return true;
}
@@ -1023,26 +1010,28 @@
/// <summary>
/// 鏌ヨ鎺ㄩ�佷俊鎭垪琛�
/// </summary>
- /// <param name="queryType"></param>
+ /// <param name="queryType">0鍏ㄩ儴 1鍒嗕韩涓庡姛鑳� 2鎶ヨ绫� 3绯荤粺淇℃伅</param>
/// <returns></returns>
public ResponsePackNew PushSerivceGetPushmessagelist(int queryType = 0)
{
- var pushType = "";
+ string pushType = null;
+
if (queryType == 1)
{
pushType = PushType.Default.ToString();
- } else if (queryType == 1)
+ }
+ else if (queryType == 2)
{
pushType = PushType.Alarm.ToString();
}
- else if (queryType == 2)
+ else if (queryType == 3)
{
pushType = PushType.Prompt.ToString();
}
var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj()
{
- pushId = OnAppConfig.Instance.PushId,
+ pushId = UserInfo.Current.PushId,
pushType = pushType
});
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist, requestJson);
@@ -1054,11 +1043,11 @@
/// <returns></returns>
public bool PushSerivceClearmessagelist()
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj()
{
- pushId = OnAppConfig.Instance.PushId
+ pushId = UserInfo.Current.PushId
});
var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Clearmessagelist, requestJson);
@@ -1079,11 +1068,11 @@
/// <returns></returns>
public bool PushSerivceSignOut()
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
try
{
var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj() {
- pushId = OnAppConfig.Instance.PushId
+ pushId = UserInfo.Current.PushId
});
var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_DeleteToken, requestJson);
@@ -1110,13 +1099,13 @@
/// <returns></returns>
public bool PushSerivceMarkAllMessageRead()
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
try
{
var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj()
{
- pushId = OnAppConfig.Instance.PushId
+ pushId = UserInfo.Current.PushId
});
var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_ALLMarkread, requestJson);
if (revertObj.Code == StateCode.SUCCESS)
@@ -1142,7 +1131,7 @@
/// <returns></returns>
public bool PushSerivceMarkMessageRead(string msgId)
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
try
{
@@ -1175,7 +1164,7 @@
/// <returns></returns>
public bool PushSerivceDeleteMessage(string msgId)
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
try
{
@@ -1844,7 +1833,7 @@
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
- d.Add("gatewayId", DriverLayer.Control.Ins.GatewayId);
+ d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId);//DriverLayer.Control.Ins.GatewayId);
d.Add("actions", actionObjs);
var requestJson = HttpUtil.GetSignRequestJson(d);
--
Gitblit v1.8.0