You've already forked VptPassiveAdapter
refactor(continuity): 优化连续性检查逻辑和时间格式
- 将时间格式从 ISO 8601 修改为标准日期时间格式 - 修复连续性检查中 Gaps 字段的空数组初始化问题 - 重构连续性检查循环逻辑,启动时立即执行一次检查 - 提取连续性检查逻辑到独立的 performContinuityCheck 函数 - 优化检查时间范围的判断逻辑
This commit is contained in:
@@ -156,8 +156,8 @@ func reportSingleDevice(ctx context.Context, result dto.ContinuityCheckResult) e
|
||||
|
||||
// convertToReportRequest 将内部检查结果转换为接口请求格式
|
||||
func convertToReportRequest(result dto.ContinuityCheckResult) dto.ContinuityReportRequest {
|
||||
// 时间格式:ISO 8601
|
||||
const timeFormat = "2006-01-02T15:04:05"
|
||||
// 时间格式
|
||||
const timeFormat = "2006-01-02 15:04:05"
|
||||
|
||||
request := dto.ContinuityReportRequest{
|
||||
DeviceNo: result.DeviceNo,
|
||||
@@ -182,6 +182,8 @@ func convertToReportRequest(result dto.ContinuityCheckResult) dto.ContinuityRepo
|
||||
GapEndTime: gap.NextStartTime.Format(timeFormat),
|
||||
})
|
||||
}
|
||||
} else {
|
||||
request.Gaps = []dto.ContinuityReportGap{}
|
||||
}
|
||||
|
||||
return request
|
||||
|
||||
Reference in New Issue
Block a user