111
This commit is contained in:
parent
46a2904880
commit
242ce72163
|
@ -9,6 +9,8 @@ using System.Text;
|
||||||
using BLL;
|
using BLL;
|
||||||
using Microsoft.SqlServer.Server;
|
using Microsoft.SqlServer.Server;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using Model;
|
||||||
|
|
||||||
namespace WebAPI.Controllers
|
namespace WebAPI.Controllers
|
||||||
{
|
{
|
||||||
|
@ -27,15 +29,38 @@ namespace WebAPI.Controllers
|
||||||
var responeData = new Model.ResponeData();
|
var responeData = new Model.ResponeData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||||
|
{
|
||||||
|
Base_Project project = null;
|
||||||
|
if (!string.IsNullOrEmpty(projectId))
|
||||||
|
{
|
||||||
|
project = db.Base_Project.FirstOrDefault(x => x.ProjectId == projectId);
|
||||||
|
}
|
||||||
string url = ConfigurationManager.AppSettings["Video_URL"];
|
string url = ConfigurationManager.AppSettings["Video_URL"];
|
||||||
List<string> urls = new List<string>();
|
List<string> urls = new List<string>();
|
||||||
string res = APIGetHttpService.Http(url+"api/v1/device/channeltree");
|
string res = APIGetHttpService.Http(url + "api/v1/device/channeltree");
|
||||||
|
List<Dictionary<string, string>> resDic = new List<Dictionary<string, string>>();
|
||||||
List<Dictionary<string, string>> jsonNvr = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(res);
|
List<Dictionary<string, string>> jsonNvr = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(res);
|
||||||
foreach (Dictionary<string, string> nvr in jsonNvr)
|
foreach (Dictionary<string, string> nvr in jsonNvr)
|
||||||
{
|
{
|
||||||
string jsonCameras = APIGetHttpService.Http(url+"api/v1/device/channeltree?serial=" + nvr["serial"]);
|
if (project != null && nvr["customName"].ToString() == project.ProjectName)
|
||||||
|
{
|
||||||
|
string jsonCameras = APIGetHttpService.Http(url + "api/v1/device/channeltree?serial=" + nvr["serial"]);
|
||||||
responeData.data = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jsonCameras);
|
responeData.data = JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jsonCameras);
|
||||||
|
return responeData;
|
||||||
|
}
|
||||||
|
else if (project == null)
|
||||||
|
{
|
||||||
|
string jsonCameras = APIGetHttpService.Http(url + "api/v1/device/channeltree?serial=" + nvr["serial"]);
|
||||||
|
resDic.AddRange(JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jsonCameras));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string jsonCameras = APIGetHttpService.Http(url + "api/v1/device/channeltree?serial=" + nvr["serial"]);
|
||||||
|
resDic.AddRange(JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jsonCameras));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
responeData.data = resDic;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue