//
//  postMessageMNet.m
//  Open
//
//  Created by 看看智能 on 2017/3/3.
//  Copyright © 2017年 黄江涛 . All rights reserved.
//

#import "postMessageMNet.h"

@implementation postMessageMNet

-(NSMutableArray *)Image
{
    if (!_Image) {
        _Image =[NSMutableArray new];
    }
    return _Image;
}


+(id)getSuperCatalogcompletionHandle:(void(^)(postMessageModel*, NSError *))complete
{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/getSuperCatalog"];
       NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    return [self  POST:pathNew1 parameters:nil completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [postMessageModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
        }
    }];
}

+(id)getChildCatalog:(NSInteger )parentid completionHandle:(void (^)(postMessageModel *, NSError *))complete
{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/getChildCatalog"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSDictionary *dictNew =@{
                                 @"parentid":@(parentid)
                                 };
        NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [postMessageModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
        }
    }];

}


+(id)getinsertPublishInfoPublishName:(NSString *)publishName andPublish_name:(NSString *)publish_name andUser_id:(double)user_id andPublish_parentName:(NSString *)publish_parentName andCatalogName:(NSString *)catalogName andPublish_catelogName:(NSString *)publish_catalogName andpublish_province:(NSString *)publish_province andPublish_city:(NSString *)publish_city andPublish_country:(NSString *)publish_country andPublish_content:(NSString *)publish_content andTelephone:(NSString *)publish_telphone andPublish_address:(NSString *)publish_address andImage:(NSMutableArray *)array_image andLocation_X:(double)location_x andLocation_Y:(double)Location_Y completionHandle:(void (^)(postMessageModel *, NSError *))complete
{
    
    
    
 __block   NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/insertPublishInfo"];
    NSDictionary *dict1 =[NSDictionary new];
    if (array_image) {
     dict1 =@{
                                @"flag":@2,
                                @"publish_content":[EnercryTool encryptUseDES:publish_content key:DESKEY],
                                 @"publishName":[EnercryTool encryptUseDES:publishName key:DESKEY],
                                 @"publish_name":publish_name,
                                 @"user_id":@(user_id),
                                 @"publish_parentName":publish_parentName,
                                 @"publish_catalogName":publish_catalogName,
                                 @"publish_province":publish_province,
                                 @"publish_city":publish_city,
                                 @"publish_country":publish_country,
                                 @"publish_telphone":publish_telphone,
                                 @"publish_address":publish_address,
                                @"image":[array_image componentsJoinedByString:@","],
                                 @"location_x":@(location_x),
                                 @"location_y":@(Location_Y)
                                 };
    NSLog(@"%@",dict1);
    NSLog(@"path:%@",pathNew_1);
    }else
    {
              dict1 =@{
                                         @"flag":@2,
                                         @"publishName":[EnercryTool encryptUseDES:publishName key:DESKEY],
                                         @"publish_name":publish_name,
                                         @"user_id":@(user_id),
                                         @"publish_parentName":publish_parentName,
                                         @"publish_catalogName":publish_catalogName,
                                         @"publish_province":publish_province,
                                         @"publish_city":publish_city,
                                         @"publish_country":publish_country,
                                         @"publish_content":[EnercryTool encryptUseDES:publish_content key:DESKEY],
                                         @"publish_telphone":publish_telphone,
                                         @"publish_address":publish_address,
                                         @"location_x":@(location_x),
                                         @"location_y":@(Location_Y)
        
                                         };
                NSLog(@"dictNew:%@",dict1);
    }
        return [self POST:pathNew_1 parameters:dict1 completionHandler:^(id responseObj, NSError *error) {
            complete( [postMessageModel mj_objectWithKeyValues:responseObj],error);
            NSLog(@"%@",responseObj);
        }];

}
+(NSString*)utf8Str:(NSString*)str1
{
 NSString *str2= [str1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    return  str2;
}


+(id)findMyPublishInfo:(NSInteger)user_id andPage:(NSInteger)page andState:(NSInteger)state com:(void(^)(postMessageModel*, NSError *))complete{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/findMyPublishInfo"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew =@{
                             @"user_id":@(user_id),
                             @"page":@(page),
                             @"state":@(state)
                             };
    NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [postMessageModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
        }
    }];
}

+(id)findPublishInfo:(NSInteger)page andPro:(NSString*)publishProvince andCity:(NSString*)publishCity andCountry:(NSString*)publishCountry andSuper:(NSString*)superCategoryname andCate:(NSString*)categoryname andL_x:(double)location_x andL_y:(double )location_y cH:(void(^)(postMessageModel*, NSError *))complete{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/freePublishInfo"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew =@{
                             @"publishProvince":publishProvince,
                             @"page":@(page),
                             @"publishCity":publishCity,
                             @"publishCountry":publishCountry,
                                   @"superCategoryname":superCategoryname,
                                   @"categoryname":categoryname,
                                   @"location_x":@(location_x),
                                   @"location_y":@(location_y)
                             };
    NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [postMessageModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
        }
    }];


}

+(id)deleteForeverUserID:(NSInteger)userid andIdString:(NSString *)idString com:(void (^)(postMessageModel *, NSError *))complete
{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/deleteForever"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew =@{
  @"user_id":@(userid),
  @"idString":idString,
  
                             };
    NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [postMessageModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
        }
    }];



}

+(id)recommendedInfopublishProvince:(NSString *)publishProvince andpublishCity:(NSString*)publishCity andpublishCountry:(NSString*)publishCountry andpage:(NSInteger)page H:(void(^)(postMessageModel*, NSError *))complete{
    NSString * pathNew_1 =[IPDIZHI stringByAppendingString:@"/socialsecurity/kankan/recommendedInfo"];
    NSString * pathNew1 =  [pathNew_1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *dictNew =@{
                             @"publishProvince":publishProvince,
                             @"publishCity":publishCity,
                             @"publishCountry":publishCountry,
                             @"page":@(page)
                             };
    NSLog(@"dictNew:%@",dictNew);
    return [self  POST:pathNew1 parameters:dictNew completionHandler:^(id responseObj, NSError *error) {
        NSLog(@"%@",responseObj);
        complete( [postMessageModel mj_objectWithKeyValues:responseObj],error);
        if (error) {
            NSLog(@"打印错误:%@",error);
        }
    }];


}












@end
