| | |
| | | if (roomTemp.BackgroundImageType != 0)
|
| | | {
|
| | | //自定义的图片,它存在于本地,但是它是全路径
|
| | | string[] Arry = roomTemp.BackgroundImage.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | listFile.Add(Arry[Arry.Length - 1]);
|
| | | this.AddShardFile(Arry[Arry.Length - 1]);
|
| | | listFile.Add(roomTemp.BackgroundImage);
|
| | | this.AddShardFile(roomTemp.BackgroundImage);
|
| | | }
|
| | | }
|
| | | else
|
| | |
| | | if (roomTemp.BackgroundImageType != 0)
|
| | | {
|
| | | //删除自定义图片
|
| | | string[] Arry = roomTemp.BackgroundImage.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | listDelPic.Add(Arry[Arry.Length - 1]);
|
| | | listDelPic.Add(roomTemp.BackgroundImage);
|
| | | }
|
| | | if (nowRoom.BackgroundImageType != 0)
|
| | | {
|
| | | //自定义的图片,它存在于本地,但是它是全路径
|
| | | string[] Arry = nowRoom.BackgroundImage.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | listFile.Add(Arry[Arry.Length - 1]);
|
| | | this.AddShardFile(Arry[Arry.Length - 1]);
|
| | | listFile.Add(nowRoom.BackgroundImage);
|
| | | this.AddShardFile(nowRoom.BackgroundImage);
|
| | | }
|
| | | //变更图片设置
|
| | | roomTemp.BackgroundImageType = nowRoom.BackgroundImageType;
|
| | |
| | | {
|
| | | if (secene.IconPathType != 0)
|
| | | {
|
| | | //自定义的图片,它存在于本地,但是它是全路径
|
| | | string[] Arry = secene.IconPath.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | listFile.Add(Arry[Arry.Length - 1]);
|
| | | this.AddShardFile(Arry[Arry.Length - 1]);
|
| | | //自定义的图片,它存在于本地
|
| | | listFile.Add(secene.IconPath);
|
| | | this.AddShardFile(secene.IconPath);
|
| | | }
|
| | |
|
| | | listFile.Add(secene.FileName);
|
| | |
| | | if (memberShardInfo.dicAllShardKeys.ContainsKey(fileName) == false)
|
| | | {
|
| | | var result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeDataShare/AddShareData", false, info);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | if (result == null)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
| | | nvc.Add("HouseDistributedMark", Common.Config.Instance.Home.Id);
|
| | | nvc.Add("SubAccountDistributedMark", memberShardInfo.SubAccountDistributedMark);
|
| | | nvc.Add("ShareDataBytes", Convert.ToBase64String(this.GetShardFileContent(fileName)));
|
| | | nvc.Add("IsOtherAccountCtrl", Common.Config.Instance.isAdministrator.ToString());
|
| | |
|
| | | //追加共享
|
| | | if (memberShardInfo.dicAllShardKeys.ContainsKey(fileName) == false)
|
| | | {
|
| | | var result = this.UpLoadBigBackupFileToDB("ZigbeeDataShare/AddShareData", fullName, nvc);
|
| | | if (string.IsNullOrEmpty(result) == true)
|
| | | {
|
| | | return null;
|
| | | }
|
| | | //这里有点特殊,接口是直接返回主键回来的,而不是Jsoin
|
| | | var result = this.DoUpLoadBigBackupFileToDB("ZigbeeDataShare/AddShareData", fullName, nvc);
|
| | | return result;
|
| | | }
|
| | | else
|
| | | {
|
| | | nvc.Add("DistributedMark", memberShardInfo.dicAllShardKeys[fileName]);
|
| | | var result = this.UpLoadBigBackupFileToDB("ZigbeeDataShare/EditShareData", fullName, nvc);
|
| | | if (result != "1")
|
| | | var result = this.DoUpLoadBigBackupFileToDB("ZigbeeDataShare/EditShareData", fullName, nvc);
|
| | | if (result == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 上传大文件
|
| | | /// 执行上传大文件
|
| | | /// </summary>
|
| | | /// <param name="RequestName">请求接口</param>
|
| | | /// <param name="fullFileName">文件名字(含路径)</param>
|
| | | /// <param name="nvc"></param>
|
| | | /// <returns></returns>
|
| | | private string UpLoadBigBackupFileToDB(string RequestName, string fullFileName, NameValueCollection nvc)
|
| | | private string DoUpLoadBigBackupFileToDB(string RequestName, string fullFileName, NameValueCollection nvc)
|
| | | {
|
| | | string paramName = "file";
|
| | | string contentType = "application/octet-stream";
|
| | | string requestUrl = $"{CommonPage.RequestHttpsHost}/{RequestName}";
|
| | | //启用管理员权限
|
| | | //if (Config.Instance.isAdministrator == true)
|
| | | //{
|
| | | // requestUrl = $"{Config.Instance.AdminRequestBaseUrl}/{RequestName}";
|
| | | //}
|
| | | //else
|
| | | //{
|
| | | // requestUrl = $"{CommonPage.RequestHttpsHost}/{RequestName}";
|
| | | //}
|
| | |
|
| | | string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
|
| | | byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
|
| | |
| | | wr.Method = "POST";
|
| | | wr.KeepAlive = true;
|
| | | wr.Credentials = System.Net.CredentialCache.DefaultCredentials;
|
| | |
|
| | | wr.Headers.Add(HttpRequestHeader.Authorization, Config.Instance.Token);
|
| | |
|
| | | var rs = wr.GetRequestStream();
|
| | |
|
| | |
| | | StreamReader reader2 = new StreamReader(stream2);
|
| | |
|
| | | string result = reader2.ReadToEnd();
|
| | | if (RequestName == "ZigbeeDataShare/AddShareData")
|
| | | {
|
| | | return result;
|
| | | }
|
| | |
|
| | | var data = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.ResponsePack>(result);
|
| | |
|
| | | bool flage = UserCenterLogic.CheckNotEorrorMsg(data, requestUrl);
|
| | | if (flage == true)
|
| | | {
|
| | | return "1";
|
| | | //编辑的时候,这个东西会是null
|
| | | return data.ResponseData == null ? "1" : data.ResponseData.ToString();
|
| | | }
|
| | | return "0";
|
| | |
|
| | | //Log出力
|
| | | IMessageCommon.Current.GetMsgByRequestName(RequestName, data, nvc);
|
| | |
|
| | | return null;
|
| | | }
|
| | | catch
|
| | | {
|
| | | return "-1";
|
| | | return null;
|
| | | }
|
| | | finally
|
| | | {
|