getQiNiuToken


#pragma mark --获取七牛 token           deng - 很好
+(void)getQiNiuToken{
    if (![FSGlobalMethodClass judgeDicIsHaveData: [YMJMainModel sharedObject].userinfo.userId]) {
        return;
    }
    NSDictionary *parameters=[NSDictionary dictionaryWithObjectsAndKeys:@"0",@"type",nil];

    [self getDataWithParameters:parameters requestType:FSNetworkingRequestTypeGet andWithURL: getHomeBaseUrl userInfo:nil success: ^(NSURLSessionDataTask *task,NSDictionary *responseObject,NSDictionary *userInfo) {
        // 请求成功,解析数据
        if ([FSGlobalMethodClass judgeDicIsHaveData: [responseObject objectForKey:@"uploadTokenNa"]]) {
#pragma mark - upload Token     或者 uploadTokenNa
            [YMJMainModel sharedObject].uploadToken = [NSString stringWithFormat:@"%@",[responseObject objectForKey:@"uploadTokenNa"]];
        }
 
        
        
        [self getIPAddressesDengWithURL: abroadIPAddressesDengWithURL  completion:^(id result) {
            
            if ( [result[@"country"] isEqual: @"中国" ]) {
                
                if ([FSGlobalMethodClass judgeDicIsHaveData: [responseObject objectForKey:@"uploadToken"]]) {

                    [YMJMainModel sharedObject].uploadToken = [NSString stringWithFormat:@"%@",[responseObject objectForKey:@"uploadToken"]];
                }

            }

        }];
        
        
        
        
        
    } exception:^(NSDictionary *responseObject,NSDictionary *userInfo) {
        NSLog(@"网络异常%@",responseObject);
    }failure:^(NSError *error,NSDictionary *userInfo) {
        NSLog(@"fa userinfo:%@",error);
    }];

}

你可能感兴趣的:(getQiNiuToken)