| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- package eVVM.apk.ui.My.information;
- import com.allen.library.RxHttpUtils;
- import com.allen.library.interceptor.Transformer;
- import com.allen.library.observer.CommonObserver;
- import java.util.HashMap;
- import java.util.Map;
- import eVVM.apk.api.ApiService;
- import eVVM.apk.helper.Encrypt;
- import eVVM.apk.helper.MD5;
- import eVVM.apk.helper.SPUtils;
- import eVVM.apk.mvp.MvpModel;
- import eVVM.apk.ui.bean.VerificationCodeBean;
- /**
- * Created by Android Studio.
- * User: zbb
- * Date: 2019/6/3
- * Describe: InformationModel
- */
- public class InformationModel extends MvpModel<InformationOnListener> {
- public InformationModel() {
- }
- public void information(String telephone, String userName, String code ,String password, String email) {
- // String user_token = (String) SPUtils.get("USER_TOKEN", "");
- Map<String,String> map = new HashMap<>();
- map.put("telephone", Encrypt.encrypt(telephone));
- map.put("userName",userName);
- map.put("code",code);
- map.put("password", MD5.GetMD5Code(password));
- map.put("email",email);
- //map.put("token",user_token);
- RxHttpUtils.createApi(ApiService.class)
- .informationdoc(map)
- .compose(Transformer.<VerificationCodeBean>switchSchedulers())
- .subscribe(new CommonObserver<VerificationCodeBean>() {
- @Override
- protected void onError(String errorMsg) {
- getListener().onFail(errorMsg);
- }
- @Override
- protected void onSuccess(VerificationCodeBean verificationCodeBean) {
- if (verificationCodeBean.getCode() == 200){
- getListener().onSucceed(verificationCodeBean);
- }else {
- getListener().onFail(verificationCodeBean.getMsg());
- }
- }
- });
- }
- public void getCode(String telephone, int type) {
- Map<String, String> map = new HashMap<>();
- map.put("telephone", "" + Encrypt.encrypt(telephone));
- map.put("type", "" + type);
- RxHttpUtils.createApi(ApiService.class)
- .getCode(map)
- .compose(Transformer.<VerificationCodeBean>switchSchedulers())
- .subscribe(new CommonObserver<VerificationCodeBean>() {
- @Override
- protected void onError(String errorMsg) {
- getListener().onCodeFail(errorMsg);
- }
- @Override
- protected void onSuccess(VerificationCodeBean codeData) {
- if (codeData.getCode() == 200){
- getListener().onCodeSucceed(codeData);
- }else {
- getListener().onCodeFail(codeData.getMsg());
- }
- }
- });
- }
- }
|