Browse Source

erere

master
fyf 2 years ago
parent
commit
708734b76b
1 changed files with 33 additions and 3 deletions
  1. +33
    -3
      DataVAPI/UpAndDown/Sample.cs

+ 33
- 3
DataVAPI/UpAndDown/Sample.cs View File

@@ -43,8 +43,7 @@ namespace DataVAPI.UpAndDown
}; };
AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions(); AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
AlibabaCloud.SDK.Iot20180120.Models.QueryDeviceFileListResponse resp = client.QueryDeviceFileListWithOptions(queryDeviceFileListRequest, runtime); AlibabaCloud.SDK.Iot20180120.Models.QueryDeviceFileListResponse resp = client.QueryDeviceFileListWithOptions(queryDeviceFileListRequest, runtime);
//AlibabaCloud.TeaConsole.Client.Log();
//;

AlibabaCloudRes cloudRes= Tools.JsonToObjectTools<AlibabaCloudRes>(AlibabaCloud.TeaUtil.Common.ToJSONString(resp.ToMap())); AlibabaCloudRes cloudRes= Tools.JsonToObjectTools<AlibabaCloudRes>(AlibabaCloud.TeaUtil.Common.ToJSONString(resp.ToMap()));
cloudRes?.body?.Data?.FileSummary?.ForEach(fileSummary => cloudRes?.body?.Data?.FileSummary?.ForEach(fileSummary =>
{ {
@@ -52,12 +51,43 @@ namespace DataVAPI.UpAndDown
if (_data != null) if (_data != null)
{ {
_data.UtcCreatedOn = DateTime.Parse(_data.UtcCreatedOn).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss"); _data.UtcCreatedOn = DateTime.Parse(_data.UtcCreatedOn).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
_data.DownloadUrl = CutStarStr(_data.DownloadUrl,"http://","https://");
retdata.Add(_data); retdata.Add(_data);
} }
}); });
return retdata; return retdata;
} }

/// <summary>
/// 替换字符串起始位置(开头)中指定的字符串
/// </summary>
/// <param name="s">源串</param>
/// <param name="searchStr">查找的串</param>
/// <param name="replaceStr">替换的目标串</param>
/// <returns></returns>
public static string CutStarStr(string s, string searchStr, string replaceStr)
{
var result = s;
try
{
if (string.IsNullOrEmpty(result))
{
return result;
}
if (s.Length < searchStr.Length)
{
return result;
}
if (s.IndexOf(searchStr, 0, searchStr.Length, StringComparison.Ordinal) > -1)
{
result = s.Substring(searchStr.Length);
}
return result;
}
catch (Exception e)
{
return result;
}
}
public static QueryDeviceFileResponseBodyData FileQuery(string DeviceName,string FileId) public static QueryDeviceFileResponseBodyData FileQuery(string DeviceName,string FileId)
{ {
AlibabaCloud.SDK.Iot20180120.Client client = CreateClient("LTAI5tDbUDuCvqU5hP8ZpHHV", "SvNIRQuz3BQFEaC3PFSJdgpeOKWFRi"); AlibabaCloud.SDK.Iot20180120.Client client = CreateClient("LTAI5tDbUDuCvqU5hP8ZpHHV", "SvNIRQuz3BQFEaC3PFSJdgpeOKWFRi");


Loading…
Cancel
Save