// // Log.m // IBOSS // // Created by guan hong hou on 15/10/30. // Copyright © 2015年 elongtian. All rights reserved. // #import #import "Log.h" #import "ImageModel.h" #import "ReplyInfo.h" #import "Sound.h" #import "DKMessage.h" #import "DateFormat.h" #import "ReplyFrame.h" @implementation Log -(void)ParseDic:(NSDictionary *)dic { if(dic!=nil){ _recordId=[[dic objectForKey:@"RecordID"] integerValue]; NSInteger recordStatus= [[dic objectForKey:@"RecordStatus"]integerValue]; if(recordStatus==0){ _recordStatus=@"(未点评)"; } else{ _recordStatus=@"(已点评)"; } _recordSource=[[dic objectForKey:@"RecordSource"]integerValue]; _location=[dic objectForKey:@"RecordLocation"]; _userName=[dic objectForKey:@"UserName"]; _content=[dic objectForKey:@"RecordContent"]; _valueFlag=[[dic objectForKey:@"ValueFlag"]integerValue]; _commentUserId=[[dic objectForKey:@"CommentUserID"]integerValue]; _checker=[dic objectForKey:@"Checker"]; _commentUserCode=[dic objectForKey:@"CommentUserCode"]; NSString *logCreateTime=[dic objectForKey:@"CreateTime"]; _createTime= [DateFormat dateFormatSplit:logCreateTime]; _remarks=[dic objectForKey:@"Remarks"]; _commentUpdateTime=[dic objectForKey:@"CheckUpdateTime"]; _imageArray=[dic objectForKey:@"dailyRecordPhotos"]; _replyJsonArray=[dic objectForKey:@"dailyRecordReplies"]; _soundJsonArray=[dic objectForKey:@"dailyRecordSounds"]; if(_imageArray!=nil&&[_imageArray count]>0){ NSMutableArray *imgArr=[[NSMutableArray alloc]init]; for(int i=0;i<[_imageArray count];i++){ NSDictionary *imgDic= _imageArray[i]; NSString *imgPath=[imgDic objectForKey:@"SourcePath"]; ImageModel *img=[ImageModel new]; img.imageName=imgPath; [imgArr addObject:img]; } _imagePathArray=[imgArr copy]; } if(_soundJsonArray!=nil){ NSMutableArray *soundTempArray=[[NSMutableArray alloc] init]; for(int i=0;i<[_soundJsonArray count];i++){ NSDictionary *soundDic=_soundJsonArray[i]; NSString *soundPath=[soundDic objectForKey:@"SoundPath"]; NSString *soundTime=[soundDic objectForKey:@"SoundTime"]; Sound *sound=[Sound new]; sound.soundPath=soundPath; sound.duration=soundTime; [soundTempArray addObject:sound]; } _soundArray=[soundTempArray copy]; } if(_replyJsonArray!=nil&&_replyJsonArray.count>0){ NSMutableArray *replyTempArray=[[NSMutableArray alloc] init]; for(int i=0;i<[_replyJsonArray count];i++){ NSDictionary *replyDic=_replyJsonArray[i]; NSString *replyId=[replyDic objectForKey:@"ReplyID"]; NSInteger createUserId=[[replyDic objectForKey:@"CreateUserID"]integerValue]; NSInteger recordId=[[replyDic objectForKey:@"RecordID"]integerValue]; NSInteger replierUserId=[[replyDic objectForKey:@"RepliedUserID"]integerValue]; NSString *replyContent=[replyDic objectForKey:@"ReplyContent"]; NSString *userName=[replyDic objectForKey:@"UserName"]; NSString *repliedUserName=[replyDic objectForKey:@"RepliedUserName"]; ReplyInfo *info=[ReplyInfo new]; info.replyId=replyId; info.createUserId=createUserId; info.recordId=recordId; info.replyUserId=replierUserId; info.replyContent=replyContent; info.userName=userName; info.RepliedUserName=repliedUserName; ReplyFrame *replyFrame=[[ReplyFrame alloc]init]; [replyFrame setReplyInfoFrame:info]; [replyTempArray addObject:replyFrame]; } _replyArray=[replyTempArray copy]; } } } @end