12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // YOUPAILZChatRoomGiftAttachment.m
- // VQU
- //
- // Created by CY on 2021/11/17.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZChatRoomGiftAttachment.h"
- @implementation YOUPAILZChatRoomGiftAttachment
- - (NSString *)encodeAttachment
- {
- NSDictionary *dict = @{
- CMType : @(CustomOnChatRoomGift),
- CMData : @{
- CMGiftId: self.gift_id ?[NSNumber numberWithInteger:self.gift_id]:@0,
- CMGiftName: self.gift_name?self.gift_name:@"",
- CMGiftUrl: self.gift_url ?self.gift_url:@"",
- CMGiftCount: self.gift_count ?[NSNumber numberWithInteger:self.gift_count]:@0,
- CMFrom: self.from_uid?[NSNumber numberWithInteger:self.from_uid]:@0,
- CMTo: self.to_uid?[NSNumber numberWithInteger:self.to_uid]:@0,
- CMLink_type: self.link_type?[NSNumber numberWithInteger:self.link_type]:@0,
- CMLink_url: self.link_url?self.link_url:@"",
- CMMd5String:self.md5_string ?self.md5_string:@"",
- CMGiftSvga:self.gift_svga ?self.gift_svga:@"",
- CMGiftType:self.gift_type?[NSNumber numberWithInteger:self.gift_type]:@0,
- CMFromNickname:self.from_nickname ?self.from_nickname:@"",
- CMSendGiftHide:self.send_gift_hide ?@(self.send_gift_hide):@0,
- CMFromAvatar:self.from_avatar ?self.from_avatar:@"",
- CMReceiveInfo:self.receiveInfo?self.receiveInfo:@[],
- }
- };
- NSData *data = [NSJSONSerialization dataWithJSONObject:dict
- options:0
- error:nil];
- NSString *content = nil;
- if (data) {
- content = [[NSString alloc] initWithData:data
- encoding:NSUTF8StringEncoding];
- }
- return content;
- }
- @end
|