2025-05-15 11:08:23 +08:00
|
|
|
package com.qxcm.modulelogin.present;
|
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.qxcm.modulelogin.bean.UserFillResp;
|
2025-05-22 19:03:01 +08:00
|
|
|
import com.qxcm.moduleutil.bean.UserBean;
|
2025-05-15 11:08:23 +08:00
|
|
|
import com.qxcm.moduleutil.http.BaseObserver;
|
|
|
|
|
import com.qxcm.moduleutil.presenter.BasePresenter;
|
2025-05-22 19:03:01 +08:00
|
|
|
import com.qxcm.moduleutil.utils.oss.OSSOperUtils;
|
2025-05-15 11:08:23 +08:00
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import io.reactivex.disposables.Disposable;
|
|
|
|
|
|
|
|
|
|
public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View> implements ImproveInfoContacts.IImproveInfoPre {
|
|
|
|
|
public ImproveInfoPresenter(ImproveInfoContacts.View view, Context context) {
|
|
|
|
|
super(view, context);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void upDateUserInfo(Map<String, String> map) {
|
2025-05-22 19:03:01 +08:00
|
|
|
api.userUpdate(map, new BaseObserver<UserBean>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSubscribe(Disposable d) {
|
|
|
|
|
addDisposable(d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onNext(UserBean userBean) {
|
|
|
|
|
MvpRef.get().updateSuccess(userBean);
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-05-15 11:08:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void uploadFile(File file, int type) {
|
2025-05-22 19:03:01 +08:00
|
|
|
MvpRef.get().showLoadings("上传中...");
|
|
|
|
|
String url = OSSOperUtils.getPath(file, type);
|
|
|
|
|
OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess() {
|
|
|
|
|
if (isViewAttach()) {
|
|
|
|
|
MvpRef.get().disLoadings();
|
|
|
|
|
MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFail() {
|
|
|
|
|
if (isViewAttach()) {
|
|
|
|
|
MvpRef.get().disLoadings();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-05-15 11:08:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateAvatar(String headPicture) {
|
2025-05-22 19:03:01 +08:00
|
|
|
// MvpRef.get().showLoadings();
|
2025-05-15 11:08:23 +08:00
|
|
|
// ApiClient.getInstance().updateAvatar(headPicture, new BaseObserver<String>() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onSubscribe(Disposable d) {
|
|
|
|
|
// addDisposable(d);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onNext(String s) {
|
|
|
|
|
// MvpRef.get().updateAvatarSuccess(headPicture);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onComplete() {
|
|
|
|
|
// MvpRef.get().disLoadings();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateNickname() {
|
|
|
|
|
// TODO: 2019/1/15 完善昵称修改功能
|
2025-05-22 19:03:01 +08:00
|
|
|
api.upUserNickname(new BaseObserver<String>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSubscribe(Disposable d) {
|
|
|
|
|
addDisposable(d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onNext(String s) {
|
|
|
|
|
MvpRef.get().updateNicknameSuccess(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onComplete() {
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-05-15 11:08:23 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void getSexTrue(String sex) {
|
|
|
|
|
// TODO: 2019/1/15 完善性别获取头像信息
|
2025-05-22 19:03:01 +08:00
|
|
|
api.upUserPic(sex, new BaseObserver<String>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSubscribe(Disposable d) {
|
|
|
|
|
addDisposable(d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onNext(String userPictrue) {
|
|
|
|
|
MvpRef.get().updateSexTrue(userPictrue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onComplete() {
|
|
|
|
|
}
|
|
|
|
|
});
|
2025-05-15 11:08:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|