public class Refiut {
public static Refiut refiut;
public Retrofit retrofit;
private Refiut() {
retrofit = new Retrofit.Builder()
.baseUrl("http://172.17.8.100/small/")
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(
new OkHttpClient.Builder()
.writeTimeout(5000, TimeUnit.MILLISECONDS)
.readTimeout(5000,TimeUnit.MILLISECONDS)
.connectTimeout(5000,TimeUnit.MILLISECONDS)
.build()
)
.build();
}
public static synchronized Refiut getInstance(){
if (refiut==null){
refiut= new Refiut();
}
return refiut;
}
public Retrofit getRetrofit() {
return retrofit;
}
}
public interface Apisever {
@GET("commodity/v1/findCategory")
Observable<LeftResultBean> show();
//记住
@GET("commodity/v1/findCommodityByCategory")
Observable<RightResultBean> RightShow(@QueryMap Map<String,String> map);
@GET("order/verify/v1/findShoppingCart")
@Headers({"userId:10582","sessionId:157449986137310582"})
Observable<GouWuResult> getGouWu();
}