
//
//  CityNetManager.m
//  Day06_3_NSURLSession的副本
//
//  Created by gao on 2016/11/14.
//  Copyright © 2016年 Tarena. All rights reserved.
//

#import "CityNetManager.h"
#import "MJExtension.h"
#import "MyMD5.h"
#import "gather.h"

#define DESKEY @"KkweFace95271124"
@class CityModel;
@implementation CityNetManager


+(id)getMoreCityForThisMethod:(NSString *)provinceName encrypt:(NSString *)nameEncrypt andTheOther:(NSString *)provinceID twoEncrypt:(NSString *)messageEncrypt andPutThePathForThis:(NSString *)path andID:(NSInteger)ID completionHandle:(void (^)(CityModel *, NSError *))complete
{
NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSString *str1 = [NSString stringWithFormat:@"%@=%@&%@=%@&KkweInfo",provinceID,messageEncrypt,provinceName,nameEncrypt];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];

    NSDictionary *dictNew =@{provinceName:nameEncrypt,
      provinceID:messageEncrypt,
      @"flag":@2,
      @"sign":str1,
    @"userId":@(ID),
    @"versionflag":@2
      };
    NSLog(@"dictNew:%@",dictNew);
return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
    
    if ([responseObj isKindOfClass:[NSData class]]) {
         NSLog(@"%@",[NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:NULL]);
        NSLog(@"%@",[[NSString alloc] initWithData:responseObj encoding:NSUTF8StringEncoding]);
    }
    if ( error || responseObj == nil  )  {
          complete( nil,error);
    }else{

    
        NSDictionary *weatherDic =  nil;
        
        if ([responseObj isKindOfClass:[NSData class]]) {
            weatherDic = [NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableLeaves error:&error];
            
           
        }else {
            weatherDic = responseObj;
        }
        
        NSLog(@"responseObj:%@",weatherDic);
    //                                                           NSLog(@"%@",weatherDic);
    [UserDefault setObject: @"" forKey:@"AESparam"];
    [UserDefault synchronize];
    if(weatherDic){
         NSString *param = [weatherDic objectForKey:@"param"];
        if (param) {
        if (![param  isEqualToString:@""] || ( param  != NULL) ) {
            if ([param isKindOfClass:[NSString class]] ) {
                  int zero =(short) [weatherDic objectForKey:@"code"];
                if (zero == 0) {

                }else{
                    NSArray *b = [param componentsSeparatedByString:@";"];
                    if (b.count >0  ) {
                        if (b[0] && ![b[0] isEqualToString:@""]) {
                            [[NSUserDefaults standardUserDefaults] setObject: [EnercryTool desA:b[0]] forKey:@"AESparam"];
                            [[NSUserDefaults standardUserDefaults]synchronize];
                        }
                    }
                }
            }
  
        }
        
    }
    }


    
    complete( [CityModel mj_objectWithKeyValues:responseObj],error);
    }
  
}];
    
}

+(id)getMD5Method:(NSString *)provinceName encrypt:(NSString *)nameEncrypt andTheOther:(NSString *)provinceID twoEncrypt:(NSString *)messageEncrypt andPutThePathForThis:(NSString *)path completionHandle:(void (^)(CitytoCityModel *, NSError *))complete
{
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSString *str1 = [NSString stringWithFormat:@"%@=%@&%@=%@&KkweInfo",provinceID,messageEncrypt,provinceName,nameEncrypt];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    
    NSDictionary *dictNew =@{provinceName:nameEncrypt,
                             provinceID:messageEncrypt,
                             @"flag":@2,
                             @"sign":str1
                             };
    NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [CitytoCityModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            
        }
        
    }];

}
+(id)getAreaMethod:(NSString *)provinceName encrypt:(NSString *)nameEncrypt andTheOther:(NSString *)provinceID twoEncrypt:(NSString *)messageEncrypt andPutThePathForThis:(NSString *)path completionHandle:(void (^)( areaModel*, NSError *))complete
{
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSString *str1 = [NSString stringWithFormat:@"%@=%@&%@=%@&KkweInfo",provinceID,messageEncrypt,provinceName,nameEncrypt];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    
    NSDictionary *dictNew =@{provinceName:nameEncrypt,
                             provinceID:messageEncrypt,
                             @"flag":@2,
                             @"sign":str1
                             };
    NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        complete( [areaModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            
        }
        
    }];
    
}

+(id)getTownMethod:(NSString *)provinceName encrypt:(NSString *)nameEncrypt andTheOther:(NSString *)provinceID twoEncrypt:(NSString *)messageEncrypt andPutThePathForThis:(NSString *)path completionHandle:(void (^)( Town*, NSError *))complete
{
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSString *str1 = [NSString stringWithFormat:@"%@=%@&%@=%@&KkweInfo",provinceID,messageEncrypt,provinceName,nameEncrypt];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    
    NSDictionary *dictNew =@{provinceName:nameEncrypt,
                             provinceID:messageEncrypt,
                             @"flag":@2,
                             @"sign":str1
                             };
    NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [Town mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            
        }
        
    }];
}
+(id)getVillageMethod:(NSString *)provinceName encrypt:(NSString *)nameEncrypt andTheOther:(NSString *)provinceID twoEncrypt:(NSString *)messageEncrypt andPutThePathForThis:(NSString *)path completionHandle:(void (^)( VillageModel*, NSError *))complete
{
  
    
    
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSString *str1 = [NSString stringWithFormat:@"%@=%@&%@=%@&KkweInfo",provinceID,messageEncrypt,provinceName,nameEncrypt];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    
    NSDictionary *dictNew =@{provinceName:nameEncrypt,
                             provinceID:messageEncrypt,
                             @"flag":@2,
                             @"sign":str1
                             };
    NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [VillageModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            
        }
        
    }];

}
+(id)getVeriftAdressNameToThePath:(NSString *)path FortheName:(NSString *)name   encrypt:(NSString *)nameEncrypt theIdentityNumberPara:(NSString *)identityNumber twoEncrypt:(NSString *)messageEncrypt theProvince_namePara:(NSString *)province_name theCity_namePara:(NSString *)city_name theCounty_namePara:(NSString *)county_name theTown_namePara:(NSString *)town_name theVillageNameThPara:(NSString *)village_name thePhoneNumber:(NSString *)phoneNumber companyName:(NSString *)company_name verifyType:(NSInteger)verifyType idName:(NSString *)IDs youP:(NSString*)p youP:(NSString*)p_ completionHandle:(void (^)( verifyAdressModel*, NSError *))complete;
{
    NSString *str1 = [NSString stringWithFormat:@"identityNumber=%@&name=%@&KkweInfo",messageEncrypt,nameEncrypt];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    if (IDs == nil ) {
        IDs = [NSNull null];
    }
    if (([town_name isEqualToString:@""]) &&([village_name isEqualToString:@""])) {
        town_name  =  [NSNull null];
        village_name =  [NSNull null];
    }else
    {
        town_name = [EnercryTool encryptUseDES:town_name key:DESKEY];
        village_name =  [EnercryTool encryptUseDES:village_name key:DESKEY];
    }
    if (!p) {
        p =[NSNull null];
    }
    if (!p_) {
        p_ =[NSNull null];
    }
    if ([company_name isEqualToString:@""]) {
        company_name = [NSNull null];
    }else
    {
        company_name =  [EnercryTool encryptUseDES:company_name key:DESKEY];
    }
    
    if (!phoneNumber) {
        phoneNumber =[NSNull null];
    }
    
    
    
    
    
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew =@{
                             @"flag":@2,
                             @"name":[EnercryTool A:name],
                             @"identityNumber":[EnercryTool A:identityNumber],
                             @"province_name":[EnercryTool encryptUseDES:province_name key:DESKEY],
                             @"city_name":[EnercryTool encryptUseDES:city_name key:DESKEY],
                             @"county_name":[EnercryTool encryptUseDES:county_name key:DESKEY],
                             @"town_name":town_name,
                             @"village_name":village_name,
                             @"phone_number":[EnercryTool encryptUseDES:phoneNumber key:DESKEY],
                             @"company_name":company_name,
                             @"verify_type": @(verifyType),
                             @"id":IDs,
                             @"sign":str1,
                             @"userId":@([getPeopleID PeopleID]),
                             @"ocrTotalImage":p,
                             @"ocrHeadImage":p_
                             };
    NSLog(@"dictNew:%@",dictNew);
  
    
    
    
    NSLog(@"Path:%@",pathNew1);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
   
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
                 complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];

}

+(id)getaddressRelationToThePath:(NSString *)path getID:(NSString*)ID FortheName:(NSString *)name  theIdentityNumberPara:(NSString *)identityNumber  verifyType:(NSInteger)verifyType nowAddress:(NSString*)nowAddress andPhone:(NSString*)telPhone completionHandle:(void (^)( verifyAdressModel*, NSError *))complete
{
    NSString *str1 = [NSString stringWithFormat:@"identityNumber=%@&name=%@&KkweInfo",[EnercryTool A:identityNumber],[EnercryTool A:name]];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    if (ID == nil) {
        ID =[NSNull null];
//        ID =@"Null";
    }
    if (telPhone) {
        telPhone = [EnercryTool encryptUseDES:telPhone key:DESKEY];
    }else{
        telPhone =[NSNull null];
    }
    
    
    NSDictionary *dictNew =@{
                             @"flag":@2,
                             @"id":ID,
                             @"name":[EnercryTool A:name],
                             @"identityNumber":[EnercryTool A:identityNumber],
                             @"address_relation": @(verifyType),
                             @"now_address":[EnercryTool encryptUseDES:nowAddress key:DESKEY],
                             @"sign":str1,
                             @"phone_number":telPhone
                             };
    NSLog(@"dictNew:%@",dictNew);
    NSLog(@"Path:%@",pathNew1);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];

}

+(id)getaddressPhotoToThePath:(NSString *)path getID:(NSString*)ID FortheName:(NSString *)name  theIdentityNumberPara:(NSString *)identityNumber image:(NSData *)imageData andPhone:(NSString*)telPhone andArray:(NSMutableArray*)array completionHandle:(void (^)( verifyAdressModel*, NSError *))complete
{
    if (ID == nil) {
        ID =[NSNull null];
//        ID =@"Null";
    }
    if (telPhone == nil) {
        telPhone =[NSNull null];
        //        ID =@"Null";
    }else{
   telPhone =      [EnercryTool encryptUseDES:telPhone key:DESKEY];

    }
    NSString *str1 = [NSString stringWithFormat:@"identityNumber=%@&name=%@&KkweInfo",[EnercryTool A:identityNumber],[EnercryTool A:name]];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    NSString *senderPic =@"";
    if (array.count <1) {
          [SVProgressHUD doneShow];
        senderPic =[NSNull null];
    }else{
        senderPic =[array componentsJoinedByString:@","];
    }


    
    NSDictionary *dictNew =@{
                             @"flag":@2,
                             @"id":ID,
                             @"name":[EnercryTool A:name],
                             @"identityNumber":[EnercryTool A:identityNumber],
                             @"image":[EnercryTool encryptBase64:imageData],
                             @"sign":str1,
                             @"versionflag":@1,
//                             @"phoneNumber":telPhone,
                             @"photoLstr":senderPic//1周 照片一逗号的形式隔开
                             };


    NSLog(@"dictNew:%@",dictNew);
    NSLog(@"Path:%@",pathNew1);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        
        if (responseObj == NULL) {
           
            SVProgressHUD.minimumDismissTimeInterval = 2.0;
            [SVProgressHUD showWithStatus:@"网络连接超时"];
               [SVProgressHUD dismiss];
        }
        
        if ([responseObj isKindOfClass:[NSData class]]) {
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:nil];
            NSLog(@"response:%@",dic);
        }else{
            NSLog(@"response:%@",responseObj);
        }
        
        if (error) {
            NSLog(@"打印错误:%@",error);
            complete(nil,error);
            
        }else
        {
            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];


}
//第一个界面
+(id)getverifyToThePathandUserName:(NSInteger)userid andPath:(NSString *)path FortheName:(NSString *)name  theIdentityNumberPara:(NSString *)identityNumber completionHandle:(void (^)( verifyAdressModel*, NSError *))complete
{
    NSString *str1 = [NSString stringWithFormat:@"identityNumber=%@&name=%@&KkweInfo",[EnercryTool A:identityNumber],[EnercryTool A:name]];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew =@{
                             @"flag":@2,
                             @"name":[EnercryTool A:name],
                             @"identityNumber":[EnercryTool A:identityNumber],
                             @"sign":str1,
                           @"userId":@(userid)
                             };
    NSLog(@"dictNew:%@",dictNew);
    NSLog(@"Path:%@",pathNew1);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];
    
    
}
+(id)OnceSocialMessage:(NSString *)name andIdentityName:(NSString *)identityName andUserId:(NSInteger)userid andPhone_number:(NSString *)iphonenNumber completionHandle:(void (^)(verifyAdressModel *, NSError *))complete{
    
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/findLibInfo"];
        NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew =@{
                             @"identityNumber":identityName,
                             @"name":name,
                             @"userId":@(userid),
                             @"phone_number":iphonenNumber
                             };
    NSLog(@"dictNew:%@",dictNew);
    NSLog(@"Path:%@",pathNew1);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {

    
       
        
        if (responseObj && ![responseObj isEqual:@"<null>"]) {
             NSLog(@"response:%@",[NSJSONSerialization JSONObjectWithData:(NSData *)responseObj options:NSJSONReadingMutableLeaves error:nil]);
        }
        if (error) {
            NSLog(@"打印错误:%@",error);

        }else
        {

            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
            
        }
    }];
//        NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/findLibInfo"];
//    NSString *bugg  =[NSString stringWithFormat:@"?identityNumber=%@&name=%@&userId=%@&phone_number=%@",identityName,name,@(userid),iphonenNumber];
//
//    pathNew_1 =  [pathNew_1 stringByAppendingString:bugg];
//     pathNew_1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//    return [self  POST:pathNew_1 parameters:nil completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
//        NSLog(@"response:%@",responseObj);
//        if (error) {
//            NSLog(@"打印错误:%@",error);
//
//        }else
//        {
//            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
//        }
//    }];
}


+(id)manyPic:(NSMutableArray *)image completionHandle:(void (^)(verifyAdressModel *, NSError *))complete{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/ver"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSLog(@"%@",image);

    if (image.count <=3) {
        [SVProgressHUD showErrorWithStatus:@"照片上传失败"];
        return nil;
    }
    
    
    NSDictionary *dictNew =@{
                             @"flag":@2,//3
                             @"photoLstr":[image componentsJoinedByString:@","]//1周 照片一逗号的形式隔开

                             };
    //可能要转
    NSLog(@"%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        if (error) {
            NSLog(@"打印错误:%@",error);
        }else
        {
            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];
    
    
    
}


+(id)getSuccessSenderSocialMessageInsertInfo:(NSString *)path getName:(NSString *)Name privateStringIdentityNumber:(NSString *)identityName andProvinceName:(NSString *)province_name andCityName:(NSString *)city_name andCountryName:(NSString *)country_name andTownName:(NSString *)townName andvillageName:(NSString *)village_name andTelephone:(NSString *)telephone andCompanyName:(NSString *)company_Name andFlag:(NSInteger)flag andVerifyType:(NSInteger )verifyType andUimage:(NSMutableArray *)image ocrIMage:(NSString*)ocrImage ocrIMage_:(NSString*)ocrImage_ completionHandle:(void (^)(verifyAdressModel *, NSError *))complete
{
 //离线采集业务写这
    if([path isEqualToString:@"离线采集"]){
        
        gather *gat = [[gather alloc]init];
        gatherUtil *gatUtil = [[gatherUtil alloc]init];
        gat.Name = Name;
        gat.identityName = identityName;
        gat.provinceGather =province_name;
        gat.city_name=city_name;
        gat.country_name =country_name;
        gat.townName = townName;
        gat.village_name =village_name;
        gat.telephone = telephone;
        gat.company_Name =company_Name;
        gat.flag =2;
        gat.verifyType =verifyType;
        gat.imageCopy =[image copy];
        gat.ocrImage = ocrImage;
        gat.ocrImage_ =ocrImage_;
        [gatUtil addDate:gat];
         complete( nil,nil);
        return  nil;
    }
    
    
    
    
    

    if (!ocrImage) {
        ocrImage =[NSNull null];
    }
    if (!ocrImage_) {
        ocrImage_ =[NSNull null];
    }
    
    if ([company_Name isEqualToString:@""]) {
        company_Name =[NSNull null];
    }
    else
    {
        company_Name =[EnercryTool encryptUseDES:company_Name key:DESKEY];
    }
    if ([townName isEqualToString:@""]) {
        townName =[NSNull null];
    }else
    {
        townName =[EnercryTool encryptUseDES:townName key:DESKEY];
    }
    
    
    if ([village_name isEqualToString:@""]) {
          village_name =[NSNull null];
    }else
    {
        village_name=[EnercryTool encryptUseDES:village_name key:DESKEY];
    }

    if (!telephone) {
        telephone =[NSNull null];
    }
    

    
    NSString *str1 = [NSString stringWithFormat:@"identityNumber=%@&name=%@&KkweInfo",[EnercryTool A:identityName],[EnercryTool A:Name]];
    NSLog(@"%@",str1);
    str1 =  [MyMD5 md5:str1];
    if (!identityName) {
        identityName = [NSNull null];
    }else{
        identityName = [EnercryTool A:identityName];
    }
    
    NSLog(@"%@",identityName);
    NSLog(@"%@",Name);
    NSString * pathNew1 =  [path  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    
//    NSLog(@"%@",[EnercryTool A:Name]);
//    NSLog(@"%@",[EnercryTool A:identityName]);
//    NSLog(@"%@",[EnercryTool encryptUseDES:province_name key:DESKEY]);
//    NSLog(@"%@",[EnercryTool encryptUseDES:city_name key:DESKEY]);
//    NSLog(@"%@",[EnercryTool encryptUseDES:country_name key:DESKEY]);
//    NSLog(@"%@",townName);
//    NSLog(@"%@",village_name);
//    NSLog(@"%@",company_Name);
//    NSLog(@"%ld",(long)verifyType);
//    NSLog(@"%@",ocrImage_);
//    NSLog(@"%@",ocrImage);
//    NSLog(@"%@",str1);
    //NSLog(@"%@",image);
    
    
    
    
    
    NSDictionary *dictNew =@{
                             @"flag":@2,
                             @"name":[EnercryTool A:Name],
                             @"identityNumber":identityName,
                             @"province_name":[EnercryTool encryptUseDES:province_name key:DESKEY],//des加密  KkweFace95271124
                             @"city_name":[EnercryTool encryptUseDES:city_name key:DESKEY],
                             @"county_name":[EnercryTool encryptUseDES:country_name key:DESKEY],
                             @"town_name":townName,
                             @"village_name":village_name,
                             @"phone_number":[EnercryTool encryptUseDES:telephone key:DESKEY],
                             @"company_name":company_Name,
                             @"verify_type":@(verifyType),
                             @"image":[image componentsJoinedByString:@","],
                             @"ocrHeadImage":ocrImage_,
                             @"ocrTotalImage":ocrImage,
                               @"sign":str1,//des加密
                             @"iosVersion":@2,//3
                             @"userId":@([getPeopleID PeopleID])
                             };
    


    NSLog(@"%@",dictNew);
    

    
    
    
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
      
        if (error) {
            NSLog(@"打印错误:%@",error);
               [SVProgressHUD dismiss];
        }else
        {
            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];
    
}
+(id)findLibInfoIdentityNumber:(NSString*)identityNumber andName:(NSString*)name andProvinceName:(NSString *)province_name andCityName:(NSString *)city_name andCountryName:(NSString *)country_name andIns:(NSInteger)ins andTown_name:(NSString *)town andVillageName:(NSString *)village andIns:(NSInteger)ice completionHandle:(void (^)( verifyAdressModel*, NSError *))complete
{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/checkLibInfo"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew = nil;
    if ([village isEqualToString:@""]) {
        dictNew =@{
                                 @"identityNumber":identityNumber,
                                 @"name":name,
                                 @"province_name":province_name,
                                 @"city_name":city_name,
                                 @"county_name":country_name,
                                 @"isNewInsert":@(ins),
                                 @"verify_type":@(ice)
                                 };
    }else{
      dictNew =@{
                                 @"identityNumber":identityNumber,
                                 @"name":name,
                                 @"province_name":province_name,
                                 @"city_name":city_name,
                                 @"county_name":country_name,
                                 @"isNewInsert":@(ins),
                                 @"town_name":[EnercryTool encryptUseDES:town key:DESKEY],
                                 @"village_name":[EnercryTool encryptUseDES:village key:DESKEY],
                                 @"verify_type":@(ice)
                                 };

    }
    
 
    NSLog(@"dictNew:%@",dictNew);
    NSLog(@"Path:%@",pathNew1);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];

    
    
}





+(id)myCertificationUserID:(NSInteger)userID andPage:(NSInteger)page province:(NSString*)province andPath:(NSString*)path completionHandle:(void (^)( socialModelRecord*, NSError *))complete{

    NSDictionary *dictNew = nil;
    
    NSLog(@"%@",province);
    
    if (!userID  || province == nil) {
        
        return nil;
    }
    
    
    if ([path isEqualToString:[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/myCertificationRecord"]]) {
      dictNew =@{
                                 @"userId":@(userID),
                                 @"page":@(page),
                                 @"provinceName":province
                                 };
    }else{
        dictNew  =@{
                     @"userId":@(userID),
                     @"phone_number": [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                     @"province_name":province,
                     @"current_page":@(page)
                     };
    
    
    }
    
    
    
    NSString * pathNew1 =  [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    
  
    
    
    
    
    
    NSLog(@"dictNew:%@",dictNew);
    NSLog(@"Path:%@",pathNew1);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(socialModelRecord* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            complete( [socialModelRecord mj_objectWithKeyValues:responseObj],error);
        }
        
    }];



}



+(id)manualVerificationBakID:(NSString*)bak andidentityNumber:(NSString *)identityNumber andImage:(NSData *)image andOCR:(NSString*)ocr andTel:(NSString*)tel completionHandle:(void (^)(CitytoCityModel *, NSError *))complete
{

    
    
    
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/manualVerification"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


    
    NSDictionary *dictNew =@{
                             @"flag":@2,
                             @"id":bak,
                             @"identityNumber":[EnercryTool A:identityNumber],
                             @"image":[EnercryTool encryptBase64:image],
                             @"ocrTotalImage":ocr,
                             @"name":[EnercryTool A:[[NSUserDefaults standardUserDefaults]objectForKey:@"name"]]
                             };
    
    
    NSLog(@"dictNew:%@",dictNew);

    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(CitytoCityModel* responseObj, NSError *error) {
        
        if ([responseObj isKindOfClass:[NSDictionary class]]) {
            NSLog(@"response:%@",responseObj);
        }else if ([responseObj isKindOfClass:[NSData class]]){
            NSLog(@"response:%@",[NSJSONSerialization JSONObjectWithData:(NSData *)responseObj options:NSJSONReadingMutableContainers error:nil]);  
        }
        
        if (error) {
            NSLog(@"打印错误:%@",error);
        }else
        {
            complete( [CitytoCityModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];


}

+(id)phonenumberAndCompletionHandle:(void (^)(resulTModel *, NSError *))complete
{
    
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/getProvinceNamebyNum"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew =@{
                             @"telephone":[EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
                             };
    NSLog(@"dictNew:%@",dictNew);
    
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(resulTModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        
        if ([responseObj isKindOfClass:[NSData class]]) {
            
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:nil];
            NSLog(@"%@",dic);
        }
       
        if (error) {
            NSLog(@"打印错误:%@",error);
        }else
        {
            complete( [resulTModel mj_objectWithKeyValues:responseObj],error);
        }
        
    }];
    
    
}



+(id)newIDAndNAme:(NSString *)ID andName:(NSString *)name andResult:(NSString *)result completionHandle:(void (^)(verifyAdressModel *, NSError *))complete{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/updateUserName"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    
    if(!result){
        result = [NSNull null];
    }
    
    NSDictionary *dictNew =@{
                             @"name":name,
                             @"identityNumber":ID,
                             @"subLibName":result
                             };
    NSLog(@"dictNew:%@",dictNew);
    NSLog(@"Path:%@",pathNew1);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
    }];
    
    
}


+(id)tongxunlu:(NSString*)result completionHandle:(void (^)( verifyAdressModel*, NSError *))complete{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/linkman"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    if (!result) {
        result =[NSNull null];
    }
    
    NSDictionary *dictNew =@{
                             @"user_id":@([getPeopleID PeopleID]),
                             @"from_model":@2,
                             @"jsoncontact":result
                             };
    NSLog(@"dictNew:%@",dictNew);
    NSLog(@"Path:%@",result);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
        NSLog(@"response:%@",responseObj);
        if (error) {
            NSLog(@"打印错误:%@",error);
            
        }else
        {
            complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
        }
    }];
    
    
    
    
}



//+(id) replaceTelphone:(NSString *)Telphone andName:(NSString *)Name andIdNumber:(NSString *)IdNumber completionHandle:(void (^)(verifyAdressModel *, NSError *))complete{
//    NSString * pathNew_1 =[MEIMANIP stringByAppendingString:@"/socialsecurity/kankan/updateUserTelphone"];
//    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
//
//    if (!Telphone) {
//                Telphone =[NSNull null];
//            }
//
////    [EnercryTool encryptUseDES:[getPeopleID PeopleIphoneNmber] key:DESKEY],
//            NSDictionary *dictNew =@{
//                                     @"userid":@([getPeopleID PeopleID]),
//                                     @"frommodel":@2,
//                                     @"identityNumber":[EnercryTool A:IdNumber ],
//                                     @"personname":[EnercryTool A:Name ],
//                                     @"newtelphone":[EnercryTool encryptUseDES:Telphone key:DESKEY],
//                                     };
//            NSLog(@"dictNew:%@",dictNew);
//            NSLog(@"Path:%@",pathNew_1);
//
//    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(verifyAdressModel* responseObj, NSError *error) {
//                NSLog(@"response:%@",responseObj);
//                if (error) {
//                    NSLog(@"打印错误:%@",error);
//
//                }else
//                {
//                    complete( [verifyAdressModel mj_objectWithKeyValues:responseObj],error);
//                }
//            }];
//}
@end
