Commit d61a0385234f3545a322240feb1a1c7917418250
1 parent
fd7c9a33
视频上传,交易记录
Showing
12 changed files
with
542 additions
and
40 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -87,6 +87,10 @@ |
| 87 | 87 | 79803E272AD68D3100F05F68 /* CNLiveMineShopViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79803E262AD68D3100F05F68 /* CNLiveMineShopViewController.swift */; }; |
| 88 | 88 | 79803E292AD6991200F05F68 /* CNLiveMineInputMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79803E282AD6991200F05F68 /* CNLiveMineInputMessageView.swift */; }; |
| 89 | 89 | 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7987BF3C2A497644000A1ABC /* CNLiveMineQuestViewController.swift */; }; |
| 90 | + 798916E92B04532D00D08302 /* CNLiveSavePointDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798916E82B04532D00D08302 /* CNLiveSavePointDB.swift */; }; | |
| 91 | + 798916ED2B048E8200D08302 /* CNLiveShopTransViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798916EC2B048E8200D08302 /* CNLiveShopTransViewController.swift */; }; | |
| 92 | + 798916EF2B048EC800D08302 /* CNLiveShopTransListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798916EE2B048EC800D08302 /* CNLiveShopTransListViewController.swift */; }; | |
| 93 | + 798916F12B0491A400D08302 /* CNLiveShopBodyTransListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798916F02B0491A400D08302 /* CNLiveShopBodyTransListView.swift */; }; | |
| 90 | 94 | 7989B5C52A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */; }; |
| 91 | 95 | 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7989B5C62A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift */; }; |
| 92 | 96 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44E72A30134400815935 /* CNLiveMineHeaderView.swift */; }; |
| ... | ... | @@ -255,6 +259,10 @@ |
| 255 | 259 | 79803E262AD68D3100F05F68 /* CNLiveMineShopViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineShopViewController.swift; sourceTree = "<group>"; }; |
| 256 | 260 | 79803E282AD6991200F05F68 /* CNLiveMineInputMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputMessageView.swift; sourceTree = "<group>"; }; |
| 257 | 261 | 7987BF3C2A497644000A1ABC /* CNLiveMineQuestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineQuestViewController.swift; sourceTree = "<group>"; }; |
| 262 | + 798916E82B04532D00D08302 /* CNLiveSavePointDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSavePointDB.swift; sourceTree = "<group>"; }; | |
| 263 | + 798916EC2B048E8200D08302 /* CNLiveShopTransViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopTransViewController.swift; sourceTree = "<group>"; }; | |
| 264 | + 798916EE2B048EC800D08302 /* CNLiveShopTransListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopTransListViewController.swift; sourceTree = "<group>"; }; | |
| 265 | + 798916F02B0491A400D08302 /* CNLiveShopBodyTransListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyTransListView.swift; sourceTree = "<group>"; }; | |
| 258 | 266 | 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineEarnViewController.swift; sourceTree = "<group>"; }; |
| 259 | 267 | 7989B5C62A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineEarnListViewController.swift; sourceTree = "<group>"; }; |
| 260 | 268 | 798A44E72A30134400815935 /* CNLiveMineHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineHeaderView.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -544,6 +552,7 @@ |
| 544 | 552 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */, |
| 545 | 553 | 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */, |
| 546 | 554 | 794FF1082B02131300385E85 /* CNLiveSaveSearchDB.swift */, |
| 555 | + 798916E82B04532D00D08302 /* CNLiveSavePointDB.swift */, | |
| 547 | 556 | ); |
| 548 | 557 | path = Database; |
| 549 | 558 | sourceTree = "<group>"; |
| ... | ... | @@ -716,6 +725,8 @@ |
| 716 | 725 | 792B53272AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift */, |
| 717 | 726 | 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */, |
| 718 | 727 | 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */, |
| 728 | + 798916EC2B048E8200D08302 /* CNLiveShopTransViewController.swift */, | |
| 729 | + 798916EE2B048EC800D08302 /* CNLiveShopTransListViewController.swift */, | |
| 719 | 730 | ); |
| 720 | 731 | path = Controller; |
| 721 | 732 | sourceTree = "<group>"; |
| ... | ... | @@ -735,6 +746,7 @@ |
| 735 | 746 | 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */, |
| 736 | 747 | 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */, |
| 737 | 748 | 791C1C8B2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift */, |
| 749 | + 798916F02B0491A400D08302 /* CNLiveShopBodyTransListView.swift */, | |
| 738 | 750 | ); |
| 739 | 751 | path = View; |
| 740 | 752 | sourceTree = "<group>"; |
| ... | ... | @@ -1165,6 +1177,7 @@ |
| 1165 | 1177 | 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */, |
| 1166 | 1178 | 7C83B4402A52BB2B004BF4A4 /* CNGlobalEnum.swift in Sources */, |
| 1167 | 1179 | 7C83B4442A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift in Sources */, |
| 1180 | + 798916F12B0491A400D08302 /* CNLiveShopBodyTransListView.swift in Sources */, | |
| 1168 | 1181 | 7CD675482A274167008354C1 /* PGIndexBannerSubiew.m in Sources */, |
| 1169 | 1182 | 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */, |
| 1170 | 1183 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */, |
| ... | ... | @@ -1175,6 +1188,7 @@ |
| 1175 | 1188 | 19BB1FEA2AEF7B4A0094D962 /* CNLiveShopConsoleCell.swift in Sources */, |
| 1176 | 1189 | 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */, |
| 1177 | 1190 | 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, |
| 1191 | + 798916E92B04532D00D08302 /* CNLiveSavePointDB.swift in Sources */, | |
| 1178 | 1192 | 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */, |
| 1179 | 1193 | 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */, |
| 1180 | 1194 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */, |
| ... | ... | @@ -1212,6 +1226,7 @@ |
| 1212 | 1226 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */, |
| 1213 | 1227 | 19CC4D522ADD129800308E2A /* CNUpSlideAnimationTransition.swift in Sources */, |
| 1214 | 1228 | 7CD6754F2A2840B9008354C1 /* CNMetaCodeHomePageController.swift in Sources */, |
| 1229 | + 798916EF2B048EC800D08302 /* CNLiveShopTransListViewController.swift in Sources */, | |
| 1215 | 1230 | 7989B5C52A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift in Sources */, |
| 1216 | 1231 | 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */, |
| 1217 | 1232 | 19BB1FE62AEB93B80094D962 /* CNLiveShopUserInfoModel.swift in Sources */, |
| ... | ... | @@ -1261,6 +1276,7 @@ |
| 1261 | 1276 | 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */, |
| 1262 | 1277 | 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */, |
| 1263 | 1278 | 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */, |
| 1279 | + 798916ED2B048E8200D08302 /* CNLiveShopTransViewController.swift in Sources */, | |
| 1264 | 1280 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, |
| 1265 | 1281 | 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */, |
| 1266 | 1282 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, | ... | ... |
metaCode/Classes/Common/Util/CNLiveCommonQiniuTool.swift
| ... | ... | @@ -39,6 +39,16 @@ class UploadManager: NSObject { |
| 39 | 39 | UploadManager.uploadData(madiaData: imageData, key: key, progress: progressBlock, success: successBlock) |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | + /// 上传视频 | |
| 43 | + /// - Parameters: | |
| 44 | + /// - imageData: 视频数据 | |
| 45 | + /// - progressBlock: 进度回调 | |
| 46 | + /// - successBlock: 成功回调 | |
| 47 | + static func uploadVideo(videoData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) { | |
| 48 | + let key = UploadManager.createVideoFileName() | |
| 49 | + UploadManager.uploadData(madiaData: videoData, key: key, progress: progressBlock, success: successBlock) | |
| 50 | + } | |
| 51 | + | |
| 42 | 52 | |
| 43 | 53 | |
| 44 | 54 | /// 上传到七牛 |
| ... | ... | @@ -113,6 +123,13 @@ class UploadManager: NSObject { |
| 113 | 123 | let imageName = "802/mateCode/img/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).jpg" |
| 114 | 124 | return imageName |
| 115 | 125 | } |
| 126 | + | |
| 127 | + /// 设置视频名称 | |
| 128 | + /// - Returns: 图片名 | |
| 129 | + static private func createVideoFileName() -> String { | |
| 130 | + let imageName = "802/mateCode/video/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).mp4" | |
| 131 | + return imageName | |
| 132 | + } | |
| 116 | 133 | } |
| 117 | 134 | |
| 118 | 135 | class QiNiuUploadModel: BaseModel { | ... | ... |
metaCode/Classes/Config/Database/CNLiveSaveAuthDB.swift
| ... | ... | @@ -71,6 +71,30 @@ class CNLiveSaveAuthDB : NSObject{ |
| 71 | 71 | // } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | + /// 获取所有数据 | |
| 75 | + /// - Returns: 返回查找的所以数据 | |
| 76 | + func searchAllObject() -> Array<MineAuthListModel>{ | |
| 77 | + | |
| 78 | + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | |
| 79 | + if (temp_dic == nil) { | |
| 80 | + return Array() | |
| 81 | + } | |
| 82 | + let tempArray = NSMutableArray.init() | |
| 83 | + temp_dic?.allValues.forEach({ value in | |
| 84 | + let listModel = dictionaryToModel(value as! [String : Any], MineAuthListModel.self,"") | |
| 85 | + tempArray.add(listModel) | |
| 86 | + }) | |
| 87 | + return tempArray as! Array<MineAuthListModel> | |
| 88 | + | |
| 89 | +// do{ | |
| 90 | +// let allData: [MineAuthListModel] = try database.getObjects(fromTable: CNLiveAuthListTableName) | |
| 91 | +// return allData | |
| 92 | +// }catch{ | |
| 93 | +// print("获取失败") | |
| 94 | +// return [] | |
| 95 | +// } | |
| 96 | + } | |
| 97 | + | |
| 74 | 98 | /// 删除一条数据 |
| 75 | 99 | /// - Parameter delete: 被删除的数据 |
| 76 | 100 | func deleteObject(delete: MineAuthListModel){ |
| ... | ... | @@ -132,29 +156,7 @@ class CNLiveSaveAuthDB : NSObject{ |
| 132 | 156 | } |
| 133 | 157 | |
| 134 | 158 | |
| 135 | - /// 获取所有数据 | |
| 136 | - /// - Returns: 返回查找的所以数据 | |
| 137 | - func searchAllObject() -> Array<MineAuthListModel>{ | |
| 138 | - | |
| 139 | - let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | |
| 140 | - if (temp_dic == nil) { | |
| 141 | - return Array() | |
| 142 | - } | |
| 143 | - let tempArray = NSMutableArray.init() | |
| 144 | - temp_dic?.allValues.forEach({ value in | |
| 145 | - let listModel = dictionaryToModel(value as! [String : Any], MineAuthListModel.self,"") | |
| 146 | - tempArray.add(listModel) | |
| 147 | - }) | |
| 148 | - return tempArray as! Array<MineAuthListModel> | |
| 149 | - | |
| 150 | -// do{ | |
| 151 | -// let allData: [MineAuthListModel] = try database.getObjects(fromTable: CNLiveAuthListTableName) | |
| 152 | -// return allData | |
| 153 | -// }catch{ | |
| 154 | -// print("获取失败") | |
| 155 | -// return [] | |
| 156 | -// } | |
| 157 | - } | |
| 159 | + | |
| 158 | 160 | |
| 159 | 161 | /// 获取所有数据唯一值id |
| 160 | 162 | /// - Returns: 返回查找的所以数据 | ... | ... |
metaCode/Classes/Config/Database/CNLiveSavePointDB.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveSavePointDB.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by open on 2023/11/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +let CNLiveSavePointCacheKey = "kCNLiveSavePointCacheKey" | |
| 11 | +class CNLiveSavePointDB: NSObject { | |
| 12 | + | |
| 13 | + static let shared = CNLiveSavePointDB.init() | |
| 14 | + | |
| 15 | + open func save(object: MinePointCheckInModel) { | |
| 16 | + var temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | |
| 17 | + if (temp_dic == nil) { | |
| 18 | + temp_dic = NSMutableDictionary.init() | |
| 19 | + } | |
| 20 | + temp_dic?.setObject((object.toJSON() ?? Dictionary()) as Dictionary, forKey: CNLiveSavePointCacheKey as NSCopying) | |
| 21 | + temp_dic?.write(toFile: userFileDir+"storage.plist", atomically: true) | |
| 22 | + } | |
| 23 | + | |
| 24 | + open func take() -> MinePointCheckInModel { | |
| 25 | + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | |
| 26 | + if (temp_dic == nil) { | |
| 27 | + return MinePointCheckInModel() | |
| 28 | + } | |
| 29 | + let resp = temp_dic?.object(forKey: CNLiveSavePointCacheKey) | |
| 30 | + let listModel = dictionaryToModel(resp as! [String : Any], MinePointCheckInModel.self,"") as! MinePointCheckInModel | |
| 31 | + return listModel | |
| 32 | + } | |
| 33 | + | |
| 34 | + private lazy var userFileDir: String = { | |
| 35 | + let userFileDir = NSString() | |
| 36 | + var path: String = "" | |
| 37 | + path = "\(fileDir)/userId_\(UserInfoManager.shared.userInfo.uid)/" | |
| 38 | + let fileManager = FileManager.default | |
| 39 | + var isDir: ObjCBool = false | |
| 40 | + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir) | |
| 41 | + if !(isDir.boolValue && exist) { | |
| 42 | + do { | |
| 43 | + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true) | |
| 44 | + } catch { | |
| 45 | + debugPrint("文件目录创建失败") | |
| 46 | + return "" | |
| 47 | + } | |
| 48 | + } | |
| 49 | + return path as String | |
| 50 | + }() | |
| 51 | + | |
| 52 | + private lazy var fileDir: String = { | |
| 53 | + let path = "\(NSHomeDirectory())/Documents/metaCode/savePoint" | |
| 54 | + let fileManager = FileManager.default | |
| 55 | + var isDir: ObjCBool = false | |
| 56 | + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir) | |
| 57 | + if !(isDir.boolValue && exist) { | |
| 58 | + do { | |
| 59 | + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true) | |
| 60 | + } catch { | |
| 61 | + debugPrint("文件目录创建失败") | |
| 62 | + return "" | |
| 63 | + } | |
| 64 | + } | |
| 65 | + return path as String | |
| 66 | + }() | |
| 67 | +} | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
| ... | ... | @@ -45,9 +45,9 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, |
| 45 | 45 | ["name":"更多设置","icon":"mine_list_icon_set_more"]] |
| 46 | 46 | dataArray.add(array03) |
| 47 | 47 | |
| 48 | - | |
| 49 | -// dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]]) | |
| 50 | - | |
| 48 | + let array04 : [Dictionary] = [["name":"订单列表","icon":"mine_list_icon_help_feedback"], | |
| 49 | + ["name":"交易记录","icon":"mine_list_icon_help_feedback"]] | |
| 50 | + dataArray.add(array04) | |
| 51 | 51 | |
| 52 | 52 | return dataArray |
| 53 | 53 | }() |
| ... | ... | @@ -87,6 +87,9 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, |
| 87 | 87 | if respStatue == .success { |
| 88 | 88 | self?.checkModel = result as? MinePointCheckInModel |
| 89 | 89 | self?.tableView.reloadData() |
| 90 | + } else { | |
| 91 | + self?.checkModel = MinePointCheckInModel.init() | |
| 92 | + self?.tableView.reloadData() | |
| 90 | 93 | } |
| 91 | 94 | } |
| 92 | 95 | } |
| ... | ... | @@ -174,7 +177,12 @@ extension CNLiveMineViewController { |
| 174 | 177 | } |
| 175 | 178 | |
| 176 | 179 | if indexPath.section == 4 { |
| 177 | - self.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) | |
| 180 | + if indexPath.row == 0 { | |
| 181 | + self.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) | |
| 182 | + } | |
| 183 | + if indexPath.row == 1 { | |
| 184 | + | |
| 185 | + } | |
| 178 | 186 | } |
| 179 | 187 | |
| 180 | 188 | } | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
| ... | ... | @@ -397,8 +397,13 @@ class MineBodyThreeViewCell: UITableViewCell { |
| 397 | 397 | _checkModel = newValue |
| 398 | 398 | balanceNumberButton.stopAnimating() |
| 399 | 399 | pointNumberButton.stopAnimating() |
| 400 | - balanceNumberButton.setTitle(newValue?.money, for: .normal) | |
| 401 | - pointNumberButton.setTitle(newValue?.integral, for: .normal) | |
| 400 | + if newValue == nil { | |
| 401 | + balanceNumberButton.setTitle("0", for: .normal) | |
| 402 | + pointNumberButton.setTitle("0", for: .normal) | |
| 403 | + } else { | |
| 404 | + balanceNumberButton.setTitle((newValue!.money!.isNotBlank()) ? newValue?.money : "0", for: .normal) | |
| 405 | + pointNumberButton.setTitle((newValue!.integral!.isNotBlank()) ? newValue?.integral : "0", for: .normal) | |
| 406 | + } | |
| 402 | 407 | } |
| 403 | 408 | } |
| 404 | 409 | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
| ... | ... | @@ -370,8 +370,8 @@ class MineQuestHeaderView: UIView { |
| 370 | 370 | mainView.addSubview(balanceDescButton) |
| 371 | 371 | mainView.addSubview(descBtn) |
| 372 | 372 | |
| 373 | - balanceDescButton.setTitle(checkModel.money, for: .normal) | |
| 374 | - pointDescButton.setTitle(checkModel.integral, for: .normal) | |
| 373 | + balanceDescButton.setTitle((checkModel.money!.isNotBlank()) ? checkModel.money : "0", for: .normal) | |
| 374 | + pointDescButton.setTitle((checkModel.integral!.isNotBlank()) ? checkModel.integral : "0", for: .normal) | |
| 375 | 375 | |
| 376 | 376 | setupConstraints() |
| 377 | 377 | } |
| ... | ... | @@ -540,8 +540,8 @@ class MineEarnHeaderView: UIView { |
| 540 | 540 | // mainView.addSubview(tipView) |
| 541 | 541 | // tipView.addSubview(tipLabel) |
| 542 | 542 | |
| 543 | - left_Label.text = checkModel.integral | |
| 544 | - right_Label.text = checkModel.money | |
| 543 | + left_Label.text = checkModel.integral!.isNotBlank() ? checkModel.integral : "0" | |
| 544 | + right_Label.text = checkModel.money!.isNotBlank() ? checkModel.money : "0" | |
| 545 | 545 | |
| 546 | 546 | setupConstraints() |
| 547 | 547 | } | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineSubBodyListView.swift
| ... | ... | @@ -51,7 +51,7 @@ class MineInfoLListTableViewCell : UITableViewCell { |
| 51 | 51 | |
| 52 | 52 | public func setupWithDataSource(icon: String, name: String, is_auth: Bool) { |
| 53 | 53 | iconView.kf.indicatorType = .activity |
| 54 | - iconView.kf.setImage(with: URL(string: icon), placeholder: UIImage.imageWithColor(color: HexColor("0xf9f9f9")!, size: CGSize(width: 50, height: 50))) | |
| 54 | + iconView.kf.setImage(with: URL(string: icon), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 50, height: 50))) | |
| 55 | 55 | titleLabel.text = name |
| 56 | 56 | if is_auth { |
| 57 | 57 | addBtn.backgroundColor = HexColor("#DCDCDC") | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -644,18 +644,34 @@ class CNLiveMineViewModel: NSObject { |
| 644 | 644 | let errorCode = "\(resp["code"] ?? "0")" |
| 645 | 645 | if (errorCode == "200") { |
| 646 | 646 | let listModel = dictionaryToModel(resp as! [String : Any], MinePointCheckInModel.self,"data") as! MinePointCheckInModel |
| 647 | + CNLiveSavePointDB.shared.save(object: listModel) | |
| 647 | 648 | resultBlock(listModel,.success) |
| 648 | 649 | } else { |
| 649 | - showMessage(message: resp["message"] as! String) | |
| 650 | - resultBlock(NSNull(),.failed) | |
| 650 | + let listModel = CNLiveSavePointDB.shared.take() | |
| 651 | + if listModel.integral!.isNotBlank() && listModel.money!.isNotBlank() { | |
| 652 | + resultBlock(listModel,.success) | |
| 653 | + } else { | |
| 654 | + showMessage(message: resp["message"] as! String) | |
| 655 | + resultBlock(NSNull(),.failed) | |
| 656 | + } | |
| 651 | 657 | } |
| 652 | 658 | } else { |
| 653 | 659 | if CNLiveNetworking.isNetworking() { |
| 654 | - showMessage(message: "获取失败") | |
| 655 | - resultBlock(NSNull(),.failed) | |
| 660 | + let listModel = CNLiveSavePointDB.shared.take() | |
| 661 | + if listModel.integral!.isNotBlank() && listModel.money!.isNotBlank() { | |
| 662 | + resultBlock(listModel,.success) | |
| 663 | + } else { | |
| 664 | + showMessage(message: "获取失败") | |
| 665 | + resultBlock(NSNull(),.failed) | |
| 666 | + } | |
| 656 | 667 | } else { |
| 657 | - showMessage(message: "似乎与网络断开链接") | |
| 658 | - resultBlock(NSNull(),.noNetwork) | |
| 668 | + let listModel = CNLiveSavePointDB.shared.take() | |
| 669 | + if listModel.integral!.isNotBlank() && listModel.money!.isNotBlank() { | |
| 670 | + resultBlock(listModel,.success) | |
| 671 | + } else { | |
| 672 | + showMessage(message: "似乎与网络断开链接") | |
| 673 | + resultBlock(NSNull(),.noNetwork) | |
| 674 | + } | |
| 659 | 675 | } |
| 660 | 676 | } |
| 661 | 677 | } | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopTransListViewController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopTransListViewController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by open on 2023/11/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | +import Foundation | |
| 11 | +import JXSegmentedView | |
| 12 | +import JXPagingView | |
| 13 | +import EmptyDataSet_Swift | |
| 14 | +import MJRefresh | |
| 15 | + | |
| 16 | +enum CNLiveShopTransListShowType { | |
| 17 | + case all //全部 | |
| 18 | + case income //收入 | |
| 19 | + case outcome //支出 | |
| 20 | +} | |
| 21 | + | |
| 22 | +class CNLiveShopTransListViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, JXSegmentedListContainerViewListDelegate, EmptyDataSetSource, EmptyDataSetDelegate { | |
| 23 | + | |
| 24 | + func listView() -> UIView { | |
| 25 | + return view | |
| 26 | + } | |
| 27 | + | |
| 28 | + let kShopBodyTransListViewCellIdentifier = "kShopBodyTransListViewCellIdentifier" | |
| 29 | + lazy var tableView : UITableView = { | |
| 30 | + let tableView = UITableView(frame: .zero, style: .grouped) | |
| 31 | + tableView.dataSource = self | |
| 32 | + tableView.delegate = self | |
| 33 | + tableView.emptyDataSetSource = self | |
| 34 | + tableView.emptyDataSetDelegate = self | |
| 35 | + tableView.backgroundColor = .clear | |
| 36 | + tableView.tableFooterView = UIView.init() | |
| 37 | + tableView.separatorInset = UIEdgeInsets(top: 0, left: adapt_length(length: 20), bottom: 0, right: adapt_length(length: 20)) | |
| 38 | + tableView.register(ShopBodyTransListViewCell.self, forCellReuseIdentifier: kShopBodyTransListViewCellIdentifier) | |
| 39 | + return tableView | |
| 40 | + }() | |
| 41 | + | |
| 42 | + lazy var dataArray: NSMutableArray = { | |
| 43 | + let dataArray = NSMutableArray.init() | |
| 44 | + return dataArray | |
| 45 | + }() | |
| 46 | + | |
| 47 | + var pageNum: NSInteger | |
| 48 | + var network_type: CNLiveMineResponseType! | |
| 49 | + init() { | |
| 50 | + self.pageNum = 1 | |
| 51 | + super.init(nibName:nil, bundle:nil) | |
| 52 | + } | |
| 53 | + | |
| 54 | + required init?(coder: NSCoder) { | |
| 55 | + fatalError("init(coder:) has not been implemented") | |
| 56 | + } | |
| 57 | + | |
| 58 | + override func viewDidLoad() { | |
| 59 | + super.viewDidLoad() | |
| 60 | + view.backgroundColor = HexColor("#FAFAFA") | |
| 61 | + | |
| 62 | + view.addSubview(tableView) | |
| 63 | + tableView.snp.makeConstraints { make in | |
| 64 | + make.top.equalToSuperview() | |
| 65 | + make.bottom.left.right.equalToSuperview() | |
| 66 | + } | |
| 67 | + } | |
| 68 | + | |
| 69 | + func loadDataSourceAction(page: NSInteger) { | |
| 70 | + | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + func addRefreshView() { | |
| 75 | + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in | |
| 76 | + self!.pageNum = 1 | |
| 77 | + self!.loadDataSourceAction(page: 1) | |
| 78 | + }) | |
| 79 | + | |
| 80 | + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in | |
| 81 | + self!.pageNum = self!.pageNum + 1 | |
| 82 | + self!.loadDataSourceAction(page: self!.pageNum) | |
| 83 | + }) | |
| 84 | + } | |
| 85 | + | |
| 86 | + override func viewDidLayoutSubviews() { | |
| 87 | + super.viewDidLayoutSubviews() | |
| 88 | + } | |
| 89 | + | |
| 90 | +} | |
| 91 | +extension CNLiveShopTransListViewController { | |
| 92 | + | |
| 93 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| 94 | + return dataArray.count | |
| 95 | + } | |
| 96 | + | |
| 97 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| 98 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyTransListViewCellIdentifier) as? ShopBodyTransListViewCell else { | |
| 99 | + return ShopBodyTransListViewCell() | |
| 100 | + } | |
| 101 | + return cell | |
| 102 | + } | |
| 103 | + | |
| 104 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
| 105 | + return adapt_length(length: 110) | |
| 106 | + } | |
| 107 | + | |
| 108 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
| 109 | + | |
| 110 | + } | |
| 111 | +} | |
| 112 | + | |
| 113 | +extension CNLiveShopTransListViewController { | |
| 114 | + | |
| 115 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | |
| 116 | + if network_type == .failed || network_type == .unkonw { | |
| 117 | + return UIImage(named: "mine_list_source_unusual_failed") | |
| 118 | + } | |
| 119 | + if dataArray.count == 0 { | |
| 120 | + return UIImage(named: "mine_list_source_unusual_empty") | |
| 121 | + } | |
| 122 | + if network_type == .noNetwork { | |
| 123 | + return UIImage(named: "mine_list_source_unusual_noNet") | |
| 124 | + } | |
| 125 | + return UIImage(named: "mine_list_source_unusual_empty") | |
| 126 | + } | |
| 127 | + | |
| 128 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | |
| 129 | + var defult_string = "" | |
| 130 | + if network_type == .failed || network_type == .unkonw { | |
| 131 | + defult_string = "接口请求错误,刷新试试~" | |
| 132 | + } | |
| 133 | + if network_type == .noNetwork { | |
| 134 | + defult_string = "网络开小差了,刷新试试~" | |
| 135 | + } | |
| 136 | + if dataArray.count == 0 { | |
| 137 | + defult_string = "暂时没有数据~" | |
| 138 | + } | |
| 139 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | |
| 140 | + } | |
| 141 | + | |
| 142 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | |
| 143 | + if network_type == .failed || network_type == .noNetwork { | |
| 144 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | |
| 145 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | |
| 146 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | |
| 147 | + } | |
| 148 | + return nil | |
| 149 | + } | |
| 150 | + | |
| 151 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | |
| 152 | + if network_type == .failed || network_type == .noNetwork { | |
| 153 | + loadDataSourceAction(page: 1) | |
| 154 | + } | |
| 155 | + } | |
| 156 | +} | ... | ... |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopTransViewController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopTransViewController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by open on 2023/11/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import JXSegmentedView | |
| 10 | +import JXPagingView | |
| 11 | + | |
| 12 | +class CNLiveShopTransViewController: CNLiveBaseViewController { | |
| 13 | + | |
| 14 | + lazy var viewControllers: NSMutableArray = { | |
| 15 | + let viewControllers = NSMutableArray.init() | |
| 16 | + viewControllers.add(CNLiveShopTransListViewController.init()) | |
| 17 | + viewControllers.add(CNLiveShopTransListViewController.init()) | |
| 18 | + return viewControllers | |
| 19 | + }() | |
| 20 | + | |
| 21 | + lazy var dataSource: JXSegmentedNumberDataSource = { | |
| 22 | + let dataSource = JXSegmentedNumberDataSource() | |
| 23 | + dataSource.titles = ["达人","电商"] | |
| 24 | + dataSource.numbers = [0,0,0,0] | |
| 25 | + dataSource.isTitleColorGradientEnabled = true | |
| 26 | + dataSource.itemWidth = JXSegmentedViewAutomaticDimension | |
| 27 | + dataSource.itemSpacing = 0 | |
| 28 | + dataSource.titleNormalFont = Font_15_Fit | |
| 29 | + dataSource.titleSelectedFont = Font_15_Fit | |
| 30 | + dataSource.titleNormalColor = HexColor("#999999")! | |
| 31 | + dataSource.titleSelectedColor = HexColor("#28C1C6")! | |
| 32 | + return dataSource | |
| 33 | + }() | |
| 34 | + | |
| 35 | + lazy var categoryView: JXSegmentedView = { | |
| 36 | + let categoryView = JXSegmentedView.init(frame: CGRectMake(0, KNavigationHeight, KSreenWidth, CGFloat(kCNLiveShopOrderListSectionTitleHeight))) | |
| 37 | + categoryView.dataSource = dataSource | |
| 38 | + categoryView.delegate = self | |
| 39 | + categoryView.collectionView.backgroundColor = HexColor("fafbfd") | |
| 40 | + categoryView.backgroundColor = .white | |
| 41 | + | |
| 42 | + let lineView = JXSegmentedIndicatorBackgroundView.init() | |
| 43 | + lineView.indicatorColor = HexColor("#28C1C6")! | |
| 44 | + lineView.indicatorHeight = 2 | |
| 45 | + lineView.indicatorPosition = .bottom | |
| 46 | + lineView.indicatorWidthIncrement = 0 | |
| 47 | + lineView.indicatorCornerRadius = 0 | |
| 48 | + categoryView.indicators = [lineView] | |
| 49 | + | |
| 50 | + return categoryView | |
| 51 | + }() | |
| 52 | + | |
| 53 | + lazy var screenButton: UIButton = { | |
| 54 | + let screenButton = UIButton.init(type: .custom) | |
| 55 | + screenButton.frame = CGRect(x: KSreenWidth - adapt_length(length: 40), y: (get_system_nav_height() - (get_system_statusBar_height() + adapt_length(length: 30)))/2 + get_system_statusBar_height(), width: adapt_length(length: 30), height: adapt_length(length: 30)) | |
| 56 | + screenButton.setImage(UIImage(named: "DS_order_search"), for: .normal) | |
| 57 | + screenButton.backgroundColor = .clear | |
| 58 | + screenButton.layer.masksToBounds = true | |
| 59 | + screenButton.layer.cornerRadius = 5 | |
| 60 | + screenButton.addTarget(self, action: #selector(screenButtonClick), for: .touchUpInside) | |
| 61 | + return screenButton | |
| 62 | + }() | |
| 63 | + | |
| 64 | + lazy var listContainerView: JXSegmentedListContainerView! = { | |
| 65 | + return JXSegmentedListContainerView(dataSource: self) | |
| 66 | + }() | |
| 67 | + | |
| 68 | + override func viewWillAppear(_ animated: Bool) { | |
| 69 | + super.viewWillAppear(animated) | |
| 70 | + self.navigationController?.interactivePopGestureRecognizer?.isEnabled = (categoryView.selectedIndex == 0) | |
| 71 | + } | |
| 72 | + | |
| 73 | + override func viewWillDisappear(_ animated: Bool) { | |
| 74 | + super.viewWillDisappear(animated) | |
| 75 | + self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true | |
| 76 | + } | |
| 77 | + | |
| 78 | + override func viewDidLoad() { | |
| 79 | + super.viewDidLoad() | |
| 80 | + view.backgroundColor = .white | |
| 81 | + navigationBarHidden = false | |
| 82 | + titleName = "交易记录" | |
| 83 | + | |
| 84 | + view.addSubview(categoryView) | |
| 85 | + | |
| 86 | + categoryView.listContainer = listContainerView | |
| 87 | + view.addSubview(listContainerView) | |
| 88 | + | |
| 89 | + topNavView.addSubview(screenButton) | |
| 90 | + | |
| 91 | + } | |
| 92 | + | |
| 93 | + override func viewDidLayoutSubviews() { | |
| 94 | + super.viewDidLayoutSubviews() | |
| 95 | + | |
| 96 | + categoryView.frame = CGRect(x: 0, y: KNavigationHeight, width: view.bounds.size.width, height: CGFloat(kCNLiveShopOrderListSectionTitleHeight)) | |
| 97 | + listContainerView.frame = CGRect(x: 0, y: KNavigationHeight+CGFloat(kCNLiveShopOrderListSectionTitleHeight), width: view.bounds.size.width, height: view.bounds.size.height - CGFloat(kCNLiveShopOrderListSectionTitleHeight) - KNavigationHeight) | |
| 98 | + } | |
| 99 | + | |
| 100 | + @objc func screenButtonClick() { | |
| 101 | + | |
| 102 | + } | |
| 103 | + | |
| 104 | + | |
| 105 | +} | |
| 106 | +extension CNLiveShopTransViewController: JXSegmentedViewDelegate { | |
| 107 | + func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) { | |
| 108 | + navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0) | |
| 109 | + } | |
| 110 | +} | |
| 111 | + | |
| 112 | +extension CNLiveShopTransViewController: JXSegmentedListContainerViewDataSource { | |
| 113 | + func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int { | |
| 114 | + if let titleDataSource = categoryView.dataSource as? JXSegmentedBaseDataSource { | |
| 115 | + return titleDataSource.dataSource.count | |
| 116 | + } | |
| 117 | + return 0 | |
| 118 | + } | |
| 119 | + | |
| 120 | + func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate { | |
| 121 | + return viewControllers[index] as! JXSegmentedListContainerViewListDelegate | |
| 122 | + } | |
| 123 | +} | |
| 124 | + | ... | ... |
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyTransListView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopTransListView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by open on 2023/11/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class ShopBodyTransListViewCell: UITableViewCell { | |
| 11 | + | |
| 12 | + lazy var iconImageView: UIImageView = { | |
| 13 | + let iconImageView = UIImageView.init(frame: CGRectMake(0, 0, adapt_length(length: 40), adapt_length(length: 40))) | |
| 14 | + iconImageView.contentMode = .scaleAspectFill | |
| 15 | + iconImageView.layer.cornerRadius = adapt_length(length: 20) | |
| 16 | + iconImageView.layer.masksToBounds = true | |
| 17 | + return iconImageView | |
| 18 | + }() | |
| 19 | + | |
| 20 | + lazy var titleLabel: UILabel = { | |
| 21 | + let titleLabel = UILabel.init() | |
| 22 | + titleLabel.textColor = HexColor("#333333") | |
| 23 | + titleLabel.font = medium_adapt_font(pointSize: 15) | |
| 24 | + return titleLabel | |
| 25 | + }() | |
| 26 | + | |
| 27 | + lazy var timeLabel: UILabel = { | |
| 28 | + let timeLabel = UILabel.init() | |
| 29 | + timeLabel.textColor = HexColor("#999999") | |
| 30 | + timeLabel.font = regular_adapt_font(pointSize: 12) | |
| 31 | + return timeLabel | |
| 32 | + }() | |
| 33 | + | |
| 34 | + lazy var payTypeImageView: UIImageView = { | |
| 35 | + let payTypeImageView = UIImageView.init(frame: CGRectMake(0, 0, adapt_length(length: 54), adapt_length(length: 16))) | |
| 36 | + payTypeImageView.contentMode = .scaleAspectFit | |
| 37 | + return payTypeImageView | |
| 38 | + }() | |
| 39 | + | |
| 40 | + lazy var priceLab: UILabel = { | |
| 41 | + let priceLab = UILabel.init() | |
| 42 | + priceLab.textColor = HexColor("#333333") | |
| 43 | + priceLab.font = medium_adapt_font(pointSize: 18) | |
| 44 | + priceLab.textAlignment = .right | |
| 45 | + return priceLab | |
| 46 | + }() | |
| 47 | + | |
| 48 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
| 49 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | |
| 50 | + contentView.backgroundColor = .clear | |
| 51 | + selectionStyle = .none | |
| 52 | + | |
| 53 | + addSubview(iconImageView) | |
| 54 | + iconImageView.snp.makeConstraints { make in | |
| 55 | + make.centerY.equalToSuperview() | |
| 56 | + make.left.equalToSuperview().offset(20) | |
| 57 | + make.size.equalTo(adapt_length(length: 40)) | |
| 58 | + } | |
| 59 | + addSubview(titleLabel) | |
| 60 | + titleLabel.snp.makeConstraints { make in | |
| 61 | + make.left.equalTo(iconImageView.snp.right).offset(adapt_length(length: 15)) | |
| 62 | + make.right.equalToSuperview().offset(-adapt_length(length: 75)) | |
| 63 | + make.top.equalTo(iconImageView.snp.top) | |
| 64 | + make.height.equalTo(adapt_length(length: 21)) | |
| 65 | + } | |
| 66 | + addSubview(timeLabel) | |
| 67 | + timeLabel.snp.makeConstraints { make in | |
| 68 | + make.left.equalTo(titleLabel.snp.left) | |
| 69 | + make.top.equalTo(titleLabel.snp.bottom).offset(adapt_length(length: 5)) | |
| 70 | + make.size.equalTo(CGSize(width: adapt_length(length: 130), height: 17)) | |
| 71 | + } | |
| 72 | + addSubview(payTypeImageView) | |
| 73 | + payTypeImageView.snp.makeConstraints { make in | |
| 74 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | |
| 75 | + make.top.equalToSuperview().offset(adapt_length(length: 17)) | |
| 76 | + make.size.equalTo(payTypeImageView.size) | |
| 77 | + } | |
| 78 | + addSubview(priceLab) | |
| 79 | + priceLab.snp.makeConstraints { make in | |
| 80 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | |
| 81 | + make.left.equalTo(timeLabel.snp.right).offset(adapt_length(length: 15)) | |
| 82 | + make.top.equalTo(payTypeImageView.snp.bottom).offset(4) | |
| 83 | + make.height.equalTo(adapt_length(length: 25)) | |
| 84 | + } | |
| 85 | + } | |
| 86 | + | |
| 87 | + required init?(coder: NSCoder) { | |
| 88 | + fatalError("init(coder:) has not been implemented") | |
| 89 | + } | |
| 90 | + | |
| 91 | +} | ... | ... |