master
nodyang@aliyun.com 2 months ago
parent 88977f8c0f
commit ca8613082d

@ -35,6 +35,52 @@ namespace SlnMesnac.TouchSocket
_logger=logger;
}
[EnableCors("cors")]
[WebApi(HttpMethodType.POST)]
public Back Back(Hk hk)
{
Back ba=new Back();
_logger.LogInformation("海康回调接口");
_logger.LogInformation("{Data}", hk.ToJsonString());
if (hk.data_type == 1)
{
ScanLogSocket scan = new ScanLogSocket()
{
code = hk.code,
data_type = hk.data_type,
ocr = hk.ocr,
rfid = hk.rfid,
timestamp = hk.timestamp,
url = hk.url
};
ba= ScanBack(scan);
}
else
{
if (hk.data_type == 2)
{
ScanStatusSocket scan = new ScanStatusSocket()
{
data_type = hk.data_type,
is_alarm = hk.is_alarm,
device_status = hk.device_status,
timestamp = hk.timestamp,
};
ba = ScanStatus(scan);
}
}
return ba;
}
/// <summary>
/// 扫描的状态回传
/// </summary>

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
public class ScanLogSocket
{
@ -27,4 +28,45 @@ public class ScanLogSocket
public string ocr { get; set; }
public string url { get; set; }
}
}
public class Hk
{
public DateTime CreateTime
{
get
{
DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeMilliseconds(timestamp);
return dateTimeOffset.UtcDateTime;
}
}
public long timestamp { get; set; }
public int data_type { get; set; }
public string rfid { get; set; }
public string code { get; set; }
public string ocr { get; set; }
public string url { get; set; }
public int is_alarm { get; set; }
public List<string> device_status { get; set; }
public List<string> status_txt { get; set; }
}

Loading…
Cancel
Save