Files
real-e-party-iOS/YuMi/Modules/YMMessage/Model/AttachmentModel.m
edwinQQQ a35a711be6 chore: Initial clean commit
- Removed YuMi/Library/ (138 MB, not tracked)
- Removed YuMi/Resources/ (23 MB, not tracked)
- Removed old version assets (566 files, not tracked)
- Excluded Pods/, xcuserdata/ and other build artifacts
- Clean repository optimized for company server deployment
2025-10-09 16:19:14 +08:00

82 lines
2.3 KiB
Objective-C

//
// AttachmentModel.m
// YUMI
//
// Created by YUMI on 2021/11/16.
//
#import "AttachmentModel.h"
#import "NSObject+MJExtension.h"
@implementation AttachmentModel
- (NSString *)encodeAttachment {
//#if DEBUG
// NSString *s = [self toJSONString];
// NSString *ss = [self compressJSONString:s];
// NSString *sss = [self convertModelToJSONString:self];
//#endif
return [self toJSONString];
}
//- (NSDictionary *)toDictionary {
// NSMutableDictionary *dict = [NSMutableDictionary dictionary];
//
// if (self.data) {
// dict[@"data"] = self.data;
// }
// dict[@"first"] = @(self.first);
// dict[@"second"] = @(self.second);
// dict[@"isBroadcast"] = @(self.isBroadcast);
//
// return [dict copy];
//}
//
//- (NSString *)convertModelToJSONString:(AttachmentModel *)model {
// if (!model) {
// return nil;
// }
//
// // 获取模型的字典表示
// NSDictionary *modelDict = [model toDictionary];
//
// // 将字典序列化为 JSON 数据
// NSError *error;
// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:modelDict options:0 error:&error];
//
// if (error) {
// NSLog(@"JSON 序列化失败: %@", error.localizedDescription);
// return nil;
// }
//
// // 转换为字符串
// return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
//}
//
//- (NSString *)compressJSONString:(NSString *)jsonString {
// if (!jsonString) return nil;
//
// // 将 JSON 字符串转为对象(字典或数组)
// NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
// NSError *error;
// id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];
//
// if (error) {
// NSLog(@"JSON 解析错误: %@", error.localizedDescription);
// return nil;
// }
//
// // 将对象重新序列化为紧凑格式的 JSON 数据
// NSData *compressedData = [NSJSONSerialization dataWithJSONObject:jsonObject options:0 error:&error];
//
// if (error) {
// NSLog(@"JSON 序列化错误: %@", error.localizedDescription);
// return nil;
// }
//
// // 转换为字符串
// NSString *compressedString = [[NSString alloc] initWithData:compressedData encoding:NSUTF8StringEncoding];
// return compressedString;
//}
@end