一个完整的串:
https://api.yunxuekeji.cn/yunxue_app_api/course/getCourseByTypeAndMore?orderOn=&classtype=031001004&forPeopleType=&format=&price=&pageIndex=1&pageSize=10&classTag=
一、在ApiService中
public interface ApiSerivce {
@FormUrlEncoded
@POST("course/getCourseByTypeAndMore")
rx.Observable<Bean1> login1Pre(@FieldMap Map<String,String> map);
}
二、在LoginModel里
Retrofit retrofit = new Retrofit.Builder().baseUrl(url)
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build();
// https://api.yunxuekeji.cn/yunxue_app_api/course/getCourseByTypeAndMore?
// orderOn=
// &classtype=031001004
// &forPeopleType=
// &format=
// &price=
// &pageIndex=1
// &pageSize=10
// &classTag=
HashMap<String, String> objectObjectMap = new HashMap<>();
objectObjectMap.put("orderOn","");
objectObjectMap.put("classtype","031001004");
objectObjectMap.put("forPeopleType","");
objectObjectMap.put("format","");
objectObjectMap.put("price","");
objectObjectMap.put("pageIndex","1");
objectObjectMap.put("pageSize","10");
objectObjectMap.put("classTag","");
retrofit.create(ApiSerivce.class)
.login1Pre(objectObjectMap)
.subscribeOn(Schedulers.io())
.retry()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Bean1>() {
@Override
public void call(Bean1 bean1) {
callBacks.loginSucc(bean1);
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
String message = throwable.getMessage();
Log.e("-==========",message.toString());
}
});
根据整体串慢慢研究其原理......