Commit 0480fb9a authored by yueming lu's avatar yueming lu

增加唯一标识字段

parent 9f212bfe
...@@ -20,9 +20,12 @@ ...@@ -20,9 +20,12 @@
GMPhobosPageViewModel *model = [[GMPhobosPageViewModel alloc] init]; GMPhobosPageViewModel *model = [[GMPhobosPageViewModel alloc] init];
//共有参数 //共有参数
model.table_name = name; model.table_name = name;
model.data = [GMPhobosTool dictionaryToJsonString:data];
NSTimeInterval time = [[NSDate date] timeIntervalSince1970] * 1000; NSTimeInterval time = [[NSDate date] timeIntervalSince1970] * 1000;
model.message_item_id = [NSString stringWithFormat:@"%.f/%lld", time, mach_absolute_time()]; model.message_item_id = [NSString stringWithFormat:@"%.f/%lld", time, mach_absolute_time()];
NSMutableDictionary *messageDict = [NSMutableDictionary dictionaryWithDictionary:data];
[messageDict setValue:model.message_item_id forKey:@"message_item_id"];
model.data = [GMPhobosTool dictionaryToJsonString:messageDict];
NSLog(@"referrer_link*******%@", messageDict[@"referrer_link"]);
model.status = PhobosDataSendStatus_wait; model.status = PhobosDataSendStatus_wait;
model.phobos_type = phobosType; model.phobos_type = phobosType;
model.api = urlapi; model.api = urlapi;
......
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
immediately:(BOOL)status{ immediately:(BOOL)status{
GMPhobosSqulitModel *model = [GMPhobosSqulitModel new]; GMPhobosSqulitModel *model = [GMPhobosSqulitModel new];
model.table_name = name; model.table_name = name;
model.data = [GMPhobosTool dictionaryToJsonString:data];
NSTimeInterval time = [[NSDate date] timeIntervalSince1970] * 1000; NSTimeInterval time = [[NSDate date] timeIntervalSince1970] * 1000;
model.message_item_id = [NSString stringWithFormat:@"%.f/%lld", time, mach_absolute_time()]; model.message_item_id = [NSString stringWithFormat:@"%.f/%lld", time, mach_absolute_time()];
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:data];
[dict setValue:model.message_item_id forKey:@"message_item_id"];
model.data = [GMPhobosTool dictionaryToJsonString:dict];
model.status = PhobosDataSendStatus_wait; model.status = PhobosDataSendStatus_wait;
model.phobos_type = phobosType; model.phobos_type = phobosType;
model.api = urlapi; model.api = urlapi;
......
...@@ -200,7 +200,7 @@ static PhobosDataManager *dataManager; ...@@ -200,7 +200,7 @@ static PhobosDataManager *dataManager;
for (GMPhobosSqulitModel *model in entities) { for (GMPhobosSqulitModel *model in entities) {
NSString *whereStr = [NSString stringWithFormat:@"where message_item_id = '%@'", model.message_item_id]; NSString *whereStr = [NSString stringWithFormat:@"where message_item_id = '%@'", model.message_item_id];
bool status = [_squlitManager gm_deleteTable:model.table_name whereFormat:whereStr]; bool status = [_squlitManager gm_deleteTable:model.table_name whereFormat:whereStr];
NSLog(@"删除状态:%d", status); NSLog(@"发送数据成功-删除状态:%d", status);
} }
} }
...@@ -211,7 +211,7 @@ static PhobosDataManager *dataManager; ...@@ -211,7 +211,7 @@ static PhobosDataManager *dataManager;
bool status = [_squlitManager gm_updateTable:model.table_name bool status = [_squlitManager gm_updateTable:model.table_name
dicOrModel: @{@"status":@(PhobosDataSendStatus_error)} dicOrModel: @{@"status":@(PhobosDataSendStatus_error)}
whereFormat:whereStr]; whereFormat:whereStr];
NSLog(@"发送失败后修改状态:%d",status); NSLog(@"发送失败后-修改状态:%d",status);
} }
} }
......
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