官网注销账号
This commit is contained in:
@@ -2,6 +2,7 @@ package com.peanut.modules.bookAbroad.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.MD5Utils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.bookAbroad.service.BookAbroadLableService;
|
||||
@@ -37,6 +38,8 @@ public class VisitorController {
|
||||
private BookListeningService bookListeningService;
|
||||
@Autowired
|
||||
private AuthorService authorService;
|
||||
@Autowired
|
||||
private com.peanut.modules.common.service.MyUserService userService;
|
||||
|
||||
//推荐图书
|
||||
@RequestMapping("/getRecommendBooks")
|
||||
@@ -120,7 +123,33 @@ public class VisitorController {
|
||||
}
|
||||
return R.ok().put("bookList",bookList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 官网注销账号
|
||||
*/
|
||||
@RequestMapping("/websitCeancelAccount")
|
||||
public R websitCeancelAccount(@RequestBody Map<String,Object> params) {
|
||||
LambdaQueryWrapper<MyUserEntity> wrapper = new LambdaQueryWrapper();
|
||||
if (params.get("account").toString().contains("@")) {
|
||||
wrapper.eq(MyUserEntity::getEmail,params.get("account").toString());
|
||||
}else {
|
||||
wrapper.eq(MyUserEntity::getTel,params.get("account").toString());
|
||||
}
|
||||
MyUserEntity userEntity = userService.getOne(wrapper);
|
||||
if (userEntity == null) {
|
||||
return R.error(500,"The user does not exist!");
|
||||
}else {
|
||||
if (userEntity.getPassword() == null|| userEntity.getPassword().equals("")) {
|
||||
return R.error(500,"Currently, no password has been set.");
|
||||
}else {
|
||||
if (MD5Utils.getSaltverifyMD5(params.get("password").toString(),userEntity.getPassword())){
|
||||
userService.removeById(userEntity.getId());
|
||||
return R.ok("CeancelAccount successful!");
|
||||
}else {
|
||||
return R.error(500,"The password is error, please try again!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user