123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- //
- // NYTcarStudentLiveModel.m
- // jiaPei
- //
- // Created by Ning.ge on 2024/3/28.
- // Copyright © 2024 JCZ. All rights reserved.
- //
- #import "NYTcarStudentLiveModel.h"
- #import "MapManager.h"
- @interface NYTcarStudentLiveModel (){
- CGFloat _itemWH;
- CGFloat _margin;
- NSInteger _index;
- }
- @property (nonatomic, readwrite, assign) CLLocationCoordinate2D myLocation;
- @end
- @implementation NYTcarStudentLiveModel
- -(void)tcarStudentLivedo{
- NSString *citystr = [RQ_USER_MANAGER getParamsKey:@"APP_STU_LIVE"];
- if ([citystr rangeOfString:RQ_USER_MANAGER.currentUser.city].location != NSNotFound) {
- //定位功能
- [MBProgressHUD rq_showProgressHUD:@"正在获取当前位置..."];
- [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) {
- [MBProgressHUD rq_hideHUD];
- if (success) {
- _myLocation = location.coordinate;
- //[self updateSTcarPhoto:@"123123"];
- [self beginCheckBodyHumanface];
- }
- }];
- }else{
- ShowMsg(@"您所在城市未开启此功能");
- return;
- }
- }
- //人脸比对流程
- - (void)beginCheckBodyHumanface{
- //先走人脸-在走api接口
- @weakify(self)
- /// 1.本地活体检测
- [RQ_CHECKBODY_MANAGER beginCheckBodyWithCheckNum:3 completeBlock:^(BOOL success, NSDictionary * _Nullable dic) {
- if (success) {
- //上传-照片
- __block NSMutableArray *arr = [NSMutableArray array];
- NSData *imageData = [[NSData alloc] initWithBase64EncodedString:dic[@"normalImg"] options:NSDataBase64DecodingIgnoreUnknownCharacters];
- NSString *method = [NSString stringWithFormat:@"education/imageup/%@/1/%@/face",RQ_USER_MANAGER.currentUser.city,RQ_USER_MANAGER.currentUser.outId];
- [jiaPeiManager requestAnythingImageWithURL:method array:arr data:imageData completion:^(NSDictionary *dict) {
- NSLog(@"%@",dict);
- int code = [dict[@"code"] intValue];
- if(code == 0 ){
- NSString *paths = dict[@"data"][@"paths"];
- NSString *photoid = dict[@"data"][@"id"];
- [self updateSTcarPhoto:photoid];
- }else{
- if (!RQObjectIsNil(dict[@"msg"])) {
- ShowMsg(dict[@"msg"]);
- return;
- }
- if (!RQObjectIsNil(dict[@"body"])) {
- ShowMsg(dict[@"body"]);
- return;
- }
- }
- }];
- }else{
- ShowMsg(@"活体检测失败");
- }
- }];
- }
- // 实车认证
- -(void)updateSTcarPhoto:(NSString *)photoid{
- NSString *lat = [NSString stringWithFormat:@"%.6f",_myLocation.latitude];
- NSString *lng = [NSString stringWithFormat:@"%.6f",_myLocation.longitude];
- NSMutableArray *arr = [NSMutableArray array];
- [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuid"];//学员ID
- [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"];//地区编号
- [arr property:[Tools getIDFV] forKey:@"imei"];//IMEI
- // [arr property:[Tools getIpAddresses] forKey:@"ip"];//IP
- [arr property:photoid forKey:@"photo"];//imageup上传的ID
- [arr property:lng forKey:@"lng"];//经度
- [arr property:lat forKey:@"lat"];//纬度RQ_USER_MANAGER.currentUser.pxjd
- [arr property:RQ_USER_MANAGER.currentUser.pxjd forKey:@"subject"];//当前科目-阶段
- NSString* method = @"uploadStudentLive";//http://api.jppt.com.cn/xmtmsappservice/appservice/uploadStudentLive
- [jiaPeiManager requestAnythingWithURL:method arrayAES:arr data:nil completion:^(NSDictionary * dict) {
- if(dict==nil)return;
- if ([dict[@"code"] intValue] == 0) {
- ShowMsg(@"实车认证成功!");
- }
- else
- {
- if (!RQObjectIsNil(dict[@"body"])) {
- NSString *body = [NYTools decryptAES:dict[@"body"]];
- ShowMsg(body);
- return;
- }
- }
- }];
- }
- @end
|