//
//  TWViewController.m
//  TWOCNetwork
//
//  Created by 尤行强 on 07/20/2022.
//  Copyright (c) 2022 尤行强. All rights reserved.
//

#import "TWViewController.h"

@interface TWViewController ()

@end

@implementation TWViewController{
    TWOCNetwork *curNet;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self configNetWork];
}

-(void)configNetWork{
    [[TWOCNetwork shareNetManager] setLangueTag:@"z"];
    [[TWOCNetwork shareNetManager] setBaseURL:@"http://fwloginintf.5mall.com/m/"];
    [TWOCNetwork shareNetManager].baseParameters = @{@"usertype":@1,@"countrycode":@"US"};
}

-(IBAction)begin:(UIButton *)sender {
    NSMutableDictionary * loginParam = [NSMutableDictionary dictionaryWithCapacity:10];
    [loginParam setValue:@"18681406820" forKey:@"username"];
    [loginParam setValue:@"1234567" forKey:@"password"];
    curNet = [[TWOCNetwork alloc] initUrl:@"login/engineerlogin.jhtml" andParam:loginParam];
    [curNet setSuccessCall:^(NSDictionary * _Nonnull result) {
        NSLog(@"%@",result);
    }];
    
    [curNet setFailCall:^(int, NSString * _Nonnull errorStr) {
        NSLog(@"%@",errorStr);
    }];
    [curNet postRequest];
}

@end
