//
//  SmallRobotViewModel.swift
//  MobilePortal
//
//  Created by caiyang on 2020/4/2.
//  Copyright © 2020 yin chen. All rights reserved.
//

import UIKit
import SwiftyJSON
import HandyJSON

class SmallRobotViewModel: NSObject {
    var httpListData = BDSmallRobotTokenModel()
    var dataSource = NSMutableArray()
    var page = 1
    var endBlock:selectBlock!
}

extension SmallRobotViewModel {
    func refreshDataSource() {
        SmallRobotProvider.request(SmallRobotAPI.smallRobotToken(value: "", pageNum: self.page)) { (result) in
            print(JSON(result))
            if case let .success(response) = result {
                // 解析数据
                let data = try? response.mapJSON()
                let json = JSON(data!)
                print(json)
//                if let advisoryList = JSONDeserializer<BDSmallRobotTokenModel>.deserializeFrom(json: json.description) {
//                    self.httpListData = advisoryList
////                    print(self.httpListData.access_token!)
//                }
                
            }
        }
    }
}
