//
//  UpcomingDetailsVC+http.swift
//  MobilePortal
//
//  Created by caiyang on 2020/4/23.
//  Copyright © 2020 yin chen. All rights reserved.
//

import UIKit

extension UpcomingDetailsVC {
    func getDetailsHttpGetCmd(){
        let cmd:HttpCommand = DetailsHttpGetCmd.init(version: PHttpVersion_v1)
        let block:httpBlock = {[weak self] (result:RequestResult!,useInfo:Any!)->() in
            if result != nil {
                self?.httpDetailsHttpGetResultResponse(result: result)
            }else{
                print("空的")
            }
        }
        let dic:NSMutableDictionary = NSMutableDictionary()
        dic[kHttpDetailsHttpGetCmd_id] = "741A6E09DD614AC8E055000000000001"
        cmd.requestInfo = dic as [NSObject:AnyObject]
        let completeDelegate = SMBaseHttpComplete.init(block: block , withUserInfo: nil)
        cmd.completeDelegate=completeDelegate
        print("url==%@",cmd.getUrl())
        cmd.execute()
    }
    func httpDetailsHttpGetResultResponse(result:RequestResult){
        let r:DetailsHttpGetResult = result as! DetailsHttpGetResult
        if r.isOk() {
            let array:NSMutableArray = r.getDetailsHttpGetResult()
            self.httpModel = array[0] as! DetailsHttpModel
        }else{
            SMToastView.showMessage("请查看当前网络状态！")
        }
        group.leave()
    }
}
