JXCommentContent.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 replyCount;
  26. @property (nonatomic, assign) BOOL isLiked;
  27. #pragma mark - 时间信息
  28. @property (nonatomic, assign) long long createdAt; // Unix时间戳(毫秒)
  29. #pragma mark - 用户认证
  30. @property (nonatomic, assign) BOOL isVerified; // 是否认证用户
  31. #pragma mark - 初始化方法
  32. - (instancetype)initWithDictionary:(NSDictionary *)dict;
  33. + (instancetype)commentWithDictionary:(NSDictionary *)dict;
  34. - (NSDictionary *)toDictionary;
  35. #pragma mark - UI格式化方法
  36. /**
  37. * 格式化时间显示
  38. * 规则:
  39. * - 今年内:显示 "月-日" 格式(如 "10-20")
  40. * - 非今年:显示 "年-月-日" 格式(如 "2024-10-20")
  41. */
  42. - (NSString *)formattedTime;
  43. /**
  44. * 格式化点赞数
  45. * 规则:
  46. * - >= 10000: "X.Xw"
  47. * - >= 1000: "X.Xk"
  48. * - < 1000: 原始数字
  49. */
  50. - (NSString *)formattedLikeCount;
  51. @end
  52. NS_ASSUME_NONNULL_END