|
|
@@ -1722,8 +1722,8 @@
|
|
|
#pragma mark new_interface
|
|
|
+(void)request_marketnews : (NSString*) lastid limit: (int) limit completionHandler:(resultHandler)result
|
|
|
{
|
|
|
- if(![NetworkUtils IsNetworkAvailable])
|
|
|
- return ;//RESULT_NET_NOTAVAILABLE;
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return ;//RESULT_NET_NOTAVAILABLE;
|
|
|
|
|
|
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
|
|
|
[params setValue:@"Market News" forKey:@"module_name"];
|
|
|
@@ -1748,8 +1748,8 @@
|
|
|
|
|
|
+(void)request_announcements : (NSString*) lastid limit: (int) limit completionHandler:(resultHandler)result
|
|
|
{
|
|
|
- if(![NetworkUtils IsNetworkAvailable])
|
|
|
- return ;//RESULT_NET_NOTAVAILABLE;
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return ;//RESULT_NET_NOTAVAILABLE;
|
|
|
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
|
|
|
[params setValue:@"Announcements" forKey:@"module_name"];
|
|
|
[params setValue:@"search" forKey:@"action_type"];
|
|
|
@@ -1772,8 +1772,8 @@
|
|
|
|
|
|
+(void) request_servicelocatin:(resultHandler)result
|
|
|
{
|
|
|
- if(![NetworkUtils IsNetworkAvailable])
|
|
|
- return ;//RESULT_NET_NOTAVAILABLE;
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return ;//RESULT_NET_NOTAVAILABLE;
|
|
|
|
|
|
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
|
|
|
[params setValue:@"Location" forKey:@"module_name"];
|
|
|
@@ -1813,8 +1813,8 @@
|
|
|
+(void)request_login : (NSString*) user password:(NSString*) password completionHandler:(resultHandler)result
|
|
|
{
|
|
|
|
|
|
- if(![NetworkUtils IsNetworkAvailable])
|
|
|
- return ;
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return ;
|
|
|
// if(![RANetwork IsHostAvailable:URL_UPDATE_AUTH])
|
|
|
// return RESULT_NET_ERROR;
|
|
|
|
|
|
@@ -2153,169 +2153,307 @@
|
|
|
|
|
|
+(void) request_detail: (NSMutableDictionary *) params completionHandler:(resultHandler)result
|
|
|
{
|
|
|
- DebugLog(@"get_detailcontent");
|
|
|
- DetailContent * detailContent = [[DetailContent alloc] init];
|
|
|
- NSMutableArray* segments = [[NSMutableArray alloc] init];
|
|
|
- detailContent.segments = segments;
|
|
|
- if(![NetworkUtils IsNetworkAvailable])
|
|
|
- {
|
|
|
- detailContent.result_code = RESULT_NET_NOTAVAILABLE;
|
|
|
-// return detailContent;
|
|
|
- return;
|
|
|
- }
|
|
|
+
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// {
|
|
|
+//
|
|
|
+// result([[RAConvertor string2dict:[NSString stringWithFormat:@"{'result':%d}",RESULT_NET_NOTAVAILABLE]] mutableCopy]);
|
|
|
+//// return detailContent;
|
|
|
+// return;
|
|
|
+// }
|
|
|
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
[params setValue:@"handset_search" forKey:@"action"];
|
|
|
// [params setValue:appDelegate.sessionid forKey:@"sessionid"];
|
|
|
|
|
|
|
|
|
- [self request_interface:URL_REQUEST_RECORDS parameters:params err_record_url:nil completionHandler:^(NSMutableDictionary *chresult) {
|
|
|
- NSString *str = [RAConvertor dict2string: chresult];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- str=[str stringByReplacingOccurrencesOfString:@"<table " withString:@"<table style=font-size:12px "];
|
|
|
-
|
|
|
-
|
|
|
- DebugLog(@"hack string: %@",str);
|
|
|
- //------- hack-----------
|
|
|
- NSDictionary *retjson=[RAConvertor string2dict:str];
|
|
|
-
|
|
|
- result([retjson mutableCopy]);
|
|
|
-
|
|
|
-
|
|
|
- } retry:0];
|
|
|
+ [self request_interface:URL_REQUEST_RECORDS parameters:params err_record_url:nil completionHandler:result retry:0];
|
|
|
return;
|
|
|
|
|
|
- NSData* json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
- if (json==nil)
|
|
|
- {
|
|
|
- DebugLog(@"json is wrong");
|
|
|
- detailContent.result_code = RESULT_NET_ERROR;
|
|
|
- //return detailContent;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //------------hack detail html 字体大小-----------
|
|
|
- NSString *str = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- str=[str stringByReplacingOccurrencesOfString:@"<table " withString:@"<table style=font-size:12px "];
|
|
|
-
|
|
|
-
|
|
|
- DebugLog(@"hack string: %@",str);
|
|
|
- //------- hack-----------
|
|
|
- NSDictionary *jsobj=[RAConvertor string2dict:str];
|
|
|
-
|
|
|
-
|
|
|
- NSError *error=nil;
|
|
|
-// NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// NSData* json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// detailContent.result_code = RESULT_NET_ERROR;
|
|
|
+// //return detailContent;
|
|
|
+// return;
|
|
|
+// }
|
|
|
//
|
|
|
//
|
|
|
- if(jsobj)
|
|
|
- {
|
|
|
- int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
- if(result== AP_SESSION_EXPIRED)
|
|
|
+// //------------hack detail html 字体大小-----------
|
|
|
+// NSString *str = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// str=[str stringByReplacingOccurrencesOfString:@"<table " withString:@"<table style=font-size:12px "];
|
|
|
+//
|
|
|
+//
|
|
|
+// DebugLog(@"hack string: %@",str);
|
|
|
+// //------- hack-----------
|
|
|
+// NSDictionary *jsobj=[RAConvertor string2dict:str];
|
|
|
+//
|
|
|
+//
|
|
|
+// NSError *error=nil;
|
|
|
+//// NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+////
|
|
|
+////
|
|
|
+// if(jsobj)
|
|
|
+// {
|
|
|
+// int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+// if(result== AP_SESSION_EXPIRED)
|
|
|
+// {
|
|
|
+// [self Authorize:appDelegate.user password:appDelegate.password];
|
|
|
+// json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// detailContent.result_code = RESULT_NET_ERROR;
|
|
|
+//// return detailContent;
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+//
|
|
|
+// }
|
|
|
+// if(result!=AP_USER_AUTH)
|
|
|
+// {
|
|
|
+// DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
+// detailContent.result_code = result;
|
|
|
+//// return detailContent;
|
|
|
+// return;
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//// if([params[@"action_type"] isEqualToString:@"Tracking"])
|
|
|
+//// {
|
|
|
+//// NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_tracking.json" ofType:nil];
|
|
|
+//// NSData *data = [[NSData alloc] initWithContentsOfFile:path];
|
|
|
+//// NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
|
|
|
+//// jsobj = json;
|
|
|
+//// }
|
|
|
+//
|
|
|
+// int count =[[jsobj valueForKey:@"count"] intValue];
|
|
|
+//
|
|
|
+//// if ([[params objectForKey:@"action_type"] isEqualToString:@"Detail"]) {
|
|
|
+//// NSMutableDictionary *mJson = [jsobj mutableCopy];
|
|
|
+//// NSDictionary *comm = @{
|
|
|
+//// @"_name": @"Communication",
|
|
|
+//// @"_type": @"communication",
|
|
|
+//// @"cc": @"",
|
|
|
+//// @"receipt": @"",
|
|
|
+//// @"count": @2,
|
|
|
+//// @"item0": @{
|
|
|
+//// @"Sender": @"user name",
|
|
|
+//// @"msg": @"content bla bla bla...",
|
|
|
+//// @"mst_time": @"04/28/2018 20:15:33",
|
|
|
+//// @"email_url": @"https://www.baidu.com"
|
|
|
+//// },
|
|
|
+//// @"item1": @{
|
|
|
+//// @"Sender": @"user name",
|
|
|
+//// @"msg": @"content bla bla bla...",
|
|
|
+//// @"mst_time": @"04/28/2018 20:15:33"
|
|
|
+//// }
|
|
|
+//// };
|
|
|
+//// [mJson setObject:comm forKey:[NSString stringWithFormat:@"group%d",count]];
|
|
|
+////
|
|
|
+//// [mJson setObject:@(++count) forKey:@"count"];
|
|
|
+////
|
|
|
+//// jsobj = mJson;
|
|
|
+//// }
|
|
|
+//
|
|
|
+// detailContent.result_code = RESULT_TRUE;
|
|
|
+// if(count==0)
|
|
|
+// {
|
|
|
+//
|
|
|
+//// return detailContent;
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// for(int i=0;i<count;i++)
|
|
|
+// {
|
|
|
+//
|
|
|
+// NSDictionary* segment = [jsobj objectForKey:[NSString stringWithFormat:@"group%d",i]];
|
|
|
+// [segments addObject:segment];
|
|
|
+//
|
|
|
+// /*
|
|
|
+// JSONObject groupobj = jsonObj.getJSONObject("group" + i);
|
|
|
+// View v = inflater.inflate(R.layout.group_tag, null);
|
|
|
+// v.setOnClickListener(this);
|
|
|
+//
|
|
|
+// TextView tvgroup = (TextView) v.findViewById(R.id.tv_group);
|
|
|
+// String group_name = groupobj.getString("_name");
|
|
|
+// tvgroup.setText(group_name);
|
|
|
+// v.setId(commonUtil.generateViewId());
|
|
|
+// ll_root.addView(v);
|
|
|
+// String grouptype = groupobj.getString("_type");
|
|
|
+//
|
|
|
+// */
|
|
|
+// }
|
|
|
+//
|
|
|
+// // NSDictionary* objrecords = [jsobj objectForKey:@"records"];
|
|
|
+//
|
|
|
+// detailContent.originContent = jsobj;
|
|
|
+//
|
|
|
+//// return detailContent;
|
|
|
+// return;
|
|
|
+//
|
|
|
+// }
|
|
|
+// return nil;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
++(DetailContent*) json2DetailContent:(NSMutableDictionary*)jsobj
|
|
|
+{
|
|
|
+
|
|
|
+ DetailContent * detailContent = [[DetailContent alloc] init];
|
|
|
+ NSMutableArray* segments = [[NSMutableArray alloc] init];
|
|
|
+ detailContent.segments = segments;
|
|
|
+ if(![NetworkUtils IsNetworkAvailable])
|
|
|
{
|
|
|
- [self Authorize:appDelegate.user password:appDelegate.password];
|
|
|
- json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
- if (json==nil)
|
|
|
- {
|
|
|
- DebugLog(@"json is wrong");
|
|
|
- detailContent.result_code = RESULT_NET_ERROR;
|
|
|
-// return detailContent;
|
|
|
- return;
|
|
|
- }
|
|
|
- jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
- result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
-
|
|
|
+ detailContent.result_code = RESULT_NET_NOTAVAILABLE;
|
|
|
+ return detailContent;
|
|
|
}
|
|
|
- if(result!=AP_USER_AUTH)
|
|
|
+ if (jsobj==nil)
|
|
|
{
|
|
|
- DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
- detailContent.result_code = result;
|
|
|
-// return detailContent;
|
|
|
- return;
|
|
|
-
|
|
|
+ DebugLog(@"json is wrong");
|
|
|
+ detailContent.result_code = RESULT_NET_ERROR;
|
|
|
+ return detailContent;
|
|
|
}
|
|
|
|
|
|
|
|
|
-// if([params[@"action_type"] isEqualToString:@"Tracking"])
|
|
|
-// {
|
|
|
-// NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_tracking.json" ofType:nil];
|
|
|
-// NSData *data = [[NSData alloc] initWithContentsOfFile:path];
|
|
|
-// NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
|
|
|
-// jsobj = json;
|
|
|
-// }
|
|
|
+ //------------hack detail html 字体大小-----------
|
|
|
+ NSString *str = [RAConvertor dict2string:jsobj];
|
|
|
|
|
|
- int count =[[jsobj valueForKey:@"count"] intValue];
|
|
|
+
|
|
|
|
|
|
-// if ([[params objectForKey:@"action_type"] isEqualToString:@"Detail"]) {
|
|
|
-// NSMutableDictionary *mJson = [jsobj mutableCopy];
|
|
|
-// NSDictionary *comm = @{
|
|
|
-// @"_name": @"Communication",
|
|
|
-// @"_type": @"communication",
|
|
|
-// @"cc": @"",
|
|
|
-// @"receipt": @"",
|
|
|
-// @"count": @2,
|
|
|
-// @"item0": @{
|
|
|
-// @"Sender": @"user name",
|
|
|
-// @"msg": @"content bla bla bla...",
|
|
|
-// @"mst_time": @"04/28/2018 20:15:33",
|
|
|
-// @"email_url": @"https://www.baidu.com"
|
|
|
-// },
|
|
|
-// @"item1": @{
|
|
|
-// @"Sender": @"user name",
|
|
|
-// @"msg": @"content bla bla bla...",
|
|
|
-// @"mst_time": @"04/28/2018 20:15:33"
|
|
|
-// }
|
|
|
-// };
|
|
|
-// [mJson setObject:comm forKey:[NSString stringWithFormat:@"group%d",count]];
|
|
|
-//
|
|
|
-// [mJson setObject:@(++count) forKey:@"count"];
|
|
|
-//
|
|
|
-// jsobj = mJson;
|
|
|
-// }
|
|
|
+ str=[str stringByReplacingOccurrencesOfString:@"<table " withString:@"<table style=font-size:12px "];
|
|
|
|
|
|
- detailContent.result_code = RESULT_TRUE;
|
|
|
- if(count==0)
|
|
|
- {
|
|
|
-
|
|
|
-// return detailContent;
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
- for(int i=0;i<count;i++)
|
|
|
- {
|
|
|
+ DebugLog(@"hack string: %@",str);
|
|
|
+ //------- hack-----------
|
|
|
+ jsobj=[[RAConvertor string2dict:str] mutableCopy];
|
|
|
+
|
|
|
+ int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+// if(result== AP_SESSION_EXPIRED)
|
|
|
+// {
|
|
|
+// [self Authorize:appDelegate.user password:appDelegate.password];
|
|
|
+// json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// detailContent.result_code = RESULT_NET_ERROR;
|
|
|
+// return detailContent;
|
|
|
+// }
|
|
|
+// jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+//
|
|
|
+// }
|
|
|
+ if(result!=AP_USER_AUTH)
|
|
|
+ {
|
|
|
+ DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
+ detailContent.result_code = result;
|
|
|
+ return detailContent;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- NSDictionary* segment = [jsobj objectForKey:[NSString stringWithFormat:@"group%d",i]];
|
|
|
- [segments addObject:segment];
|
|
|
+
|
|
|
+
|
|
|
+ int count =[[jsobj valueForKey:@"count"] intValue];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ detailContent.result_code = RESULT_TRUE;
|
|
|
+ if(count==0)
|
|
|
+ {
|
|
|
+
|
|
|
+ return detailContent;
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i=0;i<count;i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ NSDictionary* segment = [jsobj objectForKey:[NSString stringWithFormat:@"group%d",i]];
|
|
|
+ [segments addObject:segment];
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // NSDictionary* objrecords = [jsobj objectForKey:@"records"];
|
|
|
+
|
|
|
+ detailContent.originContent = jsobj;
|
|
|
+
|
|
|
+ return detailContent;
|
|
|
|
|
|
- /*
|
|
|
- JSONObject groupobj = jsonObj.getJSONObject("group" + i);
|
|
|
- View v = inflater.inflate(R.layout.group_tag, null);
|
|
|
- v.setOnClickListener(this);
|
|
|
-
|
|
|
- TextView tvgroup = (TextView) v.findViewById(R.id.tv_group);
|
|
|
- String group_name = groupobj.getString("_name");
|
|
|
- tvgroup.setText(group_name);
|
|
|
- v.setId(commonUtil.generateViewId());
|
|
|
- ll_root.addView(v);
|
|
|
- String grouptype = groupobj.getString("_type");
|
|
|
-
|
|
|
- */
|
|
|
- }
|
|
|
-
|
|
|
- // NSDictionary* objrecords = [jsobj objectForKey:@"records"];
|
|
|
-
|
|
|
- detailContent.originContent = jsobj;
|
|
|
|
|
|
-// return detailContent;
|
|
|
- return;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
++ (void)request_orderhistory:(NSMutableDictionary *)params completionHandler:(resultHandler)result
|
|
|
+{
|
|
|
+
|
|
|
+ [params setObject:@"hand_new_home_list_all" forKey:@"action"];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ if(appDelegate.personalmode)
|
|
|
+ params[@"personal_mode"] = @"true";
|
|
|
+ else
|
|
|
+ params[@"personal_mode"] = @"false";
|
|
|
+
|
|
|
+
|
|
|
+ [self request_interface:URL_HISTORY parameters:params err_record_url:nil completionHandler:result retry:0];
|
|
|
+//
|
|
|
+// NSData* json=[self get_json:URL_HISTORY parameters:params file:nil];
|
|
|
+//
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// return @{
|
|
|
+// @"result" : @RESULT_NET_ERROR,
|
|
|
+// @"err_msg" : MSG_NET_ERROR
|
|
|
+// };
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:nil];
|
|
|
+//
|
|
|
+// return resultDic;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
++ (void)request_result:(NSMutableDictionary *)params completionHandler:(resultHandler)result
|
|
|
+{
|
|
|
+
|
|
|
+// return [self mockResult:params];
|
|
|
+
|
|
|
+ params[@"action"]=@"handset_search";
|
|
|
+
|
|
|
+ [self request_interface:URL_SEARCH_RESULT parameters:params err_record_url:nil completionHandler:^(NSMutableDictionary *resultjson) {
|
|
|
+ NSMutableDictionary *resultDic = resultjson;
|
|
|
|
|
|
- }
|
|
|
-// return nil;
|
|
|
+ // detail data in local database
|
|
|
+ NSString *module_name = [params objectForKey:@"module_name"];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+ NSArray *actions = [ApexMobileDB getActionsForFunction:module_name withUser:appDelegate.user];
|
|
|
+ [resultDic setValue:actions forKey:@"actions"];
|
|
|
+ result(resultDic);
|
|
|
+ } retry:0];
|
|
|
|
|
|
+// NSData* json=[self get_json:URL_SEARCH_RESULT parameters:params file:nil];
|
|
|
+//
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// return @{
|
|
|
+// @"result" : @RESULT_NET_ERROR,
|
|
|
+// @"err_msg" : MSG_NET_ERROR
|
|
|
+// };
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSMutableDictionary *resultDic = [[NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:nil] mutableCopy];
|
|
|
+//
|
|
|
+// // detail data in local database
|
|
|
+// NSString *module_name = [params objectForKey:@"module_name"];
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+// NSArray *actions = [ApexMobileDB getActionsForFunction:module_name withUser:appDelegate.user];
|
|
|
+// [resultDic setValue:actions forKey:@"actions"];
|
|
|
+//
|
|
|
+// return resultDic;
|
|
|
}
|
|
|
@end
|