You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
962 B

3 years ago
using EC.Entity.Video;
using EC.Utils;
using System;
using System.Collections.Generic;
namespace ECMonitor.Code
{
public class LoadFromAPIServer
{
public static string _apiUrl = ConfigHelper.APIServer();
/// <summary>
/// 获取相机数据
/// </summary>
/// <returns></returns>
public static List<MsVideoRecorder> LoadCameraData()
{
List<MsVideoRecorder> msVideoRecorderList = new List<MsVideoRecorder>();
try
{
var respStr = HttpMethods.HttpGet(_apiUrl);
var respObj = Json.ToJObject(respStr);
var success = (bool)respObj["success"];
if (success)
{
var message = (string)respObj["message"];
var code = (int)respObj["code"];
var timestamp = (string)respObj["timestamp"];
msVideoRecorderList = Json.ToList<MsVideoRecorder>(respObj["result"]?.ToString());
}
}
catch (Exception ex)
{
LogFactory.GetLogger().Error(ex);
}
return msVideoRecorderList;
}
}
}