JXCommentContent.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // JXCommentContent.h
  3. // AICity
  4. //
  5. // Created by TogetherWatch on 2025-10-20.
  6. // Feature: 010-ui-ios - iOS平台完整功能实现(对标Android)
  7. // Phase: 1 - 数据模型层
  8. //
  9. // 对应Android: CommentItem (CommentDialog.kt)
  10. //
  11. #import <Foundation/Foundation.h>
  12. NS_ASSUME_NONNULL_BEGIN
  13. /**
  14. * 评论内容数据模型
  15. */
  16. @interface JXCommentContent : NSObject
  17. #pragma mark - 基本信息
  18. @property (nonatomic, assign) long long commentId;
  19. @property (nonatomic, assign) long long userId;
  20. @property (nonatomic, copy) NSString *userName;
  21. @property (nonatomic, copy) NSString *userAvatar;
  22. @property (nonatomic, copy) NSString *content;
  23. #pragma mark - 交互数据
  24. @property (nonatomic, assign) long long likeCount;
  25. @property (nonatomic, assign) long long reply_count;
  26. @property (nonatomic, assign) long long replyCount;
  27. @property (nonatomic, assign) BOOL isLiked;
  28. @property (nonatomic, assign) BOOL isOpen;
  29. #pragma mark - 时间信息
  30. @property (nonatomic, assign) long long createdAt; // Unix时间戳(毫秒)
  31. #pragma mark - 用户认证
  32. @property (nonatomic, assign) BOOL isVerified; // 是否认证用户
  33. #pragma mark - 初始化方法
  34. - (instancetype)initWithDictionary:(NSDictionary *)dict;
  35. + (instancetype)commentWithDictionary:(NSDictionary *)dict;
  36. - (NSDictionary *)toDictionary;
  37. #pragma mark - UI格式化方法
  38. /**
  39. * 格式化时间显示
  40. * 规则:
  41. * - 今年内:显示 "月-日" 格式(如 "10-20")
  42. * - 非今年:显示 "年-月-日" 格式(如 "2024-10-20")
  43. */
  44. - (NSString *)formattedTime;
  45. /**
  46. * 格式化点赞数
  47. * 规则:
  48. * - >= 10000: "X.Xw"
  49. * - >= 1000: "X.Xk"
  50. * - < 1000: 原始数字
  51. */
  52. - (NSString *)formattedLikeCount;
  53. @end
  54. NS_ASSUME_NONNULL_END