From 152da0e2d8cd3bd522fb04d1114f0930c33c9fdf Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期四, 26 十月 2023 17:19:30 +0800 Subject: [PATCH] 修复BUG --- WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift | 53 +++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 37 insertions(+), 16 deletions(-) diff --git a/WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift b/WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift index 161b10f..0e4c57a 100644 --- a/WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift +++ b/WanPai/Root/Course/TCell/CourseBooking_1_TCell.swift @@ -73,24 +73,45 @@ let date = studentAppointModel.timeFrame.components(separatedBy: " ").first let timesList = studentAppointModel.timeFrame.components(separatedBy: " ").last - var a1 = [String]() - var b1 = [String]() - for v in timesList?.components(separatedBy: "-") ?? []{ - let a = v.components(separatedBy: ",").first! - let b = v.components(separatedBy: ",").last! - a1.append(a);b1.append(b) + if let t = timesList{ + let startTime = t.components(separatedBy: "-").first! + let endTime = t.components(separatedBy: "-").last! + let startDateTime = Date.jq_StringToTimeInterval(String(format: "%@ %@", date!,startTime), "yyyy.MM.dd HH:mm:ss") + let endDateTime = Date.jq_StringToTimeInterval(String(format: "%@ %@", date!,endTime), "yyyy.MM.dd HH:mm:ss") + + var times = [OpenDoorTimeModel]() + times.append(OpenDoorTimeModel(start_time: startDateTime, end_time: endDateTime)) + let openDoorModel = OpenDoorModel(sid: [studentAppointModel.siteId], rid: studentAppointModel.ids , uid: studentAppointModel.userId, time: times, type: 2) + if let modelStr = openDoorModel.toJSONString(){ + QRPreview.show(modelStr) + } } - var times = [OpenDoorTimeModel]() - for (index,v) in a1.enumerated(){ - let startTime = Date.jq_StringToTimeInterval(String(format: "%@ %@", date!,v), "yyyy.MM.dd HH:mm:ss") - let endTime = Date.jq_StringToTimeInterval(String(format: "%@ %@", date!,b1[index]),"yyyy.MM.dd HH:mm:ss") - times.append(OpenDoorTimeModel(start_time: startTime, end_time: endTime)) - } - let openDoorModel = OpenDoorModel(sid: [studentAppointModel.siteId], rid: studentAppointModel.ids , uid: studentAppointModel.userId, time: times, type: 2) - if let modelStr = openDoorModel.toJSONString(){ - QRPreview.show(modelStr) - } + + + + + + +// var a1 = [String]() +// var b1 = [String]() +// +// for v in timesList?.components(separatedBy: "-") ?? []{ +// let a = v.components(separatedBy: ",").first! +// let b = v.components(separatedBy: ",").last! +// a1.append(a);b1.append(b) +// } +// +// var times = [OpenDoorTimeModel]() +// for (index,v) in a1.enumerated(){ +// let startTime = Date.jq_StringToTimeInterval(String(format: "%@ %@", date!,v), "yyyy.MM.dd HH:mm:ss") +// let endTime = Date.jq_StringToTimeInterval(String(format: "%@ %@", date!,b1[index]),"yyyy.MM.dd HH:mm:ss") +// times.append(OpenDoorTimeModel(start_time: startTime, end_time: endTime)) +// } +// let openDoorModel = OpenDoorModel(sid: [studentAppointModel.siteId], rid: studentAppointModel.ids , uid: studentAppointModel.userId, time: times, type: 2) +// if let modelStr = openDoorModel.toJSONString(){ +// QRPreview.show(modelStr) +// } } } -- Gitblit v1.7.1