Commit 24bc89dafd4fc2b7a02d82578f2308ffcc50ae40

Authored by liushiyu
1 parent a5d674bc

提交过滤

metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
... ... @@ -339,28 +339,24 @@ class CNLiveMineViewModel: NSObject {
339 339 if page == 1 {
340 340 let have_id_auths = CNLiveSaveAuthDB.shared.searchAllObjectId()
341 341 if have_id_auths.count > 0 {
342   - let tempArray_have = NSMutableArray()
343   - let tempArray_no = NSMutableArray()
344   - for item in listModel.list {
  342 + let tempArray = NSMutableArray.init(array: listModel.list)
  343 + for item in tempArray {
345 344 if (have_id_auths.contains("\(item.identityId)")) {
346   - tempArray_have.add(item)
  345 +// tempArray_have.add(item)
347 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 351 }else{
358 352 //本地没值 不进行处理
359 353 }
  354 + CNLiveSaveAuthDB.shared.deleteAllObjects()
  355 + CNLiveSaveAuthDB.shared.insertObjects(objects: listModel.list)
360 356 } else {
361 357 //多条数据
362   -
363 358 }
  359 +
364 360 resultBlock(listModel,.success)
365 361 } else {
366 362 showMessage(message: resp["errorMessage"] as! String)
... ... @@ -472,7 +468,8 @@ class CNLiveMineViewModel: NSObject {
472 468 }
473 469 resultBlock(tempArray,.success)
474 470 }else {
475   - resultBlock(newsModel.authInfos,.success)
  471 + let tempArray = NSMutableArray.init(array: newsModel.authInfos)
  472 + resultBlock(tempArray,.success)
476 473 }
477 474 } else {
478 475 showMessage(message: resp["errorMessage"] as! String)
... ...