我是Swift的新手,我正在尝试将我的帖子结果发送给另一个班级 这是我的帖子功能:
static func SetOrder(Json json : String ,
callback:@escaping (_ state:Int ,_ order : [Order])->Void){
let uri = ORDER + Auth(index: 1)
NetworkConnection.postData(Url: uri, Json: json) { (respone, state) in
if state == 1 {
callback( 1, [respone as! Order])
} else {
callback(0 , [respone as! Order] )
} } }
这是我想要使用我的结果的类:
Order.SetOrder(Json: orderJson as! String, callback: { (state , json) in
if state == 1 {
if self.order.payment_method == "something" {
print("this is order")
print(json)
//===== if cashier on Net ====================
var URlToPayment = getCheckoutUrl(OrderNumber: json.id
,OrderKey: json.order_key)
GO TO PEYMEnt
let url:NSURL? = NSURL(string:"\(URlToPayment)")
UIApplication.shared.openURL(url! as URL)
}
}
})