添加评论
This commit is contained in:
40
keyBoard/Class/AiTalk/M/KBAIReplyModel.m
Normal file
40
keyBoard/Class/AiTalk/M/KBAIReplyModel.m
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// KBAIReplyModel.m
|
||||
// keyBoard
|
||||
//
|
||||
// Created by Mac on 2026/1/16.
|
||||
//
|
||||
|
||||
#import "KBAIReplyModel.h"
|
||||
#import <MJExtension/MJExtension.h>
|
||||
|
||||
@implementation KBAIReplyModel
|
||||
|
||||
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
|
||||
return @{
|
||||
@"replyId" : @"id",
|
||||
@"userName" : @[ @"userName", @"nickname", @"name" ],
|
||||
@"avatarUrl" : @[ @"avatarUrl", @"avatar" ],
|
||||
};
|
||||
}
|
||||
|
||||
- (NSString *)formattedTime {
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:self.createTime];
|
||||
NSTimeInterval interval = [[NSDate date] timeIntervalSinceDate:date];
|
||||
|
||||
if (interval < 60) {
|
||||
return @"刚刚";
|
||||
} else if (interval < 3600) {
|
||||
return [NSString stringWithFormat:@"%.0f分钟前", interval / 60];
|
||||
} else if (interval < 86400) {
|
||||
return [NSString stringWithFormat:@"%.0f小时前", interval / 3600];
|
||||
} else if (interval < 86400 * 30) {
|
||||
return [NSString stringWithFormat:@"%.0f天前", interval / 86400];
|
||||
} else {
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||||
formatter.dateFormat = @"MM-dd";
|
||||
return [formatter stringFromDate:date];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user