Merge branch 'master' of http://47.104.102.122:3000/lpf/CNCEC_SUBQHSE_WUHUAN
This commit is contained in:
commit
033a73c280
|
@ -20,8 +20,8 @@ namespace BLL
|
||||||
public static string Http(string url, string method = "GET", string contenttype = "application/json;charset=utf-8", Hashtable header = null, string data = null)
|
public static string Http(string url, string method = "GET", string contenttype = "application/json;charset=utf-8", Hashtable header = null, string data = null)
|
||||||
{
|
{
|
||||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 |
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 |
|
||||||
SecurityProtocolType.Tls | SecurityProtocolType.Tls11 |
|
SecurityProtocolType.Tls | SecurityProtocolType.Tls11 |
|
||||||
SecurityProtocolType.Tls12;
|
SecurityProtocolType.Tls12;
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||||
request.Method = string.IsNullOrEmpty(method) ? "GET" : method;
|
request.Method = string.IsNullOrEmpty(method) ? "GET" : method;
|
||||||
request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype;
|
request.ContentType = string.IsNullOrEmpty(contenttype) ? "application/json;charset=utf-8" : contenttype;
|
||||||
|
|
|
@ -589,6 +589,7 @@ namespace BLL
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string CreateGetHttpResponse(string url)
|
public static string CreateGetHttpResponse(string url)
|
||||||
{
|
{
|
||||||
|
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||||
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;//创建请求对象
|
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;//创建请求对象
|
||||||
request.Method = "Get";//请求方式
|
request.Method = "Get";//请求方式
|
||||||
request.ContentType = "application/x-www-form-urlencoded";//链接类型
|
request.ContentType = "application/x-www-form-urlencoded";//链接类型
|
||||||
|
|
|
@ -1895,6 +1895,7 @@
|
||||||
<Content Include="res\images\zg05.png" />
|
<Content Include="res\images\zg05.png" />
|
||||||
<Content Include="res\image\message.png" />
|
<Content Include="res\image\message.png" />
|
||||||
<Content Include="res\index\images\logocenter.png" />
|
<Content Include="res\index\images\logocenter.png" />
|
||||||
|
<Content Include="res\js\crypto-js.min.js" />
|
||||||
<Content Include="res\js\swiper-bundle.min.css" />
|
<Content Include="res\js\swiper-bundle.min.css" />
|
||||||
<Content Include="res\js\swiper-bundle.min.js" />
|
<Content Include="res\js\swiper-bundle.min.js" />
|
||||||
<Content Include="res\js\swiper.css" />
|
<Content Include="res\js\swiper.css" />
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
<script src="~/res/lib/china.js"></script>
|
<script src="~/res/lib/china.js"></script>
|
||||||
<script src="~/res/lib/echarts.min.js"></script>
|
<script src="~/res/lib/echarts.min.js"></script>
|
||||||
<script src="~/res/lib/swiper.min.js"></script>
|
<script src="~/res/lib/swiper.min.js"></script>
|
||||||
|
<script src="~/res/js/crypto-js.min.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="~/res/css/company.css?v1">
|
<link rel="stylesheet" href="~/res/css/company.css?v1">
|
||||||
<style>
|
<style>
|
||||||
.BMap_mask {
|
.BMap_mask {
|
||||||
|
@ -559,6 +561,7 @@
|
||||||
</Items>
|
</Items>
|
||||||
</f:SimpleForm>
|
</f:SimpleForm>
|
||||||
</form>
|
</form>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var toolRefreshClientID = '<%= toolRefresh.ClientID %>';
|
var toolRefreshClientID = '<%= toolRefresh.ClientID %>';
|
||||||
var toolNewWindowClientID = '<%= toolNewWindow.ClientID %>';
|
var toolNewWindowClientID = '<%= toolNewWindow.ClientID %>';
|
||||||
|
@ -677,7 +680,9 @@
|
||||||
var username = $('#<%= hfProjectCode.ClientID %>-inputEl').val()
|
var username = $('#<%= hfProjectCode.ClientID %>-inputEl').val()
|
||||||
var password = $('#<%= hfMonitorPW.ClientID %>-inputEl').val();
|
var password = $('#<%= hfMonitorPW.ClientID %>-inputEl').val();
|
||||||
if (password != "") {
|
if (password != "") {
|
||||||
window.open(videoURL + "#/screen?username=" + username + "&password=" + password, '_blank');
|
var sign = CryptoJS.AES.encrypt(username + "$" + password +"$" + Date.now(), "nbd").toString();
|
||||||
|
sign = encodeURIComponent(sign);
|
||||||
|
window.open(videoURL + "#/screen?sign=" + sign , '_blank');
|
||||||
} else {
|
} else {
|
||||||
alert("该项目未关联监控信息!");
|
alert("该项目未关联监控信息!");
|
||||||
}
|
}
|
||||||
|
@ -906,10 +911,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 点击标题栏工具图标 - 查看源代码
|
// 点击标题栏工具图标 - 查看源代码
|
||||||
var videoURL ='<%=VideoURL %>'
|
|
||||||
function openVideo() {
|
|
||||||
window.open(videoURL, '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取当前激活选项卡的ID
|
// 获取当前激活选项卡的ID
|
||||||
function getActiveTabId() {
|
function getActiveTabId() {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -21,21 +21,24 @@ namespace WebAPI.Controllers
|
||||||
{
|
{
|
||||||
Model.ResponeData responeData = new Model.ResponeData();
|
Model.ResponeData responeData = new Model.ResponeData();
|
||||||
try
|
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"];
|
||||||
List<Dictionary<string, string>> data = new List<Dictionary<string, string>>();
|
List<Dictionary<string, string>> data = new List<Dictionary<string, string>>();
|
||||||
responeData.data = data;
|
responeData.data = data;
|
||||||
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?token=" + URLToken);
|
||||||
var name = BLL.ProjectService.GetProjectNameByProjectId(projectId);
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
if (nvr["customName"] == name)
|
|
||||||
{
|
string jsonCameras = APIGetHttpService.Http(url + "api/v1/device/channeltree?serial=" + nvr["serial"]+ "&token="+URLToken);
|
||||||
string jsonCameras = APIGetHttpService.Http(url + "api/v1/device/channeltree?serial=" + nvr["serial"]);
|
|
||||||
data.AddRange(JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jsonCameras));
|
data.AddRange(JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(jsonCameras));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -60,9 +63,17 @@ namespace WebAPI.Controllers
|
||||||
var responeData = new Model.ResponeData();
|
var responeData = new Model.ResponeData();
|
||||||
try
|
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() + "";
|
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);
|
responeData.data = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonCamera);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
Loading…
Reference in New Issue