Commit 96d2f9e96cf36f0b1cf44e3e4351a928ea685a15

Authored by liushiyu
1 parent b59f60ee

添加审核接口

metaCode.xcodeproj/project.pbxproj
... ... @@ -54,6 +54,7 @@
54 54 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
55 55 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
56 56 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */; };
  57 + 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */; };
57 58 79EABB892AB4497700F3A4E2 /* CNLiveSaveStandDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */; };
58 59 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */; };
59 60 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */; };
... ... @@ -160,6 +161,7 @@
160 161 798A44FE2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInputFeedBackViewController.swift; sourceTree = "<group>"; };
161 162 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; };
162 163 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; };
  164 + 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+CNLiveExtension.swift"; sourceTree = "<group>"; };
163 165 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveStandDB.swift; sourceTree = "<group>"; };
164 166 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoViewController.swift; sourceTree = "<group>"; };
165 167 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineNickViewController.swift; sourceTree = "<group>"; };
... ... @@ -260,6 +262,7 @@
260 262 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */,
261 263 790B1FB52A41938F0074CF00 /* UIImage+CNLiveExtensions.swift */,
262 264 7C83B4432A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift */,
  265 + 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */,
263 266 );
264 267 path = Extensions;
265 268 sourceTree = "<group>";
... ... @@ -430,6 +433,7 @@
430 433 796398922A260C0100D045EB /* Config */ = {
431 434 isa = PBXGroup;
432 435 children = (
  436 + 79E496E42AB936E200127BF8 /* Tool */,
433 437 79579CAA2AAAE905006E5B38 /* Database */,
434 438 7CD675512A29C04B008354C1 /* CNLiveConfigstant.swift */,
435 439 790D01812A2D88FC00C5978D /* CNLiveConfigMacro.swift */,
... ... @@ -489,6 +493,13 @@
489 493 path = CustomView;
490 494 sourceTree = "<group>";
491 495 };
  496 + 79E496E42AB936E200127BF8 /* Tool */ = {
  497 + isa = PBXGroup;
  498 + children = (
  499 + );
  500 + path = Tool;
  501 + sourceTree = "<group>";
  502 + };
492 503 7C2703312A36CC430061EC50 /* Global */ = {
493 504 isa = PBXGroup;
494 505 children = (
... ... @@ -881,6 +892,7 @@
881 892 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */,
882 893 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
883 894 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */,
  895 + 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */,
884 896 7C83B4422A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift in Sources */,
885 897 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */,
886 898 7CD6753D2A2740B0008354C1 /* CNMainView.swift in Sources */,
... ...
metaCode/Classes/Config/CNLiveConfigManager.swift
... ... @@ -46,7 +46,13 @@ class ConfigManager : NSObject {
46 46 @objc private func keyboardDidHideNotification(notification : Notification) {
47 47 ConfigManager.shared.keyboardDisplayHeight = 0
48 48 }
49   -
50   -
51   -
  49 +}
  50 +
  51 +extension Notification.Name {
  52 + struct StandAuth {
  53 + //认证身份成功通知
  54 + public static let StandAuthNotificationSuccess = Notification.Name("StandAuthNotificationSuccess")
  55 + //认证身份失败通知
  56 + public static let StandAuthNotificationUnSuccess = Notification.Name("StandAuthNotificationUnSuccess")
  57 + }
52 58 }
... ...
metaCode/Classes/Config/CNLiveConfigUserInfo.swift
... ... @@ -147,7 +147,11 @@ class StandSortManager: NSObject {
147 147 /// - Returns: 返回信息
148 148 static private func readStandSort() -> NSArray {
149 149 let indexs = UserDefaults.standard.object(forKey: sort_key)
150   - if indexs == nil && (indexs as! NSArray).count == 0 {
  150 + if indexs == nil {
  151 + print("获取排序信息失败")
  152 + return []
  153 + }
  154 + if (indexs as! NSArray).count == 0 {
151 155 print("获取排序信息失败")
152 156 return []
153 157 }
... ...
metaCode/Classes/Extensions/UITableViewCell+CNLiveExtension.swift 0 → 100644
  1 +//
  2 +// UITableViewCell+CNLiveExtension.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/9/19.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +extension UITableViewCell {
  11 +
  12 +
  13 +}
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineAuthResultViewController.swift
... ... @@ -53,10 +53,18 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
53 53 return sendButton
54 54 }()
55 55  
  56 + /// 已认证-身份卡片
  57 + lazy var iDCardView:CNIDCardView = {
  58 + let iDCardView:CNIDCardView = CNIDCardView(frame: CGRect(x: (KSreenWidth - 40)/2, y: get_system_nav_height()+30, width: KSreenWidth - 40, height: (KSreenWidth-40) * 0.64))
  59 + iDCardView.isHidden = true
  60 + return iDCardView
  61 + }()
  62 +
  63 + var _status: UIStatusBarStyle! = .lightContent
56 64 var _listModel:StandListModel!
57 65 var _show_type:CNLiveMineAuthResultShowType!
58 66 init(listModel:StandListModel,show_type:CNLiveMineAuthResultShowType) {
59   - super.init(nibName:nil, bundle:nil)
  67 + super.init(nibName:nil, bundle:nil)
60 68 _listModel = listModel
61 69 _show_type = show_type
62 70 }
... ... @@ -67,7 +75,7 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
67 75  
68 76 override func viewWillAppear(_ animated: Bool) {
69 77 super.viewWillAppear(animated)
70   -
  78 +
71 79 }
72 80  
73 81 override func viewDidLoad() {
... ... @@ -79,6 +87,7 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
79 87 titleName = "添加\(_listModel.name!)"
80 88 titleLabel.textColor = .white
81 89 leftBtnWhite = true
  90 + _status = .lightContent
82 91 setNeedsStatusBarAppearanceUpdate()
83 92  
84 93  
... ... @@ -106,24 +115,52 @@ class CNLiveMineAuthResultViewController: CNLiveBaseViewController {
106 115 make.height.equalTo(40)
107 116 make.width.equalTo(150)
108 117 }
  118 + view.addSubview(iDCardView)
  119 + iDCardView.snp.makeConstraints { make in
  120 + make.centerX.equalToSuperview()
  121 + make.top.equalToSuperview().offset(get_system_nav_height()+30)
  122 + make.height.equalTo((KSreenWidth-40) * 0.64)
  123 + make.width.equalTo(KSreenWidth-40)
  124 + }
109 125 sendButton.setGradient(colors: [UIColor(red: 103/255.0, green: 197/255.0, blue: 255/255.0, alpha: 1),UIColor(red: 96/255.0, green: 154/255.0, blue: 255/255.0, alpha: 1)], startPoint: CGPoint(x: 0, y: 0.5), endPoint: CGPoint(x: 1, y: 0.5))
  126 +
  127 + CNLiveMineViewModel.startKeepTimeWithStand(id: "\(_listModel.id)") { [weak self] result, respStatue in
  128 + if respStatue == .success {
  129 + self?.titleLabel.textColor = .black
  130 + self?.leftBtnWhite = false
  131 + self?.mainView.isHidden = true
  132 + self?.iDCardView.isHidden = false
  133 + self?.iDCardView.idModel = self?._listModel
  134 + self?.tipName.text = "恭喜您通过认证"
  135 + self?.tipDesc.text = "您已是中国网公益服务志愿者!"
  136 + self?._status = .default
  137 + self?.setNeedsStatusBarAppearanceUpdate()
  138 + }else{
  139 + self?.iDCardView.isHidden = true
  140 + self?.mainView.image = UIImage(named: "mine_auth_result_header_failer")
  141 + self?.tipName.text = "审核失败"
  142 + self?.tipDesc.text = "请您修改后重新提交"
  143 + }
  144 + }
110 145 }
111 146  
112 147  
113 148 override var preferredStatusBarStyle: UIStatusBarStyle {
114   - return .lightContent
  149 + return _status
115 150 }
116 151  
117 152 @objc func sendInfoActionMothod() {
118 153 if _show_type == .result_failer || _show_type == .result_success {
119   -// let tempArray = NSMutableArray.init()
120   -// self.navigationController?.viewControllers.forEach({ item in
121   -// if (item.isKind(of: NSClassFromString("CNLiveMineInputViewController")!)) {
122   -// tempArray.remove(item)
123   -// }
124   -// })
125   -// self.navigationController?.viewControllers = tempArray as! [CNLiveBaseViewController]
126   - self.navigationController?.popToViewController(CNLiveMineAddInfoViewController.init(show_type: .add), animated: true)
  154 + let tempArray = NSMutableArray.init()
  155 + self.navigationController?.viewControllers.forEach({ item in
  156 + if (item.isKind(of: CNLiveMineInputViewController.self)) {
  157 + tempArray.remove(item)
  158 + }else{
  159 + tempArray.add(item)
  160 + }
  161 + })
  162 + self.navigationController?.viewControllers = tempArray as! [CNLiveBaseViewController]
  163 + self.navigationController?.popViewController(animated: true)
127 164 }
128 165 }
129 166 }
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineInputViewController.swift
... ... @@ -82,6 +82,7 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
82 82 }
83 83  
84 84 private func loadStandInfoData() {
  85 + showLoading(message: "")
85 86 CNLiveMineViewModel.requestsStandInfo(identityId: "\(_listModel.id)", type: .nodate) {[weak self] result, respStatue in
86 87 if respStatue == .success {
87 88 self?.dataArray.addObjects(from: result as! [Any])
... ... @@ -105,7 +106,6 @@ class CNLiveMineInputViewController : CNLiveBaseViewController, UITableViewDeleg
105 106 }
106 107  
107 108 @objc func sendInfoActionMothod() {
108   -
109 109 setupWithContentUploadImage { [self] url in
110 110 self.tempCell._infoModel?.value = url
111 111 CNLiveMineViewModel.requestsPOSTAuthInfo(identityId: "\(_listModel.id)", infos: self.dataArray) { [self] result, respStatue in
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
... ... @@ -102,7 +102,7 @@ extension CNLiveMineViewController {
102 102 }
103 103 if indexPath.section == 1 {
104 104 let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineOneViewCellIdentifier) as! MineBodyOneListViewCell
105   -
  105 + cell.reloadWithData()
106 106 return cell
107 107 }
108 108 let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveMineTwoViewCellIdentifier) as! MineBodyTwoListViewCell
... ...
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
... ... @@ -68,15 +68,15 @@ class MineBodyOneListViewCell : UITableViewCell {
68 68 mainView.addSubview(lookBtn)
69 69  
70 70 setupConstraints()
71   -
72   -
  71 + }
  72 +
  73 + public func reloadWithData() {
73 74 let tempArray = StandSortManager.sortMyListData(auths: CNLiveSaveAuthDB.shared.searchAllObject() as NSArray) as! [MineAuthListModel]
74 75 if tempArray.count == 0 {
75 76 tipLabel.isHidden = false
76 77 }else{
77   - for item in tempArray {
78   - let authModel = item
79   -// setupWithIconsView(authModel: authModel, index: index)
  78 + for (index, item) in tempArray.enumerated() {
  79 + setupWithIconsView(authModel: item, index: index)
80 80 }
81 81 }
82 82 }
... ... @@ -84,17 +84,17 @@ class MineBodyOneListViewCell : UITableViewCell {
84 84 private func setupWithIconsView(authModel: MineAuthListModel,index: NSInteger) {
85 85  
86 86 let iconView = UIImageView.init()
87   - iconView.layer.cornerRadius = 10
  87 + iconView.layer.cornerRadius = 20
88 88 iconView.layer.masksToBounds = true
89 89 iconView.clipsToBounds = true
90 90 iconView.contentMode = .scaleToFill
91 91 iconView.backgroundColor = .white
92   - iconView.kf.setImage(with: URL(string: authModel.icon ?? ""), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 20, height: 20)))
  92 + iconView.kf.setImage(with: URL(string: authModel.icon ?? ""), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 40, height: 40)))
93 93 mainView.addSubview(iconView)
94 94 iconView.snp.makeConstraints { make in
95   - make.centerY.equalToSuperview()
96   - make.left.equalToSuperview().offset(10+(20 * index)-(index>1 ? 3:0))
97   - make.size.equalTo(20)
  95 + make.centerY.equalToSuperview().offset(20)
  96 + make.left.equalToSuperview().offset(10+(40 * index) - (index > 0 ? 10 : 0))
  97 + make.size.equalTo(40)
98 98 }
99 99  
100 100 }
... ... @@ -714,6 +714,7 @@ class MineBodyInputAuthCell: UITableViewCell, UITextFieldDelegate {
714 714 super.init(style: style, reuseIdentifier: reuseIdentifier)
715 715 selectionStyle = .none
716 716 backgroundColor = .clear
  717 + contentView.backgroundColor = .clear
717 718  
718 719 addSubview(mainView)
719 720 mainView.addSubview(nameLabel)
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
... ... @@ -208,6 +208,12 @@ class MineStandInfoBaseModel: BaseModel {
208 208 var icon: String?
209 209 var name: String?
210 210 var identityId: Int = 0
  211 + var code: String?
  212 + var cardImg: String?
  213 + var authTime: Int = 0
  214 + var userStatus: Int = 0
  215 + var upPath: String?
  216 + var downPath: String?
211 217 }
212 218  
213 219 class MineStandInfoModel: BaseModel {
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
... ... @@ -28,6 +28,7 @@ enum CNLiveMineResponseType {
28 28 enum CNLiveMineGetWriteType {
29 29 case nodate //未填写
30 30 case havedate //已填写
  31 + case effect //效验接口
31 32 }
32 33 typealias resultBlock = (_ type: CNLiveMineRequestType,_ result: Bool) -> Void
33 34 typealias resultNewsBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void
... ... @@ -435,7 +436,6 @@ class CNLiveMineViewModel: NSObject {
435 436 let param = NSMutableDictionary()
436 437 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "sid")
437 438 param.setValue(identityId, forKey: "identityId")
438   - showLoading(message: "")
439 439 CNLiveNetworking.setAllowRequestDefaultArgument(true)
440 440 CNLiveNetworking.setupShowDataResult(false)
441 441 CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/getIdentity", param: param as! [String: String], cacheType: .networkOnly) { task, result, error in
... ... @@ -453,6 +453,8 @@ class CNLiveMineViewModel: NSObject {
453 453 }
454 454 }
455 455 resultBlock(tempArray,.success)
  456 + }else if (type == .effect) {
  457 + resultBlock(newsModel,.success)
456 458 }else {
457 459 let tempArray = NSMutableArray.init(array: newsModel.authInfos)
458 460 resultBlock(tempArray,.success)
... ... @@ -541,6 +543,46 @@ class CNLiveMineViewModel: NSObject {
541 543 }
542 544 }
543 545  
  546 + /// 结果检查逻辑
  547 + /// - Parameter id: 当前身份
  548 + static func startKeepTimeWithStand(id: String, resultBlock: @escaping resultNewsBlock) {
  549 + // 定义需要计时的时间
  550 + var timeCount = 20
  551 + // 在global线程里创建一个时间源
  552 + let codeTimer = DispatchSource.makeTimerSource(queue: DispatchQueue.global())
  553 + // 设定这个时间源是每秒循环一次,立即开始
  554 + codeTimer.schedule(deadline: .now(), repeating: .seconds(1))
  555 + // 设定时间源的触发事件
  556 + codeTimer.setEventHandler {
  557 + // 每秒计时一次
  558 + timeCount = timeCount - 1
  559 + // 时间到了取消时间源
  560 + if timeCount <= 0 {
  561 + codeTimer.cancel()
  562 + }
  563 + // 返回主线程处理一些事件,更新UI等等
  564 + DispatchQueue.main.async {
  565 + showLoading(message: "")
  566 + CNLiveMineViewModel.requestsStandInfo(identityId: id, type: .effect) { result, respStatue in
  567 + if respStatue == .success {
  568 + let listBaseModel = result as! MineStandInfoBaseModel
  569 + if listBaseModel.authTime > 0 {
  570 + showMessage(message: listBaseModel.name!.count > 0 ? "恭喜您通过认证,您已是\(listBaseModel.name ?? "")" : "恭喜您通过认证")
  571 + resultBlock(listBaseModel, .success)
  572 + NotificationCenter.default.post(name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil)
  573 + } else {
  574 + showMessage(message: "审核失败,请您修改后重新提交")
  575 + resultBlock(listBaseModel, .failed)
  576 + NotificationCenter.default.post(name: Notification.Name.StandAuth.StandAuthNotificationUnSuccess, object: nil)
  577 + }
  578 + }
  579 + }
  580 + }
  581 + }
  582 + // 启动时间源
  583 + codeTimer.resume()
  584 + }
  585 +
544 586 /// 获取十位时间戳
545 587 static var timeStamp: Int {
546 588 let timeInterval: TimeInterval = NSDate().timeIntervalSince1970
... ...