package eVVM.apk.ui.My.examine; import com.allen.library.RxHttpUtils; import com.allen.library.interceptor.Transformer; import java.util.HashMap; import java.util.Map; import eVVM.apk.api.ApiService; import eVVM.apk.common.MyDataObsever; import eVVM.apk.mvp.MvpModel; import eVVM.apk.ui.bean.VerificationCodeBean; /** * Created by Android Studio. * User: zbb * Date: 2019/6/7 * Describe: ExamineModel */ public class ExamineModel extends MvpModel { public ExamineModel() { } public void agreeProtocol(String userId) { Map map = new HashMap<>(); map.put("userId", userId); RxHttpUtils.createApi(ApiService.class) .agreeProtocol(map) .compose(Transformer.switchSchedulers()) .subscribe(new MyDataObsever() { @Override protected void onError(String errorMsg) { getListener().onFail(errorMsg); } @Override protected void onSuccess(VerificationCodeBean verificationCodeBean) { if (verificationCodeBean.getCode() == 200) { getListener().onSucceed(verificationCodeBean); } else { getListener().onFail(verificationCodeBean.getMsg()); } } }); } public void failureReasons(String userId) { Map map = new HashMap<>(); map.put("userId", userId); RxHttpUtils.createApi(ApiService.class) .failureReasons(map) .compose(Transformer.switchSchedulers()) .subscribe(new MyDataObsever() { @Override protected void onError(String errorMsg) { getListener().onFail(errorMsg); } @Override protected void onSuccess(VerificationCodeBean verificationCodeBean) { if (verificationCodeBean.getCode() == 200) { getListener().onfailmsgSucceed(verificationCodeBean); } else { getListener().onfailmsgFail(verificationCodeBean.getMsg()); } } @Override protected boolean isHideToast() { return true; } }); } }