|  |  | 
 |  |  | package com.dayu.qiheonlinelibrary.net; | 
 |  |  |  | 
 |  |  | import android.content.Context; | 
 |  |  | import android.content.Intent; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import com.dayu.baselibrary.business.BusinessProvider; | 
 |  |  | import com.dayu.qiheonlinelibrary.net.subscribers.BaseProgressSubscriber; | 
 |  |  | import com.dayu.qiheonlinelibrary.net.subscribers.ProgressSubscriber; | 
 |  |  | import com.dayu.qiheonlinelibrary.net.subscribers.SubscriberListener; | 
 |  |  | 
 |  |  |                 observable = apiService.requestGet(path, params); | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  |             observable = apiService.requestPost(path, params); | 
 |  |  |             if (params != null) { | 
 |  |  |                 observable = apiService.requestPost(path, params); | 
 |  |  |             } else { | 
 |  |  |                 observable = apiService.requestPost(path); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         mySubscriber = new ProgressSubscriber(context, hideLoading, listener); | 
 |  |  | 
 |  |  |                         if (o instanceof BaseResponse) { | 
 |  |  |                             BaseResponse tem = (BaseResponse) o; | 
 |  |  |                             BaseResponse<T> response = new BaseResponse<>(); | 
 |  |  |                             //未登录或登录超时,请重新登录 | 
 |  |  |                             if (tem.getCode()==100401){ | 
 |  |  |                                 if (BusinessProvider.getBusinessProvider()!=null){ | 
 |  |  |                                     BusinessProvider.getBusinessProvider().startLoginNavigotor.navigateToLogin(context); | 
 |  |  |                                 } | 
 |  |  |  | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             response.setCode(tem.getCode()); | 
 |  |  |                             response.setMsg(tem.getMsg()); | 
 |  |  |  | 
 |  |  |                             if (tClass != null && tem.getData() instanceof Map) { | 
 |  |  |                             if (tClass!= null) { | 
 |  |  |                             if ( tem.getData() instanceof Map) { | 
 |  |  |                                 try { | 
 |  |  | //                                    response.setData(MyJsonParser.getBeanFromMap((Map<String, Object>) tem.getData(), tClass)); | 
 |  |  |                                     String jsonData = MyJsonParser.getJsontoMap((Map) tem.getData()); | 
 |  |  | 
 |  |  |                                 } catch (Exception e) { | 
 |  |  |                                     e.printStackTrace(); | 
 |  |  |                                 } | 
 |  |  |                             } else if (tClass != null && tem.getData() instanceof List) { | 
 |  |  |                             } else if (  tem.getData() instanceof List) { | 
 |  |  |                                 try { | 
 |  |  |                                     response.setData((T) MyJsonParser.getListByJson(MyJsonParser.getJsonbyList((List) tem.getData()), tClass)); | 
 |  |  |                                 } catch (Exception e) { | 
 |  |  |                                     e.printStackTrace(); | 
 |  |  |                                 } | 
 |  |  |                             } else if (tClass != null && tem.getData() instanceof Integer) { | 
 |  |  |                             } else if (  tem.getData() instanceof Integer) { | 
 |  |  |                                 response.setData((T) tem.getData()); | 
 |  |  |                             }  else if (tem.getData() instanceof Boolean){ | 
 |  |  |                                 response.setData((T) tem.getData()); | 
 |  |  |                             } | 
 |  |  |                             if (tClass != null && tClass.getName() instanceof String && tem.getData() instanceof String) { | 
 |  |  |                             if ( tClass.getName() instanceof String && tem.getData() instanceof String) { | 
 |  |  |                                 try { | 
 |  |  |                                     response.setData((T) tem.getData()); | 
 |  |  |                                 } catch (Exception e) { | 
 |  |  | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                             return response; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                         } | 
 |  |  |                         }} | 
 |  |  |  | 
 |  |  |                         return null; | 
 |  |  |                     } | 
 |  |  | 
 |  |  |                 .subscribe(mySubscriber); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |