无故事王国
2023-10-26 152da0e2d8cd3bd522fb04d1114f0930c33c9fdf
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)
//      }
   }
}