old mode 100644
new mode 100755
| | |
| | | { |
| | | //服务返回来没有门锁成员信息,没有必要再去请求成员列表, |
| | | //原因:节约时间,体验效果好; |
| | | result = await UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); |
| | | }
|
| | | if (string.IsNullOrEmpty(result))
|
| | | {
|
| | | //防止为空抛异常;
|
| | | result = UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); |
| | | } |
| | | if (string.IsNullOrEmpty(result)) |
| | | { |
| | | //防止为空抛异常; |
| | | return userlist; |
| | | } |
| | | var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserCenter.MemberInfoRes>>(result);
|
| | | if (listInfo == null)
|
| | | {
|
| | | //防止为空抛异常;
|
| | | var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserCenter.MemberInfoRes>>(result); |
| | | if (listInfo == null) |
| | | { |
| | | //防止为空抛异常; |
| | | return userlist; |
| | | } |
| | | for (int i = 0; i < listInfo.Count; i++) |
| | |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<string> HttpWebRequest(string getUrl, string str, string method, int second = 3, bool _bool = false) |
| | | { |
| | | |
| | | HttpWebRequest request = WebRequest.Create(getUrl) as HttpWebRequest; //创建请求 |
| | | request.Method = method; //请求方式为POST/GET |
| | | request.ContentType = "application/json"; |
| | | request.Timeout = second * 1000;//超时时间 |
| | | try |
| | | { |
| | | HttpWebRequest request = WebRequest.Create(getUrl) as HttpWebRequest; //创建请求 |
| | | request.Method = method; //请求方式为POST/GET |
| | | request.ContentType = "application/json"; |
| | | request.Timeout = second * 1000;//超时时间 |
| | | if (_bool) |
| | | { |
| | | //用于高胜可视对讲接口 |
| | |
| | | } |
| | | |
| | | } |
| | | /// <summary>
|
| | | /// 文件保存
|
| | | /// </summary>
|
| | | /// <param name="FileName">文件路径</param>
|
| | | /// <param name="obj">需要序列化数据</param>
|
| | | public static void SaveLocalFile(string FileName, object obj)
|
| | | {
|
| | | //先序列化数据;
|
| | | var data = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
|
| | | //数据转换为字节流;
|
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data);
|
| | | //写入数据;
|
| | | Shared.IO.FileUtils.WriteFileByBytes(FileName, byteData);
|
| | | } |
| | | /// <summary>
|
| | | /// 文件保存
|
| | | /// </summary>
|
| | | /// <param name="FileName">文件路径</param>
|
| | | /// <param name="data">字符串</param> |
| | | public static void SaveLocalFile(string FileName, string data)
|
| | | {
|
| | | //先序列化数据;
|
| | | //数据转换为字节流;
|
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data);
|
| | | //写入数据;
|
| | | Shared.IO.FileUtils.WriteFileByBytes(FileName, byteData);
|
| | | }
|
| | | /// <summary>
|
| | | /// 文件读取
|
| | | /// </summary>
|
| | | /// <param name="FileName">文件路径</param>
|
| | | /// <returns></returns>
|
| | | public static string ReadLocalFile(string FileName)
|
| | | /// <summary> |
| | | /// 文件保存 |
| | | /// </summary> |
| | | /// <param name="FileName">文件路径</param> |
| | | /// <param name="obj">需要序列化数据</param> |
| | | public static void SaveLocalFile(string FileName, object obj) |
| | | { |
| | | //读出保存该路径的文件;
|
| | | var varByte = Shared.IO.FileUtils.ReadFile(FileName);
|
| | | //字节流转换为字符串;
|
| | | return System.Text.Encoding.UTF8.GetString(varByte);
|
| | | //先序列化数据; |
| | | var data = Newtonsoft.Json.JsonConvert.SerializeObject(obj); |
| | | //数据转换为字节流; |
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data); |
| | | //写入数据; |
| | | Shared.IO.FileUtils.WriteFileByBytes(FileName, byteData); |
| | | } |
| | | /// <summary> |
| | | /// 文件保存 |
| | | /// </summary> |
| | | /// <param name="FileName">文件路径</param> |
| | | /// <param name="data">字符串</param> |
| | | public static void SaveLocalFile(string FileName, string data) |
| | | { |
| | | //先序列化数据; |
| | | //数据转换为字节流; |
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data); |
| | | //写入数据; |
| | | Shared.IO.FileUtils.WriteFileByBytes(FileName, byteData); |
| | | } |
| | | /// <summary> |
| | | /// 文件读取 |
| | | /// </summary> |
| | | /// <param name="FileName">文件路径</param> |
| | | /// <returns></returns> |
| | | public static string ReadLocalFile(string FileName) |
| | | { |
| | | //读出保存该路径的文件; |
| | | var varByte = Shared.IO.FileUtils.ReadFile(FileName); |
| | | //字节流转换为字符串; |
| | | return System.Text.Encoding.UTF8.GetString(varByte); |
| | | } |
| | | #endregion |
| | | |