|
@@ -1853,12 +1853,16 @@
|
|
|
else
|
|
else
|
|
|
nsimg_0= [[NSString alloc]initWithUTF8String:img_0];
|
|
nsimg_0= [[NSString alloc]initWithUTF8String:img_0];
|
|
|
|
|
|
|
|
|
|
+ [self copy_bcardImg:nsimg_0];
|
|
|
|
|
+
|
|
|
char *img_1 = (char*)sqlite3_column_text(statement, 19);
|
|
char *img_1 = (char*)sqlite3_column_text(statement, 19);
|
|
|
NSString *nsimg_1 = nil;
|
|
NSString *nsimg_1 = nil;
|
|
|
if(img_1==nil)
|
|
if(img_1==nil)
|
|
|
nsimg_1=@"";
|
|
nsimg_1=@"";
|
|
|
else
|
|
else
|
|
|
nsimg_1= [[NSString alloc]initWithUTF8String:img_1];
|
|
nsimg_1= [[NSString alloc]initWithUTF8String:img_1];
|
|
|
|
|
+ [self copy_bcardImg:nsimg_1];
|
|
|
|
|
+
|
|
|
|
|
|
|
|
char *img_2 = (char*)sqlite3_column_text(statement, 20);
|
|
char *img_2 = (char*)sqlite3_column_text(statement, 20);
|
|
|
NSString *nsimg_2 = nil;
|
|
NSString *nsimg_2 = nil;
|
|
@@ -1866,6 +1870,7 @@
|
|
|
nsimg_2=@"";
|
|
nsimg_2=@"";
|
|
|
else
|
|
else
|
|
|
nsimg_2= [[NSString alloc]initWithUTF8String:img_2];
|
|
nsimg_2= [[NSString alloc]initWithUTF8String:img_2];
|
|
|
|
|
+ [self copy_bcardImg:nsimg_2];
|
|
|
|
|
|
|
|
char *price_type = (char*)sqlite3_column_text(statement, 21);
|
|
char *price_type = (char*)sqlite3_column_text(statement, 21);
|
|
|
NSString *nsprice_type = nil;
|
|
NSString *nsprice_type = nil;
|
|
@@ -1986,6 +1991,81 @@
|
|
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
|
|
|
++ (bool) copy_bcardImg:(NSString*) filename
|
|
|
|
|
+{
|
|
|
|
|
+ if(filename.length==0)
|
|
|
|
|
+ return false;
|
|
|
|
|
+ // NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
|
|
|
+ bool ret=false;
|
|
|
|
|
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
|
|
|
|
+ NSString *cachefolder = [paths objectAtIndex:0];
|
|
|
|
|
+
|
|
|
|
|
+// NSString* from_subpath= [fromPath stringByReplacingOccurrencesOfString:cachefolder withString:@""];
|
|
|
|
|
+ NSString *offline_createimg = [cachefolder stringByAppendingPathComponent:@"offline_createimg"];
|
|
|
|
|
+ NSString *img_cache = [cachefolder stringByAppendingPathComponent:@"img_cache"];
|
|
|
|
|
+
|
|
|
|
|
+ NSString * fromPath= [offline_createimg stringByAppendingPathComponent:filename];
|
|
|
|
|
+ NSString * toPath= [img_cache stringByAppendingPathComponent:filename];
|
|
|
|
|
+
|
|
|
|
|
+// NSString *savedImagePath=[offline_createimg stringByAppendingPathComponent:filename];
|
|
|
|
|
+//
|
|
|
|
|
+// NSString *cacheImagePath=[img_cache stringByAppendingPathComponent:filename];
|
|
|
|
|
+
|
|
|
|
|
+ NSFileManager* fileManager = [NSFileManager defaultManager];
|
|
|
|
|
+ BOOL bdir=NO;
|
|
|
|
|
+ if(! [fileManager fileExistsAtPath:toPath isDirectory:&bdir])
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ NSError *error = nil;
|
|
|
|
|
+ if(![fileManager copyItemAtPath:fromPath toPath:toPath error:&error])
|
|
|
|
|
+ {
|
|
|
|
|
+ ret=false;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ ret=true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// NSError *error = nil;
|
|
|
|
|
+// bool bsuccess=[fileManager createDirectoryAtPath:offline_createimg withIntermediateDirectories:YES attributes:nil error:&error];
|
|
|
|
|
+//
|
|
|
|
|
+// if(!bsuccess)
|
|
|
|
|
+// {
|
|
|
|
|
+// DebugLog(@"Create offline_createimg folder failed");
|
|
|
|
|
+// [ret setValue:[NSNumber numberWithInt:RESULT_ERROR] forKey:@"result"];
|
|
|
|
|
+// return [RAUtils dict2data:ret];
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+ // if(bsuccess)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // sqlite3 *db = [self get_db];
|
|
|
|
|
+ //
|
|
|
|
|
+ // [self execSql:[NSString stringWithFormat:@"insert into img_cache(name) values('%@')",name] db:db];
|
|
|
|
|
+ // sqlite3_close(db);
|
|
|
|
|
+ // }
|
|
|
|
|
+ }
|
|
|
|
|
+ return ret;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+//
|
|
|
|
|
+// bool bsuccess=[image writeToFile:savedImagePath atomically:YES];
|
|
|
|
|
+// if(bsuccess)
|
|
|
|
|
+// {
|
|
|
|
|
+// NSError *error = nil;
|
|
|
|
|
+// if(![fileManager copyItemAtPath:savedImagePath toPath:cacheImagePath error:&error])
|
|
|
|
|
+// {
|
|
|
|
|
+// [ret setValue:[NSNumber numberWithInt:RESULT_ERROR] forKey:@"result"];
|
|
|
|
|
+// }
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// [ret setValue:[NSNumber numberWithInt:RESULT_TRUE] forKey:@"result"];
|
|
|
|
|
+//
|
|
|
|
|
+// ret[@"img_url_aname"]=filename;
|
|
|
|
|
+// ret[@"img_url"]=savedImagePath;
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
+(NSData *) offline_saveBusinesscard:(NSData *) image
|
|
+(NSData *) offline_saveBusinesscard:(NSData *) image
|
|
|
{
|
|
{
|
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
@@ -2044,7 +2124,7 @@
|
|
|
[ret setValue:[NSNumber numberWithInt:RESULT_TRUE] forKey:@"result"];
|
|
[ret setValue:[NSNumber numberWithInt:RESULT_TRUE] forKey:@"result"];
|
|
|
|
|
|
|
|
ret[@"img_url_aname"]=filename;
|
|
ret[@"img_url_aname"]=filename;
|
|
|
- ret[@"img_url"]=savedImagePath;
|
|
|
|
|
|
|
+ ret[@"img_url"]=filename;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|