// // NetworkCenter.m // NEPFoundation // // Created by 周泽文 on 2018/10/11. // Copyright © 2018年 周泽文. All rights reserved. // #import "NetworkCenter.h" #import "ZZWNetworkManager.h" #import "ParamCenter.h" #import "ZZWDataSaver.h" #import "ZZWTool.h" #import "ZZW_APPInfo.h" #import "NSString+Sha256.h" #import "LCNetworking.h" #import "ZZWEncryption.h" @interface NetworkCenter() @property(nonatomic,strong)ZZWNetworkManager *manager; @property(nonatomic,strong)NetworkModel *model; @property(nonatomic,strong)ParamCenter *pc; @end @implementation NetworkCenter static NetworkCenter *networkCenter = nil; + (instancetype)shareManager { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ networkCenter = [[NetworkCenter alloc] init]; }); return networkCenter; } -(instancetype)init{ self = [super init]; if (self) { _pc = [ParamCenter new]; _manager = [ZZWNetworkManager shareManager]; _model = [NetworkModel new]; _model.ipString = _pc.HuanYuBaoIP; // _model.cmd = _pc.HuanYuBaoCmd; } return self; } -(void)registerWithPhone:(NSString *)phoneNum password:(NSString *)password volidateCode:(NSString*)volidateCode inviteCode:(NSString *)inviteCode completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; _model.paramterDic = @{@"mobile":phoneNum,@"password":password,@"invite_mobile":inviteCode,@"code":volidateCode}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/account/register"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { ZZWDataSaver *saver = [ZZWDataSaver shareManager]; saver.phoneNumber = phoneNum; saver.inviteCode = dic[@"myInviteCode"]; saver.userId = [dic[@"userId"] integerValue]; saver.tokenValue = dic[@"tokenValue"]; saver.nickname = dic[@"nickname"]; saver.headUrl = dic[@"himageUrl"]; saver.email = dic[@"email"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ self.model.ipString = self.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)loginWithPhone:(NSString *)phoneNum password:(NSString *)password completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"mobile":phoneNum,@"password":password}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/account/login"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { ZZWDataSaver *saver = [ZZWDataSaver shareManager]; saver.tokenValue = dic[@"token"]; saver.phoneNumber = phoneNum; saver.inviteCode = dic[@"myInviteCode"]; saver.userId = [dic[@"userId"] integerValue]; saver.nickname = dic[@"nickName"]; saver.headUrl = dic[@"himageUrl"]; saver.email = dic[@"email"]; saver.walletAddress = dic[@"walletAddress"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ // weakSelf.model.ipString = weakSelf.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)sendCodeToEmail:(NSString *)email completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; _model.paramterDic = @{@"email":email}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"sendEmail"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)sendSmsToPhone:(NSString *)phone completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; _model.paramterDic = @{@"mobile":phone}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"util/sms/send_code"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)sendSmsToEmail:(NSString *)email uuid:(NSString *)uuid captchaCode:(NSInteger) code completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; _model.paramterDic = @{@"email":email,@"uuid":uuid,@"code":[NSNumber numberWithInteger:code]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"sendEmail"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)sendCodeToPhone:(NSString *)phoneNum completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; _model.paramterDic = @{@"telephone":phoneNum}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"sendSms"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; // 老的做法 // // 本地生成一个 6位数字符串,发送给腾讯云,让其发短信给用户。比对用户输入的6位验证码和这个字符串是否相同 // // ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; // NSString *sdkAppID = @"1400157560";//来自腾讯云 // // // 6位随机数 // NSInteger num = [ZZWTool getRandomNumWithLength:6]; // NSString *random = [NSString stringWithFormat:@"%.6ld",num]; //// NSString *random = [NSString stringWithFormat:@"%ld",[ZZWTool getRandomNumWithLength:10]]; // // _model.ipString = _pc.txIP; // _model.cmd = [NSString stringWithFormat:@"%@sdkappid=%@&random=%@",_pc.txCmd,sdkAppID,random]; //// _model.ipString = [NSString stringWithFormat:@"https://yun.tim.qq.com/v5/tlssmssvr/sendsms?sdkappid=%@&random=%@",sdkAppID,random];//腾讯云 // // // 当前时间戳 // NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0]; // NSTimeInterval a = [dat timeIntervalSince1970]; //// NSTimeInterval b = a+ 11*60; // NSString*timeString = [NSString stringWithFormat:@"%0.f", a];//转为字符型 // // NSString *appName = [ZZW_APPInfo shareInstance].appName; // // // NSString *appKey = @"ff87981bb86f4f51468f4d30a065bbfc";// appkey 腾讯云上申请到的 // NSString *plainSig = [NSString stringWithFormat:@"appkey=%@&random=%@&time=%@&mobile=%@",appKey,random,timeString,phoneNum]; //// NSString *plainSig = [NSString stringWithFormat:@"appkey=%@&random=%@&time=%@&mobile=%@",@"5f03a35d00ee52a21327ab048186a2c4",@"7226249334",@"1457336869",@"13788888888"]; // NSString *sig = plainSig.SHA256; // // NSString *tpl_id = @"224458";//模板id // _model.paramterDic = @{@"params":@[random],@"sig":sig,@"sign":appName,@"tel":@{@"mobile":phoneNum,@"nationcode":@"86"},@"time":timeString,@"tpl_id":tpl_id}; //// _model.cmd = @""; // [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { // NSDictionary *resultDic = (NSDictionary *)responseObject; // NSInteger code = [resultDic[@"result"] integerValue]; // if (code == 0) { // completion(HuanYuBao_NetworkResultSuccess,@{@"code":[NSNumber numberWithInteger:num]}); // }else if (code == 1023){ // completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请两分钟后再发送验证码"}); // }else if (code == 1024){ // completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请一小时后再发送验证码"}); // }else if (code == 1025){ // completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请明天再尝试"}); // } // else{ // completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"网络波动,请重新发送验证码"}); // } // // }]; } -(void)checkCode:(NSString *)code forPhone:(NSString *)phoneNum completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; _model.paramterDic = @{@"telephone":phoneNum,@"code":code}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"checkCode"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getLoginDataCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/account"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getAddressListWithPage:(NSInteger)index completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"page":[NSNumber numberWithInteger:index]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/address/get_list"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)logoutCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = [NSDictionary dictionary]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"logout"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; // NSString *URL =[NSString stringWithFormat:@"%@/%@/",_model.ipString,_model.cmd]; // NSMutableDictionary *params = [NSMutableDictionary dictionary]; // // params[@"type"] = @"consultant"; // // [LCNetworking PostWithURL:URL Params:params success:^(NSDictionary *responseObject) { // NSHTTPCookieStorage* cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; // // NSArray<NSHTTPCookie *> *cookies = [cookieStorage cookiesForURL:[NSURL URLWithString:URL]]; // NSMutableArray<NSDictionary *> *propertiesList = [[NSMutableArray alloc] init]; // // [cookies enumerateObjectsUsingBlock:^(NSHTTPCookie * _Nonnull cookie, NSUInteger idx, BOOL * _Nonnull stop) { // NSMutableDictionary *properties = [[cookie properties] mutableCopy]; // //将cookie过期时间设置为一年后 // NSDate *expiresDate = [NSDate dateWithTimeIntervalSinceNow:3600*24*30*12]; // properties[NSHTTPCookieExpires] = expiresDate; // //下面一行是关键,删除Cookies的discard字段,应用退出,会话结束的时候继续保留Cookies // [properties removeObjectForKey:NSHTTPCookieDiscard]; // //重新设置改动后的Cookies // [cookieStorage setCookie:[NSHTTPCookie cookieWithProperties:properties]]; // // }]; // // NSLog(@"POST_success____%@", responseObject); // } failure:^(NSString *error) { // NSLog(@"POST_failure____%@", error); // }]; } -(void)fixPassword:(NSString *)password newPassword:(NSString *)npassword completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"password":password,@"password_new":npassword}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/change_password"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getMainDataCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"index"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getMarketCircleDataCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"marketing/get_category"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)operateMovie:(NSInteger)movieId type:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; if (type == 2) { _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"movieId":[NSString stringWithFormat:@"%ld",movieId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"doFavMovie"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; }else if (type == 1){ _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"movieId":[NSString stringWithFormat:@"%ld",movieId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"doLikeMovie"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } } -(void)resetPassword:(NSString *)password withPhone:(NSString *)phoneNum code:(NSString *)code completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"mobile":phoneNum,@"password":password,@"code":code}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/account/find_pwd"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getInviteImageListCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/qrcode"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getInviteImageDetailWithID:(NSInteger)inviteId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"id":[NSNumber numberWithInteger:inviteId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/qrcode/get_image"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getHuanYuBaoBalanceCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getInvestBalance"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultNotNetwork){ completion(HuanYuBao_NetworkResultNoNetwork,(NSDictionary *)responseObject); }else if (result == NetworkResultServerError){ completion(HuanYuBao_NetworkResultServerError,(NSDictionary *)responseObject); } else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getAllFilmInvestInfoCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"pageNum":@1}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.cmdV2,@"getMovies"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultNotNetwork){ completion(HuanYuBao_NetworkResultNoNetwork,(NSDictionary *)responseObject); }else if (result == NetworkResultServerError){ completion(HuanYuBao_NetworkResultServerError,(NSDictionary *)responseObject); } else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getMovieInfo:(NSString *)movieId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.cmdV2,@"getMovieDetail"]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"movieId":movieId}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getHuanYuBaoRateCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getHuanYuBaoRate"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { ZZWDataSaver *saver = [ZZWDataSaver shareManager]; saver.HuanYuBaoRate = [NSString stringWithFormat:@"%.2f",[dic[@"rate"] floatValue]]; NSLog(@"getHuanYuBaoRateCompletion %@",saver.HuanYuBaoRate); completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)investMovie:(NSInteger)movieId amount:(NSInteger)HuanYuBaoAmount completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"moveName":[self getMovieNameWithID:movieId],@"moveId":[NSNumber numberWithInteger:movieId],@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"amount":[NSNumber numberWithInteger:HuanYuBaoAmount]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"invest"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getInvestMovieRecordCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getInvestDetail"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getHuanYuBaoRecordListBalanceCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; // _model.paramterDic = @{@"username":phoneNum,@"password1":password,@"password2":password,@"email":@""}; _model.paramterDic = @{}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"HuanYuBaolist"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { NSDictionary *dic = (NSDictionary *)responseObject; if (result == NetworkResultSuccess) { completion(HuanYuBao_NetworkResultSuccess,dic); }else if (result == NetworkResultFailure){ NSString *reason = [dic objectForKey:@"username"]; if ([reason isEqualToString:@"A user with that username already exists."]) { reason = @"该账号已经存在"; }else if (reason == nil){ NSArray *arr = [dic objectForKey:@"password1"]; if (arr.count > 0) { reason = @"密码至少八位数字和字母结合"; } } dic = @{@"reason":reason}; completion(HuanYuBao_NetworkResultFailure,dic); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getDownloadUrlCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"deviceType":[NSNumber numberWithInt:1]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getVersionAddress"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)checkVersionCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"deviceType":[NSNumber numberWithInt:1],@"version":[NSString stringWithFormat:@"v%@",[ZZW_APPInfo shareInstance].appVersion]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"checkVersion"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)setHead:(NSString *)headPath completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"avatar":headPath}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/modify_avatar"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ self.model.ipString = self.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)uploadImage:(UIImage *)image completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"util/uploader/upload"]; // 将图片转为jpeg格式,无压缩 NSData *data = UIImageJPEGRepresentation(image, 0.1); [manager uploadData:data mineType:@"image/jpeg" model:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSArray *files = dic[@"files"]; NSDictionary *file = files.firstObject; ZZWDataSaver *saver = [ZZWDataSaver shareManager]; saver.headUrl = file[@"url"]; saver.headPath = file[@"filename"]; completion(HuanYuBao_NetworkResultSuccess,file); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)updateUserInfo:(NSString *)infoString type:(NSInteger )infoType completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"updateUserInfo"]; if (infoType == 1) {//修改昵称 _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"nickName":infoString}; }else if (infoType == 2){//修改邮箱 _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"email":infoString}; }else{ _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"nickName":infoString}; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"没有输入更改类型"}); } [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { ZZWDataSaver *saver = [ZZWDataSaver shareManager]; if (infoType == 1) { saver.nickname = infoString; } completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getNewsBannerCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaobanner,@"getAll"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSArray *arr = (NSArray *)responseObject[@"data"]; NSMutableDictionary *dic = [NSMutableDictionary dictionary]; for (NSInteger i = 0; i < arr.count; i++) { NSDictionary *dic1 = arr[i]; [dic setObject:dic1[@"bannerUrl"] forKey:[NSString stringWithFormat:@"bannerUrl%ld",i]]; } completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getBetInfoWithType:(NSInteger )type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"betType":[NSNumber numberWithInteger:type],@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"scence/getAllByBetType"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = responseObject[@"data"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultNotNetwork){ completion(HuanYuBao_NetworkResultNoNetwork,(NSDictionary *)responseObject); }else if (result == NetworkResultServerError){ completion(HuanYuBao_NetworkResultServerError,(NSDictionary *)responseObject); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)betMovie:(NSInteger)betId amount:(NSInteger)HuanYuBaoAmount type:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"scenceMovieId":[NSNumber numberWithInteger:betId],@"betWhich":[NSNumber numberWithInteger:type],@"amount":[NSNumber numberWithInteger:HuanYuBaoAmount],@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"bet"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,nil); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getBetMovieInfo:(NSInteger)scenceId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"scenceMovieId":[NSNumber numberWithInteger:scenceId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"scence/getByScenceMovieId"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = responseObject[@"data"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getBetRecordWithPage:(NSInteger)index completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"pageNum":[NSNumber numberWithInteger:index]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getMyBetRecord"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = @{@"data":responseObject[@"data"]} ; completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getGuidePageCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"bootPage/getPages"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = responseObject[@"data"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)uploadPersonInfo:(NSDictionary *)personInfo completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"cerId":personInfo[@"cerId"],@"name":personInfo[@"name"],@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"userAuth/add"]; NSArray *datas = @[personInfo[@"frontFaceFile"],personInfo[@"backFaceFile"]]; NSArray *mineTypes = @[@"image/jpeg",@"image/jpeg"]; NSArray *names = @[@"frontFaceFile",@"backFaceFile"]; [manager uploadDatas:datas mineTypes:mineTypes names:names model:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ self.model.ipString = self.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)updatePersonInfo:(NSDictionary *)personInfo completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"cerId":personInfo[@"cerId"],@"name":personInfo[@"name"],@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"id":personInfo[@"id"]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"userAuth/update"]; NSArray *datas = @[personInfo[@"frontFaceFile"],personInfo[@"backFaceFile"]]; NSArray *mineTypes = @[@"image/jpeg",@"image/jpeg"]; NSArray *names = @[@"frontFaceFile",@"backFaceFile"]; [manager uploadDatas:datas mineTypes:mineTypes names:names model:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ self.model.ipString = self.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)checkAuthStatusCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"userAuth/get"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = nil; if (!responseObject[@"data"]) { dic = @{@"status":@"3"}; }else{ dic = @{@"status":responseObject[@"data"][@"status"]}; } completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getMyDeviceWithPage:(NSInteger)index type:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"page":[NSNumber numberWithInteger:index], @"status":[NSNumber numberWithInteger:type-1] }; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user/device/get_list"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ self.model.ipString = self.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)checkTradeRecordWithTime:(NSString *)time page:(NSInteger)index type:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; if (type == 0) { _model.paramterDic = @{@"page":[NSNumber numberWithInteger:index] }; }else{ _model.paramterDic = @{@"page":[NSNumber numberWithInteger:index], @"status":[NSNumber numberWithInteger:type-1] }; } _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"order/online/get_list"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ self.model.ipString = self.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)trasferTYB:(NSInteger)count toAccount:(NSString *)account completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"amount":[NSNumber numberWithInteger:count],@"payee":account,@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"wallet/doTransactionOutApply"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ self.model.ipString = self.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)validateEmail:(NSString *)email withPassword:(NSString *)password volidateCode:(NSString *)volidateCode completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; password = [ZZWEncryption MD5ForLower32Bate:password]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"email":email,@"password":password,@"smsCode":volidateCode}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"updateEmail"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getUserInfoCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"user"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = responseObject[@"data"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)trasferRecordWithPage:(NSInteger)index completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"pageNum":[NSNumber numberWithInteger:index]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"wallet/getTransactionRecord"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSArray *arr = responseObject[@"data"]; completion(HuanYuBao_NetworkResultSuccess,@{@"items":arr}); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)setPayPasswrod:(NSString *)password completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; password = [ZZWEncryption MD5ForLower32Bate:password]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"payPassword":password}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"setPayPassword"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,nil); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)checkPayPassword:(NSString *)password completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; password = [ZZWEncryption MD5ForLower32Bate:password]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"payPassword":password}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"checkPayPassword"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,nil); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getBroadcastWithType:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"type":[NSNumber numberWithInteger:type]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"broadcast/getByType"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getSignDataCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getSignData"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getBigWheelDataCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"luckTurntable/getData"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)lottoryCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"luckTurntable/lottery"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)updatePrize:(NSInteger)prizeID word:(NSString *)word completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"priceId":[NSNumber numberWithInteger:prizeID],@"word":word}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"luckTurntable/draw"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getWheelPrizeRecordWithPage:(NSInteger)index type:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"pageNum":[NSNumber numberWithInteger:index],@"type":[NSNumber numberWithInteger:type]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"luckTurntable/getBingoRecord"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getGuessRankCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; // _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"pageNum":[NSNumber numberWithInteger:index],@"type":[NSNumber numberWithInteger:type]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getBetRanking"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getUserAuthInfoCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"userAuth/get"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)forgetPayPasswordWithNewPassword:(NSString *)newPassword phone:(NSString *)phoneNum volidateCode:(NSString *)volidateCode completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; newPassword = [ZZWEncryption MD5ForLower32Bate:newPassword]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"payPassword":newPassword,@"phoneNumber":phoneNum,@"smsCode":volidateCode}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"updatePayPassword"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)fixPayPassword:(NSString *)password newPayPassword:(NSString *)payPassword completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; password = [ZZWEncryption MD5ForLower32Bate:password]; payPassword = [ZZWEncryption MD5ForLower32Bate:payPassword]; _model.paramterDic = @{@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId],@"oldPayPassword":password,@"newPayPassword":payPassword}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.cmdV2,@"updatePayPassword"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getTransferFeeCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"wallet/getEsFee"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSNumber *num = responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,@{@"key":num}); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)trasferTYB:(NSInteger)count toAccount:(NSString *)account fee:(NSInteger)payFee completion:(void (^)(HuanYuBao_NetworkResult, NSDictionary * _Nonnull))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"amount":[NSNumber numberWithInteger:count],@"toAddress":account,@"userId":[NSNumber numberWithInteger:[ZZWDataSaver shareManager].userId]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"wallet/doTransactionOutApplyForEx"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ self.model.ipString = self.pc.HuanYuBaoIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getTransferRecordWithIndex:(NSInteger) index completion:(void (^)(HuanYuBao_NetworkResult, NSDictionary * _Nonnull))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"wallet/getTransactionRecord"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSNumber *num = responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,@{@"key":num}); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getCurrentDayGuessMoviesCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"scence/getDayOfTheDay"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSNumber *num = responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)findMovieWithId:(NSInteger) movieId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"scence/findAllByMovieId"]; _model.paramterDic = @{@"movieId":[NSNumber numberWithInteger:movieId]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getImageCodeWithId:(NSInteger) randomId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; // [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@",@"/backend/createImg"]; _model.paramterDic = @{@"uuid":[NSNumber numberWithInteger:randomId]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getYesterdayResultCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"scence/getYesterdaysLotteryResults"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getSystemTimeCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"redEnvelopes/getRedEnvelopes"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = responseObject[@"data"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultNotNetwork){ completion(HuanYuBao_NetworkResultNoNetwork,(NSDictionary *)responseObject); }else if (result == NetworkResultServerError){ completion(HuanYuBao_NetworkResultServerError,(NSDictionary *)responseObject); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getRedPackageCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"redEnvelopes/openRedEnvelopes"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = responseObject[@"data"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultNotNetwork){ completion(HuanYuBao_NetworkResultNoNetwork,(NSDictionary *)responseObject); }else if (result == NetworkResultServerError){ completion(HuanYuBao_NetworkResultServerError,(NSDictionary *)responseObject); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)redeeDiamondWithCount:(CGFloat)count completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.paramterDic = @{@"diamondAmount":[NSNumber numberWithFloat:count]}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"redeemDiamonds"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { NSDictionary *dic = responseObject[@"data"]; completion(HuanYuBao_NetworkResultSuccess,dic); }else if (code == 1010 || code == 1004 || code == 1005 || code == 1006){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultNotNetwork){ completion(HuanYuBao_NetworkResultNoNetwork,(NSDictionary *)responseObject); }else if (result == NetworkResultServerError){ completion(HuanYuBao_NetworkResultServerError,(NSDictionary *)responseObject); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)trasferFIIC:(NSInteger)count toAccount:(NSString *)account password:(NSString *)password completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; password = [ZZWEncryption MD5ForLower32Bate:password]; _model.paramterDic = @{@"amount":[NSNumber numberWithInteger:count],@"payee":account,@"payPassword":password}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"wallet/doTransactionOutApply"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ // self.model.ipString = self.pc.FIICIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)trasferFIIC:(NSInteger)count toAddress:(NSString *)address password:(NSString *)password completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; password = [ZZWEncryption MD5ForLower32Bate:password]; _model.paramterDic = @{@"amount":[NSNumber numberWithInteger:count],@"toAddress":address,@"payPassword":password}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"wallet/doTransactionOutApplyForEx"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ // self.model.ipString = self.pc.FIICIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)trasferThirdpartCoin:(NSInteger)count toAddress:(NSString *)address password:(NSString *)password completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; password = [ZZWEncryption MD5ForLower32Bate:password]; _model.paramterDic = @{@"amount":[NSNumber numberWithInteger:count],@"toAddress":address,@"payPassword":password}; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"wallet/doTransactionOutApplyForExHhtUsdt"]; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSDictionary *dic = (NSDictionary *)responseObject[@"data"]; NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,dic); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else if (result == NetworkResultTimeout || result == NetworkResultServerError){ // self.model.ipString = self.pc.FIICIP2; completion(HuanYuBao_NetworkResultFailure,@{@"reason":@"请重新尝试"}); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getMallCommodityList:(NSInteger)commodityType detaiType:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/getShopCommodityList"]; _model.paramterDic = @{@"commodityType":[NSNumber numberWithInteger:commodityType],@"shop_type":[NSNumber numberWithInteger:type]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)rechargePhone:(NSString *)phone type:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/rechargePhoneBill"]; _model.paramterDic = @{@"chargeAccount":phone,@"shopCommondityId":[NSNumber numberWithInteger:type]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getRechargeRecordWithType:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/getShopOrderListByType"]; _model.paramterDic = @{@"orderType":[NSNumber numberWithInteger:type]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getUserBalanceCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary *responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getUserBalance"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else if (code == 1010 || code == 1002){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getUserInviteInfoCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getInviteInfo"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else if (code == 1010 || code == 1002){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getGasCardListCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/getGasCardList"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else if (code == 1010 || code == 1002){ completion(HuanYuBao_NetworkResultLogout,@{@"reason":responseObject[@"message"]}); } else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)rechargeGasCard:(NSString *)cardId itemId:(NSString *)itmeId count:(NSInteger)count completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/rechargeGasCard"]; _model.paramterDic = @{@"gasCardNo":cardId,@"itemId":itmeId,@"rechargeAmount":[NSNumber numberWithInteger:count]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getLivingExpenseWithCityName:(NSString *)cityName projectId:(NSString*)projectId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/getWaterCoalList"]; _model.paramterDic = @{@"city":cityName,@"projectId":projectId}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)payLivingExpenseWithId:(NSString *)itemId count:(CGFloat)count account:(NSString *)account completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/rechargeWaterCoal"]; _model.paramterDic = @{@"itemId":itemId,@"itemNum":[NSNumber numberWithFloat:count],@"rechargeAccount":account}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getTrainListWithDate:(NSString *)date start:(NSString *)start end:(NSString *)end completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/getTrainList"]; _model.paramterDic = @{@"date":date,@"from":start,@"to":end}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getPassengerListCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/getShopPassenger"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)addPassengerInfoWithName:(NSString *)name cardId:(NSString *)cardId phone:(NSString *)phone completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/insertPassenger"]; _model.paramterDic = @{@"certificatesNumber":cardId,@"passengerName":name,@"telphone":phone,@"certificatesType":@"身份证"}; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getSystemMessageCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getUserMessageList"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)buyNodeWithType:(NSInteger)type count:(NSInteger)count completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ if (type == 2) { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"buyBigNode"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; }else if (type == 1){ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"buySmallNode"]; _model.paramterDic = @{@"number":[NSNumber numberWithInteger:count]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } } -(void)readSystemMessage:(NSString *)messageId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"setMessageRead"]; _model.paramterDic = @{@"id":messageId}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getNodeInvestRecordWithType:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ if (type == 1) { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getInvestContract"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; }else if (type == 2){ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getIncomeList"]; _model.paramterDic = @{@"type":@"0"}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } } -(void)getJoiningContractCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getSmallInvestContract"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getNodeIncomeCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getInvestIncome"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getContractMemberListCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getEffectiveUsers"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getNodeIncomeWithType:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getIncomeList"]; _model.paramterDic = @{@"type":[NSNumber numberWithInteger:type]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getCoinPriceInfoWithType:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getAllTickers"]; _model.paramterDic = @{@"type":[NSNumber numberWithInteger:type]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)exchangeWithType:(NSInteger)typeId amount:(NSInteger)amount completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"redeemDiamonds"]; _model.paramterDic = @{@"amount":[NSNumber numberWithInteger:amount],@"chargeType":[NSNumber numberWithInteger:typeId]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getHomePageAssetCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"requestMainMessage"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getNodeInfoByType:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.constant,@"constant/getByKey"]; if (type == 1) { _model.paramterDic = @{@"key":@"BUY_SMALL_NODE"}; }else{ _model.paramterDic = @{@"key":@"BUY_BIG_NODE"}; } [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getNodePriceCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getNodePrice"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)isShowAsset:(BOOL)isShow completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"hideAssets"]; _model.paramterDic = @{@"isHide":[NSNumber numberWithBool:isShow]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)addNewContractCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"joinContract"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getCandlesWithTime:(NSInteger)time name:(NSString *)name completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getCandles"]; _model.paramterDic = @{@"granularity":[NSNumber numberWithInteger:time],@"instrumentId":name}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)checkTicketOrderWithType:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/getTrainOrderList"]; _model.paramterDic = @{@"state":[NSNumber numberWithInteger:type]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)orderTicketWithInfo:(NSDictionary *)dic completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion;{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/createTrainTicket"]; _model.paramterDic = dic; [manager PostWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)payOrderWithId:(NSString *)orderId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/payTrainOrder"]; _model.paramterDic = @{@"orderId":orderId}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)refundTicketWithOrder:(NSString *)orderId sudId:(NSString *)subId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/refundTrainOrder"]; _model.paramterDic = @{@"orderId":orderId,@"orderNos":subId}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)checkScanContent:(NSString *)content completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"order/offline/scan"]; _model.paramterDic = @{@"keyword":content}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)payMoney:(NSString *)amount address:(NSString *)address payPassword:(NSString *)password completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; password = [ZZWEncryption MD5ForLower32Bate:password]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transferToWechat"]; _model.paramterDic = @{@"cnyAmount":amount,@"scanStr":address,@"payPassword":password}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)payMoney:(NSString *)amount address:(NSString *)address completion:(void (^)(HuanYuBao_NetworkResult, NSDictionary * _Nonnull))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transferToWechatNoPassword"]; _model.paramterDic = @{@"cnyAmount":amount,@"scanStr":address}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getBigNodeInfoCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getBigNodeInfo"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getChatRoomCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getRooms"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getChatRoomUser:(NSString *)roomName completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getRoomUserList"]; _model.paramterDic = @{@"userId":roomName}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)downloadImage:(NSString *)imageUrl toPath:(NSString *)path name:(NSString *)name completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; // _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getRoomUserList"]; // 目录设置在 沙盒的 document下,子目录是 path _model.paramterDic = @{@"downloadUrl":imageUrl,@"downloadPath":path,@"fileName":name}; [manager downloadWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { completion(HuanYuBao_NetworkResultSuccess,nil); }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getMyTransactionListWithState:(NSInteger)state page:(NSInteger )page coinType:(NSString *)coinType completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transMarket/getMyOrderList"]; _model.paramterDic = @{@"pageNum":[NSNumber numberWithInteger:page],@"state":[NSNumber numberWithInteger:state],@"instrumentId":coinType}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getAllTransactionListWithType:(NSInteger)type page:(NSInteger)page coinType:(NSString *)coinType completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transMarket/getShowOrderList"]; _model.paramterDic = @{@"pageNum":[NSNumber numberWithInteger:page],@"orderType":[NSNumber numberWithInteger:type],@"instrumentId":coinType}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)cancelTransactionWithID:(NSString *)orderId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transMarket/cancelOrder"]; _model.paramterDic = @{@"orderId":orderId}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getCompleteTransactionOrderWithType:(NSInteger)type orderId:(NSString *)orderId completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transMarket/dealOrder"]; _model.paramterDic = @{@"orderId":orderId,@"dealType":[NSNumber numberWithInteger:type]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)createOrderWithInfo:(NSDictionary *)dic completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; NSInteger amount = [dic[@"amount"] integerValue]; NSString *instrumentId = dic[@"instrumentId"]; NSInteger orderType = [dic[@"orderType"] integerValue]; CGFloat unitPrice = [dic[@"unitPrice"] floatValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transMarket/createOrder"]; _model.paramterDic = @{@"amount":[NSNumber numberWithInteger:amount], @"instrumentId":instrumentId, @"orderType":[NSNumber numberWithInteger:orderType], @"unitPrice":[NSNumber numberWithFloat:unitPrice] }; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)dealOrder:(NSString *)orderId type:(NSInteger)type completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transMarket/dealOrder"]; _model.paramterDic = @{@"orderId":orderId, @"dealType":[NSNumber numberWithInteger:type] }; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getTransactionCoinListCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"getTransactionCoinList"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getPurchaseInfoCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transMarket/getApplyInfo"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)purchaseCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"transMarket/applyPurchasing"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getTeamIncomeCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"investment/getMyTeamIncome"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getAllProductCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"investment/getAllProducts"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)investPorject:(NSInteger)projectID amount:(NSInteger)amount completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"investment/participationInvestment"]; _model.paramterDic = @{@"productId":[NSNumber numberWithInteger:projectID], @"amount":[NSNumber numberWithInteger:amount] }; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)uploadHashCode:(NSString *)code completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"applyHash"]; _model.paramterDic = @{@"transactionHash":code}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getMyInvestInfoCompletion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"investment/getMyInvestmentInfo"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(void)getMyInvestmentRecordWithState:(NSInteger)state completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion{ ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"investment/getInvestmentRecord"]; _model.paramterDic = @{@"state":[NSNumber numberWithInteger:state]}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } -(NSString *)getErrorContentWithCode:(NSInteger)code{ /* TOKEN_MISSED_HEADER (1002,"Missed Token In Header"), TOKEN_NOT_EXIST (1010,"TOKEN NOT EXIST"), USER_NOT_EXIST (1001,"User Not Exist"), TOKEN_NOT_MATCH (1004,"INVALID TOKEN"), TOKEN_INVALID (1005,"TOKEN INVALID TIME_OUT"), USER_AGENT_NOT_MATCH (1006,"USER AGENT NOT MATCH"), 用户已存在 1007 */ NSString *content = nil; if (code == 401) { content = @"用户已经存在"; }else if (code == 500){ content = @"服务器错误"; } else if (code == 1000){// 密码不对 content = @"手机号或密码错误"; }else if (code == 1001){// 账号不存在,需要注册 content = @"该手机号尚未注册"; }else if (code == 1002){// 请求头缺少token content = @"登录过期,请重新登录"; }else if (code == 1003){// 手机号格式不对 content = @""; }else if (code == 1004){// token 无效 content = @"登录过期,请重新登录"; }else if (code == 1005){// token 超时 content = @"登录过期,请重新登录"; }else if (code == 1006){// 账号被登出 content = @"登录过期,请重新登录"; }else if (code == 1007){// 手机号已经注册 content = @"手机号已经注册,请直接登录"; }else if (code == 1008){// 旧密码不正确 content = @"旧密码错误"; }else if (code == 1009){// 两次输入的新密码不同 content = @""; }else if (code == 1010){// token不存在 content = @"账号在其他设备登录,请重新登录"; }else if (code == 1011){// 邀请码无效 content = @"邀请码错误"; }else if (code == 1013){// 验证码无效 content = @"验证码无效"; }else if (code == 1014){// 验证码过期 content = @"验证码过期"; }else if (code == 1016){// 验证码请求次数太多 content = @"验证码请求次数太多,请明天再尝试"; }else if (code == 1017){// 图形验证码错误 content = @"图形验证码错误"; }else if (code == 1020){// 支付密码未设置 content = @"密码未设置"; }else if (code == 1021){// 支付密码错误 content = @"密码错误"; }else if (code == 1023){// 设备已经注册过了 content = @"该设备已经注册过了,请登录"; }else if (code == 1032){// 新旧邮箱相同 content = @"新旧邮箱相同"; }else if (code == 1033){// 邮箱被其账号使用 content = @"邮箱被其账号使用"; }else if (code == 1036){// 没有绑定邮箱 content = @"没有绑定邮箱"; }else if (code == 00){// 节点不存在 content = @"节点不存在"; }else if (code == 01){// 余额不足 content = @"抱歉你的TYB余额不足,需要充值"; }else if (code == 2010){// 已经购买过节点 content = @"已经购买过节点"; }else if (code == 2011){// 已经加入合约 content = @"已经加入合约"; }else if (code == 2020){// 用户HHT_USDT不够 content = @"请先充值"; }else if (code == 2021){// 用户HHT不够 content = @"HHT数量不足"; }else if (code == 2026){// 没有申购 content = @"没有申购"; }else if (code == 2027){// 已经参加最新申购 content = @"已经参加最新申购"; }else if (code == 2028){// 没有申购资格 content = @"没有申购资格"; }else if (code == 2029){// USDT余额不足 content = @"USDT余额不足"; }else if (code == 5008){// content = @"没有可竞猜的电影"; }else if (code == 6000){//地址错误 content = @"地址错误"; }else if (code == 6005){// 邮箱被其账号使用 content = @"对方账户错误"; }else if (code == 6010){// 余额不足 content = @"余额不足"; }else if (code == 6011){// RMB数量不够 content = @"余额不够"; }else if (code == 6012){// 兑换RMB小于1 content = @"兑换RMB小于1"; }else if (code == 6005){// 邮箱被其账号使用 content = @"对方账户错误"; }else if (code == 7001){// 同一个ip最多10次数次 content = @"请更换网络尝试"; }else if (code == 7002){// 账号封禁 content = @"账号异常,请联系客服"; }else if (code == 7003){// 计算错误 content = @"计算错误"; }else if (code == 7009){// 没有商品 content = @"没有商品"; }else if (code == 7010){// 生成订单失败 content = @"下单失败"; }else if (code == 7011){// 生成订单失败 content = @"下单失败"; }else if (code == 7013){// 生成订单失败 content = @"下单失败"; }else if (code == 7014){// 没有红包可抢 content = @"还没到时间"; }else if (code == 7015){// 已经抢过了 content = @"抢过了啦,等下一个吧!"; }else if (code == 7016){// 抢红包失败 content = @"没抢到"; }else if (code == 7017){// 红包抢完了 content = @"红包抢完了,早点来"; }else if (code == 7018){// 不在服务时间 content = @"不在服务时间"; }else if (code == 7020){// 请通知客服 content = @"请通知客服"; }else if (code == 7024){// 身份证号错误 content = @"身份证号错误"; } else{ content = @"服务器遇到小麻烦"; } return content; } -(NSString *)getMovieNameWithID:(NSInteger)movieId{ NSArray * movies = @[@"人间-喜剧",@"孤战",@"唐人街探案3",@"灌篮高手的契约",@"紧急救援",@"没头脑和不高兴的奇妙之旅",@"猎魔行动",@"债囧之愤怒的小强",@"战狼3",@"索马里行动",@"一出好戏",@"李茶的姑妈",@"疯狂的外星人"]; return movies[movieId -1]; } - (void)getMyShop:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } - (void)getMyShopDetailWithID:(NSString *)ID completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"shop/get_detail"]; _model.paramterDic = @{@"id": ID}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } - (void)getPosList:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"order/offline/get_select_device"]; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } - (void)getPosDetailWithID:(NSString *)ID completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"device/detail"]; _model.paramterDic = @{@"id": ID}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } - (void)createOrderWithDeviceID:(NSString *)ID num:(NSString *)num isCredit:(NSString *)isCredit payType:(NSString *)payType addressID:(NSString *)addressID completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"order/online/create/submit"]; _model.paramterDic = @{@"device_id": ID, @"num": num, @"is_credit": isCredit, @"pay_type": payType, @"address_id": addressID}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } - (void)gainOrderParamWithOrderID:(NSString *)OrderID payType:(NSString *)payType completion:(void (^)(HuanYuBao_NetworkResult result, NSDictionary * responseDic))completion { ZZWNetworkManager *manager = [ZZWNetworkManager shareManager]; [manager setHead:@"Authorization" withValue:[ZZWDataSaver shareManager].tokenValue]; _model.cmd = [NSString stringWithFormat:@"%@%@",self.pc.HuanYuBaoCmd,@"order/online/pay/submit"]; _model.paramterDic = @{@"order_id": OrderID, @"pay_type": payType}; [manager getWithParametersModel:_model completion:^(NetworkResult result, id _Nullable responseObject) { if (result == NetworkResultSuccess) { NSInteger code = [responseObject[@"error"] integerValue]; if (code == 0) { completion(HuanYuBao_NetworkResultSuccess,responseObject[@"data"]); }else{ completion(HuanYuBao_NetworkResultFailure,@{@"reason":responseObject[@"message"]}); } }else{ completion(HuanYuBao_NetworkResultFailure,(NSDictionary *)responseObject); } }]; } @end