KSLiveChatroomUserQuit.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // KSLiveChatroomUserQuit.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by Kyle on 2022/3/30.
  6. //
  7. #import "KSLiveChatroomUserQuit.h"
  8. @implementation KSLiveChatroomUserQuit
  9. - (NSData *)encode {
  10. NSMutableDictionary *multableDict = [NSMutableDictionary dictionary];
  11. if (self.userId) {
  12. [multableDict setObject:self.userId forKey:@"userId"];
  13. } else {
  14. [multableDict setObject:@"" forKey:@"userId"];
  15. }
  16. if (self.userName) {
  17. [multableDict setObject:self.userName forKey:@"userName"];
  18. } else {
  19. [multableDict setObject:@"" forKey:@"userName"];
  20. }
  21. return [NSJSONSerialization dataWithJSONObject:multableDict options:kNilOptions error:nil];
  22. }
  23. - (void)decodeWithData:(NSData *)data {
  24. if (data == nil) return;
  25. NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
  26. NSDictionary *json = [[NSDictionary alloc] initWithDictionary:dictionary];
  27. if (json == nil) return;
  28. self.userId = [json stringValueForKey:@"userId"];
  29. self.userName = [json stringValueForKey:@"userName"];
  30. }
  31. + (NSString *)getObjectName {
  32. return @"RC:LookerLoginOut";
  33. }
  34. - (NSArray<NSString *> *)getSearchableWords {
  35. return nil;
  36. }
  37. + (RCMessagePersistent)persistentFlag {
  38. return MessagePersistent_NONE;
  39. }
  40. @end