加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

聚合数据iOS SDK 全国车辆违章 演示示例

发布时间:2020-12-14 05:21:31 所属栏目:百科 来源:网络整理
导读:1,将聚合数据SDK(JuheApis.framework)添加到你的程序中来,SDK依赖的包包括: 2,在聚合SDK Framework的JHSDKAPIPath.h文件中找到 快递查询 接口宏,以及字典参数 /** ?@brief 车辆违章查询--1、获取支持城市接口 @param province string 非必填 默认全部

1,将聚合数据SDK(JuheApis.framework)添加到你的程序中来,SDK依赖的包包括:


2,在聚合SDK Framework的JHSDKAPIPath.h文件中找到快递查询接口宏,以及字典参数

/**
?@brief 车辆违章查询--1、获取支持城市接口
@param province string 非必填 默认全部,省份简写,如:ZJ、JS
@param dtype string 非必填 返回数据格式:json或xml或jsonp,默认json
@param callback string 非必填 当选择jsonp格式时必须传递
*/
#define kJHAPIS_LIFE_WZ_CITYS?????????????? @"juhe.apis.wz.citys"?????????????? //1、获取支持城市接口

/**
?@brief 车辆违章查询--2、请求违章查询接口

@param dtype string 必填 返回数据格式:json或xml或jsonp,默认json
@param callback string 非必填 当选择jsonp格式时必须传递
@param ity string 必填 城市代码 *
@param hphm string 必填 号牌号码 完整7位
@param hpzl string 必填 号牌类型,默认02
@param engineno string 非必填 发动机号 (根据城市接口中的参数填写)
@param classno string 非必填 车架号 (根据城市接口中的参数填写)
*/
#define kJHAPIS_LIFE_WZ_QUERY?????????????? @"juhe.apis.wz.query"?????????????? //2、请求违章查询接口

/**
?@brief 车辆违章查询--3、车辆(号牌)种类编号查询接口
@param dtype String 非必填 返回数据格式:json或xml或jsonp,默认json
@param callback String 非必填 返回格式选择jsonp时,必须传递
*/
#define kJHAPIS_LIFE_WZ_HPZL??????????????? @"juhe.apis.wz.hpzl"??????????????? //3、车辆(号牌)种类编号查询接口

/**
?@brief 车辆违章查询--4、接口剩余次数查询
?@param dtype? string 非必填 返回数据的格式,xml或json,默认json
*/
#define kJHAPIS_LIFE_WZ_STATUS????????????? @"juhe.apis.wz.status"????????????? //4、接口剩余次数查询

3,接口在程序中调用方法(将ViewController.m改为.mm)

#import "ViewController.h"

#import <JuheApis/JuheAPI.h>
#import <JuheApis/JHOpenidSupplier.h>
#import <JuheApis/JHSDKAPIPath.h>

@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad {
??? [super viewDidLoad];
??? // Do any additional setup after loading the view,typically from a nib.
??? [[JHOpenidSupplier shareSupplier] registerJuheAPIByOpenId:@"申请到的OpenId“];
?? ?
??? UIButton* beginBtn=[UIButton buttonWithType:UIButtonTypeSystem];
??? beginBtn.frame=CGRectMake(20,111,280,40);
??? [beginBtn setTitle:@"开始" forState:UIControlStateNormal];
??? [beginBtn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
??? [beginBtn addTarget:self action:@selector(doTestAction) forControlEvents:UIControlEventTouchUpInside];
??? [beginBtn setBackgroundImage:[UIImage imageNamed:@"button5"] forState:UIControlStateNormal];
??? [self.view addSubview:beginBtn];
}

- (void)doTestAction
{
??? /* 1、获取支持城市接口 */
??? [self test :? kJHAPIS_LIFE_WZ_CITYS???????? parameters : @{@"province":@"JS",@"dtype":@"json"} ] ;
??? /* 2、请求违章查询接口 */
??? [self test :? kJHAPIS_LIFE_WZ_QUERY?????? parameters : @{@"dtype":@"json",@"city":@"SH",@"hphm”:@“苏L50A11",@"hpzl":@"02"}] ;

??? /* 3、车辆(号牌)种类编号查询接口 */
??? [self test :? kJHAPIS_LIFE_WZ_HPZL????????? parameters : @{@"dtype":@"json" }];

??? /* 4、接口剩余次数查询 */
??? [self test :? kJHAPIS_LIFE_WZ_STATUS????? parameters : @{@"dtype":@"json" }];

???
}

- (void)test:(NSString *)path? parameters:(NSDictionary *)parameters{
?? ?
??? JuheAPI *juheapi = [JuheAPI shareJuheApi];
??? [juheapi executeWorkWithAPI:path
???????????????????? parameters:parameters
??????????????????????? success:^(id responSEObject){
??????????????????????????? if ([[parameters objectForKey:@"dtype"] isEqualToString:@"xml"]) {
??????????????????????????????? NSLog(@"***xml*** n %@",responSEObject);
??????????????????????????? }else{
??????????????????????????????? int error_code = [[responSEObject objectForKey:@"error_code"] intValue];
??????????????????????????????? if (!error_code) {
??????????????????????????????????? NSLog(@" %@",responSEObject);
??????????????????????????????? }else{
??????????????????????????????????? NSLog(@" %@",responSEObject);
??????????????????????????????? }
??????????????????????????? }
?????????????????????????? ?
??????????????????????? } failure:^(NSError *error) {
??????????????????????????? NSLog(@"error:?? %@",error.description);
??????????????????????? }];
}

- (void)didReceiveMemoryWarning {
??? [super didReceiveMemoryWarning];
??? // Dispose of any resources that can be recreated.
}

@end


4,全国车辆违章接口返回数据说明以及错误码说明


1 . API : ?juhe.apis.wz.citys (宏 : kJHAPIS_LIFE_WZ_CITYS )

名称

?

?

?

类型

说明

resultcode

?

?

?

int

返回码

reason

?

?

?

string

返回说明

result

?

?

?

dictionary

返回结果

?

key

?

?

String

省份代()

?

?

province

?

String

省份名

?

?

citys

?

Array

省份下通城市数组

?

?

?

city_code

String

城市代

?

?

?

city_name

String

城市名

?

?

?

engine

Int

是否需要发动机号0,不需要 1,需要

?

?

?

engineno

Int

需要几位发动机号0,全部 1-9,需要发动机号后N

?

?

?

class

Int

是否需要车架号0,需要

?

?

?

classa

Int

同上,解决javaclass关键字无法映射

?

?

?

classno

Int

需要几位车架号0,全部 1-9需要车架号后N

?

?

?

regist

Int

是否需要登记证书0,需要

?

?

?

registno

Int

需要几位登记证书0,全部 1-9需要登记证书N

error_code

?

?

?

Int

错误码

2 . API : juhe.apis.wz.query (宏 : kJHAPIS_LIFE_WZ_QUERY )

名称

?

?

类型

说明

resultcode

?

?

int

返回码

reason

?

?

string

返回说明

result

?

?

dictionary

返回结果

?

province

?

string

查询省份代

?

city

?

string

查询城市代

?

hphm

?

string

查询的号牌号

?

lists

?

Array

章列表

?

?

date

string

?

?

area

string

章地点

?

?

act

string

章行

?

?

code

string

章代(供参考)

?

?

fen

string

章扣分(供参考)

?

?

money

string

(供参考)

?

?

handled

string

是否处理,1处理 0未处理空未知

error_code

?

?

int

错误码

3 . API : juhe.apis.wz.hpzl (宏 : kJHAPIS_LIFE_WZ_HPZL )

名称

?

类型

说明

resultcode

?

int

返回码

reason

?

string

返回说明

result

?

dictionary

返回结果

?

car

string

类型

?

id

int

类型

error_code

?

int

错误码

4 . API : ?juhe.apis.wz.status? (宏 :? kJHAPIS_LIFE_WZ_STATUS? )

名称

?

类型

说明

resultcode

?

int

返回码

reason

?

string

返回说明

result

?

dictionary

返回结果

?

surplus

string

剩余次数

error_code

?

int

错误码


?? 错误码??

?

错误码

?

203603

络错误请

?

203604

递参的格式不正确

?

203605

找到此城市代城市正在

?

203606

信息错误,输入的信息正确

?

203607

交管局网原因暂时无法查询

?

203608

您好,你所查询的城市正在护或未通查询



5,更多聚合数据SDK接口,访问这里: http://www.juhe.cn/juhesdk/idocs

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读