| | |
| | | |
| | | @IBAction func QRCodeAction(_ sender: UIButton) { |
| | | |
| | | Services.userDetails().subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data{ |
| | | Services.game_OpenDoorCode(userID: m.userId).subscribe(onNext: { data in |
| | | if let str = data.data?.toJSONString(){ |
| | | QRPreview.show(str) |
| | | } |
| | | }) { error in |
| | | let date = studentAppointModel.timeFrame.components(separatedBy: " ").first |
| | | let timesList = studentAppointModel.timeFrame.components(separatedBy: " ").last |
| | | |
| | | }.disposed(by: weakSelf.disposeBag) |
| | | } |
| | | }){ error in |
| | | var a1 = [String]() |
| | | var b1 = [String]() |
| | | |
| | | }.disposed(by: disposeBag) |
| | | 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") - 15 * 3600 |
| | | 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) |
| | | } |
| | | } |
| | | } |