Commit 404500c5 authored by freecui's avatar freecui

加工单接口bug修改

parent cad79801
......@@ -290,6 +290,7 @@
}
- (NSString *)httpParameterString {
NSString *str = [self stringWithFormatter:@"%Y-%m-%d %H:%M:%S"];
return [self stringWithFormatter:@"%Y-%m-%d %H:%M:%S"];
}
- (NSString *)coverStringFromString {
......
......@@ -20,6 +20,7 @@
// Fuctions
- (NSDictionary *)dictForCommit;
- (NSMutableDictionary *)mutableDictDateToStringForCommit;//把属性为日期类型的转化为string
- (NSDictionary *)dictForLocalSave;
- (void)praseFromJsonDict:(NSDictionary *)dict;
- (void)praseFromLocalDict:(NSDictionary *)dict;
......
......@@ -418,6 +418,48 @@
return mDict;
}
- (NSMutableDictionary *)mutableDictDateToStringForCommit {
unsigned int count;
objc_property_t *properties = class_copyPropertyList([self class], &count);
if (count == 0) {
free(properties);
return nil;
}
NSMutableDictionary *mDict = [NSMutableDictionary dictionary];
NSDictionary *dictSpKeyDict = [[self class] specialKeysAndReplaceKeys];
NSArray *arrSpecialKeys = [dictSpKeyDict allKeys];
NSArray *arrCustomKeys = [[self class] customAcitonKeys];
NSArray *arrLocalKeys = [[self class] localKeys];
for (unsigned int i = 0; i < count; i++) {
objc_property_t property = properties[i];
NSString *key = [NSString stringWithUTF8String:property_getName(property)];
id value = [self valueForKey:key];
if ([value isKindOfClass:[NSDate class]]) {
value = [value httpParameterString];
}
if (value) {
if ([arrCustomKeys containsObject:key] ||
[arrLocalKeys containsObject:key]) {
continue;
} else if ([arrSpecialKeys containsObject:key]) {
[mDict addEntriesFromDictionary:@{dictSpKeyDict[key]: value}];
} else {
[mDict addEntriesFromDictionary:@{key: value}];
}
}
}
free(properties);
return mDict;
}
- (NSDictionary *)dictForLocalSave {
unsigned int count;
objc_property_t *properties = class_copyPropertyList([self class], &count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment