LogShareAndCommentModel.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // LogShareAndCommentModel.m
  3. // IBOSS
  4. //
  5. // Created by Dongke on 15/11/5.
  6. // Copyright © 2015年 elongtian. All rights reserved.
  7. //
  8. #import "LogShareAndCommentModel.h"
  9. #import "LogShareAndCommentInfoModel.h"
  10. @implementation LogShareAndCommentModel
  11. -(id)init
  12. {
  13. self =[super init];
  14. if(self){
  15. _shareCommentArr=[NSMutableArray new];
  16. }
  17. return self;
  18. }
  19. -(void)parseShareAndCommentArr:(NSArray *)arr{
  20. if(arr!=nil){
  21. [_shareCommentArr removeAllObjects];
  22. for(int i=0;i<arr.count;i++)
  23. {
  24. LogShareAndCommentInfoModel * info=[LogShareAndCommentInfoModel new];
  25. NSDictionary * dic=arr[i];
  26. [info ParseDic:dic];
  27. [_shareCommentArr addObject:info];
  28. }
  29. }
  30. }
  31. -(void)setShareAndCommentArr:(NSArray *)arr{
  32. [_shareCommentArr removeAllObjects];
  33. if(arr!=nil){
  34. [_shareCommentArr addObjectsFromArray:arr];
  35. }
  36. }
  37. -(BOOL)updateCellChecked:(NSString *)checkDocId{
  38. for (LogShareAndCommentInfoModel* model in _shareCommentArr) {
  39. if([model.userId intValue]==[checkDocId intValue]){
  40. model.isChecked=!model.isChecked;
  41. return model.isChecked;
  42. }
  43. }
  44. return NO;
  45. }
  46. -(BOOL)hasSameCode{
  47. return NO;
  48. }
  49. -(BOOL)isSelectAtLeastOne{
  50. BOOL s=NO;
  51. for (LogShareAndCommentInfoModel* model in _shareCommentArr) {
  52. if(model.isChecked){
  53. s=YES;
  54. break;
  55. }
  56. }
  57. return s;
  58. }
  59. -(NSArray *)checkedArr{
  60. NSMutableArray *tempArr=[NSMutableArray new];
  61. for (LogShareAndCommentInfoModel* model in _shareCommentArr) {
  62. if(model.isChecked){
  63. [tempArr addObject:model];
  64. }
  65. }
  66. return tempArr;
  67. }
  68. @end