17b3dc212847f9a30616c03f28502854865daf68.svn-base 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package eVVM.apk.ui.My.examine;
  2. import com.allen.library.RxHttpUtils;
  3. import com.allen.library.interceptor.Transformer;
  4. import com.allen.library.observer.CommonObserver;
  5. import java.util.HashMap;
  6. import java.util.Map;
  7. import eVVM.apk.api.ApiService;
  8. import eVVM.apk.mvp.MvpModel;
  9. import eVVM.apk.ui.bean.VerificationCodeBean;
  10. /**
  11. * Created by Android Studio.
  12. * User: zbb
  13. * Date: 2019/6/7
  14. * Describe: ExamineModel
  15. */
  16. public class ExamineModel extends MvpModel<ExamineOnListener> {
  17. public ExamineModel() {
  18. }
  19. public void agreeProtocol(String userId) {
  20. Map<String,String> map = new HashMap<>();
  21. map.put("userId",userId);
  22. RxHttpUtils.createApi(ApiService.class)
  23. .agreeProtocol(map)
  24. .compose(Transformer.<VerificationCodeBean>switchSchedulers())
  25. .subscribe(new CommonObserver<VerificationCodeBean>() {
  26. @Override
  27. protected void onError(String errorMsg) {
  28. getListener().onFail(errorMsg);
  29. }
  30. @Override
  31. protected void onSuccess(VerificationCodeBean verificationCodeBean) {
  32. if (verificationCodeBean.getCode() == 200){
  33. getListener().onSucceed(verificationCodeBean);
  34. }else {
  35. getListener().onFail(verificationCodeBean.getMsg());
  36. }
  37. }
  38. });
  39. }
  40. }