YOUPAILPFollowAttachment.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // YOUPAILPFollowAttachment.m
  3. // zhimi
  4. //
  5. // Created by 张灿 on 2019/1/28.
  6. // Copyright © 2019年 caiPro. All rights reserved.
  7. //
  8. #import "YOUPAILPFollowAttachment.h"
  9. @implementation YOUPAILPFollowAttachment
  10. - (NSString *)encodeAttachment
  11. {
  12. NSDictionary *dict = @{
  13. CMType : @(CustomFollow),
  14. CMData : @{
  15. CMUserid: self.userid ?[NSNumber numberWithInteger:self.userid]:@0,
  16. CMSex: self.sex ?[NSNumber numberWithInteger:self.sex]:@0,
  17. CMAge: self.age ?[NSNumber numberWithInteger:self.age]:@0,
  18. CMNickname: self.nickname ?self.nickname:@"",
  19. CMAvatar: self.avatar ?self.avatar:@"",
  20. CMCity: self.city?self.city:@[],
  21. CMTimer: self.time ?self.time:@"",
  22. CMSign: self.sign ?self.sign:@"",
  23. CMGrade: self.grade ?self.grade:@{},
  24. }
  25. };
  26. NSData *data = [NSJSONSerialization dataWithJSONObject:dict
  27. options:0
  28. error:nil];
  29. NSString *content = nil;
  30. if (data) {
  31. content = [[NSString alloc] initWithData:data
  32. encoding:NSUTF8StringEncoding];
  33. }
  34. return content;
  35. }
  36. - (NSString *)cellContent:(NIMMessage *)message{
  37. return @"YOUPAILPFollowContentView";
  38. }
  39. - (CGSize)contentSize:(NIMMessageModel *)model cellWidth:(CGFloat)width{
  40. return CGSizeMake(KScreenWidth, 94);
  41. }
  42. - (UIEdgeInsets)contentViewInsets:(NIMMessage *)message
  43. {
  44. return UIEdgeInsetsZero;
  45. }
  46. @end