Commit 3dfd0c2c by han xu

身份验证增加更新功能

parent a5528917
...@@ -10,6 +10,7 @@ import com.dayu.base.api.BaseApiFactory; ...@@ -10,6 +10,7 @@ import com.dayu.base.api.BaseApiFactory;
import com.dayu.base.ui.activity.BaseActivity; import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.base.ui.presenter.SImplePresenter; import com.dayu.base.ui.presenter.SImplePresenter;
import com.dayu.common.Constants; import com.dayu.common.Constants;
import com.dayu.event.UserInfo;
import com.dayu.provider.event.CertificationEvent; import com.dayu.provider.event.CertificationEvent;
import com.dayu.provider.event.RefreshEvent; import com.dayu.provider.event.RefreshEvent;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
...@@ -175,25 +176,33 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A ...@@ -175,25 +176,33 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A
} }
showDialog(); showDialog();
if (TextUtils.isEmpty(identityUrl)) { if (!TextUtils.isEmpty(identityUrl) && !TextUtils.isEmpty(identityBackUrl)){
uploadImageCount++; uploadImageCount = 0;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityPath), Constants.PHOTO + "/privacy/idcard", "yyMM") save();
.subscribe(mPresenter.baseObserver(data -> {
identityUrl = data.get(0); }else {
uploadImageCount--; if (TextUtils.isEmpty(identityUrl)) {
save(); uploadImageCount++;
})); BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
} .subscribe(mPresenter.baseObserver(data -> {
identityUrl = data.get(0);
uploadImageCount--;
save();
}));
}
if (TextUtils.isEmpty(identityBackUrl)) { if (TextUtils.isEmpty(identityBackUrl)) {
uploadImageCount++; uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityBackPath), Constants.PHOTO + "/privacy/idcard", "yyMM") BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityBackPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
.subscribe(mPresenter.baseObserver(data -> { .subscribe(mPresenter.baseObserver(data -> {
identityBackUrl = data.get(0); identityBackUrl = data.get(0);
uploadImageCount--; uploadImageCount--;
save(); save();
})); }));
}
} }
} }
private void save() { private void save() {
...@@ -204,11 +213,22 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A ...@@ -204,11 +213,22 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A
ServiceSaveBean1.AccountIdCardExt accountExt = new ServiceSaveBean1.AccountIdCardExt( mUserId, identityUrl, identityBackUrl); ServiceSaveBean1.AccountIdCardExt accountExt = new ServiceSaveBean1.AccountIdCardExt( mUserId, identityUrl, identityBackUrl);
Api.getService(UserService2.class).commitCertificationUpdate(accountExt).compose(Api.applySchedulers()) Api.getService(UserService2.class).commitCertificationUpdate(accountExt).compose(Api.applySchedulers())
.subscribe(mPresenter.baseObserver(bool -> { .subscribe(mPresenter.baseObserver(bool -> {
ToastUtils.showShortToast(bool ? R.string.save_success : R.string.save_fail);
CommonUtils.hideSoftInput(mActivity); //更新信息
EventBus.getDefault().post(new CertificationEvent(1)); Api.getService(com.dayu.base.api.APIService.class).getDetectStatus(mUserId).compose(Api.applySchedulers())
EventBus.getDefault().post(new RefreshEvent()); .subscribe(mPresenter.baseObserver(integer -> {
finish(); UserInfo user = UserManager.getInstance().getUser();
user.setDetectStatus(integer);
UserManager.getInstance().saveUser(user);
ToastUtils.showShortToast(bool ? R.string.save_success : R.string.save_fail);
CommonUtils.hideSoftInput(mActivity);
EventBus.getDefault().post(new CertificationEvent(1));
EventBus.getDefault().post(new RefreshEvent());
finish();
}));
})); }));
} }
......
...@@ -227,35 +227,42 @@ public class RegisterActivity extends BaseActivity<SImplePresenter, ActivityRegi ...@@ -227,35 +227,42 @@ public class RegisterActivity extends BaseActivity<SImplePresenter, ActivityRegi
} }
showDialog(); showDialog();
if (TextUtils.isEmpty(identityUrl)) { if (!TextUtils.isEmpty(identityUrl) && !TextUtils.isEmpty(identityUrl) && !TextUtils.isEmpty(identityBackUrl)){
uploadImageCount++; uploadImageCount = 0;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityPath), Constants.PHOTO + "/privacy/idcard", "yyMM") save();
.subscribe(mPresenter.baseObserver(data -> {
identityUrl = data.get(0); }else {
uploadImageCount--;
save(); if (TextUtils.isEmpty(identityUrl)) {
})); uploadImageCount++;
} BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
.subscribe(mPresenter.baseObserver(data -> {
identityUrl = data.get(0);
uploadImageCount--;
save();
}));
}
if (TextUtils.isEmpty(identityBackUrl)) { if (TextUtils.isEmpty(identityBackUrl)) {
uploadImageCount++; uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityBackPath), Constants.PHOTO + "/privacy/idcard", "yyMM") BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityBackPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
.subscribe(mPresenter.baseObserver(data -> { .subscribe(mPresenter.baseObserver(data -> {
identityBackUrl = data.get(0); identityBackUrl = data.get(0);
uploadImageCount--; uploadImageCount--;
save(); save();
})); }));
} }
if (TextUtils.isEmpty(accountUrl)) { if (TextUtils.isEmpty(accountUrl)) {
uploadImageCount++; uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(accountPath), Constants.PHOTO + "/privacy/head", "yyMM") BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(accountPath), Constants.PHOTO + "/privacy/head", "yyMM")
.subscribe(mPresenter.baseObserver(imgs -> { .subscribe(mPresenter.baseObserver(imgs -> {
accountUrl = imgs.get(0); accountUrl = imgs.get(0);
uploadImageCount--; uploadImageCount--;
save(); save();
})); }));
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment