From 3c540a4f7720730018a7961d603606b066d93a40 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Tue, 6 May 2025 15:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=98=E7=BD=91=E6=B3=A8=E9=94=80=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/VisitorController.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/peanut/modules/bookAbroad/controller/VisitorController.java b/src/main/java/com/peanut/modules/bookAbroad/controller/VisitorController.java index 2cad2f7..9f3993b 100644 --- a/src/main/java/com/peanut/modules/bookAbroad/controller/VisitorController.java +++ b/src/main/java/com/peanut/modules/bookAbroad/controller/VisitorController.java @@ -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 params) { + LambdaQueryWrapper 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!"); + } + } + } + } }