| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // KSLiveChatroomMemberCount.m
- // KulexiuForTeacher
- //
- // Created by 王智 on 2022/3/31.
- //
- #import "KSLiveChatroomMemberCount.h"
- @implementation KSLiveChatroomMemberCount
- - (NSData *)encode {
- NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
- [mutableDict setObject:@(self.count) forKey:@"count"];
- if (self.senderUserInfo) {
- [mutableDict setObject:[self encodeUserInfo:self.senderUserInfo] forKey:@"user"];
- }
- return [NSJSONSerialization dataWithJSONObject:mutableDict options:kNilOptions error:nil];
- }
- - (void)decodeWithData:(NSData *)data {
- if (data == nil) return;
- NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
- NSDictionary *json = [[NSDictionary alloc] initWithDictionary:dictionary];
- if (json == nil) return;
- self.count = [[json ks_stringValueForKey:@"count"] intValue];
- NSDictionary *userinfoDic = dictionary[@"user"];
- [self decodeUserInfo:userinfoDic];
- }
- + (NSString *)getObjectName {
- return @"RC:Chatroom:MemberCount";
- }
- - (NSArray<NSString *> *)getSearchableWords {
- return nil;
- }
- + (RCMessagePersistent)persistentFlag {
- return MessagePersistent_NONE;
- }
- @end
|