|
|
@@ -11,6 +11,8 @@ using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Channels; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using NearCardAttendance.Model; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
|
|
|
|
namespace NearCardAttendance.Service.TcpServer.Handler |
|
|
|
{ |
|
|
@@ -19,15 +21,16 @@ namespace NearCardAttendance.Service.TcpServer.Handler |
|
|
|
private readonly ILogger<RegisterHandler> _logger; |
|
|
|
private readonly HttpHelper _httpHelper = default!; |
|
|
|
private readonly IDisposable _loggerScope = default!; |
|
|
|
private readonly ServiceConfig _configService; |
|
|
|
|
|
|
|
|
|
|
|
private readonly TcpClientsManager _managerTcpClients; |
|
|
|
private readonly ScheduleResendManager _managerScheduleResend; |
|
|
|
//private readonly TcpClientsManager _managerTcpClients; |
|
|
|
//private readonly ScheduleResendManager _managerScheduleResend; |
|
|
|
|
|
|
|
public RegisterHandler(ILogger<RegisterHandler> logger,HttpHelper httpHelper) |
|
|
|
public RegisterHandler(ILogger<RegisterHandler> logger,HttpHelper httpHelper, IOptions<ServiceConfig> configService) |
|
|
|
{ |
|
|
|
_logger = logger; |
|
|
|
_httpHelper = httpHelper; |
|
|
|
_configService = configService.Value; |
|
|
|
} |
|
|
|
|
|
|
|
public override void ChannelActive(IChannelHandlerContext context) |
|
|
@@ -228,7 +231,8 @@ namespace NearCardAttendance.Service.TcpServer.Handler |
|
|
|
var studentId = parser.Data.Substring(36,18).TrimEnd(); |
|
|
|
var startTime = parser.Data.Substring(54, 14).TrimEnd(); |
|
|
|
// Push card attendance information to third-party platform |
|
|
|
var url = "https://midplat.xinhualeyu.com/dev-api/user/electronicCardAttendance/receiveTbAttendanceRecord"; |
|
|
|
//var url = "https://midplat.xinhualeyu.com/dev-api/user/electronicCardAttendance/receiveTbAttendanceRecord"; |
|
|
|
var url = _configService.XinHuaLeYuUrl; |
|
|
|
var data = new |
|
|
|
{ |
|
|
|
attendanceStatus = 2, //考勤状态: 0.进 1.出 2.未知 |
|
|
@@ -257,8 +261,8 @@ namespace NearCardAttendance.Service.TcpServer.Handler |
|
|
|
var startTime = parser.Data.Substring(54, 14).TrimEnd(); |
|
|
|
var optType = parser.Data.Substring(68, 1).TrimEnd(); |
|
|
|
|
|
|
|
var url = "https://midplat.xinhualeyu.com/dev-api/user/electronicCardAttendance/receiveTbAttendanceRecord"; |
|
|
|
|
|
|
|
//var url = "https://midplat.xinhualeyu.com/dev-api/user/electronicCardAttendance/receiveTbAttendanceRecord"; |
|
|
|
var url = _configService.XinHuaLeYuUrl; |
|
|
|
var data = new |
|
|
|
{ |
|
|
|
attendanceStatus = int.TryParse(optType,out int type) ? type : 0, |
|
|
|