Commit 3dfd0c2c by han xu

身份验证增加更新功能

parent a5528917
......@@ -10,6 +10,7 @@ import com.dayu.base.api.BaseApiFactory;
import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.base.ui.presenter.SImplePresenter;
import com.dayu.common.Constants;
import com.dayu.event.UserInfo;
import com.dayu.provider.event.CertificationEvent;
import com.dayu.provider.event.RefreshEvent;
import com.dayu.provider.router.RouterPath;
......@@ -175,25 +176,33 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A
}
showDialog();
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(identityUrl) && !TextUtils.isEmpty(identityBackUrl)){
uploadImageCount = 0;
save();
}else {
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)) {
uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityBackPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
.subscribe(mPresenter.baseObserver(data -> {
identityBackUrl = data.get(0);
uploadImageCount--;
save();
}));
if (TextUtils.isEmpty(identityBackUrl)) {
uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityBackPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
.subscribe(mPresenter.baseObserver(data -> {
identityBackUrl = data.get(0);
uploadImageCount--;
save();
}));
}
}
}
private void save() {
......@@ -204,11 +213,22 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A
ServiceSaveBean1.AccountIdCardExt accountExt = new ServiceSaveBean1.AccountIdCardExt( mUserId, identityUrl, identityBackUrl);
Api.getService(UserService2.class).commitCertificationUpdate(accountExt).compose(Api.applySchedulers())
.subscribe(mPresenter.baseObserver(bool -> {
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();
//更新信息
Api.getService(com.dayu.base.api.APIService.class).getDetectStatus(mUserId).compose(Api.applySchedulers())
.subscribe(mPresenter.baseObserver(integer -> {
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
}
showDialog();
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(identityUrl) && !TextUtils.isEmpty(identityUrl) && !TextUtils.isEmpty(identityBackUrl)){
uploadImageCount = 0;
save();
}else {
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)) {
uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityBackPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
.subscribe(mPresenter.baseObserver(data -> {
identityBackUrl = data.get(0);
uploadImageCount--;
save();
}));
}
if (TextUtils.isEmpty(identityBackUrl)) {
uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityBackPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
.subscribe(mPresenter.baseObserver(data -> {
identityBackUrl = data.get(0);
uploadImageCount--;
save();
}));
}
if (TextUtils.isEmpty(accountUrl)) {
uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(accountPath), Constants.PHOTO + "/privacy/head", "yyMM")
.subscribe(mPresenter.baseObserver(imgs -> {
accountUrl = imgs.get(0);
uploadImageCount--;
if (TextUtils.isEmpty(accountUrl)) {
uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(accountPath), Constants.PHOTO + "/privacy/head", "yyMM")
.subscribe(mPresenter.baseObserver(imgs -> {
accountUrl = imgs.get(0);
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