This commit is contained in:
parent
2323e1ca78
commit
b1628fdf4a
|
@ -21,21 +21,26 @@ namespace WebAPI.Controllers
|
|||
{
|
||||
Model.ResponeData responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
{
|
||||
string url =ConfigurationManager.AppSettings["Video_URL"];
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
|
||||
string URLToken = "";
|
||||
String restoken = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/login?username=" + project.ProjectCode + "&password=" + Funs.EncryptionPassword(project.MonitorPW));
|
||||
Dictionary<string, string> dicres = JsonConvert.DeserializeObject<Dictionary<string, string>>(restoken);
|
||||
URLToken = dicres["URLToken"];
|
||||
List<Dictionary<string, string>> data = new List<Dictionary<string, string>>();
|
||||
responeData.data = data;
|
||||
List<string> urls = new List<string>();
|
||||
string res = APIGetHttpService.Http(url + "api/v1/device/channeltree");
|
||||
string res = APIGetHttpService.Http(url + "api/v1/device/channeltree?token=" + URLToken);
|
||||
var name = BLL.ProjectService.GetProjectNameByProjectId(projectId);
|
||||
List<Dictionary<string, string>> jsonNvr = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(res);
|
||||
foreach (Dictionary<string, string> nvr in jsonNvr)
|
||||
{
|
||||
if (nvr["customName"] == name)
|
||||
{
|
||||
string jsonCameras = APIGetHttpService.Http(url + "api/v1/device/channeltree?serial=" + nvr["serial"]);
|
||||
|
||||
string jsonCameras = APIGetHttpService.Http(url + "api/v1/device/channeltree?serial=" + nvr["serial"]+ "&token="+URLToken);
|
||||
data.AddRange(JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jsonCameras));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -60,9 +65,17 @@ namespace WebAPI.Controllers
|
|||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
string url = ConfigurationManager.AppSettings["Video_URL"];
|
||||
string url = ConfigurationManager.AppSettings["Video_URL"];
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(projectId);
|
||||
|
||||
string URLToken = "";
|
||||
String restoken = BLL.CommonService.CreateGetHttpResponse(url + "api/v1/login?username=" + project.ProjectCode + "&password=" + Funs.EncryptionPassword(project.MonitorPW));
|
||||
Dictionary<string, string> dicres = JsonConvert.DeserializeObject<Dictionary<string, string>>(restoken);
|
||||
URLToken = dicres["URLToken"];
|
||||
|
||||
|
||||
var stmp = new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds() + "";
|
||||
string jsonCamera = APIGetHttpService.Http(url +"api/v1/stream/start?serial=" + serial + "&code=" + code + "&_=" + stmp);
|
||||
string jsonCamera = APIGetHttpService.Http(url + "api/v1/stream/start?token="+URLToken+"&serial=" + serial + "&code=" + code + "&_=" + stmp);
|
||||
responeData.data = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonCamera);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
Loading…
Reference in New Issue