| | |
| | | hud?.hide(animated: true) |
| | | if response.error != nil { |
| | | LogError("\(response.error!)") |
| | | // alert(msg: "请求失败") |
| | | alert(msg: response.error!.localizedDescription) |
| | | ob.onError(response.error!) |
| | | }else if let data = response.data,let jsonString = String(data: data, encoding: String.Encoding.utf8){ |
| | | if let next = BaseResponse<T>.deserialize(from: jsonString){ |
| | | LogInfo("返回数据:\(next.data?.toJSON() ?? [:])") |
| | | LogInfo("返回数据:\(next.toJSON())") |
| | | if next.code == 200{ |
| | | ob.onNext(next) |
| | | }else if next.code == 700{ |
| | |
| | | ob.onError(NetRequestError.Other) |
| | | } |
| | | }else{ |
| | | // alert(msg: "请求失败") |
| | | alert(msg: "数据解析失败") |
| | | ob.onError(NetRequestError.Other) |
| | | } |
| | | }else{ |
| | | // alert(msg: "请求失败") |
| | | alert(msg: "解析失败") |
| | | ob.onError(NetRequestError.Other) |
| | | } |
| | | ob.onCompleted() |