Commit 0117f66f88366cad6e494467ffacadc2c1c5fcc5
Merge branch 'master' of http://bj.gitlab.cnlive.com/ios-team/CNLiveMateCode
Showing
1 changed file
with
11 additions
and
14 deletions
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| @@ -339,28 +339,24 @@ class CNLiveMineViewModel: NSObject { | @@ -339,28 +339,24 @@ class CNLiveMineViewModel: NSObject { | ||
| 339 | if page == 1 { | 339 | if page == 1 { |
| 340 | let have_id_auths = CNLiveSaveAuthDB.shared.searchAllObjectId() | 340 | let have_id_auths = CNLiveSaveAuthDB.shared.searchAllObjectId() |
| 341 | if have_id_auths.count > 0 { | 341 | if have_id_auths.count > 0 { |
| 342 | - let tempArray_have = NSMutableArray() | ||
| 343 | - let tempArray_no = NSMutableArray() | ||
| 344 | - for item in listModel.list { | ||
| 345 | - if (have_id_auths.contains("\(item.identityId)")) { | ||
| 346 | - tempArray_have.add(item) | 342 | + let tempArray = NSMutableArray.init(array: listModel.list) |
| 343 | + for item in tempArray { | ||
| 344 | + if (have_id_auths.contains("\((item as! MineAuthListModel).identityId)")) { | ||
| 345 | +// tempArray_have.add(item) | ||
| 347 | }else{ | 346 | }else{ |
| 348 | - tempArray_no.add(item) | 347 | +// tempArray_no.add(item) |
| 349 | } | 348 | } |
| 350 | } | 349 | } |
| 351 | - let tempArray = NSMutableArray() | ||
| 352 | - tempArray.adding(tempArray_have) | ||
| 353 | - tempArray.adding(tempArray_no) | ||
| 354 | - listModel.list = tempArray as! [MineAuthListModel] | ||
| 355 | - CNLiveSaveAuthDB.shared.deleteAllObjects() | ||
| 356 | - CNLiveSaveAuthDB.shared.insertObjects(objects: listModel.list) | 350 | +// listModel.list = tempArray as! [MineAuthListModel] |
| 357 | }else{ | 351 | }else{ |
| 358 | //本地没值 不进行处理 | 352 | //本地没值 不进行处理 |
| 359 | } | 353 | } |
| 354 | + CNLiveSaveAuthDB.shared.deleteAllObjects() | ||
| 355 | + CNLiveSaveAuthDB.shared.insertObjects(objects: listModel.list) | ||
| 360 | } else { | 356 | } else { |
| 361 | //多条数据 | 357 | //多条数据 |
| 362 | - | ||
| 363 | } | 358 | } |
| 359 | + | ||
| 364 | resultBlock(listModel,.success) | 360 | resultBlock(listModel,.success) |
| 365 | } else { | 361 | } else { |
| 366 | showMessage(message: resp["errorMessage"] as! String) | 362 | showMessage(message: resp["errorMessage"] as! String) |
| @@ -472,7 +468,8 @@ class CNLiveMineViewModel: NSObject { | @@ -472,7 +468,8 @@ class CNLiveMineViewModel: NSObject { | ||
| 472 | } | 468 | } |
| 473 | resultBlock(tempArray,.success) | 469 | resultBlock(tempArray,.success) |
| 474 | }else { | 470 | }else { |
| 475 | - resultBlock(newsModel.authInfos,.success) | 471 | + let tempArray = NSMutableArray.init(array: newsModel.authInfos) |
| 472 | + resultBlock(tempArray,.success) | ||
| 476 | } | 473 | } |
| 477 | } else { | 474 | } else { |
| 478 | showMessage(message: resp["errorMessage"] as! String) | 475 | showMessage(message: resp["errorMessage"] as! String) |