diff --git a/NearCardAttendance.Service/TcpServer/Handler/RegisterHandler.cs b/NearCardAttendance.Service/TcpServer/Handler/RegisterHandler.cs index 7f36ced..40c31f0 100644 --- a/NearCardAttendance.Service/TcpServer/Handler/RegisterHandler.cs +++ b/NearCardAttendance.Service/TcpServer/Handler/RegisterHandler.cs @@ -271,7 +271,7 @@ namespace NearCardAttendance.Service.TcpServer.Handler var data = new { attendanceStatus = 2, //考勤状态: 0.进 1.出 2.未知 - attendanceTime = DateTime.TryParse(startTime, out DateTime time) ? time.ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + attendanceTime = DateTime.ParseExact(startTime, "yyyyMMddHHmmss", null).ToString("yyyy-MM-dd HH:mm:ss"), imei = config.Imei }; var res = await _httpHelper.HttpToPostAsync(url, data); @@ -332,7 +332,7 @@ namespace NearCardAttendance.Service.TcpServer.Handler var data = new { attendanceStatus = int.TryParse(optType, out int type) ? type : 0, - attendanceTime = DateTime.TryParse(startTime, out DateTime time) ? time.ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + attendanceTime = DateTime.ParseExact(startTime, "yyyyMMddHHmmss", null).ToString("yyyy-MM-dd HH:mm:ss"), imei = config.Imei }; var res = await _httpHelper.HttpToPostAsync(url, data);