Commit 6b5d345936f24bdbc61a8db41038ec8b6c172ff4
1 parent
af1882da
添加更改存储方式,订单搜索功能
Showing
20 changed files
with
1523 additions
and
577 deletions
Podfile
| @@ -36,7 +36,7 @@ target 'metaCode' do | @@ -36,7 +36,7 @@ target 'metaCode' do | ||
| 36 | #加载GIF | 36 | #加载GIF |
| 37 | pod 'SwiftGifOrigin', '~> 1.7.0' | 37 | pod 'SwiftGifOrigin', '~> 1.7.0' |
| 38 | #数据库存储 | 38 | #数据库存储 |
| 39 | - pod 'WCDB.swift' | 39 | + #pod 'WCDB.swift' |
| 40 | #占位按钮 | 40 | #占位按钮 |
| 41 | pod 'APButton' | 41 | pod 'APButton' |
| 42 | #分类滚动切换视图 | 42 | #分类滚动切换视图 |
| @@ -44,7 +44,7 @@ target 'metaCode' do | @@ -44,7 +44,7 @@ target 'metaCode' do | ||
| 44 | pod 'JXPagingView/Paging' | 44 | pod 'JXPagingView/Paging' |
| 45 | #轮播图 | 45 | #轮播图 |
| 46 | pod 'FSPagerView', '0.8.3' | 46 | pod 'FSPagerView', '0.8.3' |
| 47 | -# pod 'SDCycleScrollView', '~> 1.82' | 47 | + #pod 'SDCycleScrollView', '~> 1.82' |
| 48 | 48 | ||
| 49 | target 'metaCodeTests' do | 49 | target 'metaCodeTests' do |
| 50 | inherit! :search_paths | 50 | inherit! :search_paths |
metaCode.xcodeproj/project.pbxproj
| @@ -77,6 +77,9 @@ | @@ -77,6 +77,9 @@ | ||
| 77 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; | 77 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; |
| 78 | 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; }; | 78 | 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; }; |
| 79 | 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */; }; | 79 | 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */; }; |
| 80 | + 794FF1052B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */; }; | ||
| 81 | + 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */; }; | ||
| 82 | + 794FF1092B02131300385E85 /* CNLiveFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794FF1082B02131300385E85 /* CNLiveFileManager.swift */; }; | ||
| 80 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; | 83 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; |
| 81 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; }; | 84 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; }; |
| 82 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; }; | 85 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; }; |
| @@ -127,7 +130,6 @@ | @@ -127,7 +130,6 @@ | ||
| 127 | 7C4931362A307B60000E44B4 /* slide_up.gif in Resources */ = {isa = PBXBuildFile; fileRef = 7C4931352A307B60000E44B4 /* slide_up.gif */; }; | 130 | 7C4931362A307B60000E44B4 /* slide_up.gif in Resources */ = {isa = PBXBuildFile; fileRef = 7C4931352A307B60000E44B4 /* slide_up.gif */; }; |
| 128 | 7C4931382A307BDB000E44B4 /* CNHomePageGuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */; }; | 131 | 7C4931382A307BDB000E44B4 /* CNHomePageGuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */; }; |
| 129 | 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C7C62F52A4D72E9007A912E /* CNLiveIdentityDB.swift */; }; | 132 | 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C7C62F52A4D72E9007A912E /* CNLiveIdentityDB.swift */; }; |
| 130 | - 7C83B43E2A52B8BA004BF4A4 /* CNHomePageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C83B43D2A52B8BA004BF4A4 /* CNHomePageViewModel.swift */; }; | ||
| 131 | 7C83B4402A52BB2B004BF4A4 /* CNGlobalEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C83B43F2A52BB2B004BF4A4 /* CNGlobalEnum.swift */; }; | 133 | 7C83B4402A52BB2B004BF4A4 /* CNGlobalEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C83B43F2A52BB2B004BF4A4 /* CNGlobalEnum.swift */; }; |
| 132 | 7C83B4422A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C83B4412A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift */; }; | 134 | 7C83B4422A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C83B4412A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift */; }; |
| 133 | 7C83B4442A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C83B4432A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift */; }; | 135 | 7C83B4442A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C83B4432A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift */; }; |
| @@ -243,6 +245,9 @@ | @@ -243,6 +245,9 @@ | ||
| 243 | 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; | 245 | 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; |
| 244 | 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; }; | 246 | 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; }; |
| 245 | 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSendViewController.swift; sourceTree = "<group>"; }; | 247 | 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSendViewController.swift; sourceTree = "<group>"; }; |
| 248 | + 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSearchViewController.swift; sourceTree = "<group>"; }; | ||
| 249 | + 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSearchListViewController.swift; sourceTree = "<group>"; }; | ||
| 250 | + 794FF1082B02131300385E85 /* CNLiveFileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveFileManager.swift; sourceTree = "<group>"; }; | ||
| 246 | 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | 251 | 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; |
| 247 | 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; }; | 252 | 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; }; |
| 248 | 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; }; | 253 | 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; }; |
| @@ -292,7 +297,6 @@ | @@ -292,7 +297,6 @@ | ||
| 292 | 7C4931352A307B60000E44B4 /* slide_up.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = slide_up.gif; sourceTree = "<group>"; }; | 297 | 7C4931352A307B60000E44B4 /* slide_up.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = slide_up.gif; sourceTree = "<group>"; }; |
| 293 | 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNHomePageGuideView.swift; sourceTree = "<group>"; }; | 298 | 7C4931372A307BDB000E44B4 /* CNHomePageGuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNHomePageGuideView.swift; sourceTree = "<group>"; }; |
| 294 | 7C7C62F52A4D72E9007A912E /* CNLiveIdentityDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveIdentityDB.swift; sourceTree = "<group>"; }; | 299 | 7C7C62F52A4D72E9007A912E /* CNLiveIdentityDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveIdentityDB.swift; sourceTree = "<group>"; }; |
| 295 | - 7C83B43D2A52B8BA004BF4A4 /* CNHomePageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNHomePageViewModel.swift; sourceTree = "<group>"; }; | ||
| 296 | 7C83B43F2A52BB2B004BF4A4 /* CNGlobalEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNGlobalEnum.swift; sourceTree = "<group>"; }; | 300 | 7C83B43F2A52BB2B004BF4A4 /* CNGlobalEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNGlobalEnum.swift; sourceTree = "<group>"; }; |
| 297 | 7C83B4412A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CALayer+CNLiveExtensions.swift"; sourceTree = "<group>"; }; | 301 | 7C83B4412A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CALayer+CNLiveExtensions.swift"; sourceTree = "<group>"; }; |
| 298 | 7C83B4432A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDate+CNLiveExtensions.swift"; sourceTree = "<group>"; }; | 302 | 7C83B4432A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDate+CNLiveExtensions.swift"; sourceTree = "<group>"; }; |
| @@ -539,6 +543,7 @@ | @@ -539,6 +543,7 @@ | ||
| 539 | 7C7C62F52A4D72E9007A912E /* CNLiveIdentityDB.swift */, | 543 | 7C7C62F52A4D72E9007A912E /* CNLiveIdentityDB.swift */, |
| 540 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */, | 544 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */, |
| 541 | 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */, | 545 | 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */, |
| 546 | + 794FF1082B02131300385E85 /* CNLiveFileManager.swift */, | ||
| 542 | ); | 547 | ); |
| 543 | path = Database; | 548 | path = Database; |
| 544 | sourceTree = "<group>"; | 549 | sourceTree = "<group>"; |
| @@ -709,6 +714,8 @@ | @@ -709,6 +714,8 @@ | ||
| 709 | 791C1C872AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift */, | 714 | 791C1C872AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift */, |
| 710 | 791C1C892AFB84EE003E6362 /* CNLiveShopOrderExpressListViewController.swift */, | 715 | 791C1C892AFB84EE003E6362 /* CNLiveShopOrderExpressListViewController.swift */, |
| 711 | 792B53272AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift */, | 716 | 792B53272AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift */, |
| 717 | + 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */, | ||
| 718 | + 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */, | ||
| 712 | ); | 719 | ); |
| 713 | path = Controller; | 720 | path = Controller; |
| 714 | sourceTree = "<group>"; | 721 | sourceTree = "<group>"; |
| @@ -760,7 +767,6 @@ | @@ -760,7 +767,6 @@ | ||
| 760 | isa = PBXGroup; | 767 | isa = PBXGroup; |
| 761 | children = ( | 768 | children = ( |
| 762 | 19565ED12AF9FE56007D6727 /* GoodsManager */, | 769 | 19565ED12AF9FE56007D6727 /* GoodsManager */, |
| 763 | - 7C83B43D2A52B8BA004BF4A4 /* CNHomePageViewModel.swift */, | ||
| 764 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */, | 770 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */, |
| 765 | 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */, | 771 | 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */, |
| 766 | 19BB1FED2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift */, | 772 | 19BB1FED2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift */, |
| @@ -1189,7 +1195,6 @@ | @@ -1189,7 +1195,6 @@ | ||
| 1189 | 7CD675522A29C04B008354C1 /* CNLiveConfigstant.swift in Sources */, | 1195 | 7CD675522A29C04B008354C1 /* CNLiveConfigstant.swift in Sources */, |
| 1190 | 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */, | 1196 | 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */, |
| 1191 | 1965FA402AFB38AA00F0F435 /* CNLiveAddGoodsSelectUploadImageView.swift in Sources */, | 1197 | 1965FA402AFB38AA00F0F435 /* CNLiveAddGoodsSelectUploadImageView.swift in Sources */, |
| 1192 | - 7C83B43E2A52B8BA004BF4A4 /* CNHomePageViewModel.swift in Sources */, | ||
| 1193 | 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */, | 1198 | 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */, |
| 1194 | 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */, | 1199 | 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */, |
| 1195 | 7C4931382A307BDB000E44B4 /* CNHomePageGuideView.swift in Sources */, | 1200 | 7C4931382A307BDB000E44B4 /* CNHomePageGuideView.swift in Sources */, |
| @@ -1227,6 +1232,7 @@ | @@ -1227,6 +1232,7 @@ | ||
| 1227 | 798A44F92A30835400815935 /* CNLiveHelpFeedBackViewController.swift in Sources */, | 1232 | 798A44F92A30835400815935 /* CNLiveHelpFeedBackViewController.swift in Sources */, |
| 1228 | 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */, | 1233 | 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */, |
| 1229 | 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */, | 1234 | 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */, |
| 1235 | + 794FF1092B02131300385E85 /* CNLiveFileManager.swift in Sources */, | ||
| 1230 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */, | 1236 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */, |
| 1231 | 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */, | 1237 | 19FA201B2AE60423001F7186 /* CNLiveDownSlideModelLayout.swift in Sources */, |
| 1232 | 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */, | 1238 | 7C4931312A2F142F000E44B4 /* CNHomePageBackgroupView.swift in Sources */, |
| @@ -1235,6 +1241,7 @@ | @@ -1235,6 +1241,7 @@ | ||
| 1235 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, | 1241 | 19CC4D562ADD19C200308E2A /* String+Extension.swift in Sources */, |
| 1236 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, | 1242 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, |
| 1237 | 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */, | 1243 | 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */, |
| 1244 | + 794FF1052B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift in Sources */, | ||
| 1238 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, | 1245 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, |
| 1239 | 791C1C882AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift in Sources */, | 1246 | 791C1C882AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift in Sources */, |
| 1240 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, | 1247 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, |
| @@ -1255,6 +1262,7 @@ | @@ -1255,6 +1262,7 @@ | ||
| 1255 | 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */, | 1262 | 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */, |
| 1256 | 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */, | 1263 | 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */, |
| 1257 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, | 1264 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, |
| 1265 | + 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */, | ||
| 1258 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, | 1266 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, |
| 1259 | 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */, | 1267 | 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */, |
| 1260 | 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */, | 1268 | 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */, |
| @@ -1443,7 +1451,7 @@ | @@ -1443,7 +1451,7 @@ | ||
| 1443 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | 1451 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 1444 | CLANG_ENABLE_MODULES = YES; | 1452 | CLANG_ENABLE_MODULES = YES; |
| 1445 | CODE_SIGN_STYLE = Automatic; | 1453 | CODE_SIGN_STYLE = Automatic; |
| 1446 | - CURRENT_PROJECT_VERSION = 1.0.1.23.11.10.17; | 1454 | + CURRENT_PROJECT_VERSION = 1.0.1.23.11.13.10; |
| 1447 | DEVELOPMENT_TEAM = 94X49GG3ZW; | 1455 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 1448 | EXCLUDED_ARCHS = ""; | 1456 | EXCLUDED_ARCHS = ""; |
| 1449 | GENERATE_INFOPLIST_FILE = YES; | 1457 | GENERATE_INFOPLIST_FILE = YES; |
| @@ -1488,7 +1496,7 @@ | @@ -1488,7 +1496,7 @@ | ||
| 1488 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | 1496 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 1489 | CLANG_ENABLE_MODULES = YES; | 1497 | CLANG_ENABLE_MODULES = YES; |
| 1490 | CODE_SIGN_STYLE = Automatic; | 1498 | CODE_SIGN_STYLE = Automatic; |
| 1491 | - CURRENT_PROJECT_VERSION = 1.0.1.23.11.10.17; | 1499 | + CURRENT_PROJECT_VERSION = 1.0.1.23.11.13.10; |
| 1492 | DEVELOPMENT_TEAM = 94X49GG3ZW; | 1500 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 1493 | EXCLUDED_ARCHS = ""; | 1501 | EXCLUDED_ARCHS = ""; |
| 1494 | GENERATE_INFOPLIST_FILE = YES; | 1502 | GENERATE_INFOPLIST_FILE = YES; |
metaCode/Classes/Common/Util/CNLiveCommonBaseModel.swift
| @@ -8,21 +8,10 @@ | @@ -8,21 +8,10 @@ | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | import UIKit | 9 | import UIKit |
| 10 | import HandyJSON | 10 | import HandyJSON |
| 11 | -import WCDBSwift | ||
| 12 | 11 | ||
| 13 | class BaseModel: HandyJSON { | 12 | class BaseModel: HandyJSON { |
| 14 | 13 | ||
| 15 | -// var database:Database | ||
| 16 | - | ||
| 17 | - required init() { | ||
| 18 | - //数据库地址 | ||
| 19 | -// let filePath = NSHomeDirectory() + "/Documents/DB/CNLiveBaseModel.db" | ||
| 20 | -// database = Database(at: filePath) | ||
| 21 | - | ||
| 22 | -// super.init() | ||
| 23 | - | ||
| 24 | -// try database.create(table: NSStringFromClass(self), of: BaseModel.self) | ||
| 25 | - } | 14 | + required init() {} |
| 26 | 15 | ||
| 27 | func mapping(mapper: HelpingMapper) { | 16 | func mapping(mapper: HelpingMapper) { |
| 28 | 17 |
metaCode/Classes/Config/Database/CNLiveFileManager.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveFileManager.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/13. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | + | ||
| 10 | +class CNLiveFileManager: NSObject { | ||
| 11 | + | ||
| 12 | + static let shared = CNLiveFileManager.init() | ||
| 13 | + | ||
| 14 | + open func save(object: Any, key: String) { | ||
| 15 | + var temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 16 | + if (temp_dic == nil) { | ||
| 17 | + temp_dic = NSMutableDictionary.init() | ||
| 18 | + } | ||
| 19 | + temp_dic?.setObject(object, forKey: key as NSCopying) | ||
| 20 | + temp_dic?.write(toFile: userFileDir+"storage.plist", atomically: true) | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + open func take(key: String) -> Any { | ||
| 24 | + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 25 | + if (temp_dic == nil) { | ||
| 26 | + return NSMutableDictionary() | ||
| 27 | + } | ||
| 28 | + return temp_dic?.object(forKey: key) as Any | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + open func takeAll() -> NSDictionary { | ||
| 32 | + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 33 | + if (temp_dic == nil) { | ||
| 34 | + return NSMutableDictionary() | ||
| 35 | + } | ||
| 36 | + return temp_dic ?? NSDictionary() | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + open func resetAllSave() { | ||
| 40 | + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 41 | + if temp_dic != nil { | ||
| 42 | + temp_dic?.removeAllObjects() | ||
| 43 | + temp_dic?.write(toFile: userFileDir+"storage.plist", atomically: true) | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + open func delete(key: String) { | ||
| 48 | + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 49 | + if temp_dic != nil { | ||
| 50 | + temp_dic?.removeObject(forKey: key) | ||
| 51 | + temp_dic?.write(toFile: userFileDir+"storage.plist", atomically: true) | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + private lazy var userFileDir: String = { | ||
| 56 | + let userFileDir = NSString() | ||
| 57 | + var path: String = "" | ||
| 58 | + path = "\(fileDir)/userId_\(UserInfoManager.shared.userInfo.uid)/" | ||
| 59 | + let fileManager = FileManager.default | ||
| 60 | + var isDir: ObjCBool = false | ||
| 61 | + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir) | ||
| 62 | + if !(isDir.boolValue && exist) { | ||
| 63 | + do { | ||
| 64 | + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true) | ||
| 65 | + } catch { | ||
| 66 | + debugPrint("文件目录创建失败") | ||
| 67 | + return "" | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + return path as String | ||
| 71 | + }() | ||
| 72 | + | ||
| 73 | + private lazy var fileDir: String = { | ||
| 74 | + let path = "\(NSHomeDirectory())/Documents/metaCode" | ||
| 75 | + let fileManager = FileManager.default | ||
| 76 | + var isDir: ObjCBool = false | ||
| 77 | + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir) | ||
| 78 | + if !(isDir.boolValue && exist) { | ||
| 79 | + do { | ||
| 80 | + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true) | ||
| 81 | + } catch { | ||
| 82 | + debugPrint("文件目录创建失败") | ||
| 83 | + return "" | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + return path as String | ||
| 87 | + }() | ||
| 88 | + | ||
| 89 | +} |
metaCode/Classes/Config/Database/CNLiveIdentityDB.swift
| @@ -6,131 +6,131 @@ | @@ -6,131 +6,131 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | -import WCDBSwift | ||
| 10 | - | ||
| 11 | -///身份认证表名 | ||
| 12 | -let CNLiveIdentityTableName = "CNLiveIdentityTable" | ||
| 13 | - | ||
| 14 | -///身份model | ||
| 15 | -final class CNLiveIdentityModel: BaseModel,TableCodable { | ||
| 16 | - var id: String = ""//ID号 | ||
| 17 | - var name: String? = ""//名称 | ||
| 18 | - var icon: String? = ""//小圆图标 | ||
| 19 | - var createTime: String? = ""//注册时间 | ||
| 20 | - var enable: Bool?//没用 | ||
| 21 | - var backgroundImg:String? = ""//首页背景图 | ||
| 22 | - var backgroundColor:String? = ""//添加身份按钮背景色 | ||
| 23 | - var description:String? = ""//首页身份说明描述 | ||
| 24 | - var auth: Bool?//身份是否验证 | ||
| 25 | - | ||
| 26 | - enum CodingKeys: String, CodingTableKey { | ||
| 27 | - typealias Root = CNLiveIdentityModel | ||
| 28 | - static let objectRelationalMapping = TableBinding(CodingKeys.self){ | ||
| 29 | - //设置表的主键key为id,用来区分数据唯一性, 如果id为int类型,可以按实现按顺序递增 | ||
| 30 | - BindColumnConstraint(id, isPrimary: true) | ||
| 31 | - } | ||
| 32 | - case id //不修改数据库字段名,和属性名保持一直 | ||
| 33 | - case name //不修改数据库字段名,和属性名保持一直 | ||
| 34 | - case icon | ||
| 35 | - case createTime | ||
| 36 | - case enable | ||
| 37 | - case backgroundImg | ||
| 38 | - case backgroundColor | ||
| 39 | - case description | ||
| 40 | - case auth | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | -} | ||
| 44 | - | ||
| 45 | -///身份列表数据库 | ||
| 46 | -class CNLiveIdentityDB :NSObject{ | ||
| 47 | - | ||
| 48 | - ///数据库 | ||
| 49 | - var database:Database | ||
| 50 | - | ||
| 51 | - //重新init方法为私有,不让外部调用 | ||
| 52 | - override init() { | ||
| 53 | - | ||
| 54 | - //数据库地址 | ||
| 55 | - let filePath = NSHomeDirectory() + "/Documents/DB/CNLiveIdentity.db" | ||
| 56 | - database = Database(at: filePath) | ||
| 57 | - | ||
| 58 | - super.init() | ||
| 59 | - self.createTable(name: CNLiveIdentityTableName, classType: CNLiveIdentityModel.self) | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - /// 创建表 | ||
| 63 | - /// - Parameters: | ||
| 64 | - /// - name: 表名 | ||
| 65 | - /// - classType: class类型,当前class需要实现 TableCodable | ||
| 66 | - private func createTable<Root:TableDecodable>(name:String, classType: Root.Type){ | ||
| 67 | - do{ | ||
| 68 | - try database.create(table: name, of: classType) | ||
| 69 | - }catch{ | ||
| 70 | - print("创建失败") | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - /// 新增一条数据 | ||
| 76 | - /// - Parameter object: 数据 | ||
| 77 | - func insterObject(object: CNLiveIdentityModel){ | ||
| 78 | - let array: [CNLiveIdentityModel] = [object] | ||
| 79 | - self.insterObjects(objects: array) | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - ///新增多条数据 | ||
| 83 | - func insterObjects(objects: Array<CNLiveIdentityModel>){ | ||
| 84 | - do{ | ||
| 85 | - try database.insert(objects, intoTable: CNLiveIdentityTableName) | ||
| 86 | - }catch{ | ||
| 87 | - print("增加一条数据失败") | ||
| 88 | - } | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - /// 删除一条数据 | ||
| 92 | - /// - Parameter delete: 被删除的数据 | ||
| 93 | - func deleteObject(delete: CNLiveIdentityModel){ | ||
| 94 | - | ||
| 95 | - do{ | ||
| 96 | - try database.delete(fromTable: CNLiveIdentityTableName, where: CNLiveIdentityModel.Properties.id == delete.id) | ||
| 97 | - } | ||
| 98 | - catch{ | ||
| 99 | - print("删除一条数据失败") | ||
| 100 | - } | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - ///更新一条数据 | ||
| 104 | - func updateObject(newObject:CNLiveIdentityModel){ | ||
| 105 | - do{ | ||
| 106 | - //需要更新的字段 | ||
| 107 | - let updateProperties = [CNLiveIdentityModel.Properties.name, | ||
| 108 | - CNLiveIdentityModel.Properties.icon, | ||
| 109 | - CNLiveIdentityModel.Properties.createTime, | ||
| 110 | - CNLiveIdentityModel.Properties.enable] | ||
| 111 | - | ||
| 112 | - try database.update(table: CNLiveIdentityTableName, on:updateProperties, with: newObject,where: CNLiveIdentityModel.Properties.id == newObject.id) | ||
| 113 | - } | ||
| 114 | - catch{ | ||
| 115 | - print("更新一条数据失败") | ||
| 116 | - } | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - ///获取所有数据 | ||
| 120 | - func searchAllObject()-> Array<CNLiveIdentityModel>{ | ||
| 121 | - do{ | ||
| 122 | - let allData: [CNLiveIdentityModel] = try database.getObjects(fromTable: CNLiveIdentityTableName) | ||
| 123 | - return allData | ||
| 124 | - } | ||
| 125 | - catch{ | ||
| 126 | - print("获取失败") | ||
| 127 | - return [] | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | -} | 9 | +//import WCDBSwift |
| 10 | +// | ||
| 11 | +/////身份认证表名 | ||
| 12 | +//let CNLiveIdentityTableName = "CNLiveIdentityTable" | ||
| 13 | +// | ||
| 14 | +/////身份model | ||
| 15 | +//final class CNLiveIdentityModel: BaseModel,TableCodable { | ||
| 16 | +// var id: String = ""//ID号 | ||
| 17 | +// var name: String? = ""//名称 | ||
| 18 | +// var icon: String? = ""//小圆图标 | ||
| 19 | +// var createTime: String? = ""//注册时间 | ||
| 20 | +// var enable: Bool?//没用 | ||
| 21 | +// var backgroundImg:String? = ""//首页背景图 | ||
| 22 | +// var backgroundColor:String? = ""//添加身份按钮背景色 | ||
| 23 | +// var description:String? = ""//首页身份说明描述 | ||
| 24 | +// var auth: Bool?//身份是否验证 | ||
| 25 | +// | ||
| 26 | +// enum CodingKeys: String, CodingTableKey { | ||
| 27 | +// typealias Root = CNLiveIdentityModel | ||
| 28 | +// static let objectRelationalMapping = TableBinding(CodingKeys.self){ | ||
| 29 | +// //设置表的主键key为id,用来区分数据唯一性, 如果id为int类型,可以按实现按顺序递增 | ||
| 30 | +// BindColumnConstraint(id, isPrimary: true) | ||
| 31 | +// } | ||
| 32 | +// case id //不修改数据库字段名,和属性名保持一直 | ||
| 33 | +// case name //不修改数据库字段名,和属性名保持一直 | ||
| 34 | +// case icon | ||
| 35 | +// case createTime | ||
| 36 | +// case enable | ||
| 37 | +// case backgroundImg | ||
| 38 | +// case backgroundColor | ||
| 39 | +// case description | ||
| 40 | +// case auth | ||
| 41 | +// } | ||
| 42 | +// | ||
| 43 | +//} | ||
| 44 | +// | ||
| 45 | +/////身份列表数据库 | ||
| 46 | +//class CNLiveIdentityDB :NSObject{ | ||
| 47 | +// | ||
| 48 | +// ///数据库 | ||
| 49 | +// var database:Database | ||
| 50 | +// | ||
| 51 | +// //重新init方法为私有,不让外部调用 | ||
| 52 | +// override init() { | ||
| 53 | +// | ||
| 54 | +// //数据库地址 | ||
| 55 | +// let filePath = NSHomeDirectory() + "/Documents/DB/CNLiveIdentity.db" | ||
| 56 | +// database = Database(at: filePath) | ||
| 57 | +// | ||
| 58 | +// super.init() | ||
| 59 | +// self.createTable(name: CNLiveIdentityTableName, classType: CNLiveIdentityModel.self) | ||
| 60 | +// } | ||
| 61 | +// | ||
| 62 | +// /// 创建表 | ||
| 63 | +// /// - Parameters: | ||
| 64 | +// /// - name: 表名 | ||
| 65 | +// /// - classType: class类型,当前class需要实现 TableCodable | ||
| 66 | +// private func createTable<Root:TableDecodable>(name:String, classType: Root.Type){ | ||
| 67 | +// do{ | ||
| 68 | +// try database.create(table: name, of: classType) | ||
| 69 | +// }catch{ | ||
| 70 | +// print("创建失败") | ||
| 71 | +// } | ||
| 72 | +// | ||
| 73 | +// } | ||
| 74 | +// | ||
| 75 | +// /// 新增一条数据 | ||
| 76 | +// /// - Parameter object: 数据 | ||
| 77 | +// func insterObject(object: CNLiveIdentityModel){ | ||
| 78 | +// let array: [CNLiveIdentityModel] = [object] | ||
| 79 | +// self.insterObjects(objects: array) | ||
| 80 | +// } | ||
| 81 | +// | ||
| 82 | +// ///新增多条数据 | ||
| 83 | +// func insterObjects(objects: Array<CNLiveIdentityModel>){ | ||
| 84 | +// do{ | ||
| 85 | +// try database.insert(objects, intoTable: CNLiveIdentityTableName) | ||
| 86 | +// }catch{ | ||
| 87 | +// print("增加一条数据失败") | ||
| 88 | +// } | ||
| 89 | +// } | ||
| 90 | +// | ||
| 91 | +// /// 删除一条数据 | ||
| 92 | +// /// - Parameter delete: 被删除的数据 | ||
| 93 | +// func deleteObject(delete: CNLiveIdentityModel){ | ||
| 94 | +// | ||
| 95 | +// do{ | ||
| 96 | +// try database.delete(fromTable: CNLiveIdentityTableName, where: CNLiveIdentityModel.Properties.id == delete.id) | ||
| 97 | +// } | ||
| 98 | +// catch{ | ||
| 99 | +// print("删除一条数据失败") | ||
| 100 | +// } | ||
| 101 | +// } | ||
| 102 | +// | ||
| 103 | +// ///更新一条数据 | ||
| 104 | +// func updateObject(newObject:CNLiveIdentityModel){ | ||
| 105 | +// do{ | ||
| 106 | +// //需要更新的字段 | ||
| 107 | +// let updateProperties = [CNLiveIdentityModel.Properties.name, | ||
| 108 | +// CNLiveIdentityModel.Properties.icon, | ||
| 109 | +// CNLiveIdentityModel.Properties.createTime, | ||
| 110 | +// CNLiveIdentityModel.Properties.enable] | ||
| 111 | +// | ||
| 112 | +// try database.update(table: CNLiveIdentityTableName, on:updateProperties, with: newObject,where: CNLiveIdentityModel.Properties.id == newObject.id) | ||
| 113 | +// } | ||
| 114 | +// catch{ | ||
| 115 | +// print("更新一条数据失败") | ||
| 116 | +// } | ||
| 117 | +// } | ||
| 118 | +// | ||
| 119 | +// ///获取所有数据 | ||
| 120 | +// func searchAllObject()-> Array<CNLiveIdentityModel>{ | ||
| 121 | +// do{ | ||
| 122 | +// let allData: [CNLiveIdentityModel] = try database.getObjects(fromTable: CNLiveIdentityTableName) | ||
| 123 | +// return allData | ||
| 124 | +// } | ||
| 125 | +// catch{ | ||
| 126 | +// print("获取失败") | ||
| 127 | +// return [] | ||
| 128 | +// } | ||
| 129 | +// | ||
| 130 | +// | ||
| 131 | +// } | ||
| 132 | +// | ||
| 133 | +//} | ||
| 134 | 134 | ||
| 135 | 135 | ||
| 136 | 136 |
metaCode/Classes/Config/Database/CNLiveSaveAuthDB.swift
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | -import WCDBSwift | 9 | +//import WCDBSwift |
| 10 | 10 | ||
| 11 | ///身份认证表名 | 11 | ///身份认证表名 |
| 12 | let CNLiveAuthListTableName = "CNLiveAuthListTable" | 12 | let CNLiveAuthListTableName = "CNLiveAuthListTable" |
| @@ -14,154 +14,211 @@ let CNLiveAuthListTableName = "CNLiveAuthListTable" | @@ -14,154 +14,211 @@ let CNLiveAuthListTableName = "CNLiveAuthListTable" | ||
| 14 | class CNLiveSaveAuthDB : NSObject{ | 14 | class CNLiveSaveAuthDB : NSObject{ |
| 15 | 15 | ||
| 16 | ///数据库 | 16 | ///数据库 |
| 17 | - var database: Database | 17 | +// var database: Database |
| 18 | 18 | ||
| 19 | static let shared = CNLiveSaveAuthDB() | 19 | static let shared = CNLiveSaveAuthDB() |
| 20 | 20 | ||
| 21 | //重新init方法为私有,不让外部调用 | 21 | //重新init方法为私有,不让外部调用 |
| 22 | - private override init() { | ||
| 23 | - //数据库地址 | ||
| 24 | - let filePath = NSHomeDirectory() + "/Documents/DB"+UserInfoManager.shared.userInfo.uid+"/CNLiveAuthListTable.db" | ||
| 25 | - database = Database(at: filePath) | ||
| 26 | - | ||
| 27 | - super.init() | ||
| 28 | - do { | ||
| 29 | - try database.create(table: CNLiveAuthListTableName, of: MineAuthListModel.self) | ||
| 30 | - } catch { | ||
| 31 | - print("创建失败") | ||
| 32 | - } | ||
| 33 | - } | 22 | +// private override init() { |
| 23 | +// //数据库地址 | ||
| 24 | +// let filePath = NSHomeDirectory() + "/Documents/DB"+UserInfoManager.shared.userInfo.uid+"/CNLiveAuthListTable.db" | ||
| 25 | +// database = Database(at: filePath) | ||
| 26 | +// | ||
| 27 | +// super.init() | ||
| 28 | +// do { | ||
| 29 | +// try database.create(table: CNLiveAuthListTableName, of: MineAuthListModel.self) | ||
| 30 | +// } catch { | ||
| 31 | +// print("创建失败") | ||
| 32 | +// } | ||
| 33 | +// } | ||
| 34 | 34 | ||
| 35 | /// 新增一条数据 | 35 | /// 新增一条数据 |
| 36 | /// - Parameter object: 数据 | 36 | /// - Parameter object: 数据 |
| 37 | - func insterObject(object: MineAuthListModel){ | ||
| 38 | - let array: [MineAuthListModel] = [object] | ||
| 39 | - do{ | ||
| 40 | - try database.insert(array, intoTable: CNLiveAuthListTableName) | ||
| 41 | - }catch{ | ||
| 42 | - print("增加一条数据失败") | ||
| 43 | - } | 37 | + func insterObject(object: MineAuthListModel) { |
| 38 | +// let array: [MineAuthListModel] = [object] | ||
| 39 | +// do{ | ||
| 40 | +// try database.insert(array, intoTable: CNLiveAuthListTableName) | ||
| 41 | +// }catch{ | ||
| 42 | +// print("增加一条数据失败") | ||
| 43 | +// } | ||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /// 批量增加数据 | 46 | /// 批量增加数据 |
| 47 | /// - Parameter objects: 数据组 | 47 | /// - Parameter objects: 数据组 |
| 48 | func insertObjects(objects: [MineAuthListModel]) { | 48 | func insertObjects(objects: [MineAuthListModel]) { |
| 49 | - if objects.count > 0 { | ||
| 50 | - do{ | ||
| 51 | - for model in objects { | ||
| 52 | - let m = model | ||
| 53 | - print("插入时的数据结构===>\(m.identityId)") | ||
| 54 | - } | ||
| 55 | - try database.insert(objects, intoTable: CNLiveAuthListTableName) | ||
| 56 | - }catch{ | ||
| 57 | - print("增加一条数据失败") | ||
| 58 | - } | ||
| 59 | - }else{ | ||
| 60 | - print("数据为空") | 49 | + |
| 50 | + var temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 51 | + if (temp_dic == nil) { | ||
| 52 | + temp_dic = NSMutableDictionary.init() | ||
| 61 | } | 53 | } |
| 54 | + for item in objects { | ||
| 55 | + temp_dic?.setObject((item.toJSON() ?? Dictionary()) as Dictionary, forKey: CNLiveAuthListTableName+"\(item.identityId)" as NSCopying) | ||
| 56 | + } | ||
| 57 | + temp_dic?.write(toFile: userFileDir+"storage.plist", atomically: true) | ||
| 58 | + | ||
| 59 | +// if objects.count > 0 { | ||
| 60 | +// do{ | ||
| 61 | +// for model in objects { | ||
| 62 | +// let m = model | ||
| 63 | +// print("插入时的数据结构===>\(m.identityId)") | ||
| 64 | +// } | ||
| 65 | +// try database.insert(objects, intoTable: CNLiveAuthListTableName) | ||
| 66 | +// }catch{ | ||
| 67 | +// print("增加一条数据失败") | ||
| 68 | +// } | ||
| 69 | +// }else{ | ||
| 70 | +// print("数据为空") | ||
| 71 | +// } | ||
| 62 | } | 72 | } |
| 63 | 73 | ||
| 64 | /// 删除一条数据 | 74 | /// 删除一条数据 |
| 65 | /// - Parameter delete: 被删除的数据 | 75 | /// - Parameter delete: 被删除的数据 |
| 66 | func deleteObject(delete: MineAuthListModel){ | 76 | func deleteObject(delete: MineAuthListModel){ |
| 67 | 77 | ||
| 68 | - do{ | ||
| 69 | - try database.delete(fromTable: CNLiveAuthListTableName, where: MineAuthListModel.Properties.identityId == delete.identityId) | ||
| 70 | - }catch{ | ||
| 71 | - print("删除一条数据失败") | ||
| 72 | - } | 78 | +// do{ |
| 79 | +// try database.delete(fromTable: CNLiveAuthListTableName, where: MineAuthListModel.Properties.identityId == delete.identityId) | ||
| 80 | +// }catch{ | ||
| 81 | +// print("删除一条数据失败") | ||
| 82 | +// } | ||
| 73 | } | 83 | } |
| 74 | 84 | ||
| 75 | /// 删除本地所有数据 | 85 | /// 删除本地所有数据 |
| 76 | func deleteAllObjects() { | 86 | func deleteAllObjects() { |
| 77 | - do { | ||
| 78 | - try database.delete(fromTable: CNLiveAuthListTableName) | ||
| 79 | - } catch { | ||
| 80 | - print("数据删除失败") | ||
| 81 | - } | 87 | +// do { |
| 88 | +// try database.delete(fromTable: CNLiveAuthListTableName) | ||
| 89 | +// } catch { | ||
| 90 | +// print("数据删除失败") | ||
| 91 | +// } | ||
| 82 | } | 92 | } |
| 83 | 93 | ||
| 84 | 94 | ||
| 85 | /// 更新一条数据 | 95 | /// 更新一条数据 |
| 86 | /// - Parameter newObject: 更新的数据源 | 96 | /// - Parameter newObject: 更新的数据源 |
| 87 | func updateObject(newObject: MineAuthListModel) { | 97 | func updateObject(newObject: MineAuthListModel) { |
| 88 | - do{ | ||
| 89 | - //需要更新的字段 | ||
| 90 | - let updateProperties = [MineAuthListModel.Properties.name, | ||
| 91 | - MineAuthListModel.Properties.icon, | ||
| 92 | - MineAuthListModel.Properties.cardImg, | ||
| 93 | - MineAuthListModel.Properties.authTime, | ||
| 94 | - MineAuthListModel.Properties.code, | ||
| 95 | - MineAuthListModel.Properties.userStatus,] | ||
| 96 | - | ||
| 97 | - try database.update(table: CNLiveAuthListTableName, on:updateProperties, with: newObject,where: MineAuthListModel.Properties.identityId == newObject.identityId) | ||
| 98 | - }catch{ | ||
| 99 | - print("更新一条数据失败") | ||
| 100 | - } | 98 | +// do{ |
| 99 | +// //需要更新的字段 | ||
| 100 | +// let updateProperties = [MineAuthListModel.Properties.name, | ||
| 101 | +// MineAuthListModel.Properties.icon, | ||
| 102 | +// MineAuthListModel.Properties.cardImg, | ||
| 103 | +// MineAuthListModel.Properties.authTime, | ||
| 104 | +// MineAuthListModel.Properties.code, | ||
| 105 | +// MineAuthListModel.Properties.userStatus,] | ||
| 106 | +// | ||
| 107 | +// try database.update(table: CNLiveAuthListTableName, on:updateProperties, with: newObject,where: MineAuthListModel.Properties.identityId == newObject.identityId) | ||
| 108 | +// }catch{ | ||
| 109 | +// print("更新一条数据失败") | ||
| 110 | +// } | ||
| 101 | } | 111 | } |
| 102 | 112 | ||
| 103 | /// 更新多条数据 | 113 | /// 更新多条数据 |
| 104 | /// - Parameter newObjects: 新数据数组 | 114 | /// - Parameter newObjects: 新数据数组 |
| 105 | func updateObjects(newObjects: [MineAuthListModel]) { | 115 | func updateObjects(newObjects: [MineAuthListModel]) { |
| 106 | - do { | ||
| 107 | - let tempArray = NSMutableArray() | ||
| 108 | - for _ in newObjects { | ||
| 109 | - //需要更新的字段 | ||
| 110 | - let updateProperties = [MineAuthListModel.Properties.name, | ||
| 111 | - MineAuthListModel.Properties.icon, | ||
| 112 | - MineAuthListModel.Properties.cardImg, | ||
| 113 | - MineAuthListModel.Properties.authTime, | ||
| 114 | - MineAuthListModel.Properties.code, | ||
| 115 | - MineAuthListModel.Properties.userStatus,] | ||
| 116 | - tempArray.add(updateProperties) | ||
| 117 | - } | ||
| 118 | - try database.update(table: CNLiveAuthListTableName, on: tempArray as! [PropertyConvertible], with: newObjects) | ||
| 119 | - } catch { | ||
| 120 | - print("更新多条数据失败") | ||
| 121 | - } | 116 | +// do { |
| 117 | +// let tempArray = NSMutableArray() | ||
| 118 | +// for _ in newObjects { | ||
| 119 | +// //需要更新的字段 | ||
| 120 | +// let updateProperties = [MineAuthListModel.Properties.name, | ||
| 121 | +// MineAuthListModel.Properties.icon, | ||
| 122 | +// MineAuthListModel.Properties.cardImg, | ||
| 123 | +// MineAuthListModel.Properties.authTime, | ||
| 124 | +// MineAuthListModel.Properties.code, | ||
| 125 | +// MineAuthListModel.Properties.userStatus,] | ||
| 126 | +// tempArray.add(updateProperties) | ||
| 127 | +// } | ||
| 128 | +// try database.update(table: CNLiveAuthListTableName, on: tempArray as! [PropertyConvertible], with: newObjects) | ||
| 129 | +// } catch { | ||
| 130 | +// print("更新多条数据失败") | ||
| 131 | +// } | ||
| 122 | } | 132 | } |
| 123 | 133 | ||
| 124 | 134 | ||
| 125 | /// 获取所有数据 | 135 | /// 获取所有数据 |
| 126 | /// - Returns: 返回查找的所以数据 | 136 | /// - Returns: 返回查找的所以数据 |
| 127 | func searchAllObject() -> Array<MineAuthListModel>{ | 137 | func searchAllObject() -> Array<MineAuthListModel>{ |
| 128 | - do{ | ||
| 129 | - let allData: [MineAuthListModel] = try database.getObjects(fromTable: CNLiveAuthListTableName) | ||
| 130 | - return allData | ||
| 131 | - }catch{ | ||
| 132 | - print("获取失败") | ||
| 133 | - return [] | 138 | + |
| 139 | + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 140 | + if (temp_dic == nil) { | ||
| 141 | + return Array() | ||
| 134 | } | 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 | +// } | ||
| 135 | } | 157 | } |
| 136 | 158 | ||
| 137 | /// 获取所有数据唯一值id | 159 | /// 获取所有数据唯一值id |
| 138 | /// - Returns: 返回查找的所以数据 | 160 | /// - Returns: 返回查找的所以数据 |
| 139 | - func searchAllObjectId() -> Array<String>{ | ||
| 140 | - do{ | ||
| 141 | - let allData: [MineAuthListModel] = try database.getObjects(fromTable: CNLiveAuthListTableName) | ||
| 142 | - let tempArray = NSMutableArray.init() | ||
| 143 | - for item in allData { | ||
| 144 | - print("数据库查找之后数据==>\(item.identityId)") | ||
| 145 | - tempArray.add(item.identityId) | ||
| 146 | - } | ||
| 147 | - return tempArray as! Array<String> | ||
| 148 | - }catch{ | ||
| 149 | - print("获取失败") | ||
| 150 | - return [] | ||
| 151 | - } | ||
| 152 | - } | 161 | +// func searchAllObjectId() -> Array<String>{ |
| 162 | +// do{ | ||
| 163 | +// let allData: [MineAuthListModel] = try database.getObjects(fromTable: CNLiveAuthListTableName) | ||
| 164 | +// let tempArray = NSMutableArray.init() | ||
| 165 | +// for item in allData { | ||
| 166 | +// print("数据库查找之后数据==>\(item.identityId)") | ||
| 167 | +// tempArray.add(item.identityId) | ||
| 168 | +// } | ||
| 169 | +// return tempArray as! Array<String> | ||
| 170 | +// }catch{ | ||
| 171 | +// print("获取失败") | ||
| 172 | +// return [] | ||
| 173 | +// } | ||
| 174 | +// } | ||
| 153 | 175 | ||
| 154 | /// 通过id获取特定数据 | 176 | /// 通过id获取特定数据 |
| 155 | /// - Parameter identityId: id | 177 | /// - Parameter identityId: id |
| 156 | /// - Returns: 返回查找的数据 | 178 | /// - Returns: 返回查找的数据 |
| 157 | - func searchOneObject(identityId: String) -> MineAuthListModel{ | ||
| 158 | - do { | ||
| 159 | - let searchPropertie = [MineAuthListModel.Properties.identityId] | ||
| 160 | - let array: [MineAuthListModel] = try database.getObjects(on: searchPropertie, fromTable: CNLiveAuthListTableName, where: MineAuthListModel.Properties.identityId == identityId) | ||
| 161 | - return array.count > 0 ? array.first! : MineAuthListModel.init() | ||
| 162 | - } catch { | ||
| 163 | - print("获取失败") | ||
| 164 | - return MineAuthListModel.init() | 179 | +// func searchOneObject(identityId: String) -> MineAuthListModel{ |
| 180 | +// do { | ||
| 181 | +// let searchPropertie = [MineAuthListModel.Properties.identityId] | ||
| 182 | +// let array: [MineAuthListModel] = try database.getObjects(on: searchPropertie, fromTable: CNLiveAuthListTableName, where: MineAuthListModel.Properties.identityId == identityId) | ||
| 183 | +// return array.count > 0 ? array.first! : MineAuthListModel.init() | ||
| 184 | +// } catch { | ||
| 185 | +// print("获取失败") | ||
| 186 | +// return MineAuthListModel.init() | ||
| 187 | +// } | ||
| 188 | +// } | ||
| 189 | + | ||
| 190 | + | ||
| 191 | + private lazy var userFileDir: String = { | ||
| 192 | + let userFileDir = NSString() | ||
| 193 | + var path: String = "" | ||
| 194 | + path = "\(fileDir)/userId_\(UserInfoManager.shared.userInfo.uid)/" | ||
| 195 | + let fileManager = FileManager.default | ||
| 196 | + var isDir: ObjCBool = false | ||
| 197 | + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir) | ||
| 198 | + if !(isDir.boolValue && exist) { | ||
| 199 | + do { | ||
| 200 | + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true) | ||
| 201 | + } catch { | ||
| 202 | + debugPrint("文件目录创建失败") | ||
| 203 | + return "" | ||
| 204 | + } | ||
| 165 | } | 205 | } |
| 166 | - } | 206 | + return path as String |
| 207 | + }() | ||
| 208 | + | ||
| 209 | + private lazy var fileDir: String = { | ||
| 210 | + let path = "\(NSHomeDirectory())/Documents/metaCode/saveAuth" | ||
| 211 | + let fileManager = FileManager.default | ||
| 212 | + var isDir: ObjCBool = false | ||
| 213 | + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir) | ||
| 214 | + if !(isDir.boolValue && exist) { | ||
| 215 | + do { | ||
| 216 | + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true) | ||
| 217 | + } catch { | ||
| 218 | + debugPrint("文件目录创建失败") | ||
| 219 | + return "" | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + return path as String | ||
| 223 | + }() | ||
| 167 | } | 224 | } |
metaCode/Classes/Config/Database/CNLiveSaveStandDB.swift
| @@ -6,169 +6,226 @@ | @@ -6,169 +6,226 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | -import WCDBSwift | 9 | +//import WCDBSwift |
| 10 | 10 | ||
| 11 | ///身份列表表名 identityApi/allList 接口数据存储 | 11 | ///身份列表表名 identityApi/allList 接口数据存储 |
| 12 | let CNLiveStandListTableName = "CNLiveStandListTableName" | 12 | let CNLiveStandListTableName = "CNLiveStandListTableName" |
| 13 | class CNLiveSaveStandDB: NSObject { | 13 | class CNLiveSaveStandDB: NSObject { |
| 14 | 14 | ||
| 15 | ///数据库 | 15 | ///数据库 |
| 16 | - var database: Database | 16 | +// var database: Database |
| 17 | 17 | ||
| 18 | static let shared = CNLiveSaveStandDB() | 18 | static let shared = CNLiveSaveStandDB() |
| 19 | 19 | ||
| 20 | - //重新init方法为私有,不让外部调用 | ||
| 21 | - private override init() { | ||
| 22 | - //数据库地址 | ||
| 23 | - let filePath = NSHomeDirectory() + "/Documents/DB"+UserInfoManager.shared.userInfo.uid+"/CNLiveStandListTableName.db" | ||
| 24 | - database = Database(at: filePath) | ||
| 25 | - | ||
| 26 | - super.init() | ||
| 27 | - do { | ||
| 28 | - try database.create(table: CNLiveStandListTableName, of: StandListModel.self) | ||
| 29 | - } catch { | ||
| 30 | - print("创建失败") | ||
| 31 | - } | ||
| 32 | - } | 20 | +// //重新init方法为私有,不让外部调用 |
| 21 | +// private override init() { | ||
| 22 | +// //数据库地址 | ||
| 23 | +// let filePath = NSHomeDirectory() + "/Documents/DB"+UserInfoManager.shared.userInfo.uid+"/CNLiveStandListTableName.db" | ||
| 24 | +// database = Database(at: filePath) | ||
| 25 | +// | ||
| 26 | +// super.init() | ||
| 27 | +// do { | ||
| 28 | +// try database.create(table: CNLiveStandListTableName, of: StandListModel.self) | ||
| 29 | +// } catch { | ||
| 30 | +// print("创建失败") | ||
| 31 | +// } | ||
| 32 | +// } | ||
| 33 | 33 | ||
| 34 | /// 新增一条数据 | 34 | /// 新增一条数据 |
| 35 | /// - Parameter object: 数据 | 35 | /// - Parameter object: 数据 |
| 36 | - func insterObject(object: StandListModel){ | ||
| 37 | - let array: [StandListModel] = [object] | ||
| 38 | - do{ | ||
| 39 | - try database.insert(array, intoTable: CNLiveStandListTableName) | ||
| 40 | - }catch{ | ||
| 41 | - print("增加一条数据失败") | ||
| 42 | - } | ||
| 43 | - } | 36 | +// func insterObject(object: StandListModel){ |
| 37 | +// let array: [StandListModel] = [object] | ||
| 38 | +// do{ | ||
| 39 | +// try database.insert(array, intoTable: CNLiveStandListTableName) | ||
| 40 | +// }catch{ | ||
| 41 | +// print("增加一条数据失败") | ||
| 42 | +// } | ||
| 43 | +// } | ||
| 44 | 44 | ||
| 45 | /// 批量增加数据 | 45 | /// 批量增加数据 |
| 46 | /// - Parameter objects: 数据组 | 46 | /// - Parameter objects: 数据组 |
| 47 | func insertObjects(objects: [StandListModel]) { | 47 | func insertObjects(objects: [StandListModel]) { |
| 48 | - if objects.count > 0 { | ||
| 49 | - do{ | ||
| 50 | - try database.insert(objects, intoTable: CNLiveStandListTableName) | ||
| 51 | - }catch{ | ||
| 52 | - print("增加一条数据失败") | ||
| 53 | - } | ||
| 54 | - }else{ | ||
| 55 | - print("数据为空") | 48 | + |
| 49 | + var temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 50 | + if (temp_dic == nil) { | ||
| 51 | + temp_dic = NSMutableDictionary.init() | ||
| 52 | + } | ||
| 53 | + for item in objects { | ||
| 54 | + temp_dic?.setObject((item.toJSON() ?? Dictionary()) as Dictionary, forKey: CNLiveStandListTableName+"\(item.id)" as NSCopying) | ||
| 56 | } | 55 | } |
| 56 | + temp_dic?.write(toFile: userFileDir+"storage.plist", atomically: true) | ||
| 57 | + | ||
| 58 | + | ||
| 59 | +// if objects.count > 0 { | ||
| 60 | +// do{ | ||
| 61 | +// try database.insert(objects, intoTable: CNLiveStandListTableName) | ||
| 62 | +// }catch{ | ||
| 63 | +// print("增加一条数据失败") | ||
| 64 | +// } | ||
| 65 | +// }else{ | ||
| 66 | +// print("数据为空") | ||
| 67 | +// } | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /// 获取所有数据 | ||
| 71 | + /// - Returns: 返回查找的所以数据 | ||
| 72 | + func searchAllObject() -> Array<StandListModel>{ | ||
| 73 | + | ||
| 74 | + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist") | ||
| 75 | + if (temp_dic == nil) { | ||
| 76 | + return Array() | ||
| 77 | + } | ||
| 78 | + let tempArray = NSMutableArray.init() | ||
| 79 | + temp_dic?.allValues.forEach({ value in | ||
| 80 | + let listModel = dictionaryToModel(value as! [String : Any], StandListModel.self,"") | ||
| 81 | + tempArray.add(listModel) | ||
| 82 | + }) | ||
| 83 | + return tempArray as! Array<StandListModel> | ||
| 84 | + | ||
| 85 | +// do{ | ||
| 86 | +// let allData: [StandListModel] = try database.getObjects(fromTable: CNLiveStandListTableName) | ||
| 87 | +// return allData | ||
| 88 | +// }catch{ | ||
| 89 | +// print("获取失败") | ||
| 90 | +// return [] | ||
| 91 | +// } | ||
| 57 | } | 92 | } |
| 58 | 93 | ||
| 59 | /// 删除一条数据 | 94 | /// 删除一条数据 |
| 60 | /// - Parameter delete: 被删除的数据 | 95 | /// - Parameter delete: 被删除的数据 |
| 61 | func deleteObject(delete: StandListModel){ | 96 | func deleteObject(delete: StandListModel){ |
| 62 | 97 | ||
| 63 | - do{ | ||
| 64 | - try database.delete(fromTable: CNLiveStandListTableName, where: StandListModel.Properties.id == delete.id) | ||
| 65 | - }catch{ | ||
| 66 | - print("删除一条数据失败") | ||
| 67 | - } | 98 | +// do{ |
| 99 | +// try database.delete(fromTable: CNLiveStandListTableName, where: StandListModel.Properties.id == delete.id) | ||
| 100 | +// }catch{ | ||
| 101 | +// print("删除一条数据失败") | ||
| 102 | +// } | ||
| 68 | } | 103 | } |
| 69 | 104 | ||
| 70 | /// 删除本地所有数据 | 105 | /// 删除本地所有数据 |
| 71 | func deleteAllObjects() { | 106 | func deleteAllObjects() { |
| 72 | - do { | ||
| 73 | - try database.delete(fromTable: CNLiveStandListTableName) | ||
| 74 | - } catch { | ||
| 75 | - print("数据删除失败") | ||
| 76 | - } | 107 | +// do { |
| 108 | +// try database.delete(fromTable: CNLiveStandListTableName) | ||
| 109 | +// } catch { | ||
| 110 | +// print("数据删除失败") | ||
| 111 | +// } | ||
| 77 | } | 112 | } |
| 78 | 113 | ||
| 79 | 114 | ||
| 80 | /// 更新一条数据 | 115 | /// 更新一条数据 |
| 81 | /// - Parameter newObject: 更新的数据源 | 116 | /// - Parameter newObject: 更新的数据源 |
| 82 | func updateObject(newObject: StandListModel){ | 117 | func updateObject(newObject: StandListModel){ |
| 83 | - do{ | ||
| 84 | - //需要更新的字段 | ||
| 85 | - let updateProperties = [StandListModel.Properties.name, | ||
| 86 | - StandListModel.Properties.enable, | ||
| 87 | - StandListModel.Properties.createTime, | ||
| 88 | - StandListModel.Properties.createTimeString, | ||
| 89 | - StandListModel.Properties.timeString, | ||
| 90 | - StandListModel.Properties.auth, | ||
| 91 | - StandListModel.Properties.backgroundImg, | ||
| 92 | - StandListModel.Properties.backgroundColor, | ||
| 93 | - StandListModel.Properties.backgroundColour, | ||
| 94 | - StandListModel.Properties.description, | ||
| 95 | - StandListModel.Properties.cardImg, | ||
| 96 | - StandListModel.Properties.downPath,] | ||
| 97 | - | ||
| 98 | - try database.update(table: CNLiveStandListTableName, on:updateProperties, with: newObject,where: StandListModel.Properties.id == newObject.id) | ||
| 99 | - }catch{ | ||
| 100 | - print("更新一条数据失败") | ||
| 101 | - } | 118 | +// do{ |
| 119 | +// //需要更新的字段 | ||
| 120 | +// let updateProperties = [StandListModel.Properties.name, | ||
| 121 | +// StandListModel.Properties.enable, | ||
| 122 | +// StandListModel.Properties.createTime, | ||
| 123 | +// StandListModel.Properties.createTimeString, | ||
| 124 | +// StandListModel.Properties.timeString, | ||
| 125 | +// StandListModel.Properties.auth, | ||
| 126 | +// StandListModel.Properties.backgroundImg, | ||
| 127 | +// StandListModel.Properties.backgroundColor, | ||
| 128 | +// StandListModel.Properties.backgroundColour, | ||
| 129 | +// StandListModel.Properties.description, | ||
| 130 | +// StandListModel.Properties.cardImg, | ||
| 131 | +// StandListModel.Properties.downPath,] | ||
| 132 | +// | ||
| 133 | +// try database.update(table: CNLiveStandListTableName, on:updateProperties, with: newObject,where: StandListModel.Properties.id == newObject.id) | ||
| 134 | +// }catch{ | ||
| 135 | +// print("更新一条数据失败") | ||
| 136 | +// } | ||
| 102 | } | 137 | } |
| 103 | 138 | ||
| 104 | /// 更新多条数据 | 139 | /// 更新多条数据 |
| 105 | /// - Parameter newObjects: 新数据数组 | 140 | /// - Parameter newObjects: 新数据数组 |
| 106 | func updateObjects(newObjects: [StandListModel]) { | 141 | func updateObjects(newObjects: [StandListModel]) { |
| 107 | - do { | ||
| 108 | - let tempArray = NSMutableArray() | ||
| 109 | - for _ in newObjects { | ||
| 110 | - //需要更新的字段 | ||
| 111 | - let updateProperties = [StandListModel.Properties.name, | ||
| 112 | - StandListModel.Properties.enable, | ||
| 113 | - StandListModel.Properties.createTime, | ||
| 114 | - StandListModel.Properties.createTimeString, | ||
| 115 | - StandListModel.Properties.timeString, | ||
| 116 | - StandListModel.Properties.auth, | ||
| 117 | - StandListModel.Properties.backgroundImg, | ||
| 118 | - StandListModel.Properties.backgroundColor, | ||
| 119 | - StandListModel.Properties.backgroundColour, | ||
| 120 | - StandListModel.Properties.description, | ||
| 121 | - StandListModel.Properties.cardImg, | ||
| 122 | - StandListModel.Properties.downPath,] | ||
| 123 | - tempArray.add(updateProperties) | ||
| 124 | - } | ||
| 125 | - try database.update(table: CNLiveStandListTableName, on: tempArray as! [PropertyConvertible], with: newObjects) | ||
| 126 | - } catch { | ||
| 127 | - print("更新多条数据失败") | ||
| 128 | - } | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - | ||
| 132 | - /// 获取所有数据 | ||
| 133 | - /// - Returns: 返回查找的所以数据 | ||
| 134 | - func searchAllObject() -> Array<StandListModel>{ | ||
| 135 | - do{ | ||
| 136 | - let allData: [StandListModel] = try database.getObjects(fromTable: CNLiveStandListTableName) | ||
| 137 | - return allData | ||
| 138 | - }catch{ | ||
| 139 | - print("获取失败") | ||
| 140 | - return [] | ||
| 141 | - } | 142 | +// do { |
| 143 | +// let tempArray = NSMutableArray() | ||
| 144 | +// for _ in newObjects { | ||
| 145 | +// //需要更新的字段 | ||
| 146 | +// let updateProperties = [StandListModel.Properties.name, | ||
| 147 | +// StandListModel.Properties.enable, | ||
| 148 | +// StandListModel.Properties.createTime, | ||
| 149 | +// StandListModel.Properties.createTimeString, | ||
| 150 | +// StandListModel.Properties.timeString, | ||
| 151 | +// StandListModel.Properties.auth, | ||
| 152 | +// StandListModel.Properties.backgroundImg, | ||
| 153 | +// StandListModel.Properties.backgroundColor, | ||
| 154 | +// StandListModel.Properties.backgroundColour, | ||
| 155 | +// StandListModel.Properties.description, | ||
| 156 | +// StandListModel.Properties.cardImg, | ||
| 157 | +// StandListModel.Properties.downPath,] | ||
| 158 | +// tempArray.add(updateProperties) | ||
| 159 | +// } | ||
| 160 | +// try database.update(table: CNLiveStandListTableName, on: tempArray as! [PropertyConvertible], with: newObjects) | ||
| 161 | +// } catch { | ||
| 162 | +// print("更新多条数据失败") | ||
| 163 | +// } | ||
| 142 | } | 164 | } |
| 143 | 165 | ||
| 144 | /// 获取所有数据唯一值id | 166 | /// 获取所有数据唯一值id |
| 145 | /// - Returns: 返回查找的所以数据 | 167 | /// - Returns: 返回查找的所以数据 |
| 146 | - func searchAllObjectId() -> Array<String>{ | ||
| 147 | - do{ | ||
| 148 | - let allData: [StandListModel] = try database.getObjects(fromTable: CNLiveStandListTableName) | ||
| 149 | - let tempArray = NSMutableArray.init() | ||
| 150 | - for item in allData { | ||
| 151 | - tempArray.add("\(item.id)") | ||
| 152 | - } | ||
| 153 | - return tempArray as! Array<String> | ||
| 154 | - }catch{ | ||
| 155 | - print("获取失败") | ||
| 156 | - return [] | ||
| 157 | - } | ||
| 158 | - } | 168 | +// func searchAllObjectId() -> Array<String>{ |
| 169 | +// do{ | ||
| 170 | +// let allData: [StandListModel] = try database.getObjects(fromTable: CNLiveStandListTableName) | ||
| 171 | +// let tempArray = NSMutableArray.init() | ||
| 172 | +// for item in allData { | ||
| 173 | +// tempArray.add("\(item.id)") | ||
| 174 | +// } | ||
| 175 | +// return tempArray as! Array<String> | ||
| 176 | +// }catch{ | ||
| 177 | +// print("获取失败") | ||
| 178 | +// return [] | ||
| 179 | +// } | ||
| 180 | +// } | ||
| 159 | 181 | ||
| 160 | /// 通过id获取特定数据 | 182 | /// 通过id获取特定数据 |
| 161 | /// - Parameter identityId: id | 183 | /// - Parameter identityId: id |
| 162 | /// - Returns: 返回查找的数据 | 184 | /// - Returns: 返回查找的数据 |
| 163 | - func searchOneObject(identityId: String) -> StandListModel{ | ||
| 164 | - do { | ||
| 165 | - let searchPropertie = [StandListModel.Properties.id] | ||
| 166 | - let array: [StandListModel] = try database.getObjects(on: searchPropertie, fromTable: CNLiveStandListTableName, where: StandListModel.Properties.id == identityId) | ||
| 167 | - return array.count > 0 ? array.first! : StandListModel.init() | ||
| 168 | - } catch { | ||
| 169 | - print("获取失败") | ||
| 170 | - return StandListModel.init() | 185 | +// func searchOneObject(identityId: String) -> StandListModel{ |
| 186 | +// do { | ||
| 187 | +// let searchPropertie = [StandListModel.Properties.id] | ||
| 188 | +// let array: [StandListModel] = try database.getObjects(on: searchPropertie, fromTable: CNLiveStandListTableName, where: StandListModel.Properties.id == identityId) | ||
| 189 | +// return array.count > 0 ? array.first! : StandListModel.init() | ||
| 190 | +// } catch { | ||
| 191 | +// print("获取失败") | ||
| 192 | +// return StandListModel.init() | ||
| 193 | +// } | ||
| 194 | +// } | ||
| 195 | + | ||
| 196 | + | ||
| 197 | + private lazy var userFileDir: String = { | ||
| 198 | + let userFileDir = NSString() | ||
| 199 | + var path: String = "" | ||
| 200 | + path = "\(fileDir)/userId_\(UserInfoManager.shared.userInfo.uid)/" | ||
| 201 | + let fileManager = FileManager.default | ||
| 202 | + var isDir: ObjCBool = false | ||
| 203 | + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir) | ||
| 204 | + if !(isDir.boolValue && exist) { | ||
| 205 | + do { | ||
| 206 | + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true) | ||
| 207 | + } catch { | ||
| 208 | + debugPrint("文件目录创建失败") | ||
| 209 | + return "" | ||
| 210 | + } | ||
| 171 | } | 211 | } |
| 172 | - } | 212 | + return path as String |
| 213 | + }() | ||
| 214 | + | ||
| 215 | + private lazy var fileDir: String = { | ||
| 216 | + let path = "\(NSHomeDirectory())/Documents/metaCode/saveStannd" | ||
| 217 | + let fileManager = FileManager.default | ||
| 218 | + var isDir: ObjCBool = false | ||
| 219 | + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir) | ||
| 220 | + if !(isDir.boolValue && exist) { | ||
| 221 | + do { | ||
| 222 | + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true) | ||
| 223 | + } catch { | ||
| 224 | + debugPrint("文件目录创建失败") | ||
| 225 | + return "" | ||
| 226 | + } | ||
| 227 | + } | ||
| 228 | + return path as String | ||
| 229 | + }() | ||
| 173 | 230 | ||
| 174 | } | 231 | } |
metaCode/Classes/Main/HomePage/ViewModel/CNHomePageViewModel.swift deleted
100644 → 0
| 1 | -// | ||
| 2 | -// CNLiveHomePageViewModel.swift | ||
| 3 | -// metaCode | ||
| 4 | -// | ||
| 5 | -// Created by daojian on 2023/7/3. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import CNLiveRequestBastKit | ||
| 10 | - | ||
| 11 | -///请求响应回调 | ||
| 12 | -typealias responseBlock = (_ listArray:Array<CNLiveIdentityModel>, _ responseType:CNLiveNetworkingResponseType, _ errorMsg:String) -> Void | ||
| 13 | - | ||
| 14 | -class CNLiveHomePageViewModel:NSObject { | ||
| 15 | - | ||
| 16 | - /// 获取身份列表 | ||
| 17 | - class func getUserIdentityApi(resultBlock:@escaping responseBlock){ | ||
| 18 | - | ||
| 19 | - //先从本地获取,本地有直接返回 | ||
| 20 | - let db = CNLiveIdentityDB() | ||
| 21 | -// let allDbArray = db.searchAllObject() | ||
| 22 | -// if(allDbArray.count > 0){ | ||
| 23 | -// resultBlock(allDbArray,.success,"") | ||
| 24 | -// return | ||
| 25 | -// } | ||
| 26 | - | ||
| 27 | - //从网络获取 | ||
| 28 | - CNLiveNetworking.setAllowRequestDefaultArgument(false) | ||
| 29 | - CNLiveNetworking.setupShowDataResult(false) | ||
| 30 | - CNLiveNetworking.requestNetwork(with: .GET, urlString: "\(APPBaseMCUrl)/identityApi/allList?sid=\(UserInfoManager.shared.userInfo.uid)&page=1&pageSize=1000", param: nil, cacheType: .networkOnly) { task , result, error in | ||
| 31 | - | ||
| 32 | - if((error) != nil){ | ||
| 33 | - //网络请求失败 | ||
| 34 | - if CNLiveNetworking.isNetworking(){ | ||
| 35 | - resultBlock([],.failed,error?.localizedDescription ?? "请求失败") | ||
| 36 | - }else{ | ||
| 37 | - resultBlock([],.noNetwork,"无网络连接") | ||
| 38 | - } | ||
| 39 | - return | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - let resultDic:NSDictionary = result as! NSDictionary | ||
| 43 | - | ||
| 44 | - let errorCode:String = "\(resultDic["errorCode"]!)" | ||
| 45 | - if (errorCode == "0"){ | ||
| 46 | - let data:NSDictionary = resultDic["data"] as! NSDictionary | ||
| 47 | - let list:NSArray = data["list"] as! NSArray | ||
| 48 | - | ||
| 49 | - //list数据转CNLiveIdentityModel, 并把model存入本地 | ||
| 50 | - | ||
| 51 | - var array:Array = Array<CNLiveIdentityModel>() | ||
| 52 | - for index in 0..<list.count{ | ||
| 53 | - let item = dictionaryToModel(list[index] as! [String : Any], CNLiveIdentityModel.self, "") | ||
| 54 | - array.append(item as! CNLiveIdentityModel) | ||
| 55 | - //存入数据库 | ||
| 56 | - db.insterObject(object: item as! CNLiveIdentityModel) | ||
| 57 | - } | ||
| 58 | - resultBlock(array,.success,"") | ||
| 59 | - } | ||
| 60 | - else{ | ||
| 61 | - let errorMessage:String = resultDic["errorMessage"] as! String | ||
| 62 | - showMessage(message: errorMessage) | ||
| 63 | - resultBlock([],.failed,errorMessage) | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - | ||
| 71 | -} |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
| @@ -46,7 +46,7 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, | @@ -46,7 +46,7 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, | ||
| 46 | dataArray.add(array03) | 46 | dataArray.add(array03) |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | -// dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]]) | 49 | + dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]]) |
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | return dataArray | 52 | return dataArray |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | import HandyJSON | 9 | import HandyJSON |
| 10 | -import WCDBSwift | ||
| 11 | 10 | ||
| 12 | class UpdateInfoModel: BaseModel { | 11 | class UpdateInfoModel: BaseModel { |
| 13 | 12 | ||
| @@ -134,7 +133,7 @@ class StandListBaseModel: BaseModel { | @@ -134,7 +133,7 @@ class StandListBaseModel: BaseModel { | ||
| 134 | var pages: Int = 0 | 133 | var pages: Int = 0 |
| 135 | } | 134 | } |
| 136 | 135 | ||
| 137 | -final class StandListModel: BaseModel, TableCodable { | 136 | +final class StandListModel: BaseModel {//, TableCodable { |
| 138 | 137 | ||
| 139 | var id: Int = 0//ID号- | 138 | var id: Int = 0//ID号- |
| 140 | var name: String?//名称- | 139 | var name: String?//名称- |
| @@ -184,31 +183,31 @@ final class StandListModel: BaseModel, TableCodable { | @@ -184,31 +183,31 @@ final class StandListModel: BaseModel, TableCodable { | ||
| 184 | }) | 183 | }) |
| 185 | } | 184 | } |
| 186 | 185 | ||
| 187 | - enum CodingKeys: String, CodingTableKey { | ||
| 188 | - typealias Root = StandListModel | ||
| 189 | - static let objectRelationalMapping = TableBinding(CodingKeys.self) | ||
| 190 | - { | ||
| 191 | - //设置表的主键key为id,用来区分数据唯一性, 如果id为int类型,可以按实现按顺序递增 | ||
| 192 | - BindColumnConstraint(id, isPrimary: true, isAutoIncrement: true) | ||
| 193 | - } | ||
| 194 | - case id | ||
| 195 | - case name | ||
| 196 | - case icon | ||
| 197 | - case enable | ||
| 198 | - case createTime | ||
| 199 | - case createTimeString | ||
| 200 | - case timeString | ||
| 201 | - case auth | ||
| 202 | - case backgroundImg | ||
| 203 | - case backgroundColor | ||
| 204 | - case backgroundColour | ||
| 205 | - case description | ||
| 206 | - case cardImg | ||
| 207 | - case downPath | ||
| 208 | - case descBackgroundImg | ||
| 209 | - case upPath | ||
| 210 | - case downType | ||
| 211 | - } | 186 | +// enum CodingKeys: String, CodingTableKey { |
| 187 | +// typealias Root = StandListModel | ||
| 188 | +// static let objectRelationalMapping = TableBinding(CodingKeys.self) | ||
| 189 | +// { | ||
| 190 | +// //设置表的主键key为id,用来区分数据唯一性, 如果id为int类型,可以按实现按顺序递增 | ||
| 191 | +// BindColumnConstraint(id, isPrimary: true, isAutoIncrement: true) | ||
| 192 | +// } | ||
| 193 | +// case id | ||
| 194 | +// case name | ||
| 195 | +// case icon | ||
| 196 | +// case enable | ||
| 197 | +// case createTime | ||
| 198 | +// case createTimeString | ||
| 199 | +// case timeString | ||
| 200 | +// case auth | ||
| 201 | +// case backgroundImg | ||
| 202 | +// case backgroundColor | ||
| 203 | +// case backgroundColour | ||
| 204 | +// case description | ||
| 205 | +// case cardImg | ||
| 206 | +// case downPath | ||
| 207 | +// case descBackgroundImg | ||
| 208 | +// case upPath | ||
| 209 | +// case downType | ||
| 210 | +// } | ||
| 212 | } | 211 | } |
| 213 | 212 | ||
| 214 | // !!!: /api/identityApi/getIdentity 接口标记 | 213 | // !!!: /api/identityApi/getIdentity 接口标记 |
| @@ -267,8 +266,8 @@ class MineAuthListBaseModel: BaseModel { | @@ -267,8 +266,8 @@ class MineAuthListBaseModel: BaseModel { | ||
| 267 | var pages: Int = 0 | 266 | var pages: Int = 0 |
| 268 | } | 267 | } |
| 269 | 268 | ||
| 270 | -final class MineAuthListModel: BaseModel , TableCodable { | ||
| 271 | - | 269 | +final class MineAuthListModel: BaseModel {//,TableCodable { |
| 270 | + | ||
| 272 | required init() {} | 271 | required init() {} |
| 273 | 272 | ||
| 274 | var cardImg: String? = "" | 273 | var cardImg: String? = "" |
| @@ -279,22 +278,22 @@ final class MineAuthListModel: BaseModel , TableCodable { | @@ -279,22 +278,22 @@ final class MineAuthListModel: BaseModel , TableCodable { | ||
| 279 | var identityId: Int = 0 | 278 | var identityId: Int = 0 |
| 280 | var userStatus: Int = 0 | 279 | var userStatus: Int = 0 |
| 281 | 280 | ||
| 282 | - enum CodingKeys: String, CodingTableKey { | ||
| 283 | - | ||
| 284 | - typealias Root = MineAuthListModel | ||
| 285 | - static let objectRelationalMapping = TableBinding(CodingKeys.self) | ||
| 286 | - { | ||
| 287 | - //设置表的主键key为id,用来区分数据唯一性, 如果id为int类型,可以按实现按顺序递增 | ||
| 288 | - BindColumnConstraint(identityId, isPrimary: true, isAutoIncrement: true) | ||
| 289 | - } | ||
| 290 | - case identityId //不修改数据库字段名,和属性名保持一直 | ||
| 291 | - case name //不修改数据库字段名,和属性名保持一直 | ||
| 292 | - case icon | ||
| 293 | - case cardImg | ||
| 294 | - case authTime | ||
| 295 | - case code | ||
| 296 | - case userStatus | ||
| 297 | - } | 281 | +// enum CodingKeys: String, CodingTableKey { |
| 282 | +// | ||
| 283 | +// typealias Root = MineAuthListModel | ||
| 284 | +// static let objectRelationalMapping = TableBinding(CodingKeys.self) | ||
| 285 | +// { | ||
| 286 | +// //设置表的主键key为id,用来区分数据唯一性, 如果id为int类型,可以按实现按顺序递增 | ||
| 287 | +// BindColumnConstraint(identityId, isPrimary: true, isAutoIncrement: true) | ||
| 288 | +// } | ||
| 289 | +// case identityId //不修改数据库字段名,和属性名保持一直 | ||
| 290 | +// case name //不修改数据库字段名,和属性名保持一直 | ||
| 291 | +// case icon | ||
| 292 | +// case cardImg | ||
| 293 | +// case authTime | ||
| 294 | +// case code | ||
| 295 | +// case userStatus | ||
| 296 | +// } | ||
| 298 | } | 297 | } |
| 299 | 298 | ||
| 300 | // !!!: /Api/Index3/myOrderCount 数据返回 | 299 | // !!!: /Api/Index3/myOrderCount 数据返回 |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderDetailViewController.swift
| @@ -109,6 +109,9 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | @@ -109,6 +109,9 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | ||
| 109 | 109 | ||
| 110 | func loadDataSourceAction() { | 110 | func loadDataSourceAction() { |
| 111 | CNLiveShopViewModel.requestOrderDetail(orderId: _orderId, isOrderDetai: _show_type == .order, isRefund: _form_type == .afterSale) { [weak self] result, respStatue in | 111 | CNLiveShopViewModel.requestOrderDetail(orderId: _orderId, isOrderDetai: _show_type == .order, isRefund: _form_type == .afterSale) { [weak self] result, respStatue in |
| 112 | + if self == nil { | ||
| 113 | + return | ||
| 114 | + } | ||
| 112 | if respStatue == .success { | 115 | if respStatue == .success { |
| 113 | if self!._show_type == .order { | 116 | if self!._show_type == .order { |
| 114 | self!.detailModel = result as? ShopOrderDetailModel | 117 | self!.detailModel = result as? ShopOrderDetailModel |
| @@ -197,7 +200,8 @@ extension CNLiveShopOrderDetailViewController { | @@ -197,7 +200,8 @@ extension CNLiveShopOrderDetailViewController { | ||
| 197 | if detailModel.send_num > 1 || detailModel.is_send == "0" { | 200 | if detailModel.send_num > 1 || detailModel.is_send == "0" { |
| 198 | self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: detailModel.id! as NSString), animated: true) | 201 | self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: detailModel.id! as NSString), animated: true) |
| 199 | } else { | 202 | } else { |
| 200 | - self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: "1000021749", expId: "0", express_num: "1234556789012345", show_type: .orderExpress, progress: .Zero), animated: true) | 203 | +// self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: "1000021749", expId: "0", express_num: "1234556789012345", show_type: .orderExpress, progress: .Zero), animated: true) |
| 204 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: detailModel.id! as NSString, expId: "", express_num: detailModel.express_num! as NSString, show_type: .orderExpress, progress: .Zero), animated: true) | ||
| 201 | } | 205 | } |
| 202 | } | 206 | } |
| 203 | 207 |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressDetailViewController.swift
| @@ -32,16 +32,25 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa | @@ -32,16 +32,25 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa | ||
| 32 | return tableView | 32 | return tableView |
| 33 | }() | 33 | }() |
| 34 | 34 | ||
| 35 | + lazy var headerView: ShopBodyOrderExpressDetailHeaderView = { | ||
| 36 | + let headerView = ShopBodyOrderExpressDetailHeaderView.init(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 0), show_type: _show_type) | ||
| 37 | + if _show_type == .orderExpress || _show_type == .refundExpress { | ||
| 38 | + headerView.expressModel = self.expressModel | ||
| 39 | + headerView.express_num = _express_num! as String | ||
| 40 | + headerView._orderId = _orderId! as String | ||
| 41 | + headerView._expId = _expId! as String | ||
| 42 | + } else { | ||
| 43 | + headerView.TBY_progress = _progress | ||
| 44 | + } | ||
| 45 | + headerView.isUserInteractionEnabled = true | ||
| 46 | + return headerView | ||
| 47 | + }() | ||
| 48 | + | ||
| 35 | lazy var dataArray: NSMutableArray = { | 49 | lazy var dataArray: NSMutableArray = { |
| 36 | let dataArray = NSMutableArray.init() | 50 | let dataArray = NSMutableArray.init() |
| 37 | return dataArray | 51 | return dataArray |
| 38 | }() | 52 | }() |
| 39 | 53 | ||
| 40 | - lazy var temp_array: NSMutableArray = { | ||
| 41 | - let temp_array = NSMutableArray.init() | ||
| 42 | - return temp_array | ||
| 43 | - }() | ||
| 44 | - | ||
| 45 | var _expId: NSString! | 54 | var _expId: NSString! |
| 46 | var _orderId: NSString! | 55 | var _orderId: NSString! |
| 47 | var _refundId: NSString! | 56 | var _refundId: NSString! |
| @@ -68,7 +77,7 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa | @@ -68,7 +77,7 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa | ||
| 68 | navigationBarHidden = false | 77 | navigationBarHidden = false |
| 69 | titleName = "物流详情" | 78 | titleName = "物流详情" |
| 70 | 79 | ||
| 71 | -// loadDataSourceAction() | 80 | + loadDataSourceAction() |
| 72 | 81 | ||
| 73 | view.addSubview(tableView) | 82 | view.addSubview(tableView) |
| 74 | tableView.snp.makeConstraints { make in | 83 | tableView.snp.makeConstraints { make in |
| @@ -84,6 +93,7 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa | @@ -84,6 +93,7 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa | ||
| 84 | if respStatue == .success { | 93 | if respStatue == .success { |
| 85 | self!.expressModel = (result as! ShopOrderExpressDetailModel).express | 94 | self!.expressModel = (result as! ShopOrderExpressDetailModel).express |
| 86 | self!.dataArray.addObjects(from: (result as! ShopOrderExpressDetailModel).data) | 95 | self!.dataArray.addObjects(from: (result as! ShopOrderExpressDetailModel).data) |
| 96 | + self!.tableView.tableHeaderView = self!.headerView | ||
| 87 | self!.tableView.reloadData() | 97 | self!.tableView.reloadData() |
| 88 | }else if (respStatue == .noNetwork) { | 98 | }else if (respStatue == .noNetwork) { |
| 89 | self!.network_type = .noNetwork | 99 | self!.network_type = .noNetwork |
| @@ -108,7 +118,6 @@ extension CNLiveShopOrderExpressDetailViewController { | @@ -108,7 +118,6 @@ extension CNLiveShopOrderExpressDetailViewController { | ||
| 108 | } | 118 | } |
| 109 | } | 119 | } |
| 110 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | 120 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 111 | - return UITableViewCell.init() | ||
| 112 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderExpressDetailTableViewCellIdentifier) as? ShopBodyOrderExpressDetailTableViewCell else { | 121 | guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderExpressDetailTableViewCellIdentifier) as? ShopBodyOrderExpressDetailTableViewCell else { |
| 113 | return ShopBodyOrderExpressDetailTableViewCell() | 122 | return ShopBodyOrderExpressDetailTableViewCell() |
| 114 | } | 123 | } |
| @@ -129,24 +138,11 @@ extension CNLiveShopOrderExpressDetailViewController { | @@ -129,24 +138,11 @@ extension CNLiveShopOrderExpressDetailViewController { | ||
| 129 | isLastRow = true | 138 | isLastRow = true |
| 130 | } | 139 | } |
| 131 | } | 140 | } |
| 132 | - cell.setupDataSource(dataModel: detailModel, row: indexPath.row, isLastRow: isLastRow, type: _show_type, address: expressModel.address! as NSString, express_state: expressModel.state! as NSString, temp_array: temp_array) | 141 | + cell.setupDataSource(dataModel: detailModel, row: indexPath.row, isLastRow: isLastRow, type: _show_type, address: expressModel.address! as NSString, express_state: expressModel.state! as NSString) |
| 133 | return cell | 142 | return cell |
| 134 | } | 143 | } |
| 135 | -// func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 136 | -// var detailModel: ShopOrderExpressDetailDateModel! | ||
| 137 | -// if _show_type == .orderExpress || _show_type == .refundExpress { | ||
| 138 | -// if indexPath.row == 0 { | ||
| 139 | -// detailModel = ShopOrderExpressDetailDateModel() | ||
| 140 | -// } else { | ||
| 141 | -// detailModel = (dataArray[indexPath.row - 1] as! ShopOrderExpressDetailDateModel) | ||
| 142 | -// } | ||
| 143 | -// } else { | ||
| 144 | -// detailModel = (dataArray[indexPath.row] as! ShopOrderExpressDetailDateModel) | ||
| 145 | -// } | ||
| 146 | -// return adapt_length(length: detailModel.cellH+70) | ||
| 147 | -// } | ||
| 148 | - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 149 | - return 0.01 | 144 | + func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { |
| 145 | + return adapt_length(length: 80) | ||
| 150 | } | 146 | } |
| 151 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | 147 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 152 | } | 148 | } |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressViewController.swift
| @@ -197,7 +197,9 @@ extension CNLiveShopOrderExpressViewController { | @@ -197,7 +197,9 @@ extension CNLiveShopOrderExpressViewController { | ||
| 197 | title = "快递单号" | 197 | title = "快递单号" |
| 198 | if express_num.isNotBlank() { | 198 | if express_num.isNotBlank() { |
| 199 | content = express_num! as String | 199 | content = express_num! as String |
| 200 | - selectExpressModel.no = express_num as String | 200 | + if selectExpressModel != nil { |
| 201 | + selectExpressModel.no = "\(express_num ?? "")" | ||
| 202 | + } | ||
| 201 | } else { | 203 | } else { |
| 202 | if selectExpressModel != nil { | 204 | if selectExpressModel != nil { |
| 203 | content = (selectExpressModel.no != nil) ? selectExpressModel.no! : "" | 205 | content = (selectExpressModel.no != nil) ? selectExpressModel.no! : "" |
| @@ -210,7 +212,9 @@ extension CNLiveShopOrderExpressViewController { | @@ -210,7 +212,9 @@ extension CNLiveShopOrderExpressViewController { | ||
| 210 | cell.setup(title: title, content: content, placeHolder: placeHolder, contentIsEdit: contentIsEdit, isShowArrowImage: isShowArrowImage, isShowLine: isShowLine) | 212 | cell.setup(title: title, content: content, placeHolder: placeHolder, contentIsEdit: contentIsEdit, isShowArrowImage: isShowArrowImage, isShowLine: isShowLine) |
| 211 | cell.clickBlock = {[weak self] content, row in | 213 | cell.clickBlock = {[weak self] content, row in |
| 212 | if row == (self!.hiddenShop ? 1 : 2) { | 214 | if row == (self!.hiddenShop ? 1 : 2) { |
| 213 | - self!.selectExpressModel.no = content | 215 | + if self!.selectExpressModel != nil { |
| 216 | + self!.selectExpressModel.no = content | ||
| 217 | + } | ||
| 214 | } | 218 | } |
| 215 | } | 219 | } |
| 216 | return cell | 220 | return cell |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderListViewController.swift
| @@ -85,21 +85,21 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe | @@ -85,21 +85,21 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe | ||
| 85 | state = "6" | 85 | state = "6" |
| 86 | } | 86 | } |
| 87 | showLoading(message: "") | 87 | showLoading(message: "") |
| 88 | - CNLiveShopViewModel.requestOrderList(state: state, page: page) { [weak self] result, respStatue in | 88 | + CNLiveShopViewModel.requestOrderList(state: state, keyword: "", page: page) { [weak self] result, respStatue in |
| 89 | if respStatue == .success { | 89 | if respStatue == .success { |
| 90 | if self!.pageNum == 1 { | 90 | if self!.pageNum == 1 { |
| 91 | self!.dataArray.removeAllObjects() | 91 | self!.dataArray.removeAllObjects() |
| 92 | self!.dataArray.addObjects(from: result as! [ShopOrderListModel]) | 92 | self!.dataArray.addObjects(from: result as! [ShopOrderListModel]) |
| 93 | - if self!.dataArray.count > 0 { | 93 | + if self!.dataArray.count > 0 && self!.tableView.mj_header == nil && self!.tableView.mj_footer == nil { |
| 94 | self!.addRefreshView() | 94 | self!.addRefreshView() |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | if self!.pageNum > 1 { | 97 | if self!.pageNum > 1 { |
| 98 | self!.dataArray.addObjects(from: result as! [ShopOrderListModel]) | 98 | self!.dataArray.addObjects(from: result as! [ShopOrderListModel]) |
| 99 | } | 99 | } |
| 100 | - self!.tableView.reloadData() | ||
| 101 | self!.tableView.mj_header?.endRefreshing() | 100 | self!.tableView.mj_header?.endRefreshing() |
| 102 | self!.tableView.mj_footer?.endRefreshing() | 101 | self!.tableView.mj_footer?.endRefreshing() |
| 102 | + self!.tableView.reloadData() | ||
| 103 | if (result as! Array<Any>).count == 0 { | 103 | if (result as! Array<Any>).count == 0 { |
| 104 | self!.tableView.mj_footer?.endRefreshingWithNoMoreData() | 104 | self!.tableView.mj_footer?.endRefreshingWithNoMoreData() |
| 105 | self!.tableView.reloadData() | 105 | self!.tableView.reloadData() |
| @@ -283,7 +283,8 @@ extension CNLiveShopOrderListViewController { | @@ -283,7 +283,8 @@ extension CNLiveShopOrderListViewController { | ||
| 283 | self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true) | 283 | self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true) |
| 284 | // self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true) | 284 | // self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true) |
| 285 | } else { | 285 | } else { |
| 286 | - self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: "1000021749", expId: "0", express_num: "1234556789012345", show_type: .orderExpress, progress: .Zero), animated: true) | 286 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: listModel.id! as NSString, expId: "", express_num: listModel.express_num! as NSString, show_type: .orderExpress, progress: .Zero), animated: true) |
| 287 | +// self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: "1000021749", expId: "0", express_num: "1234556789012345", show_type: .orderExpress, progress: .Zero), animated: true) | ||
| 287 | } | 288 | } |
| 288 | } | 289 | } |
| 289 | 290 |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderSearchListViewController.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopOrderSearchListViewController.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/13. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import EmptyDataSet_Swift | ||
| 10 | +import MJRefresh | ||
| 11 | + | ||
| 12 | +class CNLiveShopOrderSearchListViewController: CNLiveBaseViewController, UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate { | ||
| 13 | + | ||
| 14 | + let kShopBodyOrderListViewCellIdentifier = "kShopBodyListViewCellIdentifier" | ||
| 15 | + let kShopBodyOrderHeaderViewCellIdentifier = "kShopBodyOrderHeaderViewCellIdentifier" | ||
| 16 | + let kShopBodyOrderFooterViewCellIdentifier = "kShopBodyOrderFooterViewCellIdentifier" | ||
| 17 | + lazy var tableView : UITableView = { | ||
| 18 | + let tableView = UITableView(frame: .zero, style: .grouped) | ||
| 19 | + tableView.dataSource = self | ||
| 20 | + tableView.delegate = self | ||
| 21 | + tableView.emptyDataSetSource = self | ||
| 22 | + tableView.emptyDataSetDelegate = self | ||
| 23 | + tableView.backgroundColor = .clear | ||
| 24 | + tableView.tableFooterView = UIView.init() | ||
| 25 | + tableView.separatorStyle = .none | ||
| 26 | + tableView.register(ShopBodyOrderListViewCell.self, forCellReuseIdentifier: kShopBodyOrderListViewCellIdentifier) | ||
| 27 | + tableView.register(ShopBodyOrderHeaderViewCell.self, forHeaderFooterViewReuseIdentifier: kShopBodyOrderHeaderViewCellIdentifier) | ||
| 28 | + tableView.register(ShopBodyOrderFooterViewCell.self, forHeaderFooterViewReuseIdentifier: kShopBodyOrderFooterViewCellIdentifier) | ||
| 29 | + return tableView | ||
| 30 | + }() | ||
| 31 | + | ||
| 32 | + lazy var searchTextField: UITextField = { | ||
| 33 | + let searchTextField = UITextField.init(frame: CGRectMake(adapt_length(length: 30), get_system_statusBar_height() + (get_system_nav_ui_height() - adapt_length(length: 30))/2, KSreenWidth - adapt_length(length: 40), adapt_length(length: 30))) | ||
| 34 | + return searchTextField | ||
| 35 | + }() | ||
| 36 | + | ||
| 37 | + lazy var dataArray: NSMutableArray = { | ||
| 38 | + let dataArray = NSMutableArray.init() | ||
| 39 | + return dataArray | ||
| 40 | + }() | ||
| 41 | + | ||
| 42 | + var pageNum: NSInteger! | ||
| 43 | + var _searchText: String! | ||
| 44 | + var network_type: CNLiveMineResponseType! | ||
| 45 | + init(searchText: String) { | ||
| 46 | + pageNum = 1 | ||
| 47 | + _searchText = searchText | ||
| 48 | + super.init(nibName:nil, bundle:nil) | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + required init?(coder: NSCoder) { | ||
| 52 | + fatalError("init(coder:) has not been implemented") | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + override func viewDidLoad() { | ||
| 56 | + super.viewDidLoad() | ||
| 57 | + navigationBarHidden = false | ||
| 58 | + | ||
| 59 | + initNav() | ||
| 60 | + view.addSubview(tableView) | ||
| 61 | + | ||
| 62 | + loadDataSourceAction(page: 1) | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + func initNav() { | ||
| 66 | + let view = UIView.init(frame: CGRectMake(0, 0, adapt_length(length: 30), adapt_length(length: 30))) | ||
| 67 | + | ||
| 68 | + let imageView = UIImageView.init(frame: CGRect(x: adapt_length(length: 7), y: adapt_length(length: 4), width: adapt_length(length: 22), height: adapt_length(length: 22))) | ||
| 69 | + imageView.image = UIImage(named: "DS_order_search") | ||
| 70 | + imageView.clipsToBounds = true | ||
| 71 | + imageView.contentMode = .scaleAspectFit | ||
| 72 | + view.addSubview(imageView) | ||
| 73 | + | ||
| 74 | + searchTextField.leftView = view | ||
| 75 | + searchTextField.delegate = self | ||
| 76 | + searchTextField.leftViewMode = .always | ||
| 77 | + searchTextField.placeholder = "请输入关键字..." | ||
| 78 | + searchTextField.backgroundColor = HexColor("#f0f0f0") | ||
| 79 | + searchTextField.returnKeyType = .search | ||
| 80 | + searchTextField.layer.cornerRadius = adapt_length(length: 15) | ||
| 81 | + searchTextField.layer.masksToBounds = true | ||
| 82 | + searchTextField.font = regular_adapt_font(pointSize: 13) | ||
| 83 | + searchTextField.text = _searchText | ||
| 84 | + topNavView.addSubview(searchTextField) | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + func loadDataSourceAction(page: NSInteger) { | ||
| 88 | + showLoading(message: "") | ||
| 89 | + CNLiveShopViewModel.requestOrderList(state: "", keyword: searchTextField.text!, page: page) { [weak self] result, respStatue in | ||
| 90 | + if respStatue == .success { | ||
| 91 | + if self!.pageNum == 1 { | ||
| 92 | + self!.dataArray.removeAllObjects() | ||
| 93 | + self!.dataArray.addObjects(from: result as! [ShopOrderListModel]) | ||
| 94 | + if self!.dataArray.count > 0 && self!.tableView.mj_header == nil && self!.tableView.mj_footer == nil { | ||
| 95 | + self!.addRefreshView() | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + if self!.pageNum > 1 { | ||
| 99 | + self!.dataArray.addObjects(from: result as! [ShopOrderListModel]) | ||
| 100 | + } | ||
| 101 | + self!.tableView.mj_header?.endRefreshing() | ||
| 102 | + self!.tableView.mj_footer?.endRefreshing() | ||
| 103 | + self!.tableView.reloadData() | ||
| 104 | + if (result as! Array<Any>).count == 0 { | ||
| 105 | + self!.tableView.mj_footer?.endRefreshingWithNoMoreData() | ||
| 106 | + self!.tableView.reloadData() | ||
| 107 | + } | ||
| 108 | + }else if (respStatue == .noNetwork) { | ||
| 109 | + self!.network_type = .noNetwork | ||
| 110 | + self!.tableView.reloadEmptyDataSet() | ||
| 111 | + } else { | ||
| 112 | + self!.network_type = .failed | ||
| 113 | + self!.tableView.reloadEmptyDataSet() | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + func addRefreshView() { | ||
| 119 | + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in | ||
| 120 | + self!.pageNum = 1 | ||
| 121 | + self!.loadDataSourceAction(page: 1) | ||
| 122 | + }) | ||
| 123 | + | ||
| 124 | + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in | ||
| 125 | + self!.pageNum = self!.pageNum + 1 | ||
| 126 | + self!.loadDataSourceAction(page: self!.pageNum) | ||
| 127 | + }) | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + override func viewWillLayoutSubviews() { | ||
| 131 | + super.viewWillLayoutSubviews() | ||
| 132 | + tableView.frame = CGRect(x: 0, y: get_system_nav_height(), width: KSreenWidth, height: view.height - get_system_nav_height()) | ||
| 133 | + } | ||
| 134 | +} | ||
| 135 | + | ||
| 136 | +extension CNLiveShopOrderSearchListViewController { | ||
| 137 | + | ||
| 138 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
| 139 | + return dataArray.count | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 143 | + let order_detail = (dataArray[section] as! ShopOrderListModel).order_detail | ||
| 144 | + return order_detail.count | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 148 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderListViewCellIdentifier) as? ShopBodyOrderListViewCell else { | ||
| 149 | + return ShopBodyOrderListViewCell() | ||
| 150 | + } | ||
| 151 | + let order_detail = (dataArray[indexPath.section] as! ShopOrderListModel).order_detail | ||
| 152 | + let addTime = (dataArray[indexPath.section] as! ShopOrderListModel).addtime! | ||
| 153 | + cell.setupDataSource(goodsModel: order_detail[indexPath.row] , addTime: addTime) | ||
| 154 | + return cell | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 158 | + return adapt_length(length: 110) | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | ||
| 162 | + return adapt_length(length: 40) | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | ||
| 166 | + let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: kShopBodyOrderHeaderViewCellIdentifier) as! ShopBodyOrderHeaderViewCell | ||
| 167 | + let listModel = (dataArray[section] as! ShopOrderListModel) | ||
| 168 | + headerView.setupDataSource(listModel: listModel) | ||
| 169 | + return headerView | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { | ||
| 173 | + let listModel = (dataArray[section] as! ShopOrderListModel) | ||
| 174 | + if listModel.isRefund == "1" { | ||
| 175 | + return adapt_length(length: 60) | ||
| 176 | + } else { | ||
| 177 | + return adapt_length(length: 110) | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { | ||
| 182 | + let footerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: kShopBodyOrderFooterViewCellIdentifier) as! ShopBodyOrderFooterViewCell | ||
| 183 | + let listModel = (dataArray[section] as! ShopOrderListModel) | ||
| 184 | + footerView.setupDataSource(listModel: listModel) | ||
| 185 | + footerView.clickRightBtnCallBack = { [weak self] title, clickEvent, listModel in | ||
| 186 | + self?.orderOperation(title: title, event: clickEvent, listModel: listModel) | ||
| 187 | + } | ||
| 188 | + return footerView | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 192 | + let listModel = (dataArray[indexPath.section] as! ShopOrderListModel) | ||
| 193 | + pushOrderDetail(listModel: listModel) | ||
| 194 | + } | ||
| 195 | +} | ||
| 196 | +extension CNLiveShopOrderSearchListViewController { | ||
| 197 | + | ||
| 198 | + | ||
| 199 | + func textFieldShouldReturn(_ textField: UITextField) -> Bool { | ||
| 200 | + view.endEditing(true) | ||
| 201 | + | ||
| 202 | + if textField.text!.count > 30 { | ||
| 203 | + textField.text = "\(textField.text?.prefix(29) ?? "")" | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + let historyDataArr = CNLiveFileManager.shared.take(key: kShopOrderListSearchHistroyDatas) as! NSMutableArray | ||
| 207 | + if historyDataArr.contains(textField.text! as String) { | ||
| 208 | + historyDataArr.remove(textField.text! as String) | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + historyDataArr.insert(textField.text! as String, at: 0) | ||
| 212 | + CNLiveFileManager.shared.save(object: historyDataArr, key: kShopOrderListSearchHistroyDatas) | ||
| 213 | + | ||
| 214 | + loadDataSourceAction(page: 1) | ||
| 215 | + | ||
| 216 | + return true | ||
| 217 | + } | ||
| 218 | +} | ||
| 219 | + | ||
| 220 | +extension CNLiveShopOrderSearchListViewController { | ||
| 221 | + | ||
| 222 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | ||
| 223 | + if network_type == .failed || network_type == .unkonw { | ||
| 224 | + return UIImage(named: "mine_list_source_unusual_failed") | ||
| 225 | + } | ||
| 226 | + if dataArray.count == 0 { | ||
| 227 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 228 | + } | ||
| 229 | + if network_type == .noNetwork { | ||
| 230 | + return UIImage(named: "mine_list_source_unusual_noNet") | ||
| 231 | + } | ||
| 232 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | ||
| 236 | + var defult_string = "" | ||
| 237 | + if network_type == .failed || network_type == .unkonw { | ||
| 238 | + defult_string = "接口请求错误,刷新试试~" | ||
| 239 | + } | ||
| 240 | + if network_type == .noNetwork { | ||
| 241 | + defult_string = "网络开小差了,刷新试试~" | ||
| 242 | + } | ||
| 243 | + if dataArray.count == 0 { | ||
| 244 | + defult_string = "暂时没有数据~" | ||
| 245 | + } | ||
| 246 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | ||
| 250 | + if network_type == .failed || network_type == .noNetwork { | ||
| 251 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | ||
| 252 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | ||
| 253 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | ||
| 254 | + } | ||
| 255 | + return nil | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | ||
| 259 | + if network_type == .failed || network_type == .noNetwork { | ||
| 260 | + loadDataSourceAction(page: 1) | ||
| 261 | + } | ||
| 262 | + } | ||
| 263 | +} | ||
| 264 | + | ||
| 265 | +extension CNLiveShopOrderSearchListViewController { | ||
| 266 | + | ||
| 267 | + /// 通过不同的按钮逻辑跳转不同界面 | ||
| 268 | + /// - Parameters: | ||
| 269 | + /// - clickEvent: 按钮类型 | ||
| 270 | + /// - listModel: 数据源 | ||
| 271 | + private func orderOperation(title: String, event: CNDSOrderListSectionFooterBtnClickEvent, listModel: ShopOrderListModel) { | ||
| 272 | + switch event { | ||
| 273 | + case .delivery: | ||
| 274 | + if listModel.is_tui == "2" { | ||
| 275 | + showMessage(message: "此为退款订单") | ||
| 276 | + return | ||
| 277 | + } | ||
| 278 | + delivery(listModel: listModel) | ||
| 279 | + break | ||
| 280 | + case .notifyOrder: | ||
| 281 | + if listModel.is_tui == "2" { | ||
| 282 | + showMessage(message: "此为退款订单") | ||
| 283 | + return | ||
| 284 | + } | ||
| 285 | + notifyOrder(listModel: listModel) | ||
| 286 | + break | ||
| 287 | + case .connection: | ||
| 288 | + pushOrderDetail(listModel: listModel) | ||
| 289 | + break | ||
| 290 | + case .expDetail: | ||
| 291 | + delivery(listModel: listModel) | ||
| 292 | + break | ||
| 293 | + case .checkExpress: | ||
| 294 | + pushExpressVC(listModel: listModel) | ||
| 295 | + break | ||
| 296 | + case .express: | ||
| 297 | + pushExpressVC(listModel: listModel) | ||
| 298 | + break | ||
| 299 | + default: | ||
| 300 | + break | ||
| 301 | + } | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + /// 跳转物流相关界面 | ||
| 305 | + /// - Parameter detailModel: 数据源 | ||
| 306 | + private func pushExpressVC(listModel: ShopOrderListModel) { | ||
| 307 | + if listModel.send_num > 1 || listModel.is_send == "0" { | ||
| 308 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true) | ||
| 309 | +// self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true) | ||
| 310 | + } else { | ||
| 311 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: listModel.id! as NSString, expId: "", express_num: listModel.express_num! as NSString, show_type: .orderExpress, progress: .Zero), animated: true) | ||
| 312 | +// self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: "1000021749", expId: "0", express_num: "1234556789012345", show_type: .orderExpress, progress: .Zero), animated: true) | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + /// 选取商品及拆单 | ||
| 317 | + /// - Parameter listModel: 数据源 | ||
| 318 | + private func delivery(listModel: ShopOrderListModel) { | ||
| 319 | + var type: CNLiveShopOrderSpliteSendViewType = .splite | ||
| 320 | + if listModel.is_send == "0" { | ||
| 321 | + type = .select | ||
| 322 | + } | ||
| 323 | + self.navigationController?.pushViewController(CNLiveShopOrderSendViewController.init(orderId: listModel.id! as NSString, show_type: type), animated: true) | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + /// 通知用户自提 | ||
| 327 | + /// - Parameter listModel: 数据源 | ||
| 328 | + private func notifyOrder(listModel: ShopOrderListModel) { | ||
| 329 | + ConfigAlertManager.shared.presentAlert(title: "提示", message: "确认通知用户自提?", actionTitles: ["取消","确认"]) { index in | ||
| 330 | + if index == 1 { | ||
| 331 | + CNLiveShopViewModel.requestNotifyOrder(orderId: listModel.id!) { result, respStatue in | ||
| 332 | + if respStatue == .success { | ||
| 333 | + showMessage(message: "通知成功") | ||
| 334 | + } | ||
| 335 | + } | ||
| 336 | + } | ||
| 337 | + } | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + /// 跳转到订单详情界面 | ||
| 341 | + /// - Parameter listModel: 数据源 | ||
| 342 | + private func pushOrderDetail(listModel: ShopOrderListModel) { | ||
| 343 | + if listModel.isRefund == "1" { | ||
| 344 | + let detailVC = CNLiveShopOrderDetailViewController.init(orderId: listModel.id!, show_type: .sale, form_type: .afterSale) | ||
| 345 | + self.navigationController?.pushViewController(detailVC, animated: true) | ||
| 346 | + } else { | ||
| 347 | + if listModel.address_address!.count > 0 { | ||
| 348 | + self.navigationController?.pushViewController(CNLiveShopOrderDetailViewController.init(orderId: listModel.id!, show_type: .order, form_type: .afterSale), animated: true) | ||
| 349 | + } else { | ||
| 350 | + showMessage(message: "目前没有地址信息,暂无法发货") | ||
| 351 | + } | ||
| 352 | + } | ||
| 353 | + } | ||
| 354 | +} |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderSearchViewController.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopOrderSearchViewController.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/13. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | + | ||
| 10 | +let kShopOrderListSearchHistroyDatas = "kShopOrderListSearchHistroyDatas" | ||
| 11 | +class CNLiveShopOrderSearchViewController: CNLiveBaseViewController, UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource { | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + let kShopBodyOrderSearchHistoryTableViewCellIdentifier = "kShopBodyOrderSearchHistoryTableViewCellIdentifier" | ||
| 15 | + lazy var tableView: UITableView = { | ||
| 16 | + let tableView = UITableView.init(frame: CGRect(x: 0, y: get_system_nav_height(), width: KSreenWidth, height: KSreenHeight - get_system_nav_height()), style: .plain) | ||
| 17 | + tableView.delegate = self | ||
| 18 | + tableView.dataSource = self | ||
| 19 | + tableView.separatorInset = UIEdgeInsets(top: 0, left: adapt_length(length: 20), bottom: 0, right: adapt_length(length: 20)) | ||
| 20 | + tableView.rowHeight = adapt_length(length: 45) | ||
| 21 | + tableView.sectionHeaderHeight = adapt_length(length: 45) | ||
| 22 | + tableView.backgroundColor = HexColor("#f1f2f6") | ||
| 23 | + tableView.register(ShopBodyOrderSearchHistoryTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderSearchHistoryTableViewCellIdentifier) | ||
| 24 | + | ||
| 25 | + let footerView = UIView.init(frame: CGRectMake(0, 0, KSreenWidth, adapt_length(length: 45))) | ||
| 26 | + footerView.backgroundColor = .white | ||
| 27 | + | ||
| 28 | + let deleteBtn = UIButton.init(type: .custom) | ||
| 29 | + deleteBtn.frame = footerView.bounds | ||
| 30 | + if historyArr.count > 0 { | ||
| 31 | + deleteBtn.setTitle("清除搜索历史", for: .normal) | ||
| 32 | + deleteBtn.setTitleColor(HexColor("#FF3355"), for: .normal) | ||
| 33 | + } else { | ||
| 34 | + deleteBtn.setTitle("无搜索历史", for: .normal) | ||
| 35 | + deleteBtn.setTitleColor(HexColor("#898989"), for: .normal) | ||
| 36 | + } | ||
| 37 | + deleteBtn.tag = 1 | ||
| 38 | + deleteBtn.titleLabel?.font = regular_adapt_font(pointSize: 14) | ||
| 39 | + deleteBtn.addTarget(self, action: #selector(deleteAllBtnClick), for: .touchUpInside) | ||
| 40 | + footerView.addSubview(deleteBtn) | ||
| 41 | + | ||
| 42 | + tableView.tableFooterView = footerView | ||
| 43 | + | ||
| 44 | + return tableView | ||
| 45 | + }() | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + lazy var searchTextField: UITextField = { | ||
| 49 | + let searchTextField = UITextField.init(frame: CGRectMake(adapt_length(length: 15), get_system_statusBar_height() + (get_system_nav_ui_height() - adapt_length(length: 30))/2, KSreenWidth - adapt_length(length: 95), adapt_length(length: 30))) | ||
| 50 | + return searchTextField | ||
| 51 | + }() | ||
| 52 | + | ||
| 53 | + lazy var cancelButton: UIButton = { | ||
| 54 | + let cancelButton = UIButton.init(type: .custom) | ||
| 55 | + cancelButton.frame = CGRect(x: KSreenWidth - 70, y: (get_system_nav_height() - (get_system_statusBar_height() + 25))/2 + get_system_statusBar_height(), width: 60, height: 25) | ||
| 56 | + cancelButton.setTitle("取消", for: .normal) | ||
| 57 | + cancelButton.titleLabel?.font = semibold_adapt_font(pointSize: 15) | ||
| 58 | + cancelButton.setTitleColor(HexColor("#ff3355"), for: .normal) | ||
| 59 | + cancelButton.backgroundColor = .clear | ||
| 60 | + cancelButton.layer.masksToBounds = true | ||
| 61 | + cancelButton.layer.cornerRadius = 5 | ||
| 62 | + cancelButton.addTarget(self, action: #selector(cancelBtnClick), for: .touchUpInside) | ||
| 63 | + return cancelButton | ||
| 64 | + }() | ||
| 65 | + | ||
| 66 | + lazy var historyArr: NSMutableArray = { | ||
| 67 | + let historyArr = NSMutableArray.init() | ||
| 68 | + return historyArr | ||
| 69 | + }() | ||
| 70 | + | ||
| 71 | + override func viewWillAppear(_ animated: Bool) { | ||
| 72 | + super.viewWillAppear(animated) | ||
| 73 | + take() | ||
| 74 | + searchTextField.text = "" | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + override func viewWillLayoutSubviews() { | ||
| 78 | + super.viewWillLayoutSubviews() | ||
| 79 | + tableView.frame = CGRect(x: 0, y: get_system_nav_height(), width: KSreenWidth, height: view.height - get_system_nav_height()) | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + override func viewDidLoad() { | ||
| 83 | + super.viewDidLoad() | ||
| 84 | + navigationBarHidden = false | ||
| 85 | + | ||
| 86 | + initNav() | ||
| 87 | + view.addSubview(tableView) | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + func initNav() { | ||
| 91 | + let btn = self.leftNavBtns.first! as UIButton | ||
| 92 | + btn.isHidden = true | ||
| 93 | + | ||
| 94 | + let view = UIView.init(frame: CGRectMake(0, 0, adapt_length(length: 30), adapt_length(length: 30))) | ||
| 95 | + | ||
| 96 | + let imageView = UIImageView.init(frame: CGRect(x: adapt_length(length: 7), y: adapt_length(length: 4), width: adapt_length(length: 22), height: adapt_length(length: 22))) | ||
| 97 | + imageView.image = UIImage(named: "DS_order_search") | ||
| 98 | + imageView.clipsToBounds = true | ||
| 99 | + imageView.contentMode = .scaleAspectFit | ||
| 100 | + view.addSubview(imageView) | ||
| 101 | + | ||
| 102 | + searchTextField.leftView = view | ||
| 103 | + searchTextField.delegate = self | ||
| 104 | + searchTextField.leftViewMode = .always | ||
| 105 | + searchTextField.placeholder = "请输入关键字..." | ||
| 106 | + searchTextField.backgroundColor = HexColor("#f0f0f0") | ||
| 107 | + searchTextField.returnKeyType = .search | ||
| 108 | + searchTextField.layer.cornerRadius = adapt_length(length: 15) | ||
| 109 | + searchTextField.layer.masksToBounds = true | ||
| 110 | + searchTextField.font = regular_adapt_font(pointSize: 13) | ||
| 111 | + topNavView.addSubview(searchTextField) | ||
| 112 | + | ||
| 113 | + topNavView.addSubview(cancelButton) | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + @objc func cancelBtnClick() { | ||
| 117 | + self.navigationController?.popViewController(animated: true) | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @objc func deleteAllBtnClick(deleteBtn: UIButton) { | ||
| 121 | + if historyArr.count > 0 { | ||
| 122 | + deleteAll() | ||
| 123 | + deleteBtn.setTitle("无搜索历史", for: .normal) | ||
| 124 | + deleteBtn.setTitleColor(HexColor("#898989"), for: .normal) | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + ///!!!: | ||
| 129 | + ///增删改查 | ||
| 130 | + func saveRecord(title: String) { | ||
| 131 | + if !title.isNotBlank() { | ||
| 132 | + return | ||
| 133 | + } | ||
| 134 | + if historyArr.contains(title) { | ||
| 135 | + historyArr.remove(title) | ||
| 136 | + } | ||
| 137 | + historyArr.insert(title, at: 0) | ||
| 138 | + tableView.reloadData() | ||
| 139 | + | ||
| 140 | + CNLiveFileManager.shared.save(object: historyArr, key: kShopOrderListSearchHistroyDatas) | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + func take() { | ||
| 144 | + let takeArr = CNLiveFileManager.shared.take(key: kShopOrderListSearchHistroyDatas) | ||
| 145 | + if (takeArr as AnyObject).count > 0 { | ||
| 146 | + historyArr = NSMutableArray.init(array: takeArr as! [Any]) | ||
| 147 | + tableView.reloadData() | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + | ||
| 151 | + let deleteBtn = tableView.tableFooterView?.viewWithTag(1) as! UIButton | ||
| 152 | + if historyArr.count > 0 { | ||
| 153 | + deleteBtn.setTitle("清除搜索历史", for: .normal) | ||
| 154 | + deleteBtn.setTitleColor(HexColor("#ff3355"), for: .normal) | ||
| 155 | + } else { | ||
| 156 | + deleteBtn.setTitle("无搜索历史", for: .normal) | ||
| 157 | + deleteBtn.setTitleColor(HexColor("#898989"), for: .normal) | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + func deleteAll() { | ||
| 162 | + | ||
| 163 | + historyArr.removeAllObjects() | ||
| 164 | + CNLiveFileManager.shared.delete(key: kShopOrderListSearchHistroyDatas) | ||
| 165 | + | ||
| 166 | + tableView.reloadData() | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + func delete(index: NSInteger) { | ||
| 170 | + | ||
| 171 | + historyArr.removeObject(at: index) | ||
| 172 | + CNLiveFileManager.shared.save(object: historyArr, key: kShopOrderListSearchHistroyDatas) | ||
| 173 | + | ||
| 174 | + tableView.reloadData() | ||
| 175 | + } | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +extension CNLiveShopOrderSearchViewController { | ||
| 179 | + | ||
| 180 | + | ||
| 181 | + func textFieldShouldReturn(_ textField: UITextField) -> Bool { | ||
| 182 | + view.endEditing(true) | ||
| 183 | + | ||
| 184 | + saveRecord(title: textField.text ?? "") | ||
| 185 | + | ||
| 186 | + let delectBtn = (tableView.tableFooterView?.viewWithTag(1))! as! UIButton | ||
| 187 | + delectBtn.setTitle("清除搜索历史", for: .normal) | ||
| 188 | + delectBtn.setTitleColor(HexColor("#ff3355"), for: .normal) | ||
| 189 | + | ||
| 190 | + self.navigationController?.pushViewController(CNLiveShopOrderSearchListViewController.init(searchText: textField.text!), animated: true) | ||
| 191 | + | ||
| 192 | + return true | ||
| 193 | + } | ||
| 194 | +} | ||
| 195 | + | ||
| 196 | +extension CNLiveShopOrderSearchViewController { | ||
| 197 | + | ||
| 198 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 199 | + return historyArr.count | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 203 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderSearchHistoryTableViewCellIdentifier) as? ShopBodyOrderSearchHistoryTableViewCell else { | ||
| 204 | + return ShopBodyOrderSearchHistoryTableViewCell() | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + cell.titleLabel.text = historyArr[indexPath.row] as? String | ||
| 208 | + cell.deleteBtn.tag = indexPath.row | ||
| 209 | + cell.clickBlock = {[weak self] button in | ||
| 210 | + self!.delete(index: button.tag) | ||
| 211 | + | ||
| 212 | + if self!.historyArr.count == 0 { | ||
| 213 | + let delectBtn = tableView.tableFooterView?.viewWithTag(1) as! UIButton | ||
| 214 | + delectBtn.setTitle("无搜索历史", for: .normal) | ||
| 215 | + delectBtn.setTitleColor(HexColor("#898989"), for: .normal) | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + return cell | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | ||
| 222 | + let headerView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: adapt_length(length: 45))) | ||
| 223 | + headerView.backgroundColor = .white | ||
| 224 | + | ||
| 225 | + let titleLabel = UILabel.init(frame: CGRect(x: adapt_length(length: 20), y: 0, width: KSreenWidth - adapt_length(length: 65), height: adapt_length(length: 45))) | ||
| 226 | + titleLabel.textColor = HexColor("#898989") | ||
| 227 | + titleLabel.font = regular_adapt_font(pointSize: 14) | ||
| 228 | + titleLabel.text = "历史搜索" | ||
| 229 | + headerView.addSubview(titleLabel) | ||
| 230 | + | ||
| 231 | + let lineLabel = UILabel.init(frame: CGRect(x: adapt_length(length: 20), y: adapt_length(length: 44), width: KSreenWidth, height: adapt_length(length: 1))) | ||
| 232 | + lineLabel.backgroundColor = HexColor("#e4e4e4") | ||
| 233 | + headerView.addSubview(lineLabel) | ||
| 234 | + return headerView | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 238 | + | ||
| 239 | + self.navigationController?.pushViewController(CNLiveShopOrderSearchListViewController.init(searchText: historyArr[indexPath.row] as! String), animated: true) | ||
| 240 | + | ||
| 241 | + saveRecord(title: historyArr[indexPath.row] as! String) | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { | ||
| 245 | + view.endEditing(true) | ||
| 246 | + } | ||
| 247 | +} |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderViewController.swift
| @@ -52,6 +52,17 @@ class CNLiveShopOrderViewController: CNLiveBaseViewController { | @@ -52,6 +52,17 @@ class CNLiveShopOrderViewController: CNLiveBaseViewController { | ||
| 52 | return categoryView | 52 | return categoryView |
| 53 | }() | 53 | }() |
| 54 | 54 | ||
| 55 | + lazy var searchButton: UIButton = { | ||
| 56 | + let searchButton = UIButton.init(type: .custom) | ||
| 57 | + searchButton.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)) | ||
| 58 | + searchButton.setImage(UIImage(named: "DS_order_search"), for: .normal) | ||
| 59 | + searchButton.backgroundColor = .clear | ||
| 60 | + searchButton.layer.masksToBounds = true | ||
| 61 | + searchButton.layer.cornerRadius = 5 | ||
| 62 | + searchButton.addTarget(self, action: #selector(searchBtnClick), for: .touchUpInside) | ||
| 63 | + return searchButton | ||
| 64 | + }() | ||
| 65 | + | ||
| 55 | lazy var listContainerView: JXSegmentedListContainerView! = { | 66 | lazy var listContainerView: JXSegmentedListContainerView! = { |
| 56 | return JXSegmentedListContainerView(dataSource: self) | 67 | return JXSegmentedListContainerView(dataSource: self) |
| 57 | }() | 68 | }() |
| @@ -67,6 +78,8 @@ class CNLiveShopOrderViewController: CNLiveBaseViewController { | @@ -67,6 +78,8 @@ class CNLiveShopOrderViewController: CNLiveBaseViewController { | ||
| 67 | categoryView.listContainer = listContainerView | 78 | categoryView.listContainer = listContainerView |
| 68 | view.addSubview(listContainerView) | 79 | view.addSubview(listContainerView) |
| 69 | 80 | ||
| 81 | + topNavView.addSubview(searchButton) | ||
| 82 | + | ||
| 70 | } | 83 | } |
| 71 | 84 | ||
| 72 | override func viewDidLayoutSubviews() { | 85 | override func viewDidLayoutSubviews() { |
| @@ -75,6 +88,10 @@ class CNLiveShopOrderViewController: CNLiveBaseViewController { | @@ -75,6 +88,10 @@ class CNLiveShopOrderViewController: CNLiveBaseViewController { | ||
| 75 | categoryView.frame = CGRect(x: 0, y: KNavigationHeight, width: view.bounds.size.width, height: CGFloat(kCNLiveShopOrderListSectionTitleHeight)) | 88 | categoryView.frame = CGRect(x: 0, y: KNavigationHeight, width: view.bounds.size.width, height: CGFloat(kCNLiveShopOrderListSectionTitleHeight)) |
| 76 | listContainerView.frame = CGRect(x: 0, y: KNavigationHeight+CGFloat(kCNLiveShopOrderListSectionTitleHeight), width: view.bounds.size.width, height: view.bounds.size.height - CGFloat(kCNLiveShopOrderListSectionTitleHeight) - KNavigationHeight) | 89 | listContainerView.frame = CGRect(x: 0, y: KNavigationHeight+CGFloat(kCNLiveShopOrderListSectionTitleHeight), width: view.bounds.size.width, height: view.bounds.size.height - CGFloat(kCNLiveShopOrderListSectionTitleHeight) - KNavigationHeight) |
| 77 | } | 90 | } |
| 91 | + | ||
| 92 | + @objc func searchBtnClick() { | ||
| 93 | + self.navigationController?.pushViewController(CNLiveShopOrderSearchViewController.init(), animated: true) | ||
| 94 | + } | ||
| 78 | } | 95 | } |
| 79 | 96 | ||
| 80 | extension CNLiveShopOrderViewController: JXSegmentedViewDelegate { | 97 | extension CNLiveShopOrderViewController: JXSegmentedViewDelegate { |
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyCustomView.swift
| @@ -11,6 +11,7 @@ import Kingfisher | @@ -11,6 +11,7 @@ import Kingfisher | ||
| 11 | 11 | ||
| 12 | typealias clickAgreeCallBack = (_ refundView: ShopBodyOrderRefundView,_ desc: String) -> Void | 12 | typealias clickAgreeCallBack = (_ refundView: ShopBodyOrderRefundView,_ desc: String) -> Void |
| 13 | typealias clickButtonCallBack = (_ isSelected: Bool) -> Void | 13 | typealias clickButtonCallBack = (_ isSelected: Bool) -> Void |
| 14 | +typealias clickSearchCallBack = (_ button: UIButton) -> Void | ||
| 14 | typealias clickInputCallBack = (_ content: String, _ row: NSInteger) -> Void | 15 | typealias clickInputCallBack = (_ content: String, _ row: NSInteger) -> Void |
| 15 | class ShopBodyOrderRefundView: UIView, UITextViewDelegate { | 16 | class ShopBodyOrderRefundView: UIView, UITextViewDelegate { |
| 16 | 17 | ||
| @@ -685,3 +686,52 @@ class ShopBodyOrderExpressFirmTableViewCell: UITableViewCell { | @@ -685,3 +686,52 @@ class ShopBodyOrderExpressFirmTableViewCell: UITableViewCell { | ||
| 685 | fatalError("init(coder:) has not been implemented") | 686 | fatalError("init(coder:) has not been implemented") |
| 686 | } | 687 | } |
| 687 | } | 688 | } |
| 689 | + | ||
| 690 | +class ShopBodyOrderSearchHistoryTableViewCell: UITableViewCell { | ||
| 691 | + | ||
| 692 | + lazy var titleLabel: UILabel = { | ||
| 693 | + let titleLabel = UILabel.init() | ||
| 694 | + titleLabel.textColor = HexColor("#6a6a6a") | ||
| 695 | + titleLabel.font = regular_adapt_font(pointSize: 14) | ||
| 696 | + return titleLabel | ||
| 697 | + }() | ||
| 698 | + | ||
| 699 | + lazy var deleteBtn: UIButton = { | ||
| 700 | + let deleteBtn = UIButton.init(type: .custom) | ||
| 701 | + deleteBtn.setImage(UIImage(named: "mine_header_icon_close"), for: .normal) | ||
| 702 | + deleteBtn.addTarget(self, action: #selector(buttonClick), for: .touchUpInside) | ||
| 703 | + return deleteBtn | ||
| 704 | + }() | ||
| 705 | + | ||
| 706 | + var clickBlock: clickSearchCallBack! | ||
| 707 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 708 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 709 | + contentView.backgroundColor = .clear | ||
| 710 | + selectionStyle = .none | ||
| 711 | + | ||
| 712 | + addSubview(deleteBtn) | ||
| 713 | + deleteBtn.snp.makeConstraints { make in | ||
| 714 | + make.centerY.equalToSuperview() | ||
| 715 | + make.size.equalTo(adapt_length(length: 30)) | ||
| 716 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 717 | + } | ||
| 718 | + | ||
| 719 | + addSubview(titleLabel) | ||
| 720 | + titleLabel.snp.makeConstraints { make in | ||
| 721 | + make.centerY.equalToSuperview() | ||
| 722 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 723 | + make.right.equalTo(deleteBtn.snp.left).offset(-adapt_length(length: 10)) | ||
| 724 | + } | ||
| 725 | + } | ||
| 726 | + | ||
| 727 | + | ||
| 728 | + @objc func buttonClick(button: UIButton) { | ||
| 729 | + if (clickBlock != nil) { | ||
| 730 | + clickBlock(button) | ||
| 731 | + } | ||
| 732 | + } | ||
| 733 | + | ||
| 734 | + required init?(coder: NSCoder) { | ||
| 735 | + fatalError("init(coder:) has not been implemented") | ||
| 736 | + } | ||
| 737 | +} |
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyExpressView.swift
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | import EmptyDataSet_Swift | 9 | import EmptyDataSet_Swift |
| 10 | +import Kingfisher | ||
| 10 | 11 | ||
| 11 | class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDataSource { | 12 | class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDataSource { |
| 12 | 13 | ||
| @@ -145,7 +146,7 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa | @@ -145,7 +146,7 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa | ||
| 145 | func setupDataSource(listModel: ShopOrderExpressListModel) { | 146 | func setupDataSource(listModel: ShopOrderExpressListModel) { |
| 146 | _listModel = listModel | 147 | _listModel = listModel |
| 147 | 148 | ||
| 148 | - logoImageView.kf.setImage(with: URL(string: listModel.simg!)) | 149 | + logoImageView.kf.setImage(with: URL(string: listModel.simg!), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: adapt_length(length: 39.68), height: adapt_length(length: 39.68)))) |
| 149 | expressName.text = listModel.express | 150 | expressName.text = listModel.express |
| 150 | expressName.sizeToFit() | 151 | expressName.sizeToFit() |
| 151 | expressNo.text = "快递编号:\(listModel.express_num ?? "0")" | 152 | expressNo.text = "快递编号:\(listModel.express_num ?? "0")" |
| @@ -168,7 +169,7 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa | @@ -168,7 +169,7 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa | ||
| 168 | } | 169 | } |
| 169 | 170 | ||
| 170 | @objc func pushExpressDetail() { | 171 | @objc func pushExpressDetail() { |
| 171 | - currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: _listModel.id! as NSString, expId: _listModel.express_num! as NSString, express_num: _listModel.express_num! as NSString, show_type: .orderExpress, progress: .Zero), animated: true) | 172 | + currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: _listModel.order_id! as NSString, expId: _listModel.id! as NSString, express_num: _listModel.express_num! as NSString, show_type: .orderExpress, progress: .Zero), animated: true) |
| 172 | } | 173 | } |
| 173 | 174 | ||
| 174 | @objc func actionClick(sender: UIButton) { | 175 | @objc func actionClick(sender: UIButton) { |
| @@ -239,22 +240,6 @@ class ShopBodyOrderExpressListCollectionViewCell: UICollectionViewCell { | @@ -239,22 +240,6 @@ class ShopBodyOrderExpressListCollectionViewCell: UICollectionViewCell { | ||
| 239 | } | 240 | } |
| 240 | } | 241 | } |
| 241 | 242 | ||
| 242 | -class ShopBodyOrderExpressDetailHeaderView: UIView { | ||
| 243 | - | ||
| 244 | - var _showType: CNLiveShopOrderExpressDetailShowType! | ||
| 245 | - init(frame: CGRect, showType: CNLiveShopOrderExpressDetailShowType) { | ||
| 246 | - super.init(frame: frame) | ||
| 247 | - _showType = showType | ||
| 248 | - } | ||
| 249 | - | ||
| 250 | - | ||
| 251 | - | ||
| 252 | - required init?(coder: NSCoder) { | ||
| 253 | - fatalError("init(coder:) has not been implemented") | ||
| 254 | - } | ||
| 255 | - | ||
| 256 | -} | ||
| 257 | - | ||
| 258 | 243 | ||
| 259 | class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelegate { | 244 | class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelegate { |
| 260 | 245 | ||
| @@ -295,19 +280,16 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -295,19 +280,16 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 295 | super.init(style: style, reuseIdentifier: reuseIdentifier) | 280 | super.init(style: style, reuseIdentifier: reuseIdentifier) |
| 296 | contentView.backgroundColor = .white | 281 | contentView.backgroundColor = .white |
| 297 | selectionStyle = .none | 282 | selectionStyle = .none |
| 298 | - _have_layout = false | ||
| 299 | 283 | ||
| 300 | addSubview(lineLabel) | 284 | addSubview(lineLabel) |
| 301 | addSubview(pointImageView) | 285 | addSubview(pointImageView) |
| 302 | addSubview(titleTextView) | 286 | addSubview(titleTextView) |
| 303 | addSubview(timeLabel) | 287 | addSubview(timeLabel) |
| 304 | addSubview(bottomLine) | 288 | addSubview(bottomLine) |
| 305 | - | ||
| 306 | -// initLayout() | ||
| 307 | } | 289 | } |
| 308 | 290 | ||
| 309 | func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { | 291 | func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { |
| 310 | - if URL.absoluteString == "tel://" { | 292 | + if URL.absoluteString.contains("tel://") { |
| 311 | let phone = URL.absoluteString.components(separatedBy: "tel://").last | 293 | let phone = URL.absoluteString.components(separatedBy: "tel://").last |
| 312 | ConfigAlertManager.shared.presentAlert(title: phone!, message: "", actionTitles: ["取消","呼叫"]) { index in | 294 | ConfigAlertManager.shared.presentAlert(title: phone!, message: "", actionTitles: ["取消","呼叫"]) { index in |
| 313 | if index == 1 { | 295 | if index == 1 { |
| @@ -322,14 +304,13 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -322,14 +304,13 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 322 | return false | 304 | return false |
| 323 | } | 305 | } |
| 324 | 306 | ||
| 325 | - var _have_layout: Bool! | ||
| 326 | var _dataModel: ShopOrderExpressDetailDateModel! | 307 | var _dataModel: ShopOrderExpressDetailDateModel! |
| 327 | var _row: NSInteger! | 308 | var _row: NSInteger! |
| 328 | var _isLastRow: Bool! | 309 | var _isLastRow: Bool! |
| 329 | var _type: CNLiveShopOrderExpressDetailShowType! | 310 | var _type: CNLiveShopOrderExpressDetailShowType! |
| 330 | var _address: NSString! | 311 | var _address: NSString! |
| 331 | var _express_state: NSString! | 312 | var _express_state: NSString! |
| 332 | - func setupDataSource(dataModel: ShopOrderExpressDetailDateModel, row: NSInteger, isLastRow: Bool, type: CNLiveShopOrderExpressDetailShowType, address: NSString, express_state: NSString, temp_array: NSMutableArray) { | 313 | + func setupDataSource(dataModel: ShopOrderExpressDetailDateModel, row: NSInteger, isLastRow: Bool, type: CNLiveShopOrderExpressDetailShowType, address: NSString, express_state: NSString) { |
| 333 | _dataModel = dataModel | 314 | _dataModel = dataModel |
| 334 | _row = row | 315 | _row = row |
| 335 | _isLastRow = isLastRow | 316 | _isLastRow = isLastRow |
| @@ -350,7 +331,7 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -350,7 +331,7 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 350 | pointImageView.image = nil | 331 | pointImageView.image = nil |
| 351 | pointImageView.backgroundColor = HexColor("#d2d2d2") | 332 | pointImageView.backgroundColor = HexColor("#d2d2d2") |
| 352 | pointImageView.size = CGSizeMake(adapt_length(length: 5), adapt_length(length: 5)) | 333 | pointImageView.size = CGSizeMake(adapt_length(length: 5), adapt_length(length: 5)) |
| 353 | - pointImageView.layer.cornerRadius = pointImageView.height/2 | 334 | + pointImageView.layer.cornerRadius = adapt_length(length: 2.5) |
| 354 | pointImageView.layer.masksToBounds = true | 335 | pointImageView.layer.masksToBounds = true |
| 355 | } else if (_row == 1) { | 336 | } else if (_row == 1) { |
| 356 | let state = _express_state == "3" ? "已签收" : "运输中" | 337 | let state = _express_state == "3" ? "已签收" : "运输中" |
| @@ -363,8 +344,8 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -363,8 +344,8 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 363 | pointImageView.image = UIImage(named: "DS_express_current") | 344 | pointImageView.image = UIImage(named: "DS_express_current") |
| 364 | pointImageView.backgroundColor = .clear | 345 | pointImageView.backgroundColor = .clear |
| 365 | pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15)) | 346 | pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15)) |
| 366 | - pointImageView.layer.cornerRadius = 0 | ||
| 367 | - pointImageView.layer.masksToBounds = false | 347 | + pointImageView.layer.cornerRadius = adapt_length(length: 7.5) |
| 348 | + pointImageView.layer.masksToBounds = true | ||
| 368 | } else { | 349 | } else { |
| 369 | let title = NSMutableAttributedString.init(string: dataModel.AcceptStation!, attributes: [.font:medium_adapt_font(pointSize: 12),.foregroundColor:HexColor("#b4b4b4")!,.paragraphStyle:para.copy()]) | 350 | let title = NSMutableAttributedString.init(string: dataModel.AcceptStation!, attributes: [.font:medium_adapt_font(pointSize: 12),.foregroundColor:HexColor("#b4b4b4")!,.paragraphStyle:para.copy()]) |
| 370 | titleTextView.attributedText = setHyperlinksAttrStr(attrStr: title) | 351 | titleTextView.attributedText = setHyperlinksAttrStr(attrStr: title) |
| @@ -373,7 +354,7 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -373,7 +354,7 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 373 | pointImageView.image = nil | 354 | pointImageView.image = nil |
| 374 | pointImageView.backgroundColor = backgroundColor | 355 | pointImageView.backgroundColor = backgroundColor |
| 375 | pointImageView.size = CGSize(width: adapt_length(length: 5), height: adapt_length(length: 5)) | 356 | pointImageView.size = CGSize(width: adapt_length(length: 5), height: adapt_length(length: 5)) |
| 376 | - pointImageView.layer.cornerRadius = pointImageView.height/2 | 357 | + pointImageView.layer.cornerRadius = adapt_length(length: 2.5) |
| 377 | pointImageView.layer.masksToBounds = true | 358 | pointImageView.layer.masksToBounds = true |
| 378 | pointImageView.layer.borderColor = HexColor("#d2d2d2")?.cgColor | 359 | pointImageView.layer.borderColor = HexColor("#d2d2d2")?.cgColor |
| 379 | pointImageView.layer.borderWidth = adapt_length(length: 1) | 360 | pointImageView.layer.borderWidth = adapt_length(length: 1) |
| @@ -386,7 +367,7 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -386,7 +367,7 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 386 | pointImageView.image = UIImage(named: "DS_express_current") | 367 | pointImageView.image = UIImage(named: "DS_express_current") |
| 387 | pointImageView.backgroundColor = .clear | 368 | pointImageView.backgroundColor = .clear |
| 388 | pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15)) | 369 | pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15)) |
| 389 | - pointImageView.layer.cornerRadius = 0 | 370 | + pointImageView.layer.cornerRadius = adapt_length(length: 7.5) |
| 390 | pointImageView.layer.masksToBounds = false | 371 | pointImageView.layer.masksToBounds = false |
| 391 | } else { | 372 | } else { |
| 392 | titleTextView.textColor = HexColor("#999999") | 373 | titleTextView.textColor = HexColor("#999999") |
| @@ -394,7 +375,7 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -394,7 +375,7 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 394 | pointImageView.image = UIImage(named: "DS_express_current") | 375 | pointImageView.image = UIImage(named: "DS_express_current") |
| 395 | pointImageView.backgroundColor = .clear | 376 | pointImageView.backgroundColor = .clear |
| 396 | pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15)) | 377 | pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15)) |
| 397 | - pointImageView.layer.cornerRadius = pointImageView.height/2 | 378 | + pointImageView.layer.cornerRadius = adapt_length(length: 7.5) |
| 398 | pointImageView.layer.masksToBounds = true | 379 | pointImageView.layer.masksToBounds = true |
| 399 | pointImageView.layer.borderColor = HexColor("#d2d2d2")?.cgColor | 380 | pointImageView.layer.borderColor = HexColor("#d2d2d2")?.cgColor |
| 400 | pointImageView.layer.borderWidth = adapt_length(length: 1) | 381 | pointImageView.layer.borderWidth = adapt_length(length: 1) |
| @@ -402,26 +383,12 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -402,26 +383,12 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 402 | titleTextView.text = dataModel.AcceptStation | 383 | titleTextView.text = dataModel.AcceptStation |
| 403 | timeLabel.text = dataModel.AcceptTime | 384 | timeLabel.text = dataModel.AcceptTime |
| 404 | } | 385 | } |
| 405 | -// titleTextView.sizeToFit() | 386 | + titleTextView.snp.removeConstraints() |
| 387 | + pointImageView.snp.removeConstraints() | ||
| 388 | + lineLabel.snp.removeConstraints() | ||
| 389 | + titleTextView.sizeToFit() | ||
| 406 | setupLayout() | 390 | setupLayout() |
| 407 | - } | ||
| 408 | - | ||
| 409 | - func initLayout() { | ||
| 410 | - lineLabel.snp.makeConstraints { make in | ||
| 411 | - make.centerX.equalTo(pointImageView) | ||
| 412 | - make.top.bottom.equalToSuperview() | ||
| 413 | - make.width.equalTo(adapt_length(length: 1)) | ||
| 414 | - } | ||
| 415 | - pointImageView.snp.makeConstraints { make in | ||
| 416 | - make.top.equalToSuperview().offset(adapt_length(length: 16)) | ||
| 417 | - make.left.equalTo(adapt_length(length: 20)) | ||
| 418 | - make.size.equalTo(adapt_length(length: 5)) | ||
| 419 | - } | ||
| 420 | - titleTextView.snp.makeConstraints { make in | ||
| 421 | - make.top.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 422 | - make.left.equalToSuperview().offset(adapt_length(length: 48)) | ||
| 423 | - make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 424 | - } | 391 | + |
| 425 | } | 392 | } |
| 426 | 393 | ||
| 427 | func setupLayout() { | 394 | func setupLayout() { |
| @@ -464,26 +431,26 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -464,26 +431,26 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 464 | make.top.equalToSuperview().offset(adapt_length(length: 15)) | 431 | make.top.equalToSuperview().offset(adapt_length(length: 15)) |
| 465 | make.left.equalToSuperview().offset(adapt_length(length: 48)) | 432 | make.left.equalToSuperview().offset(adapt_length(length: 48)) |
| 466 | make.right.equalToSuperview().offset(-adapt_length(length: 20)) | 433 | make.right.equalToSuperview().offset(-adapt_length(length: 20)) |
| 467 | - make.height.equalTo(_dataModel.cellH) | ||
| 468 | - } | ||
| 469 | -// let top = timeLabel.text!.isNotBlank() ? adapt_length(length: 15) : 0 | ||
| 470 | -// timeLabel.snp.makeConstraints { make in | ||
| 471 | -// make.top.equalTo(titleTextView.snp.bottom).offset(adapt_length(length: top)) | ||
| 472 | -// make.left.equalTo(titleTextView.snp.left) | ||
| 473 | -// make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 474 | -// make.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 475 | -// } | ||
| 476 | -// bottomLine.snp.makeConstraints { make in | ||
| 477 | -// make.left.equalTo(titleTextView.snp.left) | ||
| 478 | -// make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 479 | -// make.bottom.equalToSuperview() | ||
| 480 | -// make.height.equalTo(adapt_length(length: 1)) | ||
| 481 | -// } | 434 | + make.height.equalTo(titleTextView.size) |
| 435 | + } | ||
| 436 | + let top = timeLabel.text!.isNotBlank() ? adapt_length(length: 15) : 0 | ||
| 437 | + timeLabel.snp.makeConstraints { make in | ||
| 438 | + make.top.equalTo(titleTextView.snp.bottom).offset(adapt_length(length: top)) | ||
| 439 | + make.left.equalTo(titleTextView.snp.left) | ||
| 440 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 441 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 442 | + } | ||
| 443 | + bottomLine.snp.makeConstraints { make in | ||
| 444 | + make.left.equalTo(titleTextView.snp.left) | ||
| 445 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 446 | + make.bottom.equalToSuperview() | ||
| 447 | + make.height.equalTo(adapt_length(length: 1)) | ||
| 448 | + } | ||
| 482 | } | 449 | } |
| 483 | 450 | ||
| 484 | func setHyperlinksAttrStr(attrStr: NSMutableAttributedString) -> NSAttributedString { | 451 | func setHyperlinksAttrStr(attrStr: NSMutableAttributedString) -> NSAttributedString { |
| 485 | do { | 452 | do { |
| 486 | - let dataDetector = try NSDataDetector(types: NSTextCheckingTypes(NSTextCheckingResult.CheckingType.link.rawValue) | NSTextCheckingTypes(NSTextCheckingResult.CheckingType.phoneNumber.rawValue)) | 453 | + let dataDetector = try NSDataDetector(types: NSTextCheckingTypes(NSTextCheckingResult.CheckingType.phoneNumber.rawValue) | NSTextCheckingTypes(NSTextCheckingResult.CheckingType.link.rawValue)) |
| 487 | let res = dataDetector.matches(in: attrStr.string, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, attrStr.string.count)) | 454 | let res = dataDetector.matches(in: attrStr.string, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, attrStr.string.count)) |
| 488 | for checkingRes in res { | 455 | for checkingRes in res { |
| 489 | if (checkingRes.phoneNumber != nil) { | 456 | if (checkingRes.phoneNumber != nil) { |
| @@ -503,3 +470,181 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | @@ -503,3 +470,181 @@ class ShopBodyOrderExpressDetailTableViewCell: UITableViewCell, UITextViewDelega | ||
| 503 | fatalError("init(coder:) has not been implemented") | 470 | fatalError("init(coder:) has not been implemented") |
| 504 | } | 471 | } |
| 505 | } | 472 | } |
| 473 | + | ||
| 474 | +class ShopBodyOrderExpressDetailHeaderView: UIView { | ||
| 475 | + | ||
| 476 | + lazy var iconImageView: UIImageView = { | ||
| 477 | + let iconImageView = UIImageView.init(frame: CGRectMake(0, 0, adapt_length(length: 40), adapt_length(length: 40))) | ||
| 478 | + iconImageView.contentMode = .scaleAspectFill | ||
| 479 | + return iconImageView | ||
| 480 | + }() | ||
| 481 | + | ||
| 482 | + lazy var titleLabel: UILabel = { | ||
| 483 | + let titleLabel = UILabel.init() | ||
| 484 | + titleLabel.textColor = HexColor("#333333") | ||
| 485 | + titleLabel.font = medium_adapt_font(pointSize: 14) | ||
| 486 | + return titleLabel | ||
| 487 | + }() | ||
| 488 | + | ||
| 489 | + lazy var descLabel: UILabel = { | ||
| 490 | + let descLabel = UILabel.init() | ||
| 491 | + descLabel.textColor = HexColor("#b4b4b4") | ||
| 492 | + descLabel.font = regular_adapt_font(pointSize: 12) | ||
| 493 | + descLabel.isHidden = !(_show_type == .orderExpress || _show_type == .refundExpress) | ||
| 494 | + return descLabel | ||
| 495 | + }() | ||
| 496 | + | ||
| 497 | + lazy var editBtn: UIButton = { | ||
| 498 | + let editBtn = UIButton.init(type: .custom) | ||
| 499 | + editBtn.size = CGSizeMake(adapt_length(length: 47), adapt_length(length: 30)) | ||
| 500 | + editBtn.setTitle("修改", for: .normal) | ||
| 501 | + editBtn.setTitleColor(HexColor("#28c1c6"), for: .normal) | ||
| 502 | + editBtn.titleLabel?.font = medium_adapt_font(pointSize: 14) | ||
| 503 | + editBtn.layer.cornerRadius = adapt_length(length: 4) | ||
| 504 | + editBtn.layer.masksToBounds = true | ||
| 505 | + editBtn.layer.borderColor = HexColor("#28c1c6")?.cgColor | ||
| 506 | + editBtn.layer.borderWidth = adapt_length(length: 1) | ||
| 507 | + editBtn.isHidden = !(_show_type == .orderExpress || _show_type == .refundExpress) | ||
| 508 | + editBtn.addTarget(self, action: #selector(editBtnClick), for: .touchUpInside) | ||
| 509 | + return editBtn | ||
| 510 | + }() | ||
| 511 | + | ||
| 512 | + lazy var enCopyBtn: UIButton = { | ||
| 513 | + let enCopyBtn = UIButton.init(type: .custom) | ||
| 514 | + enCopyBtn.size = CGSizeMake(adapt_length(length: 77), adapt_length(length: 30)) | ||
| 515 | + enCopyBtn.setTitle("复制单号", for: .normal) | ||
| 516 | + enCopyBtn.setTitleColor(HexColor("#28c1c6"), for: .normal) | ||
| 517 | + enCopyBtn.titleLabel?.font = medium_adapt_font(pointSize: 14) | ||
| 518 | + enCopyBtn.layer.cornerRadius = adapt_length(length: 4) | ||
| 519 | + enCopyBtn.layer.masksToBounds = true | ||
| 520 | + enCopyBtn.layer.borderColor = HexColor("#28c1c6")?.cgColor | ||
| 521 | + enCopyBtn.layer.borderWidth = adapt_length(length: 1) | ||
| 522 | + enCopyBtn.isHidden = !(_show_type == .orderExpress || _show_type == .refundExpress) | ||
| 523 | + enCopyBtn.addTarget(self, action: #selector(enCopyBtnClick), for: .touchUpInside) | ||
| 524 | + return enCopyBtn | ||
| 525 | + }() | ||
| 526 | + | ||
| 527 | + lazy var lineLabel: UILabel = { | ||
| 528 | + let lineLabel = UILabel.init() | ||
| 529 | + lineLabel.backgroundColor = HexColor("#f6f6f6") | ||
| 530 | + return lineLabel | ||
| 531 | + }() | ||
| 532 | + // 自取进度 (自取有用) | ||
| 533 | + var _TBY_progress: CNLiveShopOrderExpressDetailYBYProgress! | ||
| 534 | + var TBY_progress: CNLiveShopOrderExpressDetailYBYProgress? { | ||
| 535 | + set { | ||
| 536 | + _TBY_progress = newValue | ||
| 537 | + if _TBY_progress == .Zero { | ||
| 538 | + titleLabel.text = "备货完成" | ||
| 539 | + } else { | ||
| 540 | + titleLabel.text = "自取完毕" | ||
| 541 | + } | ||
| 542 | + } | ||
| 543 | + get { | ||
| 544 | + _TBY_progress | ||
| 545 | + } | ||
| 546 | + } | ||
| 547 | + // 快递公司信息 (快递有用) | ||
| 548 | + var _expressModel: ShopOrderExpressModel! | ||
| 549 | + var expressModel: ShopOrderExpressModel? { | ||
| 550 | + set { | ||
| 551 | + _expressModel = newValue | ||
| 552 | + iconImageView.kf.setImage(with: URL(string: _expressModel.simg!), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: adapt_length(length: 40), height: adapt_length(length: 40)))) | ||
| 553 | + titleLabel.text = _expressModel.com | ||
| 554 | + } | ||
| 555 | + get { | ||
| 556 | + _expressModel | ||
| 557 | + } | ||
| 558 | + } | ||
| 559 | + // 快递编号 (快递有用) | ||
| 560 | + var _express_num: String! | ||
| 561 | + var express_num: String { | ||
| 562 | + set { | ||
| 563 | + _express_num = newValue | ||
| 564 | + descLabel.text = "快递编号:\(_express_num ?? "")" | ||
| 565 | + } | ||
| 566 | + get { | ||
| 567 | + _express_num | ||
| 568 | + } | ||
| 569 | + } | ||
| 570 | + var _orderId: String! // 快递订单号 (快递有用) | ||
| 571 | + var _expId: String! // 发货单id (多物流快递有用) | ||
| 572 | + | ||
| 573 | + var _show_type: CNLiveShopOrderExpressDetailShowType! | ||
| 574 | + init(frame: CGRect,show_type: CNLiveShopOrderExpressDetailShowType) { | ||
| 575 | + _show_type = show_type | ||
| 576 | + super.init(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: (_show_type == .orderExpress || _show_type == .refundExpress) ? adapt_length(length: 80) : adapt_length(length: 58))) | ||
| 577 | + backgroundColor = UIColor.white | ||
| 578 | + | ||
| 579 | + addSubview(iconImageView) | ||
| 580 | + iconImageView.snp.makeConstraints { make in | ||
| 581 | + make.left.equalToSuperview().offset(adapt_length(length: 20)) | ||
| 582 | + make.top.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 583 | + make.size.equalTo(adapt_length(length: 40)) | ||
| 584 | + } | ||
| 585 | + addSubview(enCopyBtn) | ||
| 586 | + enCopyBtn.snp.makeConstraints { make in | ||
| 587 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 588 | + make.top.equalToSuperview().offset(adapt_length(length: 6)) | ||
| 589 | + make.size.equalTo(enCopyBtn.size) | ||
| 590 | + } | ||
| 591 | + addSubview(editBtn) | ||
| 592 | + editBtn.snp.makeConstraints { make in | ||
| 593 | + make.right.equalTo(enCopyBtn.snp.left).offset(-adapt_length(length: 10)) | ||
| 594 | + make.centerY.equalTo(enCopyBtn) | ||
| 595 | + make.size.equalTo(editBtn.size) | ||
| 596 | + } | ||
| 597 | + addSubview(titleLabel) | ||
| 598 | + titleLabel.snp.makeConstraints { make in | ||
| 599 | + make.left.equalTo(iconImageView.snp.right).offset(adapt_length(length: 16)) | ||
| 600 | + if _show_type == .orderExpress || _show_type == .refundExpress { | ||
| 601 | + make.right.equalTo(enCopyBtn.snp.left).offset(-adapt_length(length: 16)) | ||
| 602 | + make.top.equalToSuperview().offset(adapt_length(length: 16)) | ||
| 603 | + make.height.equalTo(adapt_length(length: 17)) | ||
| 604 | + } else { | ||
| 605 | + make.centerY.equalTo(iconImageView) | ||
| 606 | + make.right.equalToSuperview().offset(-adapt_length(length: 16)) | ||
| 607 | + } | ||
| 608 | + } | ||
| 609 | + addSubview(descLabel) | ||
| 610 | + descLabel.snp.makeConstraints { make in | ||
| 611 | + make.left.equalTo(iconImageView.snp.right).offset(adapt_length(length: 16)) | ||
| 612 | + if _show_type == .orderExpress || _show_type == .refundExpress { | ||
| 613 | + make.right.equalTo(enCopyBtn.snp.left).offset(-adapt_length(length: 16)) | ||
| 614 | + } else { | ||
| 615 | + make.right.equalToSuperview().offset(-adapt_length(length: 16)) | ||
| 616 | + } | ||
| 617 | + make.top.equalTo(titleLabel.snp.bottom).offset(adapt_length(length: 10)) | ||
| 618 | + make.height.equalTo(adapt_length(length: 17)) | ||
| 619 | + } | ||
| 620 | + addSubview(lineLabel) | ||
| 621 | + lineLabel.snp.makeConstraints { make in | ||
| 622 | + make.left.right.bottom.equalToSuperview() | ||
| 623 | + make.height.equalTo(adapt_length(length: 10)) | ||
| 624 | + } | ||
| 625 | + } | ||
| 626 | + | ||
| 627 | + @objc func editBtnClick(sender: UIButton) { | ||
| 628 | + if _show_type == .orderExpress || _show_type == .refundExpress { | ||
| 629 | + let vc = CNLiveShopOrderExpressViewController.init(orderId: _orderId! as NSString, isExp: (_expId != nil), goods_arr: []) | ||
| 630 | + vc.expressModel = _expressModel | ||
| 631 | + vc.express_num = _express_num | ||
| 632 | + vc.expId = _expId | ||
| 633 | + vc.hiddenShop = true | ||
| 634 | + currentViewController()?.navigationController?.pushViewController(vc, animated: true) | ||
| 635 | + } | ||
| 636 | + } | ||
| 637 | + | ||
| 638 | + @objc func enCopyBtnClick(sender: UIButton) { | ||
| 639 | + if !_express_num.isNotBlank() { | ||
| 640 | + return | ||
| 641 | + } | ||
| 642 | + let pasteboard = UIPasteboard.general | ||
| 643 | + pasteboard.string = _express_num | ||
| 644 | + showMessage(message: "复制成功") | ||
| 645 | + } | ||
| 646 | + | ||
| 647 | + required init?(coder: NSCoder) { | ||
| 648 | + fatalError("init(coder:) has not been implemented") | ||
| 649 | + } | ||
| 650 | +} |
metaCode/Classes/Main/ShopPage/ViewModel/CNLiveShopViewModel.swift
| @@ -15,7 +15,7 @@ class CNLiveShopViewModel: NSObject { | @@ -15,7 +15,7 @@ class CNLiveShopViewModel: NSObject { | ||
| 15 | /// - Parameters: | 15 | /// - Parameters: |
| 16 | /// - state: 0全部 1待发货 2配送中 3代付款 4订单退款 | 16 | /// - state: 0全部 1待发货 2配送中 3代付款 4订单退款 |
| 17 | /// - resultShopBlock: 返回 | 17 | /// - resultShopBlock: 返回 |
| 18 | - static func requestOrderList(state: String, page: NSInteger, resultBlock: @escaping resultShopBlock) { | 18 | + static func requestOrderList(state: String, keyword: String, page: NSInteger, resultBlock: @escaping resultShopBlock) { |
| 19 | if state == "6" { | 19 | if state == "6" { |
| 20 | let param = NSMutableDictionary() | 20 | let param = NSMutableDictionary() |
| 21 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") | 21 | param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid") |
| @@ -65,7 +65,7 @@ class CNLiveShopViewModel: NSObject { | @@ -65,7 +65,7 @@ class CNLiveShopViewModel: NSObject { | ||
| 65 | param.setValue("\(page)", forKey: "page") | 65 | param.setValue("\(page)", forKey: "page") |
| 66 | param.setValue("", forKey: "delivery") | 66 | param.setValue("", forKey: "delivery") |
| 67 | param.setValue(state, forKey: "state") | 67 | param.setValue(state, forKey: "state") |
| 68 | - param.setValue("", forKey: "keyword") | 68 | + param.setValue(keyword, forKey: "keyword") |
| 69 | let custom_param = NSMutableDictionary() | 69 | let custom_param = NSMutableDictionary() |
| 70 | custom_param.setValue(APPId_wjj, forKey: "appId") | 70 | custom_param.setValue(APPId_wjj, forKey: "appId") |
| 71 | custom_param.setValue(APPKey_wjj, forKey: "appKey") | 71 | custom_param.setValue(APPKey_wjj, forKey: "appKey") |