Commit dfc6263b authored by Steven杜宇's avatar Steven杜宇

// 赴港

parent 4bc22a28
...@@ -48,8 +48,6 @@ class YHCertificateAppointViewController: YHBaseViewController { ...@@ -48,8 +48,6 @@ class YHCertificateAppointViewController: YHBaseViewController {
// 申请人是否统一赴港激活签证 本地记录的开关 // 申请人是否统一赴港激活签证 本地记录的开关
var isAllMembersGo: Bool = true // 默认一起去 var isAllMembersGo: Bool = true // 默认一起去
var semaphore = DispatchSemaphore(value: 1)
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 0.01 tableView.estimatedSectionHeaderHeight = 0.01
...@@ -833,41 +831,37 @@ extension YHCertificateAppointViewController { ...@@ -833,41 +831,37 @@ extension YHCertificateAppointViewController {
// 请求抢号成功后的反馈回执文件私链URL组对应的公链组 // 请求抢号成功后的反馈回执文件私链URL组对应的公链组
func requestSuccessScriptUrls() { func requestSuccessScriptUrls() {
printLog("XYZ0")
if self.successList.count <= 0 { if self.successList.count <= 0 {
return return
} }
self.semaphore = DispatchSemaphore(value: 1) let semaphore = DispatchSemaphore(value: 1)
DispatchQueue.global().async { DispatchQueue.global().async {
for model in self.successList { for model in self.successList {
var publicUrls:[String] = [] var publicUrls:[String] = []
for privateUrl in model.receipts { for (index, privateUrl) in model.receipts.enumerated() {
// 信号-1 如果信号<0 则阻塞等待 // 信号-1 如果信号<0 则阻塞等待
self.semaphore.wait() semaphore.wait()
self.viewModel.getPublicImageUrl(privateUrl) { success, error in self.viewModel.getPublicImageUrl(privateUrl) { success, error in
printLog("success: \n\(success)")
if let publicUrl = success { if let publicUrl = success {
printLog("ABC: success")
publicUrls.append(publicUrl) publicUrls.append(publicUrl)
} else { } else {
// 私链转公链失败 只有在点击对应的回执图片的时候再次请求公链 // 私链转公链失败 只有在点击对应的回执图片的时候再次请求公链
printLog("ABC: failed")
publicUrls.append("") publicUrls.append("")
} }
// 释放信号+1 // 释放信号+1
self.semaphore.signal() semaphore.signal()
} }
} }
self.semaphore.wait() semaphore.wait()
model.publicReceipts = publicUrls model.publicReceipts = publicUrls
self.semaphore.signal() semaphore.signal()
} }
DispatchQueue.main.async { DispatchQueue.main.async {
self.tableView.reloadData() self.tableView.reloadData()
self.semaphore.wait()
} }
} }
} }
......
...@@ -336,12 +336,13 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -336,12 +336,13 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
return return
} }
// if true { if true {
// let vc = YHCertificateAppointViewController() let vc = YHCertificateAppointViewController()
// vc.orderId = 151085 vc.orderId = 151296
// self.navigationController?.pushViewController(vc) // 151296
// return self.navigationController?.pushViewController(vc)
// } //for test dy return
} //for test dy
let item: PersonalModuleItem = items[indexPath.row] let item: PersonalModuleItem = items[indexPath.row]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment