//
//  HttpHomeClassListCmd+Response.m
//  MobilePortal
//
//  Created by xiejiangbo on 2019/3/12.
//  Copyright © 2019 yin chen. All rights reserved.
//

#import "HttpHomeClassListCmd+Response.h"
#import "HttpHomeClassListResult.h"


@protocol HomeApplicationListHttpResultDataList;
@interface HomeApplicationListHttpResultDataList : JSONModel
@property NSString<Optional>*applicationid;
@property NSString<Optional>*createby;
@property NSString<Optional>*updateby;
@property NSString<Optional>*status;
@property NSString<Optional>*iconurl;
@property NSString<Optional>*partstate;
@property NSString<Optional>*belong;
@property NSString<Optional>*hurl;
@property NSString<Optional>*iosurl;
@property NSString<Optional>*name;
@property NSString<Optional>*hversion;
@property NSString<Optional>*createon;
@property NSString<Optional>*updateon;
@property NSString<Optional>*companystate;
@property NSString<Optional>*androidurl;
@property NSString<Optional>*scope;
@property NSString<Optional>*scopes;
@property NSString<Optional>*androidversion;
@property NSString<Optional>*pointstate;
@property NSString<Optional>*platforms;
@property NSString<Optional>*empuidstate;
@property NSString<Optional>*passstate;
@property NSString<Optional>*iosversion;
@property NSString<Optional>*introduce;
@property NSString<Optional>*htitle;
@property NSString<Optional>*androidname;
@property NSString<Optional>*androidcontent;
@property NSString<Optional>*iosbundieid;
@property NSString<Optional>*iosopenurl;
@property NSString<Optional>*ioscontent;
@property NSString<Optional>*hcontent;
@property NSString<Optional>*value1;
@property NSString<Optional>*value2;
@property NSString<Optional>*value3;
@property NSString<Optional>*value4;
@property NSString<Optional>*value5;
@property NSString<Optional>*appid;
@property NSString<Optional>*sysid;
@end
@implementation HomeApplicationListHttpResultDataList
@synthesize description;
@end

@protocol HomeApplicationListHttpResultData;
@interface HomeApplicationListHttpResultData : JSONModel
@property NSMutableArray<Optional,HomeApplicationListHttpResultDataList> *application;
@property NSString<Optional>*scope;
@property NSString<Optional>*scopesort;
@end
@implementation HomeApplicationListHttpResultData
@synthesize description;
@end


@protocol HttpHomeClassListResultTitleContent;
@interface HttpHomeClassListResultTitleContent : JSONModel
@property NSString<Optional>*title;
@property NSString<Optional>*docname;
@property NSString<Optional>*status;
@property NSString<Optional>*createby;
@property NSString<Optional>*updateby;
@property NSString<Optional>*tags;
@property NSString<Optional>*image;
@property NSString<Optional>*listimage;
@property NSString<Optional>*sort;
@property NSString<Optional>*kgimage;
@property NSString<Optional>*homeshow;
@property NSString<Optional>*createon;
@property NSString<Optional>*updateon;
@property NSString<Optional>*type;
@property NSString<Optional>*id;
@property NSString<Optional>*createbyname;
@property NSString<Optional>*foldertype;
@property NSString<Optional>*updatebyname;
@property NSString<Optional>*comments;
@property NSString<Optional>*pid;
@property NSString<Optional>*author;
@property NSString<Optional>*appid;
@end
@implementation HttpHomeClassListResultTitleContent
@synthesize description;
@end


@protocol HttpHomeClassListResultTopNews;
@interface HttpHomeClassListResultTopNews : JSONModel
//@property NSString<Optional>*titleNextUrl;
//@property NSString<Optional>*titleImgUrl;
@property NSMutableArray<Optional,HttpHomeClassListResultTitleContent> *titleContent;
@end
@implementation HttpHomeClassListResultTopNews
@synthesize description;
@end


@protocol HttpHomeClassListResultMenu;
@interface HttpHomeClassListResultMenu : JSONModel
@property NSString<Optional>*applicationid;
@property NSString<Optional>*createby;
@property NSString<Optional>*updateby;
@property NSString<Optional>*status;
@property NSString<Optional>*iconurl;
@property NSString<Optional>*partstate;
@property NSString<Optional>*belong;
@property NSString<Optional>*hurl;
@property NSString<Optional>*iosurl;
@property NSString<Optional>*name;
@property NSString<Optional>*hversion;
@property NSString<Optional>*createon;
@property NSString<Optional>*updateon;
@property NSString<Optional>*companystate;
@property NSString<Optional>*androidurl;
@property NSString<Optional>*scope;
@property NSString<Optional>*scopes;
@property NSString<Optional>*androidversion;
@property NSString<Optional>*pointstate;
@property NSString<Optional>*platforms;
@property NSString<Optional>*empuidstate;
@property NSString<Optional>*passstate;
@property NSString<Optional>*iosversion;
@property NSString<Optional>*introduce;
@property NSString<Optional>*htitle;
@property NSString<Optional>*androidname;
@property NSString<Optional>*androidcontent;
@property NSString<Optional>*iosbundieid;
@property NSString<Optional>*iosopenurl;
@property NSString<Optional>*ioscontent;
@property NSString<Optional>*hcontent;
@property NSString<Optional>*value1;
@property NSString<Optional>*value2;
@property NSString<Optional>*value3;
@property NSString<Optional>*value4;
@property NSString<Optional>*value5;
@property NSString<Optional>*appid;
@end
@implementation HttpHomeClassListResultMenu
@synthesize description;
@end

@protocol HttpHomeClassListResultBanner;
@interface HttpHomeClassListResultBanner : JSONModel
@property NSString<Optional>*title;
@property NSString<Optional>*docname;
@property NSString<Optional>*status;
@property NSString<Optional>*createby;
@property NSString<Optional>*updateby;
@property NSString<Optional>*tags;
@property NSString<Optional>*image;
@property NSString<Optional>*listimage;
@property NSString<Optional>*sort;
@property NSString<Optional>*kgimage;
@property NSString<Optional>*homeshow;
@property NSString<Optional>*createon;
@property NSString<Optional>*updateon;
@property NSString<Optional>*type;
@property NSString<Optional>*id;
@property NSString<Optional>*createbyname;
@property NSString<Optional>*foldertype;
@property NSString<Optional>*updatebyname;
@property NSString<Optional>*comments;
@property NSString<Optional>*pid;
@property NSString<Optional>*author;
@property NSString<Optional>*value1;
@property NSString<Optional>*value2;
@property NSString<Optional>*value3;
@property NSString<Optional>*value4;
@property NSString<Optional>*value5;
@property NSString<Optional>*publishtime;
@property NSString<Optional>*appid;
@end
@implementation HttpHomeClassListResultBanner
@synthesize description;
@end


@protocol HttpHomeClassListResultContentData;
@interface HttpHomeClassListResultContentData : JSONModel
@property NSMutableArray<Optional,HttpHomeClassListResultMenu> *menu;
@property NSMutableArray<Optional,HttpHomeClassListResultBanner> *banner;
@property NSMutableArray<Optional,HttpHomeClassListResultBanner> *list;
@property HttpHomeClassListResultTopNews *topNews;
@end
@implementation HttpHomeClassListResultContentData
@synthesize description;
@end


@protocol HttpHomeClassListResultData;
@interface HttpHomeClassListResultData : JSONModel
@property NSMutableArray<Optional,HttpHomeClassListResultMenu> *menu;
@property NSMutableArray<Optional,HttpHomeClassListResultBanner> *toptitle;
@property NSMutableArray<Optional,HttpHomeClassListResultBanner> *topmore;
@property NSMutableArray<Optional,HttpHomeClassListResultBanner> *topnews;
@property NSMutableArray<Optional,HttpHomeClassListResultBanner> *banner;
@property NSMutableArray<Optional,HomeApplicationListHttpResultData> *commonly;
@end
@implementation HttpHomeClassListResultData
@synthesize description;
@end


@interface HttpHomeClassListResult()
@property HttpHomeClassListResultData *data;
@end
@implementation HttpHomeClassListCmd (Response)
- (void)onRequestSuccess:(id)request code:(NSInteger)code{
    
    [self.result setResultState:kRequestResultSuccess];
    NSDictionary *dic = (NSDictionary *)request;
    HttpHomeClassListResult *result = [[HttpHomeClassListResult alloc]init];
    result = (HttpHomeClassListResult *)self.result;
    if (code>199&&code<299) {
        [self.result setResultState:kRequestResultSuccess];
        NSError *error;
        result.data = [[HttpHomeClassListResultData alloc]initWithDictionary:dic error:(NSError **)&error];
        if(error){
            [self onRequestFailed:error];
            return;
        }
    }else{
        NSString *memo = [dic objectForKey:@"error_description"];
        [self.result setResultState:kRequestResultFail];
        [self.result setErrMsg:memo];
        NSLog(@"code :%ld errormsg:%@",(long)code,memo);
    }
}

- (void)onRequestFailed:(NSError *)error{
    NSLog(@"Error===%@",error);
    [self.result setErrMsg:[error localizedDescription]];
    [self.result setResultState:kRequestResultFail];
}
@end
@implementation HttpHomeClassListResult
- (NSMutableArray *)getTheAllData{
    NSMutableArray *httpArray = [NSMutableArray array];
    [httpArray addObject:[self dataMenuArray:self.data.menu AndToptitle:self.data.toptitle AndTopmore:self.data.topmore AndTopnews:self.data.topnews AndBanner:self.data.banner AndCommonly:self.data.commonly]];
    return httpArray;
}
-(HomeHttpInfoModel *)dataMenuArray:(NSMutableArray *)menuArray
          AndToptitle:(NSMutableArray *)toptitleArray
          AndTopmore:(NSMutableArray *)topmoreArray
          AndTopnews:(NSMutableArray *)topnewsArray
          AndBanner:(NSMutableArray *)bannerArray
          AndCommonly:(NSMutableArray *)commonlyArray{
    HomeHttpInfoModel *infoModel = [[HomeHttpInfoModel alloc]init];
    infoModel.banner = [NSMutableArray array];
    infoModel.menu = [NSMutableArray array];
    infoModel.topmore = [NSMutableArray array];
    infoModel.topnews = [NSMutableArray array];
    infoModel.toptitle = [NSMutableArray array];
    infoModel.commonly = [NSMutableArray array];
//    [[HomeDBHelper SharedHomeDBHelper] deleteHomeHttpInfoModelBannerModel:^(BOOL result) {
//
//    }];
//    [[HomeDBHelper SharedHomeDBHelper] deleteHomeHttpInfoModelMenuModel:^(BOOL result) {
//
//    }];
//    [[HomeDBHelper SharedHomeDBHelper] deleteHomeHttpInfoModelTitleContentModel:^(BOOL result) {
//
//    }];
    for (int index = 0; index < bannerArray.count; index ++) {
        @autoreleasepool{
            HttpHomeClassListResultBanner *httpBanner = self.data.banner[index];
            HomeHttpInfoModelBannerModel *bannerModel = [[HomeHttpInfoModelBannerModel alloc]init];
            bannerModel.title = [self getNilString:httpBanner.title];
            bannerModel.docname = [self getNilString:httpBanner.docname];
            bannerModel.status = [self getNilString:httpBanner.status];
            bannerModel.createby = [self getNilString:httpBanner.createby];
            bannerModel.updateby = [self getNilString:httpBanner.updateby];
            bannerModel.tags = [self getNilString:httpBanner.tags];
            bannerModel.image = [self getNilString:httpBanner.image];
            bannerModel.image = [self getImageUrl:bannerModel.image];
            bannerModel.listimage = [self getNilString:httpBanner.listimage];
            bannerModel.sort = [self getNilString:httpBanner.sort];
            bannerModel.kgimage = [self getNilString:httpBanner.kgimage];
            bannerModel.homeshow = [self getNilString:httpBanner.homeshow];
            bannerModel.createon = [self getNilString:httpBanner.createon];
            bannerModel.updateon = [self getNilString:httpBanner.updateon];
            bannerModel.type = [self getNilString:httpBanner.type];
            bannerModel.id = [self getNilString:httpBanner.id];
            bannerModel.createbyname = [self getNilString:httpBanner.createbyname];
            bannerModel.foldertype = [self getNilString:httpBanner.foldertype];
            bannerModel.updatebyname = [self getNilString:httpBanner.updatebyname];
            bannerModel.comments = [self getNilString:httpBanner.comments];
            bannerModel.pid = [self getNilString:httpBanner.pid];
            //        [[HomeDBHelper SharedHomeDBHelper] saveHomeHttpInfoModelBannerModel:bannerModel callBack:^(BOOL result) {
            //
            //        }];
            [infoModel.banner addObject:bannerModel];
        }
        
    }
    for (int index = 0; index < menuArray.count; index ++) {
        @autoreleasepool{
        HttpHomeClassListResultMenu *httpBanner = self.data.menu[index];
        ApplicationHttpListModel *listModel = [[ApplicationHttpListModel alloc]init];
        listModel.applicationid = [self getNilString:httpBanner.applicationid];
        listModel.createby = [self getNilString:httpBanner.createby];
        listModel.updateby = [self getNilString:httpBanner.updateby];
        listModel.status = [self getNilString:httpBanner.status];
        listModel.iconurl = [self getNilString:httpBanner.iconurl];
        listModel.imageUrl = [self getImageUrl:httpBanner.iconurl];
        listModel.partstate = [self getNilString:httpBanner.partstate];
        listModel.belong = [self getNilString:httpBanner.belong];
        listModel.hurl = [self getNilString:httpBanner.hurl];
        listModel.iosurl = [self getNilString:httpBanner.iosurl];
        listModel.name = [self getNilString:httpBanner.name];
        listModel.hversion = [self getNilString:httpBanner.hversion];
        listModel.createon = [self getNilString:httpBanner.createon];
        listModel.updateon = [self getNilString:httpBanner.updateon];
        listModel.companystate = [self getNilString:httpBanner.companystate];
        listModel.androidurl = [self getNilString:httpBanner.androidurl];
        listModel.scope = [self getNilString:httpBanner.scope];
        listModel.scopes = [self getNilString:httpBanner.scopes];
        listModel.androidversion = [self getNilString:httpBanner.androidversion];
        listModel.pointstate = [self getNilString:httpBanner.pointstate];
        listModel.platforms = [self getNilString:httpBanner.platforms];
        listModel.empuidstate = [self getNilString:httpBanner.empuidstate];
        listModel.passstate = [self getNilString:httpBanner.passstate];
        listModel.iosversion = [self getNilString:httpBanner.iosversion];
        listModel.introduce = [self getNilString:httpBanner.introduce];
        listModel.ioscontent = [self getNilString:httpBanner.ioscontent];
        listModel.iosbundieid = [self getNilString:httpBanner.iosbundieid];
        listModel.iosopenurl = [self getNilString:httpBanner.iosopenurl];
        if ([listModel.iosopenurl rangeOfString:@"://"].location == NSNotFound && ![listModel.iosopenurl isEqualToString:@""]) {
            listModel.iosopenurl = [NSString stringWithFormat:@"%@://",listModel.iosopenurl];
        }
        listModel.androidname = [self getNilString:httpBanner.androidname];
        listModel.androidcontent = [self getNilString:httpBanner.androidcontent];
        listModel.hcontent = [self getNilString:httpBanner.hcontent];
        listModel.htitle = [self getNilString:httpBanner.htitle];
        listModel.value1 = [self getNilString:httpBanner.value1];
        listModel.value2 = [self getNilString:httpBanner.value2];
        listModel.value3 = [self getNilString:httpBanner.value3];
        listModel.value4 = [self getNilString:httpBanner.value4];
        listModel.value5 = [self getNilString:httpBanner.value5];
        listModel.appid = [self getNilString:httpBanner.appid];
//        [[HomeDBHelper SharedHomeDBHelper] saveHomeHttpInfoModelMenuModel:bannerModel callBack:^(BOOL result) {
//
//        }];
        [infoModel.menu addObject:listModel];
        }
    }
    for (int index = 0; index < topmoreArray.count; index ++) {
        @autoreleasepool{
        HttpHomeClassListResultTitleContent *httpBanner = self.data.topmore[index];
        HomeHttpInfoModelTitleContentModel *bannerModel = [[HomeHttpInfoModelTitleContentModel alloc]init];
        bannerModel.homeType = @"topmore";
        bannerModel.title = [self getNilString:httpBanner.title];
        bannerModel.docname = [self getNilString:httpBanner.docname];
        bannerModel.status = [self getNilString:httpBanner.status];
        bannerModel.createby = [self getNilString:httpBanner.createby];
        bannerModel.updateby = [self getNilString:httpBanner.updateby];
        bannerModel.tags = [self getNilString:httpBanner.tags];
        bannerModel.image = [self getNilString:httpBanner.image];
        bannerModel.image = [self getImageUrl:bannerModel.image];
        bannerModel.listimage = [self getNilString:httpBanner.listimage];
        bannerModel.sort = [self getNilString:httpBanner.sort];
        bannerModel.kgimage = [self getNilString:httpBanner.kgimage];
        bannerModel.homeshow = [self getNilString:httpBanner.homeshow];
        bannerModel.createon = [self getNilString:httpBanner.createon];
        bannerModel.updateon = [self getNilString:httpBanner.updateon];
        bannerModel.type = [self getNilString:httpBanner.type];
        bannerModel.id = [self getNilString:httpBanner.id];
        bannerModel.createbyname = [self getNilString:httpBanner.createbyname];
        bannerModel.foldertype = [self getNilString:httpBanner.foldertype];
        bannerModel.updatebyname = [self getNilString:httpBanner.updatebyname];
        bannerModel.comments = [self getNilString:httpBanner.comments];
        if ([[AccountInfo sharedInstance].isTest isEqualToString:@"1"]) {
            bannerModel.comments = @"http://222.66.127.246:8021/SYERP/todolist/topListNew/view/common.html";
        } else if ([[AccountInfo sharedInstance].isTest isEqualToString:@"2"]){
            bannerModel.comments = @"http://mobileportal.shaphar.com:8020/SYERP/todolist/topListNew/view/common.html#/datalist/orderCheck";
        } else {
            bannerModel.comments = @"http://mobileportal.shaphar.com:8020/SYERP/todolist/topList/view/common.html#/datalist/orderCheck";
        }
        bannerModel.pid = [self getNilString:httpBanner.pid];
        bannerModel.author = [self getNilString:httpBanner.author];
        bannerModel.appid = [self getNilString:httpBanner.appid];
//        [[HomeDBHelper SharedHomeDBHelper] saveHomeHttpInfoModelTitleContentModel:bannerModel callBack:^(BOOL result) {
//
//        }];
        [infoModel.topmore addObject:bannerModel];
        }
    }
    for (int index = 0; index < topnewsArray.count; index ++) {
        @autoreleasepool{
        HttpHomeClassListResultBanner *httpBanner = self.data.topnews[index];
        HomeHttpInfoModelTitleContentModel *bannerModel = [[HomeHttpInfoModelTitleContentModel alloc]init];
        bannerModel.homeType = @"topnews";
        bannerModel.title = [self getNilString:httpBanner.title];
        bannerModel.docname = [self getNilString:httpBanner.docname];
        bannerModel.status = [self getNilString:httpBanner.status];
        bannerModel.createby = [self getNilString:httpBanner.createby];
        bannerModel.updateby = [self getNilString:httpBanner.updateby];
        bannerModel.tags = [self getNilString:httpBanner.tags];
        bannerModel.image = [self getNilString:httpBanner.image];
        bannerModel.image = [self getImageUrl:bannerModel.image];
        bannerModel.listimage = [self getNilString:httpBanner.listimage];
        bannerModel.sort = [self getNilString:httpBanner.sort];
        bannerModel.kgimage = [self getNilString:httpBanner.kgimage];
        bannerModel.homeshow = [self getNilString:httpBanner.homeshow];
        bannerModel.createon = [self getNilString:httpBanner.createon];
        bannerModel.updateon = [self getNilString:httpBanner.updateon];
        bannerModel.type = [self getNilString:httpBanner.type];
        bannerModel.id = [self getNilString:httpBanner.id];
        bannerModel.createbyname = [self getNilString:httpBanner.createbyname];
        bannerModel.foldertype = [self getNilString:httpBanner.foldertype];
        bannerModel.updatebyname = [self getNilString:httpBanner.updatebyname];
        bannerModel.comments = [self getNilString:httpBanner.comments];
        bannerModel.pid = [self getNilString:httpBanner.pid];
        bannerModel.author = [self getNilString:httpBanner.author];
        bannerModel.value1 = [self getNilString:httpBanner.value1];
        bannerModel.value2 = [self getNilString:httpBanner.value2];
        bannerModel.value3 = [self getNilString:httpBanner.value3];
        bannerModel.value4 = [self getNilString:httpBanner.value4];
        bannerModel.value5 = [self getNilString:httpBanner.value5];
        bannerModel.publishtime = [self getNilString:httpBanner.publishtime];
        bannerModel.appid = [self getNilString:httpBanner.appid];
//        [[HomeDBHelper SharedHomeDBHelper] saveHomeHttpInfoModelTitleContentModel:bannerModel callBack:^(BOOL result) {
//
//        }];
        [infoModel.topnews addObject:bannerModel];
        }
    }
    for (int index = 0; index < toptitleArray.count; index ++) {
        @autoreleasepool{
        HttpHomeClassListResultBanner *httpBanner = self.data.toptitle[index];
        HomeHttpInfoModelTitleContentModel *bannerModel = [[HomeHttpInfoModelTitleContentModel alloc]init];
        bannerModel.homeType = @"toptitle";
        bannerModel.title = [self getNilString:httpBanner.title];
        bannerModel.docname = [self getNilString:httpBanner.docname];
        bannerModel.status = [self getNilString:httpBanner.status];
        bannerModel.createby = [self getNilString:httpBanner.createby];
        bannerModel.updateby = [self getNilString:httpBanner.updateby];
        bannerModel.tags = [self getNilString:httpBanner.tags];
        bannerModel.image = [self getNilString:httpBanner.image];
        bannerModel.image = [self getImageUrl:bannerModel.image];
        bannerModel.listimage = [self getNilString:httpBanner.listimage];
        bannerModel.sort = [self getNilString:httpBanner.sort];
        bannerModel.kgimage = [self getNilString:httpBanner.kgimage];
        bannerModel.homeshow = [self getNilString:httpBanner.homeshow];
        bannerModel.createon = [self getNilString:httpBanner.createon];
        bannerModel.updateon = [self getNilString:httpBanner.updateon];
        bannerModel.type = [self getNilString:httpBanner.type];
        bannerModel.id = [self getNilString:httpBanner.id];
        bannerModel.createbyname = [self getNilString:httpBanner.createbyname];
        bannerModel.foldertype = [self getNilString:httpBanner.foldertype];
        bannerModel.updatebyname = [self getNilString:httpBanner.updatebyname];
        bannerModel.comments = [self getNilString:httpBanner.comments];
        bannerModel.pid = [self getNilString:httpBanner.pid];
        bannerModel.author = [self getNilString:httpBanner.author];
        bannerModel.appid = [self getNilString:httpBanner.appid];
//        [[HomeDBHelper SharedHomeDBHelper] saveHomeHttpInfoModelTitleContentModel:bannerModel callBack:^(BOOL result) {
//
//        }];
        [infoModel.toptitle addObject:bannerModel];
        }
    }
    if ([[AccountInfo sharedInstance].oldType isEqualToString:@"0"]) {
        for (int index = 0 ; index < commonlyArray.count; index ++) {
            ApplicationHttpScopListModel *scopList = [[ApplicationHttpScopListModel alloc]init];
            HomeApplicationListHttpResultData *httpScopList = commonlyArray[index];
            scopList.scope = [self getNilString:httpScopList.scope];
            scopList.scopes = [self getNilString:httpScopList.scopesort];
            [self setScopeArray:scopList.application AndScoprHttpList:httpScopList.application];
            [infoModel.commonly addObject:scopList];
        }
    } else {
        for (int index = 0 ; index < commonlyArray.count; index ++) {
            ApplicationHttpScopListModel *scopList = [[ApplicationHttpScopListModel alloc]init];
            HomeApplicationListHttpResultData *httpScopList = commonlyArray[index];
            scopList.scope = [self getNilString:httpScopList.scope];
            scopList.scopes = [self getNilString:httpScopList.scopesort];
            [self setScopeArray:scopList.application AndScoprHttpList:httpScopList.application];
            [infoModel.commonly addObject:scopList];
        }
    }
    return infoModel;
}

-(void)setScopeArray:(NSMutableArray *)scopeList AndScoprHttpList:(NSMutableArray *)scoprHttpList{
    for (int index = 0; index < scoprHttpList.count; index ++) {
        ApplicationHttpListModel *listModel = [[ApplicationHttpListModel alloc]init];
        HomeApplicationListHttpResultDataList *httpModel = scoprHttpList[index];
        listModel.applicationid = [self getNilString:httpModel.applicationid];
        listModel.createby = [self getNilString:httpModel.createby];
        listModel.updateby = [self getNilString:httpModel.updateby];
        listModel.status = [self getNilString:httpModel.status];
        listModel.iconurl = [self getNilString:httpModel.iconurl];
        listModel.imageUrl = [self getImageUrl:listModel.iconurl];
        listModel.partstate = [self getNilString:httpModel.partstate];
        listModel.belong = [self getNilString:httpModel.belong];
        listModel.hurl = [self getNilString:httpModel.hurl];
        listModel.iosurl = [self getNilString:httpModel.iosurl];
        listModel.name = [self getNilString:httpModel.name];
        listModel.hversion = [self getNilString:httpModel.hversion];
        listModel.createon = [self getNilString:httpModel.createon];
        listModel.updateon = [self getNilString:httpModel.updateon];
        listModel.companystate = [self getNilString:httpModel.companystate];
        listModel.androidurl = [self getNilString:httpModel.androidurl];
        listModel.scope = [self getNilString:httpModel.scope];
        listModel.scopes = [self getNilString:httpModel.scopes];
        listModel.androidversion = [self getNilString:httpModel.androidversion];
        listModel.pointstate = [self getNilString:httpModel.pointstate];
        listModel.platforms = [self getNilString:httpModel.platforms];
        listModel.empuidstate = [self getNilString:httpModel.empuidstate];
        listModel.passstate = [self getNilString:httpModel.passstate];
        listModel.iosversion = [self getNilString:httpModel.iosversion];
        listModel.introduce = [self getNilString:httpModel.introduce];
        listModel.ioscontent = [self getNilString:httpModel.ioscontent];
        listModel.iosbundieid = [self getNilString:httpModel.iosbundieid];
        listModel.iosopenurl = [self getNilString:httpModel.iosopenurl];
        if ([listModel.iosopenurl rangeOfString:@"://"].location == NSNotFound && ![listModel.iosopenurl isEqualToString:@""]) {
            listModel.iosopenurl = [NSString stringWithFormat:@"%@://",listModel.iosopenurl];
        }
        listModel.androidname = [self getNilString:httpModel.androidname];
        listModel.androidcontent = [self getNilString:httpModel.androidcontent];
        listModel.hcontent = [self getNilString:httpModel.hcontent];
        listModel.htitle = [self getNilString:httpModel.htitle];
        listModel.value1 = [self getNilString:httpModel.value1];
        listModel.value2 = [self getNilString:httpModel.value2];
        listModel.value3 = [self getNilString:httpModel.value3];
        listModel.value4 = [self getNilString:httpModel.value4];
        listModel.value5 = [self getNilString:httpModel.value5];
        listModel.appid = [self getNilString:httpModel.appid];
        listModel.sysid = [self getNilString:httpModel.sysid];
//        listModel.sysid = [self getNilString:httpModel.belong];
        [scopeList addObject:listModel];
    }
}
-(NSString *)remo:(NSString *)str{
    NSString *strUrl = [str stringByReplacingOccurrencesOfString:@"\n" withString:@""];
    return strUrl;
}
-(NSMutableArray *)getCacheData{
    NSMutableArray *httpArray = [NSMutableArray array];
    HomeHttpInfoModel *infoModel = [[HomeHttpInfoModel alloc]init];
    infoModel.banner = [NSMutableArray array];
    infoModel.menu = [NSMutableArray array];
    infoModel.topmore = [NSMutableArray array];
    infoModel.topnews = [NSMutableArray array];
    infoModel.toptitle = [NSMutableArray array];
    if ([[HomeDBHelper SharedHomeDBHelper] hasHomeHttpInfoModelBannerModel]) {
        [self getHomeHttpInfoModelBannerModel:infoModel.banner AndSetArray:[[HomeDBHelper SharedHomeDBHelper] allHomeHttpInfoModelBannerModel]];
    }
    if ([[HomeDBHelper SharedHomeDBHelper] hasHomeHttpInfoModelMenuModel]) {
        [self getHomeHttpInfoModelMenuModel:infoModel.menu AndSetArray:[[HomeDBHelper SharedHomeDBHelper] allHomeHttpInfoModelMenuModel]];
    }
    if ([[HomeDBHelper SharedHomeDBHelper] hasHomeHttpInfoModelTitleContentModel:@"topmore"]) {
        [self getHomeHttpInfoModelTitleContentModel:infoModel.topmore AndSetArray:[[HomeDBHelper SharedHomeDBHelper] allHomeHttpInfoModelTitleContentModel:@"topmore"]];
    }
    if ([[HomeDBHelper SharedHomeDBHelper] hasHomeHttpInfoModelTitleContentModel:@"topnews"]) {
        [self getHomeHttpInfoModelTitleContentModel:infoModel.topnews AndSetArray:[[HomeDBHelper SharedHomeDBHelper] allHomeHttpInfoModelTitleContentModel:@"topnews"]];
    }
    if ([[HomeDBHelper SharedHomeDBHelper] hasHomeHttpInfoModelTitleContentModel:@"toptitle"]) {
        [self getHomeHttpInfoModelTitleContentModel:infoModel.toptitle AndSetArray:[[HomeDBHelper SharedHomeDBHelper] allHomeHttpInfoModelTitleContentModel:@"toptitle"]];
    }
    [httpArray addObject:infoModel];
    return httpArray;
}
- (void)getHomeHttpInfoModelBannerModel:(NSMutableArray *)getArray AndSetArray:(NSMutableArray *)setArray{
    for (int index = 0; index < setArray.count; index ++) {
        HomeHttpInfoModelBannerModel *httpBanner = setArray[index];
        HomeHttpInfoModelBannerModel *bannerModel = [[HomeHttpInfoModelBannerModel alloc]init];
        bannerModel.title = [self getNilString:httpBanner.title];
        bannerModel.docname = [self getNilString:httpBanner.docname];
        bannerModel.status = [self getNilString:httpBanner.status];
        bannerModel.createby = [self getNilString:httpBanner.createby];
        bannerModel.updateby = [self getNilString:httpBanner.updateby];
        bannerModel.tags = [self getNilString:httpBanner.tags];
        bannerModel.image = [self getNilString:httpBanner.image];
        bannerModel.listimage = [self getNilString:httpBanner.listimage];
        bannerModel.sort = [self getNilString:httpBanner.sort];
        bannerModel.kgimage = [self getNilString:httpBanner.kgimage];
        bannerModel.homeshow = [self getNilString:httpBanner.homeshow];
        bannerModel.createon = [self getNilString:httpBanner.createon];
        bannerModel.updateon = [self getNilString:httpBanner.updateon];
        bannerModel.type = [self getNilString:httpBanner.type];
        bannerModel.id = [self getNilString:httpBanner.id];
        bannerModel.createbyname = [self getNilString:httpBanner.createbyname];
        bannerModel.foldertype = [self getNilString:httpBanner.foldertype];
        bannerModel.updatebyname = [self getNilString:httpBanner.updatebyname];
        bannerModel.comments = [self getNilString:httpBanner.comments];
        bannerModel.pid = [self getNilString:httpBanner.pid];
        bannerModel.appid = [self getNilString:httpBanner.appid];
        [getArray addObject:bannerModel];
    }
}
- (void)getHomeHttpInfoModelMenuModel:(NSMutableArray *)getArray AndSetArray:(NSMutableArray *)setArray{
    for (int index = 0; index < setArray.count; index ++) {
        HomeHttpInfoModelMenuModel *httpBanner = setArray[index];
        HomeHttpInfoModelMenuModel *bannerModel = [[HomeHttpInfoModelMenuModel alloc]init];
        bannerModel.title = [self getNilString:httpBanner.title];
        bannerModel.docname = [self getNilString:httpBanner.docname];
        bannerModel.status = [self getNilString:httpBanner.status];
        bannerModel.createby = [self getNilString:httpBanner.createby];
        bannerModel.updateby = [self getNilString:httpBanner.updateby];
        bannerModel.tags = [self getNilString:httpBanner.tags];
        bannerModel.image = [self getNilString:httpBanner.image];
        bannerModel.listimage = [self getNilString:httpBanner.listimage];
        bannerModel.sort = [self getNilString:httpBanner.sort];
        bannerModel.kgimage = [self getNilString:httpBanner.kgimage];
        bannerModel.homeshow = [self getNilString:httpBanner.homeshow];
        bannerModel.createon = [self getNilString:httpBanner.createon];
        bannerModel.updateon = [self getNilString:httpBanner.updateon];
        bannerModel.type = [self getNilString:httpBanner.type];
        bannerModel.id = [self getNilString:httpBanner.id];
        bannerModel.createbyname = [self getNilString:httpBanner.createbyname];
        bannerModel.foldertype = [self getNilString:httpBanner.foldertype];
        bannerModel.updatebyname = [self getNilString:httpBanner.updatebyname];
        bannerModel.comments = [self getNilString:httpBanner.comments];
        bannerModel.pid = [self getNilString:httpBanner.pid];
        bannerModel.author = [self getNilString:httpBanner.author];
        bannerModel.appid = [self getNilString:httpBanner.appid];
        [getArray addObject:bannerModel];
    }
}
- (void)getHomeHttpInfoModelTitleContentModel:(NSMutableArray *)getArray AndSetArray:(NSMutableArray *)setArray{
    for (int index = 0; index < setArray.count; index ++) {
        HomeHttpInfoModelTitleContentModel *httpBanner = setArray[index];
        ApplicationHttpListModel *bannerModel = [[ApplicationHttpListModel alloc]init];
        bannerModel.title = [self getNilString:httpBanner.title];
        bannerModel.docname = [self getNilString:httpBanner.docname];
        bannerModel.status = [self getNilString:httpBanner.status];
        bannerModel.createby = [self getNilString:httpBanner.createby];
        bannerModel.updateby = [self getNilString:httpBanner.updateby];
        bannerModel.tags = [self getNilString:httpBanner.tags];
        bannerModel.image = [self getNilString:httpBanner.image];
//        bannerModel.image = [self getImageUrl:bannerModel.image];
        bannerModel.listimage = [self getNilString:httpBanner.listimage];
        bannerModel.sort = [self getNilString:httpBanner.sort];
        bannerModel.kgimage = [self getNilString:httpBanner.kgimage];
        bannerModel.homeshow = [self getNilString:httpBanner.homeshow];
        bannerModel.createon = [self getNilString:httpBanner.createon];
        bannerModel.updateon = [self getNilString:httpBanner.updateon];
        bannerModel.type = [self getNilString:httpBanner.type];
        bannerModel.id = [self getNilString:httpBanner.id];
        bannerModel.createbyname = [self getNilString:httpBanner.createbyname];
        bannerModel.foldertype = [self getNilString:httpBanner.foldertype];
        bannerModel.updatebyname = [self getNilString:httpBanner.updatebyname];
        bannerModel.comments = [self getNilString:httpBanner.comments];
        bannerModel.pid = [self getNilString:httpBanner.pid];
        bannerModel.author = [self getNilString:httpBanner.author];
        bannerModel.value1 = [self getNilString:httpBanner.value1];
        bannerModel.value2 = [self getNilString:httpBanner.value2];
        bannerModel.value3 = [self getNilString:httpBanner.value3];
        bannerModel.value4 = [self getNilString:httpBanner.value4];
        bannerModel.value5 = [self getNilString:httpBanner.value5];
        bannerModel.publishtime = [self getNilString:httpBanner.publishtime];
        bannerModel.appid = [self getNilString:httpBanner.appid];
        [getArray addObject:bannerModel];
    }
}
@end
