Log.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // Log.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 15/10/30.
  6. // Copyright © 2015年 elongtian. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "Log.h"
  10. #import "ImageModel.h"
  11. #import "ReplyInfo.h"
  12. #import "Sound.h"
  13. #import "DKMessage.h"
  14. #import "DateFormat.h"
  15. #import "ReplyFrame.h"
  16. @implementation Log
  17. -(void)ParseDic:(NSDictionary *)dic
  18. {
  19. if(dic!=nil){
  20. _recordId=[[dic objectForKey:@"RecordID"] integerValue];
  21. NSInteger recordStatus= [[dic objectForKey:@"RecordStatus"]integerValue];
  22. if(recordStatus==0){
  23. _recordStatus=@"(未点评)";
  24. }
  25. else{
  26. _recordStatus=@"(已点评)";
  27. }
  28. _recordSource=[[dic objectForKey:@"RecordSource"]integerValue];
  29. _location=[dic objectForKey:@"RecordLocation"];
  30. _userName=[dic objectForKey:@"UserName"];
  31. _content=[dic objectForKey:@"RecordContent"];
  32. _valueFlag=[[dic objectForKey:@"ValueFlag"]integerValue];
  33. _commentUserId=[[dic objectForKey:@"CommentUserID"]integerValue];
  34. _checker=[dic objectForKey:@"Checker"];
  35. _commentUserCode=[dic objectForKey:@"CommentUserCode"];
  36. NSString *logCreateTime=[dic objectForKey:@"CreateTime"];
  37. _createTime= [DateFormat dateFormatSplit:logCreateTime];
  38. _remarks=[dic objectForKey:@"Remarks"];
  39. _commentUpdateTime=[dic objectForKey:@"CheckUpdateTime"];
  40. _imageArray=[dic objectForKey:@"dailyRecordPhotos"];
  41. _replyJsonArray=[dic objectForKey:@"dailyRecordReplies"];
  42. _soundJsonArray=[dic objectForKey:@"dailyRecordSounds"];
  43. if(_imageArray!=nil&&[_imageArray count]>0){
  44. NSMutableArray *imgArr=[[NSMutableArray alloc]init];
  45. for(int i=0;i<[_imageArray count];i++){
  46. NSDictionary *imgDic= _imageArray[i];
  47. NSString *imgPath=[imgDic objectForKey:@"SourcePath"];
  48. ImageModel *img=[ImageModel new];
  49. img.imageName=imgPath;
  50. [imgArr addObject:img];
  51. }
  52. _imagePathArray=[imgArr copy];
  53. }
  54. if(_soundJsonArray!=nil){
  55. NSMutableArray *soundTempArray=[[NSMutableArray alloc] init];
  56. for(int i=0;i<[_soundJsonArray count];i++){
  57. NSDictionary *soundDic=_soundJsonArray[i];
  58. NSString *soundPath=[soundDic objectForKey:@"SoundPath"];
  59. NSString *soundTime=[soundDic objectForKey:@"SoundTime"];
  60. Sound *sound=[Sound new];
  61. sound.soundPath=soundPath;
  62. sound.duration=soundTime;
  63. [soundTempArray addObject:sound];
  64. }
  65. _soundArray=[soundTempArray copy];
  66. }
  67. if(_replyJsonArray!=nil&&_replyJsonArray.count>0){
  68. NSMutableArray *replyTempArray=[[NSMutableArray alloc] init];
  69. for(int i=0;i<[_replyJsonArray count];i++){
  70. NSDictionary *replyDic=_replyJsonArray[i];
  71. NSString *replyId=[replyDic objectForKey:@"ReplyID"];
  72. NSInteger createUserId=[[replyDic objectForKey:@"CreateUserID"]integerValue];
  73. NSInteger recordId=[[replyDic objectForKey:@"RecordID"]integerValue];
  74. NSInteger replierUserId=[[replyDic objectForKey:@"RepliedUserID"]integerValue];
  75. NSString *replyContent=[replyDic objectForKey:@"ReplyContent"];
  76. NSString *userName=[replyDic objectForKey:@"UserName"];
  77. NSString *repliedUserName=[replyDic objectForKey:@"RepliedUserName"];
  78. ReplyInfo *info=[ReplyInfo new];
  79. info.replyId=replyId;
  80. info.createUserId=createUserId;
  81. info.recordId=recordId;
  82. info.replyUserId=replierUserId;
  83. info.replyContent=replyContent;
  84. info.userName=userName;
  85. info.RepliedUserName=repliedUserName;
  86. ReplyFrame *replyFrame=[[ReplyFrame alloc]init];
  87. [replyFrame setReplyInfoFrame:info];
  88. [replyTempArray addObject:replyFrame];
  89. }
  90. _replyArray=[replyTempArray copy];
  91. }
  92. }
  93. }
  94. @end