|
@@ -1,9 +1,11 @@
|
|
|
package com.cooleshow.usercenter.presenter;
|
|
|
|
|
|
+import com.cooleshow.base.common.BaseApplication;
|
|
|
import com.cooleshow.base.constanst.Constants;
|
|
|
import com.cooleshow.base.presenter.BasePresenter;
|
|
|
import com.cooleshow.base.rx.BaseObserver;
|
|
|
import com.cooleshow.usercenter.bean.UserLoginInfo;
|
|
|
+import com.cooleshow.usercenter.constants.UserConstants;
|
|
|
import com.cooleshow.usercenter.data.api.UserApi;
|
|
|
import com.cooleshow.usercenter.presenter.contract.VerifyLoginContract;
|
|
|
|
|
@@ -21,7 +23,45 @@ public class VerifyLoginPresenter extends BasePresenter<VerifyLoginContract.Veri
|
|
|
if (getView() != null) {
|
|
|
getView().showLoading();
|
|
|
}
|
|
|
- addSubscribe(create(UserApi.class).sendSmsCode(mobile), new BaseObserver<Object>(getView()) {
|
|
|
+ if (BaseApplication.Companion.isTeacherClient()) {
|
|
|
+ sendVerifyCodeForTeacher(mobile);
|
|
|
+ } else {
|
|
|
+ sendVerifyCodeForStu(mobile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 学生端发送验证码
|
|
|
+ *
|
|
|
+ * @param mobile
|
|
|
+ */
|
|
|
+ private void sendVerifyCodeForStu(String mobile) {
|
|
|
+ addSubscribe(create(UserApi.class).sendSmsCode(mobile, UserConstants.SEND_VERIFY_CODE_TYPE_LOGIN), new BaseObserver<Object>(getView()) {
|
|
|
+ @Override
|
|
|
+ protected void onSuccess(Object data) {
|
|
|
+ if (getView() != null) {
|
|
|
+ getView().sendVerifyCodeSuccess();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(Throwable e) {
|
|
|
+ super.onError(e);
|
|
|
+ if (getView() != null) {
|
|
|
+ getView().sendVerifyCodeFail();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 老师端发送验证码
|
|
|
+ *
|
|
|
+ * @param mobile
|
|
|
+ */
|
|
|
+ private void sendVerifyCodeForTeacher(String mobile) {
|
|
|
+ addSubscribe(create(UserApi.class).sendSmsCode(mobile, UserConstants.SEND_VERIFY_CODE_TYPE_LOGIN), new BaseObserver<Object>(getView()) {
|
|
|
@Override
|
|
|
protected void onSuccess(Object data) {
|
|
|
if (getView() != null) {
|