|
//
// otherPersonBottomCell.m
// ThePaperBase
//
// Created by YoungLee on 15/11/24.
// Copyright © 2015年 scar1900. All rights reserved.
//
#import "otherPersonBottomCell.h"
@implementation otherPersonBottomCell
@synthesize comment = _comment;
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
}
return self;
}
-(void)setComment:(commentObjectVO *)commentBo{
_comment = commentBo;
self.timeLabel.text = _comment.pubTime;
// self.okBtn.text = @"2.3k";
if (!isBlankString(_comment.praiseTimes)) {
self.okBtn.text = _comment.praiseTimes;
}else{
self.okBtn.text = @"0";
}
if (_comment.isPraised && [_comment.isPraised intValue] == 1) {
[self.okBtn setSelected:YES];
}else {
[self.okBtn setSelected:NO];
}
}
- (void)commentOK:(UIButton*)btn {
if (btn.selected) {
return;
}
[self.okBtn setSelected:YES animated:YES];
NSDictionary *dic = @{@"commentId":self.comment.commentId};
__weak typeof(self) Self = self;
[Remote doJsonActionWithBlock:2000 requestUrl:commentPraiseURL parameter:dic withWaitCursor:NO completion:^(BOOL success, NSString *message, id responseData) {
if (success) {
NSString *praseNumStr = responseData[@"praiseTimes"];
if([praseNumStr intValue] <1000){// 点赞数:当点赞数达到1K以上时,点赞后点赞数异常(bug:5372)
Self.okBtn.text = praseNumStr;
Self.comment.praiseTimes = praseNumStr;
TPLOG(@"点赞成功");
}
Self.comment.isPraised = @"1";
if ([Self.delegate respondsToSelector:@selector(hasPraisedAnswer:withCommentBO:)]) {
[Self.delegate hasPraisedAnswer:Self.indexPath withCommentBO:Self.comment];
}
}else {
ShowMessage(@"点赞失败", NO);
}
}];
}
@end
|