Commit 21662788 by 刘鹏

feat: 账户注销功能

parent 5ab37efb
......@@ -20,10 +20,10 @@ import java.util.List;
*/
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
public static String appEnv = YDLConstants.ENV_PROD;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
lifecycles.add(new DemoAppLifecycles());
......
......@@ -228,13 +228,22 @@ interface UserApi {
fun unBindThirdLogin(@Body body: RequestBody): Observable<BaseResponse<Any>>
/**
* 用户注销账号
* 用户注销账号(原有禁止登录逻辑)
*/
@FormUrlEncoded
@POST("user/forbid_login")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun userForbidLogin(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<Boolean>>
/**
* 用户注销账号
*/
@FormUrlEncoded
@POST("login/v2/accountLogOff")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun accountLogOff(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<Boolean>>
/**
* 是否需要强绑定手机号
*/
......
......@@ -78,6 +78,9 @@ interface UserHttp {
fun getNewUserJumpUrl(): Observable<BaseAPIResponse<String>>
/**用户注销账号*/
/**用户注销账号(禁止登录)*/
fun userForbidLogin(param: UserForbidLoginParam):Observable<BaseAPIResponse<Boolean>>
/**用户注销账号*/
fun accountLogOff(param: UserForbidLoginParam):Observable<BaseAPIResponse<Boolean>>
}
\ No newline at end of file
......@@ -230,13 +230,21 @@ class UserHttpImpl private constructor() : UserHttp {
}
/**
* 用户注销账号调用接口
* 用户注销账号调用接口(禁止登陆)
* */
override fun userForbidLogin(param: UserForbidLoginParam): Observable<BaseAPIResponse<Boolean>> {
return RxUtils.mapObservable(param)
.flatMap { getUserApi().userForbidLogin(it) }
}
/**
* 用户注销账号调用接口
* */
override fun accountLogOff(param: UserForbidLoginParam): Observable<BaseAPIResponse<Boolean>> {
return RxUtils.mapObservable(param)
.flatMap { getUserApi().accountLogOff(it) }
}
private object Holder {
val INSTANCE = UserHttpImpl()
}
......
......@@ -60,7 +60,7 @@ class AccountUnRegisterActivity : BaseActivity() {
private fun userForbidLogin() {
val param = UserForbidLoginParam()
param.userPort = 1;
UserHttpImpl.getInstance().userForbidLogin(param)
UserHttpImpl.getInstance().accountLogOff(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
......@@ -68,6 +68,8 @@ class AccountUnRegisterActivity : BaseActivity() {
ToastUtil.toastShort("账号已注销")
EventBus.getDefault().post(UnRegisterEvent())
finish()
}else{
ToastUtil.toastShort(it.msg)
}
}
}
......
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 to comment