通用模块修改

This commit is contained in:
wuchunlei
2024-03-25 11:27:37 +08:00
parent c32eaf2db5
commit 92a582bee0
2 changed files with 35 additions and 39 deletions

View File

@@ -236,9 +236,6 @@ public class BookLabelAndMarketController {
@RequestMapping(path = "/saveToLabel")
public R saveToLabel(@RequestBody Map params) {
LambdaQueryWrapper<ShopProductToBookLabel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ShopProductToBookLabel::getBookLabelId,params.get("bookLabelId").toString());
toLabelService.remove(wrapper);
if (!StringUtils.isEmpty(params.get("productId").toString())){
String[] ids = params.get("productId").toString().split(",");
if (ids.length > 0) {
@@ -255,15 +252,12 @@ public class BookLabelAndMarketController {
@RequestMapping(path = "/saveToMarket")
public R saveToMarket(@RequestBody Map params) {
LambdaQueryWrapper<ShopProductToBookMarket> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ShopProductToBookMarket::getBookMarketId,params.get("bookMarketId").toString());
toMarketService.remove(wrapper);
if (!StringUtils.isEmpty(params.get("productId").toString())){
String[] ids = params.get("productId").toString().split(",");
if (ids.length > 0) {
for (String id : ids) {
ShopProductToBookMarket toMarket = new ShopProductToBookMarket();
toMarket.setBookMarketId(Integer.parseInt(params.get("bookLabelId").toString()));
toMarket.setBookMarketId(Integer.parseInt(params.get("bookMarketId").toString()));
toMarket.setProductId(Integer.parseInt(id));
toMarketService.save(toMarket);
}

View File

@@ -73,7 +73,7 @@ public class UserController {
* 常规注册 发送邮箱验证码
*/
@RequestMapping("/getMailCaptcha")
public R getMailCaptcha(String email) throws Exception {
public R getMailCaptcha(String email){
//验证一分钟内是否已经发过
String redisCode = redisTemplate.opsForValue().get("RegistCode" + email);
if (!StringUtils.isEmpty(redisCode)) {
@@ -94,7 +94,7 @@ public class UserController {
}
/**
* 绑定用户电话号
* 绑定电话号
* @return
*/
@RequestMapping("/updateUserTel")
@@ -125,7 +125,7 @@ public class UserController {
}
/**
* 绑定用户邮件
* 绑定邮箱
* @return
*/
@RequestMapping("/updateUserEmail")
@@ -156,35 +156,7 @@ public class UserController {
}
/**
* 手机号验证码密码注册
*/
@RequestMapping("/register")
public R register(@RequestParam("tel") String tel,
@RequestParam("code") String code,
@RequestParam("password") String password){
String redisCode = redisTemplate.opsForValue().get("RegistCode" + tel);
if (StringUtils.isEmpty(redisCode)){
return R.error(500,"短信验证码已过期,请重试");
}
String lcode = redisCode.split("_")[0];
if (!lcode.equals(code)) {
return R.error(500,"短信验证码不符!");
}
MyUserEntity user = userService.getBaseMapper().selectOne(new QueryWrapper<MyUserEntity>().eq("tel", tel));
if(!ObjectUtil.isEmpty(user)){
return R.error(500,"该手机号已经注册!");
}
String saltMD5 = MD5Utils.getSaltMD5(password);
MyUserEntity myUserEntity = new MyUserEntity();
myUserEntity.setTel(tel);
myUserEntity.setPassword(saltMD5);
userService.save(myUserEntity);
R r = sysUserTokenService.createToken(myUserEntity.getId());
return R.ok("注册成功").put("userInfo",myUserEntity).put("token",r);
}
/**
* 手机号验证码注册或登录
* 验证码注册或登录
*/
@RequestMapping("/registerOrLogin")
public R register(String tel, String code) {
@@ -285,6 +257,36 @@ public class UserController {
return R.ok("成功");
}
/**
* 手机号验证码密码注册 -未在apipost
*/
// @RequestMapping("/register")
// public R register(@RequestParam("tel") String tel,
// @RequestParam("code") String code,
// @RequestParam("password") String password){
// String redisCode = redisTemplate.opsForValue().get("RegistCode" + tel);
// if (StringUtils.isEmpty(redisCode)){
// return R.error(500,"短信验证码已过期,请重试");
// }
// String lcode = redisCode.split("_")[0];
// if (!lcode.equals(code)) {
// return R.error(500,"短信验证码不符!");
// }
// MyUserEntity user = userService.getBaseMapper().selectOne(new QueryWrapper<MyUserEntity>().eq("tel", tel));
// if(!ObjectUtil.isEmpty(user)){
// return R.error(500,"该手机号已经注册!");
// }
// String saltMD5 = MD5Utils.getSaltMD5(password);
// MyUserEntity myUserEntity = new MyUserEntity();
// myUserEntity.setTel(tel);
// myUserEntity.setPassword(saltMD5);
// userService.save(myUserEntity);
// R r = sysUserTokenService.createToken(myUserEntity.getId());
// return R.ok("注册成功").put("userInfo",myUserEntity).put("token",r);
// }