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,6 +176,11 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A ...@@ -175,6 +176,11 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A
} }
showDialog(); showDialog();
if (!TextUtils.isEmpty(identityUrl) && !TextUtils.isEmpty(identityBackUrl)){
uploadImageCount = 0;
save();
}else {
if (TextUtils.isEmpty(identityUrl)) { if (TextUtils.isEmpty(identityUrl)) {
uploadImageCount++; uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityPath), Constants.PHOTO + "/privacy/idcard", "yyMM") BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
...@@ -196,6 +202,9 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A ...@@ -196,6 +202,9 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A
} }
} }
}
private void save() { private void save() {
if (uploadImageCount != 0){ if (uploadImageCount != 0){
return; return;
...@@ -204,12 +213,23 @@ public class CertificationUpdateActivity extends BaseActivity<SImplePresenter, A ...@@ -204,12 +213,23 @@ 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 -> {
//更新信息
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); ToastUtils.showShortToast(bool ? R.string.save_success : R.string.save_fail);
CommonUtils.hideSoftInput(mActivity); CommonUtils.hideSoftInput(mActivity);
EventBus.getDefault().post(new CertificationEvent(1)); EventBus.getDefault().post(new CertificationEvent(1));
EventBus.getDefault().post(new RefreshEvent()); EventBus.getDefault().post(new RefreshEvent());
finish(); finish();
})); }));
}));
} }
......
...@@ -227,6 +227,12 @@ public class RegisterActivity extends BaseActivity<SImplePresenter, ActivityRegi ...@@ -227,6 +227,12 @@ public class RegisterActivity extends BaseActivity<SImplePresenter, ActivityRegi
} }
showDialog(); showDialog();
if (!TextUtils.isEmpty(identityUrl) && !TextUtils.isEmpty(identityUrl) && !TextUtils.isEmpty(identityBackUrl)){
uploadImageCount = 0;
save();
}else {
if (TextUtils.isEmpty(identityUrl)) { if (TextUtils.isEmpty(identityUrl)) {
uploadImageCount++; uploadImageCount++;
BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityPath), Constants.PHOTO + "/privacy/idcard", "yyMM") BaseApiFactory.uploadPhotoNew(BaseApiFactory.packPhoto(identityPath), Constants.PHOTO + "/privacy/idcard", "yyMM")
...@@ -258,6 +264,7 @@ public class RegisterActivity extends BaseActivity<SImplePresenter, ActivityRegi ...@@ -258,6 +264,7 @@ public class RegisterActivity extends BaseActivity<SImplePresenter, ActivityRegi
})); }));
} }
} }
}
private void save() { private void save() {
if (uploadImageCount != 0){ if (uploadImageCount != 0){
......
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