NYTcarStudentLiveModel.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // NYTcarStudentLiveModel.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2024/3/28.
  6. // Copyright © 2024 JCZ. All rights reserved.
  7. //
  8. #import "NYTcarStudentLiveModel.h"
  9. #import "MapManager.h"
  10. @interface NYTcarStudentLiveModel (){
  11. CGFloat _itemWH;
  12. CGFloat _margin;
  13. NSInteger _index;
  14. }
  15. @property (nonatomic, readwrite, assign) CLLocationCoordinate2D myLocation;
  16. @end
  17. @implementation NYTcarStudentLiveModel
  18. -(void)tcarStudentLivedo{
  19. NSString *citystr = [RQ_USER_MANAGER getParamsKey:@"APP_STU_LIVE"];
  20. if ([citystr rangeOfString:RQ_USER_MANAGER.currentUser.city].location != NSNotFound) {
  21. //定位功能
  22. [MBProgressHUD rq_showProgressHUD:@"正在获取当前位置..."];
  23. [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) {
  24. [MBProgressHUD rq_hideHUD];
  25. if (success) {
  26. _myLocation = location.coordinate;
  27. //[self updateSTcarPhoto:@"123123"];
  28. [self beginCheckBodyHumanface];
  29. }
  30. }];
  31. }else{
  32. ShowMsg(@"您所在城市未开启此功能");
  33. return;
  34. }
  35. }
  36. //人脸比对流程
  37. - (void)beginCheckBodyHumanface{
  38. //先走人脸-在走api接口
  39. @weakify(self)
  40. /// 1.本地活体检测
  41. [RQ_CHECKBODY_MANAGER beginCheckBodyWithCheckNum:3 completeBlock:^(BOOL success, NSDictionary * _Nullable dic) {
  42. if (success) {
  43. //上传-照片
  44. __block NSMutableArray *arr = [NSMutableArray array];
  45. NSData *imageData = [[NSData alloc] initWithBase64EncodedString:dic[@"normalImg"] options:NSDataBase64DecodingIgnoreUnknownCharacters];
  46. NSString *method = [NSString stringWithFormat:@"education/imageup/%@/1/%@/face",RQ_USER_MANAGER.currentUser.city,RQ_USER_MANAGER.currentUser.outId];
  47. [jiaPeiManager requestAnythingImageWithURL:method array:arr data:imageData completion:^(NSDictionary *dict) {
  48. NSLog(@"%@",dict);
  49. int code = [dict[@"code"] intValue];
  50. if(code == 0 ){
  51. NSString *paths = dict[@"data"][@"paths"];
  52. NSString *photoid = dict[@"data"][@"id"];
  53. [self updateSTcarPhoto:photoid];
  54. }else{
  55. if (!RQObjectIsNil(dict[@"msg"])) {
  56. ShowMsg(dict[@"msg"]);
  57. return;
  58. }
  59. if (!RQObjectIsNil(dict[@"body"])) {
  60. ShowMsg(dict[@"body"]);
  61. return;
  62. }
  63. }
  64. }];
  65. }else{
  66. ShowMsg(@"活体检测失败");
  67. }
  68. }];
  69. }
  70. // 实车认证
  71. -(void)updateSTcarPhoto:(NSString *)photoid{
  72. NSString *lat = [NSString stringWithFormat:@"%.6f",_myLocation.latitude];
  73. NSString *lng = [NSString stringWithFormat:@"%.6f",_myLocation.longitude];
  74. NSMutableArray *arr = [NSMutableArray array];
  75. [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuid"];//学员ID
  76. [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"];//地区编号
  77. [arr property:[Tools getIDFV] forKey:@"imei"];//IMEI
  78. // [arr property:[Tools getIpAddresses] forKey:@"ip"];//IP
  79. [arr property:photoid forKey:@"photo"];//imageup上传的ID
  80. [arr property:lng forKey:@"lng"];//经度
  81. [arr property:lat forKey:@"lat"];//纬度RQ_USER_MANAGER.currentUser.pxjd
  82. [arr property:RQ_USER_MANAGER.currentUser.pxjd forKey:@"subject"];//当前科目-阶段
  83. NSString* method = @"uploadStudentLive";//http://api.jppt.com.cn/xmtmsappservice/appservice/uploadStudentLive
  84. [jiaPeiManager requestAnythingWithURL:method arrayAES:arr data:nil completion:^(NSDictionary * dict) {
  85. if(dict==nil)return;
  86. if ([dict[@"code"] intValue] == 0) {
  87. ShowMsg(@"实车认证成功!");
  88. }
  89. else
  90. {
  91. if (!RQObjectIsNil(dict[@"body"])) {
  92. NSString *body = [NYTools decryptAES:dict[@"body"]];
  93. ShowMsg(body);
  94. return;
  95. }
  96. }
  97. }];
  98. }
  99. @end